デバッグ仮対応

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