デバッグ仮対応

This commit is contained in:
kimura 2022-11-01 13:38:13 +09:00
parent b687ed37b7
commit 90c9190d1a
1 changed files with 62 additions and 61 deletions

View File

@ -47,11 +47,11 @@ public class DebugOptionManager : MonoBehaviour
[SerializeField] private Dropdown shopLevelDropdown; [SerializeField] private Dropdown shopLevelDropdown;
[SerializeField] private Dropdown bulkOrderDropdown; [SerializeField] private Dropdown bulkOrderDropdown;
[SerializeField] private Dropdown autoCookDropdown; [SerializeField] private Dropdown autoCookDropdown;
private readonly GameData globalGameData = GameDataManager.GameData;
#if UNITY_EDITOR || DEVELOPMENT_BUILD #if UNITY_EDITOR || DEVELOPMENT_BUILD
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
var gameData = GameDataManager.GameData;
WorldMarketManager.Instance.IsPause.Value = true; WorldMarketManager.Instance.IsPause.Value = true;
if (!LocalCacheManager.Exists(DebugPrevSceneTag)) if (!LocalCacheManager.Exists(DebugPrevSceneTag))
@ -82,28 +82,28 @@ public class DebugOptionManager : MonoBehaviour
resetFieldButton.OnClickAsObservable().Subscribe(_ => resetFieldButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.PlantLineDataList = new List<PlantLineData> globalGameData.PlantLineDataList = new List<PlantLineData>
{ {
new PlantLineData(PlantLineType.Center, CornFieldRank.Rank1), new PlantLineData(PlantLineType.Center, CornFieldRank.Rank1),
}; };
gameData.SeedlingDataList = new List<SeedlingProgressData>(); globalGameData.SeedlingDataList = new List<SeedlingProgressData>();
gameData.MachineLevel = 1; globalGameData.MachineLevel = 1;
gameData.CornSeed = 0; globalGameData.CornSeed = 0;
}).AddTo(this); }).AddTo(this);
resetMaterialButton.OnClickAsObservable().Subscribe(_ => resetMaterialButton.OnClickAsObservable().Subscribe(_ =>
{ {
// 所持素材 // 所持素材
gameData.Material.Clear(); globalGameData.Material.Clear();
// レシピ // レシピ
gameData.MyRecipes = GetMyRecipe(gameData.ViewedShopLevel, true); globalGameData.MyRecipes = GetMyRecipe(globalGameData.ViewedShopLevel, true);
// フライパン // フライパン
gameData.Pans = new[] { Const.DefaultPanId }; globalGameData.Pans = new[] { Const.DefaultPanId };
}).AddTo(this); }).AddTo(this);
resetTankButton.OnClickAsObservable().Subscribe(_ => resetTankButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.InitTank(); globalGameData.InitTank();
}).AddTo(this); }).AddTo(this);
refillManyProductButton.OnClickAsObservable().Subscribe(_ => refillManyProductButton.OnClickAsObservable().Subscribe(_ =>
@ -116,11 +116,11 @@ public class DebugOptionManager : MonoBehaviour
// CookingResult.AddStock(new ProductData(){volume = 5, id = 1}, ProductRarity.Gold); // CookingResult.AddStock(new ProductData(){volume = 5, id = 1}, ProductRarity.Gold);
// CookingResult.AddStock(new ProductData(){volume = 5, id = 1}, ProductRarity.Rainbow); // CookingResult.AddStock(new ProductData(){volume = 5, id = 1}, ProductRarity.Rainbow);
// CookingResult.AddStock(new ProductData(){volume = 20, id = 2}, ProductRarity.Silver); // CookingResult.AddStock(new ProductData(){volume = 20, id = 2}, ProductRarity.Silver);
if (gameData.StorageTanks.Count < 2) if (globalGameData.StorageTanks.Count < 2)
{ {
gameData.StorageTanks.Add(new StorageTank(){Capacity = Const.TankCapacity}); globalGameData.StorageTanks.Add(new StorageTank(){Capacity = Const.TankCapacity});
} }
var flavor = gameData.StorageTanks[0].FlavorId; var flavor = globalGameData.StorageTanks[0].FlavorId;
if (flavor < 1) if (flavor < 1)
{ {
flavor = 1; flavor = 1;
@ -135,17 +135,17 @@ public class DebugOptionManager : MonoBehaviour
refillLittleProductButton.OnClickAsObservable().Subscribe(_ => refillLittleProductButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.StorageTanks.ForEach(x => x.ClearStock()); globalGameData.StorageTanks.ForEach(x => x.ClearStock());
// CookingResult.AddStock(new ProductData(){volume = 5, id = 1}, ProductRarity.Yellow); // CookingResult.AddStock(new ProductData(){volume = 5, id = 1}, ProductRarity.Yellow);
CookingResult.AddStock(new ProductData(){volume = 3, id = 2}, ProductRarity.Copper); CookingResult.AddStock(new ProductData(){volume = 3, id = 2}, ProductRarity.Copper);
}).AddTo(this); }).AddTo(this);
bulkOrderResetButton.OnClickAsObservable().Subscribe(_ => bulkOrderResetButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.AchievedOrderLevel = 0; globalGameData.AchievedOrderLevel = 0;
gameData.OrderIdInProgress = 0; globalGameData.OrderIdInProgress = 0;
gameData.CancelOrderId = 0; globalGameData.CancelOrderId = 0;
gameData.CompletedProductList.Clear(); globalGameData.CompletedProductList.Clear();
}).AddTo(this); }).AddTo(this);
shopLevelUpResetButton.OnClickAsObservable().Subscribe(_ => shopLevelUpResetButton.OnClickAsObservable().Subscribe(_ =>
@ -155,41 +155,41 @@ public class DebugOptionManager : MonoBehaviour
dailyMissionResetButton.OnClickAsObservable().Subscribe(_ => dailyMissionResetButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.lastDailyMissionSetTime = DateTime.MinValue.ToBinary(); globalGameData.lastDailyMissionSetTime = DateTime.MinValue.ToBinary();
}).AddTo(this); }).AddTo(this);
dailyMissionCompleteButton.OnClickAsObservable().Subscribe(_ => dailyMissionCompleteButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.dailyMissionAchievedIdArray = gameData.dailyMissionIdArray; globalGameData.dailyMissionAchievedIdArray = globalGameData.dailyMissionIdArray;
gameData.dailyMissionCompleted = false; globalGameData.dailyMissionCompleted = false;
}).AddTo(this); }).AddTo(this);
normalMissionResetButton.OnClickAsObservable().Subscribe(_ => normalMissionResetButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.AchievedMission.Clear(); globalGameData.AchievedMission.Clear();
gameData.ResetNormalTotalCount(); globalGameData.ResetNormalTotalCount();
}).AddTo(this); }).AddTo(this);
autoCookCompleteButton.OnClickAsObservable().Subscribe(_ => autoCookCompleteButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.AutoCookFinishTime = DateTime.UtcNow.ToBinary(); globalGameData.AutoCookFinishTime = DateTime.UtcNow.ToBinary();
}).AddTo(this); }).AddTo(this);
shopRecipeCompleteButton.OnClickAsObservable().Subscribe(_ => shopRecipeCompleteButton.OnClickAsObservable().Subscribe(_ =>
{ {
var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(Const.ShopDataSheet); var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(Const.ShopDataSheet);
var ownedRecipesList = shopDataList.Where(data => data.Category == ItemCategory.Recipe).Select(data => data.itemId).ToList(); var ownedRecipesList = shopDataList.Where(data => data.Category == ItemCategory.Recipe).Select(data => data.itemId).ToList();
gameData.MyRecipes = gameData.MyRecipes.Union(ownedRecipesList).ToArray(); globalGameData.MyRecipes = globalGameData.MyRecipes.Union(ownedRecipesList).ToArray();
}).AddTo(this); }).AddTo(this);
resetShopCustomizeButton.OnClickAsObservable().Subscribe(_ => resetShopCustomizeButton.OnClickAsObservable().Subscribe(_ =>
{ {
gameData.FinishedFlags &= ~TutorialFlag.ShopCustomize; globalGameData.FinishedFlags &= ~TutorialFlag.ShopCustomize;
gameData.ShopCustomizeLevel = 1; globalGameData.ShopCustomizeLevel = 1;
gameData.ShopCustomizePoint = 0; globalGameData.ShopCustomizePoint = 0;
gameData.ShopCustomizeCoin = 0; globalGameData.ShopCustomizeCoin = 0;
gameData.ShopCustomizeSettings = new ShopCustomizeSettings(); globalGameData.ShopCustomizeSettings = new ShopCustomizeSettings();
gameData.ShopCustomizeMyItems = new[] globalGameData.ShopCustomizeMyItems = new[]
{ {
Const.ShopCustomizeDefaultCartId, Const.ShopCustomizeDefaultCartId,
Const.ShopCustomizeDefaultDecoration1Id, Const.ShopCustomizeDefaultDecoration1Id,
@ -205,9 +205,9 @@ public class DebugOptionManager : MonoBehaviour
var shopCustomizeLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopCustomizeLevelData>(Const.ShopCustomizeLevelDataSheet); var shopCustomizeLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopCustomizeLevelData>(Const.ShopCustomizeLevelDataSheet);
var maxLevelData = shopCustomizeLevelList.Last(); var maxLevelData = shopCustomizeLevelList.Last();
gameData.ShopCustomizeLevel = maxLevelData.level; globalGameData.ShopCustomizeLevel = maxLevelData.level;
gameData.ShopCustomizePoint = maxLevelData.point; globalGameData.ShopCustomizePoint = maxLevelData.point;
gameData.ShopCustomizeMyItems = gameData.ShopCustomizeMyItems globalGameData.ShopCustomizeMyItems = globalGameData.ShopCustomizeMyItems
.Union(shopCustomizeDataList.Select(data => data.id)).ToArray(); .Union(shopCustomizeDataList.Select(data => data.id)).ToArray();
}).AddTo(this); }).AddTo(this);
@ -233,22 +233,22 @@ public class DebugOptionManager : MonoBehaviour
LocalizationManager.CurrentLanguage = "Korean"; LocalizationManager.CurrentLanguage = "Korean";
}).AddTo(this); }).AddTo(this);
coinCount.text = $"{gameData.Coin}"; coinCount.text = $"{globalGameData.Coin}";
coinCount.OnValueChangedAsObservable().Subscribe(x => coinCount.OnValueChangedAsObservable().Subscribe(x =>
{ {
gameData.Coin = Int32.Parse(x); globalGameData.Coin = Int32.Parse(x);
}).AddTo(this); }).AddTo(this);
heartCount.text = $"{gameData.Heart}"; heartCount.text = $"{globalGameData.Heart}";
heartCount.OnValueChangedAsObservable().Subscribe(x => heartCount.OnValueChangedAsObservable().Subscribe(x =>
{ {
gameData.Heart = Int32.Parse(x); globalGameData.Heart = Int32.Parse(x);
}).AddTo(this); }).AddTo(this);
shopCustomizeCoinCount.text = $"{gameData.ShopCustomizeCoin}"; shopCustomizeCoinCount.text = $"{globalGameData.ShopCustomizeCoin}";
shopCustomizeCoinCount.OnValueChangedAsObservable().Subscribe(x => shopCustomizeCoinCount.OnValueChangedAsObservable().Subscribe(x =>
{ {
gameData.ShopCustomizeCoin = Int32.Parse(x); globalGameData.ShopCustomizeCoin = Int32.Parse(x);
}).AddTo(this); }).AddTo(this);
/* /*
@ -260,16 +260,17 @@ public class DebugOptionManager : MonoBehaviour
shopLevelDropdown.ClearOptions(); shopLevelDropdown.ClearOptions();
var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet); var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
shopLevelDropdown.AddOptions(shopLevelList.Where(data => data.shopLevel != Const.SpecialShopLevel).Select(data => data.shopLevel.ToString()).ToList()); shopLevelDropdown.AddOptions(shopLevelList.Where(data => data.shopLevel != Const.SpecialShopLevel).Select(data => data.shopLevel.ToString()).ToList());
shopLevelDropdown.value = gameData.ViewedShopLevel - 1; shopLevelDropdown.value = globalGameData.ViewedShopLevel - 1;
shopLevelDropdown.OnValueChangedAsObservable() shopLevelDropdown.OnValueChangedAsObservable()
.Skip(1) .Skip(1)
.DistinctUntilChanged() .DistinctUntilChanged()
.Subscribe(x => .Subscribe(x =>
{ {
var shopLevelData = shopLevelList.First(data => data.shopLevel == x + 1); var shopLevelData = shopLevelList.First(data => data.shopLevel == x + 1);
gameData.ViewedShopLevel = shopLevelData.shopLevel; globalGameData.ViewedShopLevel = shopLevelData.shopLevel;
gameData.Heart = shopLevelData.heart; globalGameData.Heart = shopLevelData.heart;
gameData.MyRecipes = GetMyRecipe(shopLevelData.shopLevel); globalGameData.MyRecipes = GetMyRecipe(shopLevelData.shopLevel);
heartCount.text = $"{globalGameData.Heart}";
}).AddTo(this); }).AddTo(this);
/* /*
@ -278,12 +279,12 @@ public class DebugOptionManager : MonoBehaviour
bulkOrderDropdown.ClearOptions(); bulkOrderDropdown.ClearOptions();
var bulkOrderList = SpreadsheetDataManager.Instance.GetBaseDataList<BulkOrderData>(Const.BulkOrderDataSheet); var bulkOrderList = SpreadsheetDataManager.Instance.GetBaseDataList<BulkOrderData>(Const.BulkOrderDataSheet);
var nextOrderList = bulkOrderList var nextOrderList = bulkOrderList
.Where(data => data.shopLevel <= gameData.ViewedShopLevel) .Where(data => data.shopLevel <= globalGameData.ViewedShopLevel)
.ToList(); .ToList();
if (nextOrderList.Count > 0) if (nextOrderList.Count > 0)
{ {
var len = nextOrderList.Count; var len = nextOrderList.Count;
var index = nextOrderList.FindIndex(data => data.id == gameData.OrderIdInProgress); var index = nextOrderList.FindIndex(data => data.id == globalGameData.OrderIdInProgress);
bulkOrderDropdown.AddOptions(nextOrderList.Select(data => $"id:{data.id}").ToList()); bulkOrderDropdown.AddOptions(nextOrderList.Select(data => $"id:{data.id}").ToList());
// 現在のIDをデフォで設定 // 現在のIDをデフォで設定
if (index != -1) if (index != -1)
@ -296,13 +297,13 @@ public class DebugOptionManager : MonoBehaviour
.Subscribe(x => .Subscribe(x =>
{ {
// オーダー達成状況をリセット // オーダー達成状況をリセット
gameData.DeliveredOrder.Clear(); globalGameData.DeliveredOrder.Clear();
gameData.AchievedOrderLevel = nextOrderList[x].shopLevel - 1; globalGameData.AchievedOrderLevel = nextOrderList[x].shopLevel - 1;
// 1つ前のオーダーを現在のオーダーに設定 // 1つ前のオーダーを現在のオーダーに設定
var prevOrder = nextOrderList[(len + x - 1) % len]; var prevOrder = nextOrderList[(len + x - 1) % len];
gameData.OrderIdInProgress = gameData.CancelOrderId = prevOrder.id; gameData.OrderIdInProgress = gameData.CancelOrderId = prevOrder.id;
// 即座に通知を発生 // 即座に通知を発生
gameData.OrderConditionCount = 99999; globalGameData.OrderConditionCount = 99999;
}).AddTo(this); }).AddTo(this);
} }
@ -312,21 +313,21 @@ public class DebugOptionManager : MonoBehaviour
autoCookDropdown.ClearOptions(); autoCookDropdown.ClearOptions();
var autoCookList = SpreadsheetDataManager.Instance.GetBaseDataList<AutoCookData>(Const.AutoCookDataSheet); var autoCookList = SpreadsheetDataManager.Instance.GetBaseDataList<AutoCookData>(Const.AutoCookDataSheet);
autoCookDropdown.AddOptions(autoCookList.Select(data => data.level.ToString()).ToList()); autoCookDropdown.AddOptions(autoCookList.Select(data => data.level.ToString()).ToList());
autoCookDropdown.value = gameData.AutoCookLevel - 1; autoCookDropdown.value = globalGameData.AutoCookLevel - 1;
autoCookDropdown.OnValueChangedAsObservable() autoCookDropdown.OnValueChangedAsObservable()
.Skip(1) .Skip(1)
.DistinctUntilChanged() .DistinctUntilChanged()
.Subscribe(x => .Subscribe(x =>
{ {
gameData.AutoCookUsesCount = 0; globalGameData.AutoCookUsesCount = 0;
gameData.AutoCookLevel = autoCookList[x].level; globalGameData.AutoCookLevel = autoCookList[x].level;
// level1ならチュートリアル復活 // level1ならチュートリアル復活
if (gameData.AutoCookLevel == 1) if (globalGameData.AutoCookLevel == 1)
{ {
gameData.FinishedFlags &= ~TutorialFlag.AutoCook; globalGameData.FinishedFlags &= ~TutorialFlag.AutoCook;
gameData.AutoCookFinishTime = DateTime.UtcNow.ToBinary(); globalGameData.AutoCookFinishTime = DateTime.UtcNow.ToBinary();
gameData.AutoCookProducts = Array.Empty<int>(); globalGameData.AutoCookProducts = Array.Empty<int>();
gameData.AutoCookUsesCount = 0; globalGameData.AutoCookUsesCount = 0;
} }
}).AddTo(this); }).AddTo(this);
@ -359,21 +360,21 @@ public class DebugOptionManager : MonoBehaviour
{ {
UsayaStorageManager.Save(UsayaStorageFilename.Settings_Data, "DebugTutorialEnable", x); UsayaStorageManager.Save(UsayaStorageFilename.Settings_Data, "DebugTutorialEnable", x);
}).AddTo(this); }).AddTo(this);
vipRewardToggle.isOn = gameData.vipCustomerFirstOpen; vipRewardToggle.isOn = globalGameData.vipCustomerFirstOpen;
vipRewardToggle.OnValueChangedAsObservable().Subscribe(x => vipRewardToggle.OnValueChangedAsObservable().Subscribe(x =>
{ {
gameData.vipCustomerFirstOpen = x; globalGameData.vipCustomerFirstOpen = x;
gameData.vipCustomerLimitTime = (x ? DateTime.UtcNow.AddSeconds(60f) : DateTime.UtcNow).ToBinary(); globalGameData.vipCustomerLimitTime = (x ? DateTime.UtcNow.AddSeconds(60f) : DateTime.UtcNow).ToBinary();
}).AddTo(this); }).AddTo(this);
} }
private static int[] GetMyRecipe(int level, bool clearShopRecipe = false) private int[] GetMyRecipe(int level, bool clearShopRecipe = false)
{ {
var productList = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet); var productList = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet);
var levelUpAchievedList = productList.Where(data => data.shopLevel != Const.SpecialShopLevel).ToList(); var levelUpAchievedList = productList.Where(data => data.shopLevel != Const.SpecialShopLevel).ToList();
var levelUpAchievedRecipeList = levelUpAchievedList.Where(data => data.shopLevel <= level).Select(data => data.id); var levelUpAchievedRecipeList = levelUpAchievedList.Where(data => data.shopLevel <= level).Select(data => data.id);
var shopRecipe = clearShopRecipe var shopRecipe = clearShopRecipe
? GameDataManager.GameData.MyRecipes.Except(levelUpAchievedList.Select(data => data.id)) ? globalGameData.MyRecipes.Except(levelUpAchievedList.Select(data => data.id))
: Array.Empty<int>(); : Array.Empty<int>();
return levelUpAchievedRecipeList.Union(shopRecipe).ToArray(); return levelUpAchievedRecipeList.Union(shopRecipe).ToArray();
} }