Merge branch 'develop' of bitbucket.org:usaya/popcorn into develop
This commit is contained in:
commit
cad38dd493
|
|
@ -1 +1 @@
|
|||
ObT3fUMokjh/artgO8bzyVoTxicjko9Vmv1iOQ0HonxymrIWct9axqD1ysb2H8Uh
|
||||
zFMH6JGKVYpnWtrDjce1KESRKBoQkRHKvczNdJN7mgXGh21g/yHdAGvAgvR5uAm9
|
||||
|
|
@ -0,0 +1 @@
|
|||
5blTNqjDfYUmR3TFHFyw8lBrlHozUyW5c7th/Xr/HNe0/lVr+dl7zIl1rql3kvqgo+JpDNqGXcK0roK3OU/ifn/u5U226p8MEOWEe77G7OPbcdVzuVuKkn+87qItifzpG2jHFBarUbJ+jxXiVGCvD7IzO9dx39vSXUFn38VNjOopBY2a/tWBYI6zfip8C8Vgg5+qG0xZz/WvSrf3nivK2iGpUf/r47JTuDTaQwbjawQ+rrxJqs/jhP2TyF8ZfMCDrVvg3YjEjuuWgLGEbANlSLn5fv8ecS1k52cbfBUDgIOxDBhSviL908sXTV9Awgo6q7HmJZ+XnmLMM+M90DmybaOyMacLhqHNFLbY9xgNeG3/2wFUY8hWw+OkC7GmnuqTxe46ykguCLxRPVC+RF/9tl/n1mHw4A4SrSLO5cD4nBUEovqkK1k4rX6UMjNyRV6rcTcX9A6+di2/cnZeODaGaclBU0WNrTBHt8+LK8NYZWCvDCNHZkkWi4jYKarVgJNOjRlG8Kc688sOgxBu2Pjwy/dSU8ya8UYcVPRSb5nkEB0CNa8LsekusAyc6n7m7pBr6dzB+is7bjn10/4S0yrVCQCCLYTofSOiFDCIhfFuVV5QCHXtPmLxVR7AHOsIT/TXId2BevRquerIh7NRAzB+6HakGB8bsZggO39tdk1PKO4hopESleRZvtlS+ZyRqWmT1kRVj+A8ztTjunB/sWRGeMBai595XO8E3RwX6tETTHHdsC/TljAq2eUE/PAk8UP+LHRL2z3jt0TLz3QaLcgnxoJIzP4Uk5wwaWyfK1DeGYvLwlUtJ8oJVcaMbYizAdYf
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b98822ce70c641ed836d82aba6f6ee1
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
97oWHVSy4mXXW++Eig+bDh8Jedn+3DPlxpStzTGvB2tdYJtjw013U1VHQhppqD+YtxbBlgZckqf5WF/M4xwC504lK0tSRhAkXPzPdggZomnzCw9digb4hf9tGMqEXyNBuxxjisCKN3CSoEj9t1fFFEMJr4CAKKNAxGaiWJ1598WwfXasqus8Xhveqt1+Vcdu2/gKfHAi4Q/AYsHvzAeCcDKG+YgjYoxnK0TPS9h8fjZnMiEdhrhSlziaJP2fgytfn00pYu5JpEwTQkLY/Y39++ACy/MoKgl8lPkBitSUT3FdGm/ZlBeaUokUtak9bkXPpLDnBakY/pZ9lzrgpsmD9pTDZJn2UGCIPT53RCAfgr+tg/LQ/VlpIlNfQrcl7Q/aDKUY5uIuMwspIVGKq8bb0A==
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cd75be532f23148bf8efa445a7e16e9b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 86a05796426f8467e86642641ff68652
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
pRRXPQ/CaHIOepWUfXpC14TxfTgCjMw/fUCadUwdpMKjAwYIvcaJjV3YSEWBz3NuRwZaAwNoxG1KB52jVcgBxvRsSec45As6ktyMcwniaPwlWzNU1rtFYH79uyP6vaz1QyELN++t+lzCSAh+UtQmV701mGe73pHolCNIuWwr1rvgp6K3xQhqQENeI/H44A+5QKhsKaAvoI3zfM/7TuH5xj3chvwHo9Cz9wOghEHeMe/BSO/J+Vqqn09+Vq4P7DVZefH8uj/BCpiXYc8akW6yJXvW6nRahfC+k9k+r/PQLVVJ+1qXp3vRLHIWp7nY1rLikcfIpndmIUQrS774cWMDJbLfcxofJgQzNnFxrL+//m317ORLa3miRCYRYh+l5/srwp5B/4OtI/TsY+gd+GtbLfFUbRvLUhFK5GFhWHxBy4YhpdBI5r0f2rium0DzETrkQ3DupylMyeJ/oSEn5VAh3Kp+rGpXkGrw5devcCyDnqWcrd/qL7lhUSLtHjnDQeYmBqYIlUXcbr44uSvefsw6ZRy6mEunFAfpCcN5tzZZQKefcWXPnZLBtdYBL02yw+Gqg13fm0ftj46lc8Om0YNKL3PLH9ZaOdJfkieCv1pyb58Zcx/OzK+ctdOkZEIpqsqeeYTQAgi1+qqBi9VcWEQ4emzx6M1Un2sr/lj/KjnKsJ7RkoStt5zcATuBRUPenO53FTXxnKpZ/22c4U8q8odIO6le2I5X3KpZb8gKQAeiiuORYn/3rJNYS9n+camF/2w5WggOytbubM3SxlD3yfOaun+Pc60GbEYFTei1oeU56ehe224lKCNVGWcUUQI3sYkoqQozzBXipTtI+Aql8mqAIe5JwjX1JN5wapWVVvpCcrBpR3ekgFaN2RLayLZ90n606f5RIHqmAeYOAbqOPJd2UmYiC2yR6tjB5X2NJp7XCtfvPs1GRNLvwlYePYHQb3Bvjy/SWavUPJJKDH+yyt34CCQzN0ayHPTV9prbuXXlyp5kK9nRy+QNtBwdwI+XhxKAQplH6+WHvzPTyHnBnkc0jRKMfybeknmK6xULnyXLqLy6tWyMjrz1vSXsM73rqBg5f0XhNhGreaLMPGkhkW2XLx4C0wGfDRNaMvn3Taj5867j9WSiCFkQTY3iK8IzpWxDqlTPZkwugBgo3cunaTPvtgwNl1iC3au7N6imsHLpVRiIGAM0rltgYsJcIZtZmAobE239jLd+RmSfMb8gO6zi2Z5UmN026y8dHINW5QOWxVBeNcQefIeC+CENE+rGDknsKk+1eVdiXwzhVTaKTLZaiyg1rWfYEr4IKylyazro32uY7ol8JVlf390EG8W53ukaYBB/iTEJlDy212+eGubCUtSL+oHTzj1yy/rtFMlQq0c=
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0e8b17a7b9bcc498098a9769a365d162
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -30,9 +30,9 @@ public class CookingResult : MonoBehaviour
|
|||
|
||||
private void Start()
|
||||
{
|
||||
var (recipe, rarityData, resultData, successAction) = LocalCacheManager.Load<(RecipeData, RarityData, CornResult, Action)>(PopcornGameManager.CookingResultDataTag);
|
||||
var (productData, rarityData, resultData, successAction) = LocalCacheManager.Load<(ProductData, RarityData, CornResult, Action)>(PopcornGameManager.CookingResultDataTag);
|
||||
var result = new ReactiveProperty<CornResult>(resultData).AddTo(this);
|
||||
SetData(recipe, rarityData);
|
||||
SetData(productData, rarityData);
|
||||
result.Subscribe(r =>
|
||||
{
|
||||
SetUI(r);
|
||||
|
|
@ -46,13 +46,13 @@ public class CookingResult : MonoBehaviour
|
|||
centerOkButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
// 獲得、遷移
|
||||
AddStock(recipe, rarityData.Rarity);
|
||||
AddStock(productData, rarityData.Rarity);
|
||||
TransitionManager.Instance.LoadScene(GameScenes.Main);
|
||||
}).AddTo(this);
|
||||
leftOkButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
// 獲得、遷移
|
||||
AddStock(recipe);
|
||||
AddStock(productData);
|
||||
TransitionManager.Instance.LoadScene(GameScenes.Main);
|
||||
}).AddTo(this);
|
||||
perfectButton.OnClickAsObservable().Subscribe(_ =>
|
||||
|
|
@ -67,12 +67,12 @@ public class CookingResult : MonoBehaviour
|
|||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private void SetData(RecipeData recipe, RarityData rarity)
|
||||
private void SetData(ProductData recipe, RarityData rarity)
|
||||
{
|
||||
// popcornImage
|
||||
popcornText.text = recipe.Name;
|
||||
popcornTextPerfect.text = recipe.Name;
|
||||
quantityText.text = string.Format(QuantityTextFormat, recipe.Volume);
|
||||
popcornText.text = recipe.name;
|
||||
popcornTextPerfect.text = recipe.name;
|
||||
quantityText.text = string.Format(QuantityTextFormat, recipe.volume);
|
||||
rarityText.text = string.Format(RarityTextFormat, rarity.rate - 100);
|
||||
rarityView.SetRarity(rarity.Rarity);
|
||||
}
|
||||
|
|
@ -104,14 +104,14 @@ public class CookingResult : MonoBehaviour
|
|||
explainWithRarityObject.SetActive(result == CornResult.Perfect);
|
||||
}
|
||||
|
||||
private void AddStock(RecipeData recipe, ProductRarity rarity = ProductRarity.Normal)
|
||||
private void AddStock(ProductData productData, ProductRarity rarity = ProductRarity.Normal)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
// 店頭の空きに追加
|
||||
var remain = recipe.Volume;
|
||||
var remain = productData.volume;
|
||||
var shopSpace = Market.ShopStockCount - gameData.ShopStock.Count;
|
||||
var stockCount = Mathf.Min(shopSpace, remain);
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(recipe.RecipeId, stockCount));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(productData.id, stockCount));
|
||||
remain -= stockCount;
|
||||
|
||||
// 空タンク並び替え
|
||||
|
|
@ -119,7 +119,7 @@ public class CookingResult : MonoBehaviour
|
|||
// 空きのタンクを確認
|
||||
gameData.StorageTanks
|
||||
.Select((tank, i) => (tank, i))
|
||||
.Where(x => x.tank.IsEmpty || x.tank.FlavorId == recipe.RecipeId && !x.tank.IsFull)
|
||||
.Where(x => x.tank.IsEmpty || x.tank.FlavorId == productData.id && !x.tank.IsFull)
|
||||
.Select(x => (x.i, space: x.tank.Capacity - x.tank.Stock))
|
||||
.OrderBy(x => x.space)
|
||||
.ToList()
|
||||
|
|
@ -132,7 +132,7 @@ public class CookingResult : MonoBehaviour
|
|||
// タンクが空ならフレーバー設定
|
||||
if (gameData.StorageTanks[x.i].IsEmpty)
|
||||
{
|
||||
gameData.StorageTanks[x.i].FlavorId = recipe.RecipeId;
|
||||
gameData.StorageTanks[x.i].FlavorId = productData.id;
|
||||
}
|
||||
// タンクに追加
|
||||
stockCount = Mathf.Min(x.space, remain);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniRx;
|
||||
using UniRx.Triggers;
|
||||
using UnityEngine;
|
||||
|
|
@ -16,6 +17,7 @@ public enum GameState
|
|||
public class PopcornGameManager : MonoBehaviour
|
||||
{
|
||||
public static readonly string CookingDataTag = "CookingData";
|
||||
public static readonly string PanDataTag = "PanData";
|
||||
public static readonly string CookingResultDataTag = "CookingResultData";
|
||||
// View
|
||||
[SerializeField] private PopcornGameView gameView;
|
||||
|
|
@ -101,6 +103,8 @@ public class PopcornGameManager : MonoBehaviour
|
|||
|
||||
private void ResetGame()
|
||||
{
|
||||
// フライパン設定
|
||||
var panData = LocalCacheManager.Load<PanData>(PanDataTag);
|
||||
cornManager.SetCornsActive(true);
|
||||
compositeDisposable.Clear();
|
||||
cornManager.Result.SkipLatestValueOnSubscribe()
|
||||
|
|
@ -112,8 +116,10 @@ public class PopcornGameManager : MonoBehaviour
|
|||
// リザルト表示遅延
|
||||
this.CallWaitForSeconds(1.2f, () =>
|
||||
{
|
||||
var recipe = LocalCacheManager.Load<RecipeData>(CookingDataTag);
|
||||
LocalCacheManager.Save(CookingResultDataTag, (recipe, new RarityData{id = 5, rate = 120}, result, new Action(() => cornManager.SetCornsActive(false))));
|
||||
var rarityList = SpreadsheetDataManager.Instance.GetBaseDataList<RarityData>(Const.RarityDataSheet);
|
||||
var rarityData = rarityList.First(data => data.Rarity == panData.Rarity);
|
||||
var productData = LocalCacheManager.Load<ProductData>(CookingDataTag);
|
||||
LocalCacheManager.Save(CookingResultDataTag, (productData, rarityData, result, new Action(() => cornManager.SetCornsActive(false))));
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.CookingResults);
|
||||
});
|
||||
}).AddTo(compositeDisposable);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class DebugOptionManager : MonoBehaviour
|
|||
gameData.ShopStock.AddRange(Enumerable.Repeat(2, 10).ToList());
|
||||
gameData.StorageTanks = new List<StorageTank>
|
||||
{
|
||||
new StorageTank(){Id = 1, Capacity = 50, FlavorId = 1, Stocks = new List<ProductStockData>{new ProductStockData{Rarity = ProductRarity.Normal, Stock = 0}}},
|
||||
// new StorageTank(){Id = 1, Capacity = 50, FlavorId = 1, Stocks = new List<ProductStockData>{new ProductStockData{Rarity = ProductRarity.Normal, Stock = 0}}},
|
||||
new StorageTank(){Id = 2, Capacity = 50, FlavorId = 2, Stocks = new List<ProductStockData>
|
||||
{
|
||||
new ProductStockData{Rarity = ProductRarity.Normal, Stock = 1},
|
||||
|
|
@ -74,7 +74,9 @@ public class DebugOptionManager : MonoBehaviour
|
|||
}},
|
||||
new StorageTank(){Id = 3, Capacity = 50, FlavorId = 1, Stocks = new List<ProductStockData>
|
||||
{
|
||||
new ProductStockData{Rarity = ProductRarity.Copper, Stock = 1},
|
||||
new ProductStockData{Rarity = ProductRarity.Normal, Stock = 1},
|
||||
new ProductStockData{Rarity = ProductRarity.Yellow, Stock = 9},
|
||||
new ProductStockData{Rarity = ProductRarity.Copper, Stock = 5},
|
||||
new ProductStockData{Rarity = ProductRarity.Silver, Stock = 5},
|
||||
new ProductStockData{Rarity = ProductRarity.Gold, Stock = 10},
|
||||
new ProductStockData{Rarity = ProductRarity.Rainbow, Stock = 20},
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ public class KitchenManager : MonoBehaviour
|
|||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Recipe);
|
||||
});
|
||||
|
||||
// スプレッドシート対応
|
||||
// レシピIDが一覧で入っている
|
||||
// データ
|
||||
var gameData = GameDataManager.GameData;
|
||||
CoinManager.Instance.ChangeCoin(gameData.coin);
|
||||
|
||||
var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
|
||||
HeartMeter.Instance.Initialize(shopLevelList);
|
||||
HeartMeter.Instance.SetHeart(gameData.Heart);
|
||||
|
||||
SetData();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
|
@ -42,8 +43,6 @@ public class KitchenManager : MonoBehaviour
|
|||
gameData.MyRecipes = new[]
|
||||
{
|
||||
1,
|
||||
2,
|
||||
13,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,31 +47,9 @@ public class Market : MonoBehaviour
|
|||
var gameData = GameDataManager.GameData;
|
||||
CoinManager.Instance.ChangeCoin(gameData.coin);
|
||||
|
||||
var shopLevelList = new List<(int level, int heart, int tenMinCustomer)>
|
||||
{
|
||||
(1, 0, 10),
|
||||
(2, 10, 15),
|
||||
(3, 30, 20),
|
||||
(4, 50, 25),
|
||||
(5, 80, 30),
|
||||
(6, 130, 35),
|
||||
(7, 210, 40),
|
||||
(8, 320, 45),
|
||||
(9, 470, 50),
|
||||
(10, 650, 55),
|
||||
(11, 870, 60),
|
||||
(12, 1120, 65),
|
||||
(13, 1420, 70),
|
||||
(14, 1870, 75),
|
||||
(15, 2470, 80),
|
||||
(16, 3170, 85),
|
||||
(17, 4070, 90),
|
||||
(18, 5470, 95),
|
||||
(19, 7070, 100),
|
||||
(20, 9070, 105),
|
||||
};
|
||||
|
||||
HeartMeter.Instance.Initialize(shopLevelList.Select(x => x.heart).ToList());
|
||||
var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
|
||||
var shopLevelToCustomerList = shopLevelList.Select(shopLevel => (level:shopLevel.shopLevel, tenMinCustomer:shopLevel.customer));
|
||||
HeartMeter.Instance.Initialize(shopLevelList);
|
||||
HeartMeter.Instance.SetHeart(gameData.Heart);
|
||||
|
||||
// 在庫数表示
|
||||
|
|
@ -302,7 +280,7 @@ public class Market : MonoBehaviour
|
|||
|
||||
// お客さん出現タイマー(店舗レベル連動
|
||||
var changeCustomerFlowObservable = HeartMeter.Instance.ShopLevel
|
||||
.Select(x => (float)60 * 10 / shopLevelList.First(y => y.level == x).tenMinCustomer); // 10分間期待値から来客の間隔を算出
|
||||
.Select(x => (float)60 * 10 / shopLevelToCustomerList.First(y => y.level == x).tenMinCustomer); // 10分間期待値から来客の間隔を算出
|
||||
var customerObservable = changeCustomerFlowObservable
|
||||
.Select(x => Observable.Interval(TimeSpan.FromSeconds(x))
|
||||
.Select(_ =>
|
||||
|
|
|
|||
|
|
@ -664,6 +664,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
lockPanel: {fileID: 3261803197014340250}
|
||||
lockPanelText: {fileID: 1139637482908115965}
|
||||
detailButton: {fileID: 8320108874302735811}
|
||||
flavorName: {fileID: 2929932626752093611}
|
||||
flavorPrice: {fileID: 2929932627123125673}
|
||||
|
|
@ -671,6 +672,7 @@ MonoBehaviour:
|
|||
flavor1AmountText: {fileID: 2929932625557648441}
|
||||
flavor2AmountText: {fileID: 367551539734858426}
|
||||
flavor2View: {fileID: 367551539495355422}
|
||||
lockPanelTextFormat: "\u5E97\u8217\u30EC\u30D9\u30EB{0}\u3067\u958B\u653E"
|
||||
--- !u!1 &2997770120253274331
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
|
@ -11,11 +12,38 @@ public class PanSelector : MonoBehaviour
|
|||
[SerializeField] private Text panName;
|
||||
[SerializeField] private Text panText;
|
||||
[SerializeField] private Image panIcon;
|
||||
public IReadOnlyReactiveProperty<PanData> SelectedPanData => selectedPanData;
|
||||
private readonly ReactiveProperty<PanData> selectedPanData = new ReactiveProperty<PanData>();
|
||||
private readonly ReactiveProperty<int> selectedIndex = new ReactiveProperty<int>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 所持フライパン読み込み
|
||||
// 設定中のフライパン表示
|
||||
// フライパン変更通知
|
||||
selectedPanData.AddTo(this);
|
||||
selectedIndex.AddTo(this);
|
||||
var panList = SpreadsheetDataManager.Instance.GetBaseDataList<PanData>(Const.PanDataSheet);
|
||||
var panCount = panList.Count;
|
||||
selectedPanData.Value = panList[0];
|
||||
selectedPanData.Subscribe(data =>
|
||||
{
|
||||
SetData(data);
|
||||
}).AddTo(this);
|
||||
selectedIndex.Subscribe(x =>
|
||||
{
|
||||
selectedPanData.Value = panList[x];
|
||||
}).AddTo(this);
|
||||
prevPanButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
selectedIndex.Value = selectedIndex.Value == 0 ? panCount - 1 : selectedIndex.Value - 1;
|
||||
}).AddTo(this);
|
||||
nextPanButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
selectedIndex.Value = selectedIndex.Value == panCount - 1 ? 0 : selectedIndex.Value + 1;
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private void SetData(PanData data)
|
||||
{
|
||||
panName.text = data.name;
|
||||
panText.text = data.text;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,57 +18,14 @@ public class RecipeData
|
|||
|
||||
public static List<RecipeData> GetAllRecipe()
|
||||
{
|
||||
return new List<RecipeData>
|
||||
return SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet).Select(data => new RecipeData
|
||||
{
|
||||
new RecipeData
|
||||
{
|
||||
RecipeId = 1,
|
||||
Name = "塩コケコーン",
|
||||
Price = 5,
|
||||
Volume = 10,
|
||||
CornAmount = 150,
|
||||
Flavors = new List<(int id, int amount)>
|
||||
{
|
||||
(2, 1)
|
||||
}
|
||||
},
|
||||
new RecipeData
|
||||
{
|
||||
RecipeId = 2,
|
||||
Name = "キャラメルコケコーン",
|
||||
Price = 15,
|
||||
Volume = 10,
|
||||
CornAmount = 150,
|
||||
Flavors = new List<(int id, int amount)>
|
||||
{
|
||||
(7, 1)
|
||||
}
|
||||
},
|
||||
new RecipeData
|
||||
{
|
||||
RecipeId = 3,
|
||||
Name = "ブラックペッパーコケコーン",
|
||||
Price = 9,
|
||||
Volume = 10,
|
||||
CornAmount = 150,
|
||||
Flavors = new List<(int id, int amount)>
|
||||
{
|
||||
(3, 1)
|
||||
}
|
||||
},
|
||||
new RecipeData
|
||||
{
|
||||
RecipeId = 13,
|
||||
Name = "塩キャラメルコケコーン",
|
||||
Price = 19,
|
||||
Volume = 10,
|
||||
CornAmount = 150,
|
||||
Flavors = new List<(int id, int amount)>
|
||||
{
|
||||
(2, 1),
|
||||
(7, 1),
|
||||
}
|
||||
},
|
||||
};
|
||||
RecipeId = data.id,
|
||||
Name = data.name,
|
||||
Price = data.price,
|
||||
Volume = data.volume,
|
||||
CornAmount = data.MaterialList[0].amount,
|
||||
Flavors = data.MaterialList
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class RecipeDetailView : MonoBehaviour
|
|||
|
||||
private void Start()
|
||||
{
|
||||
var data = LocalCacheManager.Load<RecipeData>(PopcornGameManager.CookingDataTag);
|
||||
var data = LocalCacheManager.Load<ProductData>(PopcornGameManager.CookingDataTag);
|
||||
|
||||
cancelButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
|
|
@ -42,20 +42,17 @@ public class RecipeDetailView : MonoBehaviour
|
|||
|
||||
nextButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(PopcornGameManager.PanDataTag, panSelector.SelectedPanData.Value);
|
||||
// 消費
|
||||
var gameData = GameDataManager.GameData;
|
||||
gameData.cornSeed -= data.CornAmount;
|
||||
var flavorIndex1 = gameData.Material.FindIndex(x => x.Id == data.Flavors[0].id);
|
||||
var stockMaterial1 = gameData.Material[flavorIndex1];
|
||||
stockMaterial1.Amount -= data.Flavors[0].amount;
|
||||
gameData.Material[flavorIndex1] = stockMaterial1;
|
||||
if (data.Flavors.Count == 2)
|
||||
gameData.cornSeed -= data.MaterialList[0].amount;
|
||||
var flavorIndex1 = gameData.Material.FindIndex(x => x.Id == data.MaterialList[1].id);
|
||||
gameData.Material[flavorIndex1].Amount -= data.MaterialList[1].amount;
|
||||
if (data.GetMaterialCount() == 3)
|
||||
{
|
||||
var flavorIndex2 = gameData.Material.FindIndex(x => x.Id == data.Flavors[1].id);
|
||||
var stockMaterial2 = gameData.Material[flavorIndex2];
|
||||
stockMaterial2.Amount -= data.Flavors[1].amount;
|
||||
gameData.Material[flavorIndex2] = stockMaterial2;
|
||||
var flavorIndex2 = gameData.Material.FindIndex(x => x.Id == data.MaterialList[2].id);
|
||||
gameData.Material[flavorIndex2].Amount -= data.MaterialList[2].amount;
|
||||
}
|
||||
|
||||
GameDataManager.SaveGameData();
|
||||
TransitionManager.Instance.LoadScene(GameScenes.Cooking);
|
||||
}).AddTo(this);
|
||||
|
|
@ -69,37 +66,36 @@ public class RecipeDetailView : MonoBehaviour
|
|||
tankCaution.SetActive(!isPassedTank);
|
||||
}
|
||||
|
||||
public void SetRecipe(RecipeData data)
|
||||
public void SetRecipe(ProductData data)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
|
||||
// 在庫
|
||||
// 店頭の空きがない
|
||||
var shopStock = gameData.ShopStock.FindAll(x => x == data.RecipeId).Count;
|
||||
var tankStock = gameData.StorageTanks.FindAll(x => x.FlavorId == data.RecipeId).Sum(x => x.Stock);
|
||||
var shopStock = gameData.ShopStock.FindAll(x => x == data.id).Count;
|
||||
var tankStock = gameData.StorageTanks.FindAll(x => x.FlavorId == data.id).Sum(x => x.Stock);
|
||||
flavorStock.text = string.Format(flavorStockFormat, shopStock + tankStock);
|
||||
flavorName.text = data.Name;
|
||||
flavorPrice.text = data.Price.ToString();
|
||||
cornAmountText.text = string.Format(cornAmountFormat, gameData.cornSeed, data.CornAmount);
|
||||
flavorName.text = data.name;
|
||||
flavorPrice.text = data.price.ToString();
|
||||
cornAmountText.text = string.Format(cornAmountFormat, gameData.cornSeed, data.MaterialList[0].amount);
|
||||
|
||||
var flavor1Amount = 0;
|
||||
var flavorIndex1 = gameData.Material.FindIndex(x => x.Id == data.Flavors[0].id);
|
||||
var flavorIndex1 = gameData.Material.FindIndex(x => x.Id == data.MaterialList[1].id);
|
||||
if (flavorIndex1 != -1)
|
||||
{
|
||||
flavor1Amount = gameData.Material[flavorIndex1].Amount;
|
||||
}
|
||||
flavor1AmountText.text = string.Format(flavorAmountFormat, flavor1Amount, data.Flavors[0].amount);
|
||||
flavor1AmountText.text = string.Format(flavorAmountFormat, flavor1Amount, data.MaterialList[1].amount);
|
||||
|
||||
var flavor2Amount = 0;
|
||||
if (data.Flavors.Count == 2)
|
||||
if (data.GetMaterialCount() == 3)
|
||||
{
|
||||
var flavorIndex2 = gameData.Material.FindIndex(x => x.Id == data.Flavors[1].id);
|
||||
var flavorIndex2 = gameData.Material.FindIndex(x => x.Id == data.MaterialList[2].id);
|
||||
if (flavorIndex2 != -1)
|
||||
{
|
||||
flavor2Amount = gameData.Material[flavorIndex2].Amount;
|
||||
}
|
||||
flavor2View.SetActive(true);
|
||||
flavor2AmountText.text = string.Format(flavorAmountFormat, flavor2Amount, data.Flavors[1].amount);
|
||||
flavor2AmountText.text = string.Format(flavorAmountFormat, flavor2Amount, data.MaterialList[2].amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -107,25 +103,25 @@ public class RecipeDetailView : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private bool CheckAmount(RecipeData data)
|
||||
private bool CheckAmount(ProductData data)
|
||||
{
|
||||
var flag = true;
|
||||
var gameData = GameDataManager.GameData;
|
||||
if (gameData.cornSeed < data.CornAmount)
|
||||
if (gameData.cornSeed < data.MaterialList[0].amount)
|
||||
{
|
||||
flag = false;
|
||||
cornAmountText.color = Color.red;
|
||||
}
|
||||
var flavorIndex1 = gameData.Material.FindIndex(x => x.Id == data.Flavors[0].id);
|
||||
if (flavorIndex1 == -1 || gameData.Material[flavorIndex1].Amount < data.Flavors[0].amount)
|
||||
var flavorIndex1 = gameData.Material.FindIndex(x => x.Id == data.MaterialList[1].id);
|
||||
if (flavorIndex1 == -1 || gameData.Material[flavorIndex1].Amount < data.MaterialList[1].amount)
|
||||
{
|
||||
flag = false;
|
||||
flavor1AmountText.color = Color.red;
|
||||
}
|
||||
if (data.Flavors.Count == 2)
|
||||
if (data.GetMaterialCount() == 3)
|
||||
{
|
||||
var flavorIndex2 = gameData.Material.FindIndex(x => x.Id == data.Flavors[1].id);
|
||||
if (flavorIndex2 == -1 || gameData.Material[flavorIndex2].Amount < data.Flavors[1].amount)
|
||||
var flavorIndex2 = gameData.Material.FindIndex(x => x.Id == data.MaterialList[2].id);
|
||||
if (flavorIndex2 == -1 || gameData.Material[flavorIndex2].Amount < data.MaterialList[2].amount)
|
||||
{
|
||||
flag = false;
|
||||
flavor2AmountText.color = Color.red;
|
||||
|
|
@ -134,18 +130,18 @@ public class RecipeDetailView : MonoBehaviour
|
|||
return flag;
|
||||
}
|
||||
|
||||
private bool CheckTank(RecipeData data)
|
||||
private bool CheckTank(ProductData data)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
// 店頭の空き確認
|
||||
if (data.Volume <= Market.ShopStockCount - gameData.ShopStock.Count)
|
||||
if (data.volume <= Market.ShopStockCount - gameData.ShopStock.Count)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 空のタンク、同じフレーバーのタンク空き確認
|
||||
return gameData.StorageTanks
|
||||
.Where(tank => tank.IsEmpty || tank.FlavorId == data.RecipeId && !tank.IsFull)
|
||||
.Any(tank => data.Volume <= tank.Capacity - tank.Stock);
|
||||
.Where(tank => tank.IsEmpty || tank.FlavorId == data.id && !tank.IsFull)
|
||||
.Any(tank => data.volume <= tank.Capacity - tank.Stock);
|
||||
}
|
||||
}
|
||||
|
|
@ -21,17 +21,18 @@ public class RecipeSelectDialog : MonoBehaviour
|
|||
// レシピ一覧生成
|
||||
var content = scrollRect.content;
|
||||
content.transform.DestroyAllChildrens();
|
||||
foreach (var recipeData in RecipeData.GetAllRecipe())
|
||||
var data = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet);
|
||||
foreach (var productData in data)
|
||||
{
|
||||
var view = Instantiate(recipePrefab, content.transform);
|
||||
view.SetRecipe(recipeData);
|
||||
view.SetRecipe(productData);
|
||||
// 所持レシピ確認
|
||||
if (GameDataManager.GameData.MyRecipes.Contains(recipeData.RecipeId))
|
||||
if (GameDataManager.GameData.MyRecipes.Contains(productData.id))
|
||||
{
|
||||
view.SetLockPanel(false);
|
||||
view.RecipeClickObservable.Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, recipeData);
|
||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData);
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.RecipeChoice);
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
|
@ -6,6 +7,7 @@ using UnityEngine.UI;
|
|||
public class RecipeView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject lockPanel;
|
||||
[SerializeField] private Text lockPanelText;
|
||||
[SerializeField] private Button detailButton;
|
||||
[SerializeField] private Text flavorName;
|
||||
[SerializeField] private Text flavorPrice;
|
||||
|
|
@ -14,27 +16,38 @@ public class RecipeView : MonoBehaviour
|
|||
[SerializeField] private Text flavor2AmountText;
|
||||
[SerializeField] private GameObject flavor2View;
|
||||
private static readonly string amountFormat = "x{0}";
|
||||
private static readonly string lockPanelTextFormat = "店舗レベル{0}で開放";
|
||||
private static readonly string lockPanelTextShopFormat = "仕入れから購入可能";
|
||||
public IObservable<Unit> RecipeClickObservable => detailButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||
|
||||
private void Start()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetRecipe(RecipeData data)
|
||||
public void SetRecipe(ProductData data)
|
||||
{
|
||||
flavorName.text = data.Name;
|
||||
flavorPrice.text = data.Price.ToString();
|
||||
cornAmountText.text = string.Format(amountFormat, data.CornAmount);
|
||||
flavor1AmountText.text = string.Format(amountFormat, data.Flavors[0].amount);
|
||||
if (data.Flavors.Count == 2)
|
||||
flavorName.text = data.name;
|
||||
flavorPrice.text = data.price.ToString();
|
||||
cornAmountText.text = string.Format(amountFormat, data.MaterialList[0].amount);
|
||||
flavor1AmountText.text = string.Format(amountFormat, data.MaterialList[1].amount);
|
||||
if (data.GetMaterialCount() == 3)
|
||||
{
|
||||
flavor2View.SetActive(true);
|
||||
flavor2AmountText.text = string.Format(amountFormat, data.Flavors[1].amount);
|
||||
flavor2AmountText.text = string.Format(amountFormat, data.MaterialList[2].amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
flavor2View.SetActive(false);
|
||||
}
|
||||
|
||||
if (data.shopLevel == Const.SpecialShopLevel)
|
||||
{
|
||||
lockPanelText.text = string.Format(lockPanelTextShopFormat, data.shopLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
lockPanelText.text = string.Format(lockPanelTextFormat, data.shopLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLockPanel(bool hasRecipe)
|
||||
|
|
|
|||
|
|
@ -300,6 +300,80 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!1 &96916714
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 96916715}
|
||||
- component: {fileID: 96916717}
|
||||
- component: {fileID: 96916716}
|
||||
m_Layer: 0
|
||||
m_Name: BG
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &96916715
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 96916714}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 111842754}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &96916716
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 96916714}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &96916717
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 96916714}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &103445604
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -464,6 +538,7 @@ RectTransform:
|
|||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 96916715}
|
||||
- {fileID: 329292690}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
|
@ -868,7 +943,7 @@ RectTransform:
|
|||
- {fileID: 1594398330}
|
||||
- {fileID: 1455181832}
|
||||
m_Father: {fileID: 111842754}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ public static class Const {
|
|||
|
||||
// parameter
|
||||
public static readonly int DefaultPanId = 1;
|
||||
public static readonly int SpecialShopLevel = 9999;
|
||||
public static readonly int NotSetMaterialId = 0;
|
||||
|
||||
// tag
|
||||
public static readonly string GameDataTag = "GameData";
|
||||
|
|
@ -23,6 +25,10 @@ public static class Const {
|
|||
// sheet
|
||||
public static readonly string AvatarDataSheet = "AvatarData";
|
||||
public static readonly string ShopDataSheet = "ShopData";
|
||||
public static readonly string ShopLevelDataSheet = "ShopLevelData";
|
||||
public static readonly string MaterialDataSheet = "MaterialData";
|
||||
public static readonly string ProductDataSheet = "ProductData";
|
||||
public static readonly string PanDataSheet = "PanData";
|
||||
public static readonly string RarityDataSheet = "RarityData";
|
||||
|
||||
// language
|
||||
|
|
@ -47,6 +53,10 @@ public static class Const {
|
|||
public static readonly SheetData[] BaseSheetNameList = new SheetData[]{
|
||||
// new SheetData(Const.AvatarDataSheet),
|
||||
new SheetData(Const.ShopDataSheet),
|
||||
new SheetData(Const.ShopLevelDataSheet),
|
||||
new SheetData(Const.MaterialDataSheet),
|
||||
new SheetData(Const.ProductDataSheet),
|
||||
new SheetData(Const.PanDataSheet),
|
||||
new SheetData(Const.RarityDataSheet),
|
||||
};
|
||||
public static readonly SheetData[] LanguageSheetNameList = new SheetData[]{
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ public class HeartMeter : SingletonMonoBehaviour<HeartMeter>
|
|||
compositeDisposable.AddTo(this);
|
||||
}
|
||||
|
||||
public void Initialize(List<int> list)
|
||||
public void Initialize(List<ShopLevelData> shopLevelDataList)
|
||||
{
|
||||
levelList = list;
|
||||
levelList = shopLevelDataList.Select(shopLevelData => shopLevelData.heart).ToList();
|
||||
compositeDisposable.Clear();
|
||||
shopLevel.Subscribe(x =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,6 +35,67 @@ public sealed class RarityData
|
|||
public ProductRarity Rarity => (ProductRarity)id;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PanData
|
||||
{
|
||||
public int id;
|
||||
public int nameId;
|
||||
public string name;
|
||||
public string text;
|
||||
public int rarity;
|
||||
public ProductRarity Rarity => (ProductRarity)rarity;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ProductData
|
||||
{
|
||||
public int id;
|
||||
public int nameId;
|
||||
public string name;
|
||||
public int shopLevel;
|
||||
public int price;
|
||||
public int volume;
|
||||
public int material1Id;
|
||||
public int material2Id;
|
||||
public int material3Id;
|
||||
// public int cookingType;
|
||||
public string prefabName;
|
||||
public string productPrefabName;
|
||||
private List<(int id, int amount)> materialList;
|
||||
public List<(int id, int amount)> MaterialList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (materialList == null)
|
||||
{
|
||||
materialList = new List<(int id, int amount)>
|
||||
{
|
||||
(material1Id,15 * volume),
|
||||
(material2Id,1),
|
||||
(material3Id,1),
|
||||
};
|
||||
}
|
||||
return materialList;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetMaterialCount()
|
||||
{
|
||||
return materialList.Count(material => material.id != Const.NotSetMaterialId);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ShopLevelData
|
||||
{
|
||||
public int id;
|
||||
public int shopLevel;
|
||||
public int heart;
|
||||
public int customer;
|
||||
public int achievement;
|
||||
public string text;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ShopData {
|
||||
public int id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue