Merge branch 'develop' of bitbucket.org:usaya/popcorn into develop

This commit is contained in:
koya_15 2021-09-13 11:31:14 +09:00
commit 77d397312c
9 changed files with 45 additions and 37 deletions

View File

@ -1490,12 +1490,12 @@ PrefabInstance:
- target: {fileID: 5062447477614030396, guid: f19992fe2069b4e16b2f83277fb189cb,
type: 3}
propertyPath: m_Text
value: "\u7D20\u6750\n\u88DC\u5145"
value: "\u7D20\u6750\u30EA\n\u30BB\u30C3\u30C8"
objectReference: {fileID: 0}
- target: {fileID: 5850834825256791800, guid: f19992fe2069b4e16b2f83277fb189cb,
type: 3}
propertyPath: m_Name
value: RefillButton
value: ResetMaterialButton
objectReference: {fileID: 0}
- target: {fileID: 5850834825256791800, guid: f19992fe2069b4e16b2f83277fb189cb,
type: 3}
@ -1548,7 +1548,7 @@ MonoBehaviour:
resetButton: {fileID: 785180941}
backButton: {fileID: 785180940}
resetFieldButton: {fileID: 450754452}
refillMaterialButton: {fileID: 1767352104}
resetMaterialButton: {fileID: 1767352104}
refillManyProductButton: {fileID: 1651104560}
refillLittleProductButton: {fileID: 153639484}
fastGrowingToggle: {fileID: 1998240841}

View File

@ -13,7 +13,7 @@ public class DebugOptionManager : MonoBehaviour
[SerializeField] private Button resetButton;
[SerializeField] private Button backButton;
[SerializeField] private Button resetFieldButton;
[SerializeField] private Button refillMaterialButton;
[SerializeField] private Button resetMaterialButton;
[SerializeField] private Button refillManyProductButton;
[SerializeField] private Button refillLittleProductButton;
[SerializeField] private Toggle fastGrowingToggle;
@ -46,13 +46,18 @@ public class DebugOptionManager : MonoBehaviour
gameData.SeedlingDataList = null;
}).AddTo(this);
refillMaterialButton.OnClickAsObservable().Subscribe(_ =>
resetMaterialButton.OnClickAsObservable().Subscribe(_ =>
{
// 所持素材
gameData.Material = new List<MaterialData>{new MaterialData{Id = 2}};
foreach (var material in gameData.Material)
{
material.Amount = 10;
material.Amount = 5;
}
// レシピ
gameData.MyRecipes = new[] {1, 2, 13};
// フライパン
gameData.Pans = new[] {Const.DefaultPanId};
}).AddTo(this);
refillManyProductButton.OnClickAsObservable().Subscribe(_ =>

View File

@ -33,12 +33,15 @@ public class KitchenManager : MonoBehaviour
{
var gameData = GameDataManager.GameData;
// 所持レシピ
if (gameData.MyRecipes == null || gameData.MyRecipes.Length == 0)
{
gameData.MyRecipes = new[]
{
1,
2,
13,
};
}
// 所持素材
if (gameData.Material == null || gameData.Material.Count == 0)

View File

@ -5,20 +5,7 @@ using UnityEngine.UI;
public class ProductManagement : MonoBehaviour
{
public static readonly string PrevSceneNameTag = "ProductManagementPrevSceneName";
[SerializeField] private Button prevButton;
private void Start()
{
var prevGameScene = GameScenes.Main;
if (LocalCacheManager.Exists(PrevSceneNameTag))
{
prevGameScene = LocalCacheManager.Load<GameScenes>(PrevSceneNameTag);
}
prevButton.OnClickAsObservable().Subscribe(_ =>
{
TransitionManager.Instance.LoadScene(prevGameScene);
}).AddTo(this);
}
}

View File

@ -277,6 +277,7 @@ MonoBehaviour:
name: {fileID: 9133304336883555433}
icon: {fileID: 9133304335605570096}
price: {fileID: 9133304336128604254}
text: {fileID: 9133304336181127572}
stockCount: {fileID: 9133304336153810480}
totalPrice: {fileID: 9133304335494687832}
purchaseCount: {fileID: 9133304336756314526}
@ -285,6 +286,8 @@ MonoBehaviour:
closeButton: {fileID: 9133304335940276437}
purchaseOnButton: {fileID: 9133304335268316946}
purchaseOffButton: {fileID: 7845949066005219734}
quantitySelectObject: {fileID: 9133304337054428179}
explanationObject: {fileID: 9133304336181127570}
--- !u!1 &9133304335268316944
GameObject:
m_ObjectHideFlags: 0

View File

@ -6,6 +6,7 @@ using UnityEngine.UI;
public class ShopItemPurchaseView : MonoBehaviour
{
public static readonly string ItemPurchaseTag = "ItemPurcahse";
private static readonly string redColorString= "#fb6346";
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
private static readonly int MaxPurchaseCount = 999;
@ -15,6 +16,7 @@ public class ShopItemPurchaseView : MonoBehaviour
[SerializeField] private Text name;
[SerializeField] private Transform icon;
[SerializeField] private Text price;
[SerializeField] private Text text;
[SerializeField] private Text stockCount;
[SerializeField] private Text totalPrice;
[SerializeField] private Text purchaseCount;
@ -23,13 +25,18 @@ public class ShopItemPurchaseView : MonoBehaviour
[SerializeField] private Button closeButton;
[SerializeField] private Button purchaseOnButton;
[SerializeField] private GameObject purchaseOffButton;
[SerializeField] private GameObject quantitySelectObject;
[SerializeField] private GameObject explanationObject;
private Color redColor;
private Color defaultColor;
private readonly IntReactiveProperty currentCount = new IntReactiveProperty();
private void Start()
{
currentCount.AddTo(this);
defaultColor = totalPrice.color;
ColorUtility.TryParseHtmlString(redColorString, out redColor);
// 表示データを受け取る
var data = LocalCacheManager.Load<(ShopData shopData, int stockCount, Action<int> callback)>(ItemPurchaseTag);
LocalCacheManager.Remove(ItemPurchaseTag);
SetData(data.shopData, data.stockCount);
@ -58,10 +65,12 @@ public class ShopItemPurchaseView : MonoBehaviour
{
var total = data.shopData.price * x;
SetButtonActive(total <= CoinManager.Instance.OwnCoin);
totalPrice.color = total <= CoinManager.Instance.OwnCoin ? defaultColor : Color.red;
totalPrice.color = total <= CoinManager.Instance.OwnCoin ? defaultColor : redColor;
totalPrice.text = $"{total}";
purchaseCount.text = $"{x}";
}).AddTo(this);
quantitySelectObject.SetActive(data.shopData.ConsumeType == ShopItemType.Consumable);
explanationObject.SetActive(data.shopData.ConsumeType == ShopItemType.NonConsumable);
if (data.shopData.ConsumeType == ShopItemType.Consumable)
{
addCountButton.OnClickAsObservable().Select(_ => 1)
@ -82,6 +91,7 @@ public class ShopItemPurchaseView : MonoBehaviour
name.text = shopData.name;
price.text = $"{shopData.price}";
stockCount.text = $"所持数 :{count}";
text.text = shopData.text;
}
private void SetButtonActive(bool active)

View File

@ -46,15 +46,7 @@ public class ShopListView : MonoBehaviour
index = tabs.Count;
tabs.Add((tabCategory, Instantiate(scrollRect.content, scrollRect.content.parent)));
}
var itemView = Instantiate(itemViewPrefab, tabs[index].content);
itemView.SetData(shopData);
// show detail view
itemView.DetailButtonObservable.Subscribe(_ =>
{
LocalCacheManager.Save(ShopItemDetailView.ItemDetailTag, shopData);
TransitionManager.Instance.LoadSceneAdditive(GameScenes.ShoppingExplanation);
}).AddTo(itemView);
return itemView;
return Instantiate(itemViewPrefab, tabs[index].content);
}
private ItemCategory GetTabCategory(ItemCategory category)

View File

@ -9,18 +9,21 @@ public class Shopping : MonoBehaviour
{
[SerializeField] private ShopListView listView;
// Start is called before the first frame update
private Subject<int> changeCoinSubject = new Subject<int>();
void Start()
{
changeCoinSubject.AddTo(this);
var gameData = GameDataManager.GameData;
CoinManager.Instance.ChangeCoin(gameData.coin);
HeartMeter.Instance.SetHeart(gameData.Heart);
var changeCoinSubject = new Subject<int>().AddTo(this);
// 一覧データ
var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(Const.ShopDataSheet);
foreach (var shopData in shopDataList)
{
var itemView = listView.AddItemView(shopData);
itemView.SetData(shopData);
itemView.SetStockCount(GetItemAmount(shopData));
// コインを監視して購入可能状態を切り替え
changeCoinSubject.Subscribe(ownCoin =>
@ -47,6 +50,12 @@ public class Shopping : MonoBehaviour
LocalCacheManager.Save(ShopItemPurchaseView.ItemPurchaseTag, (shopData, GetItemAmount(shopData), new Action<int>(x => purchaseSubject.OnNext(x))));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Purchase);
}).AddTo(itemView);
// show detail view
itemView.DetailButtonObservable.Subscribe(_ =>
{
LocalCacheManager.Save(ShopItemDetailView.ItemDetailTag, shopData);
TransitionManager.Instance.LoadSceneAdditive(GameScenes.ShoppingExplanation);
}).AddTo(itemView);
}
changeCoinSubject.OnNext(CoinManager.Instance.OwnCoin);
}

View File

@ -36,7 +36,6 @@ public class FooterManager : MonoBehaviour
}).AddTo(this);
productManagementButton.BindToOnClick(shareGate, _ =>
{
LocalCacheManager.Save(ProductManagement.PrevSceneNameTag, Enum.Parse(typeof(GameScenes), gameObject.scene.name));
TransitionManager.Instance.LoadScene(GameScenes.ProductManagement);
return Observable.Timer(TimeSpan.FromSeconds(.5f)).AsUnitObservable();
}).AddTo(this);