Merge branch 'develop' of bitbucket.org:usaya/popcorn into develop
This commit is contained in:
commit
a7f1c81b8b
|
|
@ -1,5 +1,86 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &746832000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 746832001}
|
||||
- component: {fileID: 746832002}
|
||||
m_Layer: 0
|
||||
m_Name: MarketBrotherPink
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &746832001
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 746832000}
|
||||
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:
|
||||
- {fileID: 5749156821563996369}
|
||||
m_Father: {fileID: 3667080857874733261}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &746832002
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 746832000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6bf6e7fee6cf41a6bad181319bb8b8ed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
animatorPrefab: {fileID: 7854448232971748898, guid: febae22cb9bba384992e30ac63891778,
|
||||
type: 3}
|
||||
pinkTransform: {fileID: 5749156821563996369}
|
||||
walkSideBottomPos: -8
|
||||
pinkWalkSpeed: 4
|
||||
coolTime: 20
|
||||
fewerBorder: 5
|
||||
--- !u!1 &2089667968034057798
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5749156821563996369}
|
||||
m_Layer: 0
|
||||
m_Name: Target
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5749156821563996369
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2089667968034057798}
|
||||
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: 746832001}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &3459593390050872226
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -9,10 +90,10 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3667080857874733261}
|
||||
- component: {fileID: 1623805592074586917}
|
||||
- component: {fileID: 7740671670896384492}
|
||||
- component: {fileID: 3756929251745663541}
|
||||
- component: {fileID: 5400893423074421525}
|
||||
- component: {fileID: 1623805592074586917}
|
||||
m_Layer: 0
|
||||
m_Name: DontDestroyObject
|
||||
m_TagString: Untagged
|
||||
|
|
@ -32,9 +113,22 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 3320409656134683753}
|
||||
- {fileID: 746832001}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1623805592074586917
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3459593390050872226}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 992ca0f9e68a447b8f3d9ea096088ae4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &7740671670896384492
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -81,18 +175,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 77ded0026daa40d4b872efbaf2c1195c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1623805592074586917
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3459593390050872226}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 992ca0f9e68a447b8f3d9ea096088ae4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &8739647597683206087
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -69,8 +69,28 @@ public class DebugOptionManager : MonoBehaviour
|
|||
|
||||
refillManyProductButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
gameData.ShopStock = Enumerable.Repeat(1, 10).ToList();
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(2, 10).ToList());
|
||||
gameData.ShopStock.Clear();
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 1, Rarity = ProductRarity.Normal
|
||||
}, 5));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 2, Rarity = ProductRarity.Yellow
|
||||
}, 5));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 3, Rarity = ProductRarity.Copper
|
||||
}, 5));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 4, Rarity = ProductRarity.Silver
|
||||
}, 5));
|
||||
// gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
// {
|
||||
// FlavorId = 5, Rarity = ProductRarity.Gold
|
||||
// }, 5));
|
||||
|
||||
gameData.StorageTanks = new List<StorageTank>
|
||||
{
|
||||
// new StorageTank(){Id = 1, Capacity = 50, FlavorId = 1, Stocks = new List<ProductStockData>{new ProductStockData{Rarity = ProductRarity.Normal, Stock = 0}}},
|
||||
|
|
@ -95,9 +115,27 @@ public class DebugOptionManager : MonoBehaviour
|
|||
refillLittleProductButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
gameData.StorageTanks.ForEach(x => x.ClearStock());
|
||||
gameData.ShopStock = Enumerable.Repeat(2, 2).ToList();
|
||||
gameData.ShopStock = Enumerable.Repeat(1, 10).ToList();
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(2, 10).ToList());
|
||||
gameData.ShopStock.Clear();
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 1, Rarity = ProductRarity.Normal
|
||||
}, 5));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 2, Rarity = ProductRarity.Yellow
|
||||
}, 5));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 3, Rarity = ProductRarity.Copper
|
||||
}, 5));
|
||||
gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
{
|
||||
FlavorId = 4, Rarity = ProductRarity.Silver
|
||||
}, 5));
|
||||
// gameData.ShopStock.AddRange(Enumerable.Repeat(new ProductStockData()
|
||||
// {
|
||||
// FlavorId = 5, Rarity = ProductRarity.Gold
|
||||
// }, 5));
|
||||
}).AddTo(this);
|
||||
|
||||
coinCount.text = $"{gameData.Coin}";
|
||||
|
|
|
|||
|
|
@ -65,12 +65,7 @@ public class KitchenManager : MonoBehaviour
|
|||
{
|
||||
gameData.Material = Enumerable.Range(1, 12).Select(x => new MaterialData(x, 0)).ToList();
|
||||
}
|
||||
|
||||
// 店頭ストック
|
||||
if (gameData.ShopStock == null)
|
||||
{
|
||||
gameData.ShopStock = new List<int>();
|
||||
}
|
||||
|
||||
// 保存タンク
|
||||
if (gameData.StorageTanks == null || gameData.StorageTanks.Count == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -498,7 +498,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 7854448232971748899}
|
||||
- component: {fileID: 7854448232971748898}
|
||||
- component: {fileID: 7854448232971748957}
|
||||
- component: {fileID: 7854448232971748956}
|
||||
m_Layer: 0
|
||||
m_Name: Brother_pink
|
||||
|
|
@ -515,7 +514,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7854448232971748896}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 4.96, y: -0.26, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 7854448232785489951}
|
||||
|
|
@ -545,24 +544,6 @@ Animator:
|
|||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!114 &7854448232971748957
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7854448232971748896}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6bf6e7fee6cf41a6bad181319bb8b8ed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
animator: {fileID: 7854448232971748898}
|
||||
pinkTransform: {fileID: 7854448232971748899}
|
||||
walkSideBottomPos: -8
|
||||
pinkWalkSpeed: 4
|
||||
coolTime: 20
|
||||
fewerBorder: 5
|
||||
--- !u!210 &7854448232971748956
|
||||
SortingGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using UniRx;
|
||||
using UniRx.Triggers;
|
||||
using UnityEngine;
|
||||
|
||||
public class BrotherPinkView : MonoBehaviour
|
||||
public class BrotherPinkView : SingletonMonoBehaviour<BrotherPinkView>
|
||||
{
|
||||
private static readonly int Normal = Animator.StringToHash("Normal");
|
||||
private static readonly int Promotion = Animator.StringToHash("Promotion");
|
||||
|
|
@ -11,7 +12,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
private static readonly Vector2 RightPos = new Vector2(4.96f, -0.26f);
|
||||
private static readonly Vector2 LeftPos = new Vector2(-4.96f, -0.26f);
|
||||
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private Animator animatorPrefab;
|
||||
[SerializeField] private Transform pinkTransform;
|
||||
[SerializeField] private float walkSideBottomPos;
|
||||
[SerializeField] private float pinkWalkSpeed = 4f;
|
||||
|
|
@ -20,6 +21,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
|
||||
public int FewerBorder => fewerBorder;
|
||||
|
||||
private Animator animator;
|
||||
private bool isManyCustomer;
|
||||
private bool isLocked;
|
||||
private int nextId;
|
||||
|
|
@ -34,8 +36,17 @@ public class BrotherPinkView : MonoBehaviour
|
|||
private Vector2 wayPoint;
|
||||
private float durationDelta;
|
||||
private float completedDuration;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
nextId = Normal;
|
||||
isManyCustomer = true;
|
||||
Debug.Log($"normal");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
pinkTransform.localPosition = RightPos;
|
||||
this.UpdateAsObservable().Subscribe(_ =>
|
||||
{
|
||||
if (isManyCustomer || isLocked)
|
||||
|
|
@ -60,7 +71,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
moveIndex = 0;
|
||||
isLocked = true;
|
||||
isManyCustomer = true;
|
||||
animator.SetTrigger(nextId);
|
||||
if (animator != null) animator.SetTrigger(nextId);
|
||||
this.CallWaitForSeconds(coolTime, () =>
|
||||
{
|
||||
isLocked = false;
|
||||
|
|
@ -72,10 +83,19 @@ public class BrotherPinkView : MonoBehaviour
|
|||
}).AddTo(this);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
public void SetBrotherView(Transform target)
|
||||
{
|
||||
nextId = Normal;
|
||||
isManyCustomer = true;
|
||||
target.DestroyAllChildrens();
|
||||
animator = Instantiate(animatorPrefab, target);
|
||||
this.UpdateAsObservable().Subscribe(_ =>
|
||||
{
|
||||
target.localPosition = pinkTransform.localPosition;
|
||||
target.localRotation = pinkTransform.localRotation;
|
||||
}).AddTo(animator);
|
||||
if (!isManyCustomer)
|
||||
{
|
||||
SetPinkMove();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPinkMove()
|
||||
|
|
@ -83,7 +103,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
var move = pinkMoves[moveIndex];
|
||||
wayPoint = move.wayPoint;
|
||||
completedDuration = move.wait;
|
||||
animator.SetTrigger(move.trigger);
|
||||
if (animator != null) animator.SetTrigger(move.trigger);
|
||||
if (Vector2.Distance(wayPoint, pinkTransform.localPosition.ToVector2()) < .01f)
|
||||
{
|
||||
// nop
|
||||
|
|
@ -99,14 +119,9 @@ public class BrotherPinkView : MonoBehaviour
|
|||
|
||||
private void SetTrigger(int id)
|
||||
{
|
||||
if (nextId == id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
nextId = id;
|
||||
if (isManyCustomer)
|
||||
{
|
||||
Debug.Log($"triggered");
|
||||
animator.SetTrigger(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
[SerializeField] private CustomerData customerData;
|
||||
[SerializeField] private CustomerController customerControllerPrefab;
|
||||
|
||||
public List<int> DisplayFlavors => displayFlavors;
|
||||
private List<int> displayFlavors = new List<int>();
|
||||
public List<ProductStockData> DisplayFlavors => displayFlavors;
|
||||
private List<ProductStockData> displayFlavors = new List<ProductStockData>();
|
||||
public List<int> ShuffledOrder => shuffledOrder;
|
||||
private List<int> shuffledOrder = new List<int>();
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
#endif
|
||||
|
||||
// 陳列
|
||||
displayFlavors = gameData.ShopStock.Select(x => x).ToList();
|
||||
displayFlavors = gameData.ShopStock.ToList();
|
||||
|
||||
// 売り順決定
|
||||
shuffledOrder = ShuffleOrder(displayFlavors.Count);
|
||||
|
|
@ -74,7 +74,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
.Subscribe(_ =>
|
||||
{
|
||||
Debug.Log("displayFlavors updated");
|
||||
displayFlavors = gameData.ShopStock.Select(x => x).ToList();
|
||||
displayFlavors = gameData.ShopStock.ToList();
|
||||
shuffledOrder = ShuffleOrder(displayFlavors.Count);
|
||||
shopState.Value = ShopState.Open;
|
||||
});
|
||||
|
|
@ -119,12 +119,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
// 売り切れ
|
||||
if (shuffledOrder.Count == 0)
|
||||
{
|
||||
controller.SetWantFlavor(new ProductStockData
|
||||
{
|
||||
FlavorId = displayFlavors.RandomChoose(),
|
||||
Rarity = ProductRarity.Normal,
|
||||
Stock = 0
|
||||
});
|
||||
controller.SetWantFlavor(displayFlavors.RandomChoose());
|
||||
controller.CallWaitForSeconds(1.5f, () =>
|
||||
{
|
||||
controller.SetComplain();
|
||||
|
|
@ -144,19 +139,14 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
continue;
|
||||
}
|
||||
|
||||
// 在庫取得
|
||||
var tmpOrderCount = Mathf.Min(controller.OrderCount, shuffledOrder.Count);
|
||||
// shuffledOrder順に販売
|
||||
orders.AddRange(shuffledOrder.GetRange(0, tmpOrderCount));
|
||||
var tmpOrderCount = Mathf.Min(controller.OrderCount, shuffledOrder.Count);
|
||||
var tmpOrders = shuffledOrder.GetRange(0, tmpOrderCount);
|
||||
shuffledOrder.RemoveRange(0, tmpOrderCount);
|
||||
orders.AddRange(tmpOrders);
|
||||
|
||||
// コーンの味吹き出しを設定(レア度優先など
|
||||
controller.SetWantFlavor(new ProductStockData
|
||||
{
|
||||
FlavorId = orders.RandomChoose(),
|
||||
Rarity = ProductRarity.Normal,
|
||||
Stock = 0
|
||||
});
|
||||
// コーンの味吹き出しを設定
|
||||
controller.SetWantFlavor(displayFlavors[tmpOrders.RandomChoose()]);
|
||||
}
|
||||
foreach (var customerController in dontBuyCustomerList)
|
||||
{
|
||||
|
|
@ -171,12 +161,8 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
return;
|
||||
}
|
||||
|
||||
var flavors = orders.Select(x => (displayFlavors[x], ProductRarity.Normal)).ToList();
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"bb order: {orders.Count} {orders.Aggregate("", (s, i) => $"{s},{i}")}");
|
||||
Debug.Log($"bb shuffledOrder:{shuffledOrder.Count} {shuffledOrder.Aggregate("", (s, i) => $"{s},{i}")}");
|
||||
#endif
|
||||
// 購入
|
||||
var flavors = orders.Select(x => displayFlavors[x]).ToList();
|
||||
var coin = SellPopcorn(flavors);
|
||||
|
||||
// 獲得処理
|
||||
|
|
@ -184,14 +170,18 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
gameData.Heart += customers.Count;
|
||||
GameDataManager.SaveGameData();
|
||||
|
||||
var remainStockCount = gameData.ShopStock.Count;
|
||||
|
||||
// 自動補充 refill
|
||||
// 商品補充
|
||||
RefillShopStockData();
|
||||
StockFlavorLog();
|
||||
|
||||
// 補充された場合フレーバー再設定
|
||||
var isReorder = RefillShopFlavors(orders, remainStockCount);
|
||||
#if UNITY_EDITOR
|
||||
StockFlavorLog();
|
||||
Debug.Log($"ShopStock{gameData.ShopStock.Count}, {shuffledOrder.Count + orders.Count}");
|
||||
Debug.Log($"displayCount:{displayFlavors.Count}\n" +
|
||||
$"shuffled:{shuffledOrder.Count} {string.Join(",", shuffledOrder)}\n" +
|
||||
$"orders:{orders.Count} {string.Join(",", orders)}");
|
||||
#endif
|
||||
// 表示データ更新
|
||||
var isReorder = RefillDisplayFlavors(gameData.ShopStock, orders, shuffledOrder.Count);
|
||||
|
||||
this.CallWaitForSeconds(1.5f, () =>
|
||||
{
|
||||
|
|
@ -260,7 +250,6 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
customerController.Setup(orderPosisionObject.transform.GetComponentsInChildren<Transform>().ToList().Skip(1).ToList());
|
||||
customerController.OrderCount = orderCount;
|
||||
customerController.CustomerPrefab = prefab;
|
||||
customerController.IsCustomer = isCustomer;
|
||||
customerControllerList.Add(customerController);
|
||||
|
||||
customerController.MoveEndObservable
|
||||
|
|
@ -278,10 +267,6 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
Destroy(customerController.gameObject);
|
||||
break;
|
||||
case CustomerMovingType.WalkCenter:
|
||||
// if (shopState.Value == ShopState.Close)
|
||||
// {
|
||||
// customerController.ChangeCustomerState(CustomerState.Leave);
|
||||
// }
|
||||
if (customerController.State.Value == CustomerState.WalkShop)
|
||||
{
|
||||
customerList.Add(customerController);
|
||||
|
|
@ -298,7 +283,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
}
|
||||
}).AddTo(customerController);
|
||||
|
||||
if (customerController.IsCustomer)
|
||||
if (isCustomer)
|
||||
{
|
||||
// 近くまで歩く(タップされたらcustomerList.Add()
|
||||
customerController.ChangeCustomerState(CustomerState.WalkShop);
|
||||
|
|
@ -322,6 +307,20 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
}).AddTo(customerController);
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
||||
// お客さんが少なくなったら弟が走る
|
||||
CustomerList.ObserveCountChanged(true).AsUnitObservable()
|
||||
.Merge(Observable.Interval(TimeSpan.FromSeconds(1f)).AsUnitObservable())
|
||||
.Where(_ => CurrentShopState.Value != ShopState.Close)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
var count = CustomerList.Count(c => c.State.Value == CustomerState.Wait || c.State.Value == CustomerState.Order);
|
||||
if (count < BrotherPinkView.Instance.FewerBorder)
|
||||
{
|
||||
Debug.Log($"market set walk");
|
||||
BrotherPinkView.Instance.SetWalk();
|
||||
}
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
// お客さん出現パターン確率計算と行動パターン計算
|
||||
|
|
@ -375,7 +374,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
return (false, GetOrderCount(false));
|
||||
}
|
||||
|
||||
private int SellPopcorn(List<(int flavor, ProductRarity rarity)> flavors)
|
||||
private int SellPopcorn(List<ProductStockData> stockDataList)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
// 品切れ
|
||||
|
|
@ -385,17 +384,17 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
}
|
||||
|
||||
// フレーバーを売る
|
||||
var recipeList = RecipeData.GetAllRecipe();
|
||||
var recipeList = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet);
|
||||
var rarityList = SpreadsheetDataManager.Instance.GetBaseDataList<RarityData>(Const.RarityDataSheet);
|
||||
var coin = 0;
|
||||
foreach (var flavorData in flavors)
|
||||
foreach (var stockData in stockDataList)
|
||||
{
|
||||
var targetIndex = gameData.ShopStock.FindIndex(x => x == flavorData.flavor);
|
||||
var flavorRecipe = recipeList.First(data => data.RecipeId == gameData.ShopStock[targetIndex]);
|
||||
var rarityData = rarityList.First(data => data.Rarity == flavorData.rarity);
|
||||
var productData = recipeList.First(data => data.id == stockData.FlavorId);
|
||||
var rarityData = rarityList.First(data => data.Rarity == stockData.Rarity);
|
||||
var targetIndex = gameData.ShopStock.FindIndex(data => data.FlavorId == stockData.FlavorId && data.Rarity == stockData.Rarity);
|
||||
gameData.ShopStock.RemoveAt(targetIndex);
|
||||
gameData.AddSalesCount(flavorData.flavor, 1, flavorData.rarity);
|
||||
coin += flavorRecipe.Price * (1 + rarityData.rate / 100);
|
||||
gameData.AddSalesCount(stockData.FlavorId, 1, stockData.Rarity);
|
||||
coin += productData.price * (1 + rarityData.rate / 100);
|
||||
}
|
||||
return coin;
|
||||
}
|
||||
|
|
@ -412,46 +411,40 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
// へらした分を店頭リストに追加する
|
||||
var gameData = GameDataManager.GameData;
|
||||
var shopSpace = ShopStockCount - gameData.ShopStock.Count;
|
||||
var index = 0;
|
||||
var tankCount = gameData.StorageTanks.Count;
|
||||
while (shopSpace > 0)
|
||||
foreach (var tank in gameData.StorageTanks.Where(tank => !tank.IsEmpty))
|
||||
{
|
||||
if (index > tankCount - 1)
|
||||
if (shopSpace == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
var tank = gameData.StorageTanks[index];
|
||||
var stockList = tank.GetStock(shopSpace);
|
||||
// レアの設定入れる
|
||||
gameData.ShopStock.AddRange(stockList.Select(x => x.FlavorId));
|
||||
gameData.ShopStock.AddRange(stockList);
|
||||
shopSpace -= stockList.Count;
|
||||
gameData.StorageTanks[index] = tank;
|
||||
index++;
|
||||
}
|
||||
GameDataManager.SaveGameData();
|
||||
}
|
||||
|
||||
private bool RefillShopFlavors(List<int> orders, int remainStockCount)
|
||||
private bool RefillDisplayFlavors(List<ProductStockData> shopStock, List<int> orders, int remain)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
if (gameData.ShopStock.Count == ShopStockCount)
|
||||
// 補充された場合店頭のフレーバー入れ替え
|
||||
if (shopStock.Count == ShopStockCount)
|
||||
{
|
||||
shuffledOrder.AddRange(orders);
|
||||
var stock = gameData.ShopStock.GetRange(remainStockCount, orders.Count).ToArray();
|
||||
var refillList = shopStock.GetRange(remain, orders.Count);
|
||||
for (int i = 0; i < orders.Count; i++)
|
||||
{
|
||||
displayFlavors[orders[i]] = stock[i];
|
||||
displayFlavors[orders[i]] = refillList[i];
|
||||
}
|
||||
}
|
||||
else if (gameData.ShopStock.Count <= 13 && shuffledOrder.Exists(x => x > 13))
|
||||
else if (shopStock.Count <= 13 && shuffledOrder.Exists(x => x > 13))
|
||||
{
|
||||
displayFlavors = gameData.ShopStock.Select(x => x).ToList();
|
||||
displayFlavors = shopStock.ToList();
|
||||
shuffledOrder = ShuffleOrder(displayFlavors.Count);
|
||||
return true;
|
||||
}
|
||||
else if (gameData.ShopStock.Count <= 7 && shuffledOrder.Exists(x => x > 7))
|
||||
else if (shopStock.Count <= 7 && shuffledOrder.Exists(x => x > 7))
|
||||
{
|
||||
displayFlavors = gameData.ShopStock.Select(x => x).ToList();
|
||||
displayFlavors = shopStock.ToList();
|
||||
shuffledOrder = ShuffleOrder(displayFlavors.Count);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -477,7 +470,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
var shopStockString = "";
|
||||
foreach (var data in RecipeData.GetAllRecipe())
|
||||
{
|
||||
var shopStockCount = GameDataManager.GameData.ShopStock.FindAll(x => x == data.RecipeId).Count;
|
||||
var shopStockCount = GameDataManager.GameData.ShopStock.FindAll(x => x.FlavorId == data.RecipeId).Count;
|
||||
var tank = GameDataManager.GameData.StorageTanks.FindAll(x => x.FlavorId == data.RecipeId).Sum(x => x.Stock);
|
||||
if (shopStockCount + tank == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class MarketManager : MonoBehaviour
|
|||
[SerializeField] private ShopStockView stockView;
|
||||
[SerializeField] private MarketCartView cartView;
|
||||
[SerializeField] private BrotherBlueView blueView;
|
||||
[SerializeField] private BrotherPinkView pinkView;
|
||||
[SerializeField] private Transform pinkTarget;
|
||||
[SerializeField] private Transform coinPrefab;
|
||||
[SerializeField] private Transform rootTransform;
|
||||
private Market market;
|
||||
|
|
@ -28,18 +28,10 @@ public class MarketManager : MonoBehaviour
|
|||
market = Market.Instance;
|
||||
productDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet);
|
||||
stockView.SetStock(gameData.StorageTanks);
|
||||
var startStocks = market.DisplayFlavors
|
||||
.Select((flavor, index) => (flavor, index))
|
||||
.Where(data => market.ShuffledOrder.Contains(data.index))
|
||||
.Select(data => (data.index, new ProductStockData
|
||||
{
|
||||
FlavorId = data.flavor,
|
||||
Rarity = ProductRarity.Gold,
|
||||
}))
|
||||
.ToList();
|
||||
var startStocks = market.ShuffledOrder.Select(x => (x, market.DisplayFlavors[x])).ToList();
|
||||
cartView.Initialize();
|
||||
cartView.SetStock(startStocks, false);
|
||||
pinkView.Initialize();
|
||||
BrotherPinkView.Instance.SetBrotherView(pinkTarget);
|
||||
|
||||
// Customerの各アニメーション設定
|
||||
foreach (var controller in market.CustomerControllerList)
|
||||
|
|
@ -78,28 +70,13 @@ public class MarketManager : MonoBehaviour
|
|||
// 補充したフレーバーのスキンを設定
|
||||
foreach (var order in x.orders)
|
||||
{
|
||||
cartView.Refill(order, new ProductStockData
|
||||
{
|
||||
FlavorId = market.DisplayFlavors[order],
|
||||
Rarity = ProductRarity.Normal,
|
||||
});
|
||||
cartView.Refill(order, market.DisplayFlavors[order]);
|
||||
}
|
||||
}
|
||||
else if (x.isReorder)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"bb setStockFlag {market.DisplayFlavors.Count} {market.ShuffledOrder.Count}");
|
||||
#endif
|
||||
// 陳列表示更新(陳列13=650ms,7=350ms)
|
||||
var stocks = market.DisplayFlavors
|
||||
.Select((flavor, index) => (flavor, index))
|
||||
.Where(data => market.ShuffledOrder.Contains(data.index))
|
||||
.Select(data => (data.index, new ProductStockData
|
||||
{
|
||||
FlavorId = data.flavor,
|
||||
Rarity = ProductRarity.Normal,
|
||||
}))
|
||||
.ToList();
|
||||
var stocks = market.ShuffledOrder.Select(i => (i, market.DisplayFlavors[i])).ToList();
|
||||
cartView.SetStock(stocks, true);
|
||||
}
|
||||
});
|
||||
|
|
@ -114,7 +91,7 @@ public class MarketManager : MonoBehaviour
|
|||
switch (state)
|
||||
{
|
||||
case ShopState.Open:
|
||||
pinkView.SetNormal();
|
||||
BrotherPinkView.Instance.SetNormal();
|
||||
closeSign.SetActive(false);
|
||||
break;
|
||||
case ShopState.Busy:
|
||||
|
|
@ -122,7 +99,7 @@ public class MarketManager : MonoBehaviour
|
|||
case ShopState.Close:
|
||||
if (market.CustomerList.Count(x => x.State.Value == CustomerState.Order) == 0)
|
||||
{
|
||||
pinkView.SetSleepy();
|
||||
BrotherPinkView.Instance.SetSleepy();
|
||||
closeSign.SetActive(true);
|
||||
}
|
||||
else
|
||||
|
|
@ -136,7 +113,7 @@ public class MarketManager : MonoBehaviour
|
|||
.Delay(TimeSpan.FromSeconds(2f))
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
pinkView.SetSleepy();
|
||||
BrotherPinkView.Instance.SetSleepy();
|
||||
closeSign.SetActive(true);
|
||||
}).AddTo(shopStateCompositeDisposable);
|
||||
}
|
||||
|
|
@ -145,19 +122,6 @@ public class MarketManager : MonoBehaviour
|
|||
throw new ArgumentOutOfRangeException(nameof(state), state, null);
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
||||
// お客さんが少なくなったら弟が走る
|
||||
market.CustomerList.ObserveCountChanged(true).AsUnitObservable()
|
||||
.Merge(Observable.Interval(TimeSpan.FromSeconds(1f)).AsUnitObservable())
|
||||
.Where(_ => market.CurrentShopState.Value != ShopState.Close)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
var count = market.CustomerList.Count(c => c.State.Value == CustomerState.Wait || c.State.Value == CustomerState.Order);
|
||||
if (count < pinkView.FewerBorder)
|
||||
{
|
||||
pinkView.SetWalk();
|
||||
}
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private void CoinEffect(int count)
|
||||
|
|
@ -220,16 +184,22 @@ public class MarketManager : MonoBehaviour
|
|||
}).AddTo(customerAnimator);
|
||||
var eventTrigger = customerAnimator.gameObject.AddComponent<ObservableEventTrigger>();
|
||||
eventTrigger.OnPointerClickAsObservable()
|
||||
.TakeWhile(_ => market.CurrentShopState.Value != ShopState.Close)
|
||||
.Where(_ => market.CurrentShopState.Value != ShopState.Close)
|
||||
.Take(1)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
controller.Tapped();
|
||||
customerAnimator.ShowTapReaction();
|
||||
if (customerAnimator.TryGetComponent(typeof(Collider2D), out var target))
|
||||
{
|
||||
Destroy(target);
|
||||
}
|
||||
if (controller.State.Value == CustomerState.Leave
|
||||
|| controller.State.Value == CustomerState.EatingLeave
|
||||
|| controller.State.Value == CustomerState.SadLeave)
|
||||
{
|
||||
return;
|
||||
}
|
||||
controller.Tapped();
|
||||
customerAnimator.ShowTapReaction();
|
||||
}).AddTo(customerAnimator);
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ public class ProductManagement : MonoBehaviour
|
|||
};
|
||||
|
||||
// タンク並び替え
|
||||
gameData.StorageTanks = gameData.StorageTanks.OrderBy(tank => tank.Stock == 0).ToList();
|
||||
gameData.StorageTanks = gameData.StorageTanks.OrderBy(tank => tank.IsEmpty).ToList();
|
||||
|
||||
// タンク設定
|
||||
var tankList = view.SetTanks(priceList);
|
||||
|
|
@ -105,7 +105,9 @@ public class ProductManagement : MonoBehaviour
|
|||
{
|
||||
state.Value = ManagementState.None;
|
||||
var tankData = gameData.StorageTanks[tankView.TankNumber - 1];
|
||||
var totalStock = gameData.ShopStock.Sum(x => x) + gameData.StorageTanks.Where(x => x.FlavorId == tankData.FlavorId).Sum(x => x.Stock);
|
||||
var shopStock = gameData.ShopStock.Count(data => data.FlavorId == tankData.FlavorId);
|
||||
var tankStock = gameData.StorageTanks.Where(x => x.FlavorId == tankData.FlavorId).Sum(x => x.Stock);
|
||||
var totalStock = shopStock + tankStock;
|
||||
var recipe = RecipeData.GetRecipe(tankData.FlavorId);
|
||||
var price = recipe?.Price ?? 0;
|
||||
List<(ProductRarity rarity, int price, int stock)> raritySummaryData = rarityDataList.Select(x =>
|
||||
|
|
@ -253,6 +255,7 @@ public class ProductManagement : MonoBehaviour
|
|||
{
|
||||
state.Value = ManagementState.None;
|
||||
GameDataManager.GameData.StorageTanks[tankNumber - 1].ClearStock();
|
||||
GameDataManager.SaveGameData();
|
||||
// 試食フラグに終了時間を設定
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -72,7 +72,7 @@ public class RecipeDetailView : MonoBehaviour
|
|||
var gameData = GameDataManager.GameData;
|
||||
|
||||
// 在庫
|
||||
var shopStock = gameData.ShopStock.FindAll(x => x == data.id).Count;
|
||||
var shopStock = gameData.ShopStock.Count(stockData => stockData.FlavorId == data.id);
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -83,8 +83,7 @@ public sealed class GameData {
|
|||
public List<MaterialData> Material = new List<MaterialData>();
|
||||
// 店頭ポップコーン在庫
|
||||
[DataMember(Name = "Data19")]
|
||||
private int[] shopStock;
|
||||
public List<int> ShopStock;
|
||||
public List<ProductStockData> ShopStock;
|
||||
// タンクポップコーン在庫
|
||||
[DataMember(Name = "Data20")]
|
||||
public List<StorageTank> StorageTanks;
|
||||
|
|
@ -196,7 +195,7 @@ public sealed class GameData {
|
|||
// avatarIdList = avatarIdArray == null ? new List<int>() : avatarIdArray.ToList();
|
||||
// newAvatarIdList = newAvatarIdArray == null ? new List<int>() : newAvatarIdArray.ToList();
|
||||
// lastAdRewardTimeList = lastAdRewardTimeArray == null ? new List<long>() : lastAdRewardTimeArray.ToList();
|
||||
ShopStock = shopStock?.ToList() ?? new List<int>();
|
||||
ShopStock = ShopStock ?? new List<ProductStockData>();
|
||||
Pans = Pans ?? new int[0];
|
||||
TotalSalesList = TotalSalesList ?? new List<ProductStockData>();
|
||||
AchievedMission = achievedMission?.ToList() ?? new List<int>();
|
||||
|
|
@ -214,7 +213,6 @@ public sealed class GameData {
|
|||
// avatarIdArray = avatarIdList.ToArray();
|
||||
// newAvatarIdArray = newAvatarIdList.ToArray();
|
||||
// lastAdRewardTimeArray = lastAdRewardTimeList.ToArray();
|
||||
shopStock = ShopStock.ToArray();
|
||||
achievedMission = AchievedMission.ToArray();
|
||||
}
|
||||
private KeyValueOfintint[] DictionaryToArray(Dictionary<int, int> dictionary){
|
||||
|
|
|
|||
Loading…
Reference in New Issue