VIP宣伝フラグ判定追加

This commit is contained in:
kimura 2022-02-04 16:51:01 +09:00
parent 3ba046e754
commit fbccefe07c
3 changed files with 22 additions and 0 deletions

View File

@ -7,6 +7,7 @@ using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
public class CookingResult : MonoBehaviour
{
@ -140,6 +141,19 @@ public class CookingResult : MonoBehaviour
{
// 獲得、遷移
MoveStock(GameDataManager.GameData.WaitAddStock);
// 確率でVip宣伝
if (GameDataManager.GameData.ShopStock.Count >= Const.VipCustomerRewardStock)
{
if (Random.value <= Const.VipCustomerRewardRate)
{
#if UNITY_EDITOR
Debug.Log($"flag VipReward");
#endif
GameDataManager.GameData.vipCustomerFirstOpen = true;
GameDataManager.GameData.vipCustomerLimitTime = DateTime.UtcNow.AddSeconds(60).ToBinary();
}
}
GameDataManager.SaveGameData();
Market.Instance.IsPause.Value = false;
TransitionManager.Instance.LoadScene(GameScenes.Main);

View File

@ -22,6 +22,8 @@ public static class Const {
public static readonly int[] FieldTutorial = { 5, 12, 6 };
public static readonly int[] ShoppingTutorial = { 7, 13, 8};
public static readonly int[] ManagementTutorial = { 9 };
public static readonly float VipCustomerRewardStock = 20; // Market.ShopStockCount以下にする
public static readonly float VipCustomerRewardRate = 0.01f;
// tag
public static readonly string GameDataTag = "GameData";

View File

@ -144,6 +144,12 @@ public sealed class GameData {
public int WaitAddHeart;
[DataMember(Name = "Data42")]
public ProductStockData WaitAddStock;
// reward(v1.1追加)
[DataMember(Name = "Data51")]
public long vipCustomerLimitTime = DateTime.UtcNow.ToBinary();
[DataMember(Name = "Data52")]
public bool vipCustomerFirstOpen;
// mission
[DataMember(Name = "Data1001")]