納品ボタンDisable対応 /調理済みの注文の保持方法変更 /レシピデータのバグ修正
This commit is contained in:
parent
769a8286dd
commit
02c19a5085
|
|
@ -72,9 +72,9 @@ public class CookingResult : MonoBehaviour
|
|||
centerOkButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
// 獲得、遷移
|
||||
if (GameDataManager.GameData.CompletedOrderList.Exists(data => data.Number != materialNumber))
|
||||
if (!GameDataManager.GameData.CompletedProductList.Exists(data => data.Number == materialNumber))
|
||||
{
|
||||
GameDataManager.GameData.CompletedOrderList.Add(new BulkOrderResultData(){Number = materialNumber, Rarity = rarityData.Rarity});
|
||||
GameDataManager.GameData.CompletedProductList.Add(new BulkOrderResultData(){Number = materialNumber, Rarity = rarityData.Rarity});
|
||||
GameDataManager.SaveGameData();
|
||||
}
|
||||
TransitionManager.Instance.LoadScene(GameScenes.Main);
|
||||
|
|
@ -82,9 +82,9 @@ public class CookingResult : MonoBehaviour
|
|||
leftOkButton.OnClickAsObservable().Subscribe(_ =>
|
||||
{
|
||||
// 獲得、遷移
|
||||
if (GameDataManager.GameData.CompletedOrderList.Exists(data => data.Number != materialNumber))
|
||||
if (!GameDataManager.GameData.CompletedProductList.Exists(data => data.Number == materialNumber))
|
||||
{
|
||||
GameDataManager.GameData.CompletedOrderList.Add(new BulkOrderResultData(){Number = materialNumber, Rarity = ProductRarity.Normal});
|
||||
GameDataManager.GameData.CompletedProductList.Add(new BulkOrderResultData(){Number = materialNumber, Rarity = ProductRarity.Normal});
|
||||
GameDataManager.SaveGameData();
|
||||
}
|
||||
TransitionManager.Instance.LoadScene(GameScenes.Main);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ GameObject:
|
|||
- component: {fileID: 2281569350741980153}
|
||||
- component: {fileID: 8166373738923674638}
|
||||
- component: {fileID: 2485495937759942127}
|
||||
- component: {fileID: 3140541868436563184}
|
||||
m_Layer: 5
|
||||
m_Name: Button_delivery_off
|
||||
m_TagString: Untagged
|
||||
|
|
@ -113,49 +112,6 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &3140541868436563184
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3717552158352820819}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 2485495937759942127}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &4082915277424874089
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1214,6 +1170,7 @@ MonoBehaviour:
|
|||
closeButton: {fileID: 4082915278992014893}
|
||||
cancelButton: {fileID: 4082915278942985871}
|
||||
deliveredButton: {fileID: 4082915279019759811}
|
||||
disabledButtonObject: {fileID: 3717552158352820819}
|
||||
achievedObject: {fileID: 4082915278879672978}
|
||||
messageText: {fileID: 4082915277970689977}
|
||||
coinText: {fileID: 4082915277569352110}
|
||||
|
|
@ -2836,12 +2793,6 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 72c4a5536cad64c4aa959dccbff86e18, type: 3}
|
||||
--- !u!224 &6299910495887276473 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 6701890203127158495, guid: 72c4a5536cad64c4aa959dccbff86e18,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 751013265656328038}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &7927160839000454040 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 7236946357327453438, guid: 72c4a5536cad64c4aa959dccbff86e18,
|
||||
|
|
@ -2854,6 +2805,12 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: ab9ddab5084248d68b0cb2c53c8dc7cc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!224 &6299910495887276473 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 6701890203127158495, guid: 72c4a5536cad64c4aa959dccbff86e18,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 751013265656328038}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &4082915279223546173
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public class BulkOrder : MonoBehaviour
|
|||
|
||||
[SerializeField] private Button cancelButton;
|
||||
[SerializeField] private Button deliveredButton;
|
||||
[SerializeField] private GameObject disabledButtonObject;
|
||||
[SerializeField] private GameObject achievedObject;
|
||||
[SerializeField] private Text messageText;
|
||||
[SerializeField] private Text coinText;
|
||||
|
|
@ -81,18 +82,20 @@ public class BulkOrder : MonoBehaviour
|
|||
bulkOrderData.productId2,
|
||||
bulkOrderData.productId3,
|
||||
};
|
||||
var completed = gameData.CompletedProductList.Count == orderList.Count(x => x != 0);
|
||||
var delivered = gameData.DeliveredOrder.Contains(bulkOrderData.id);
|
||||
achievedObject.SetActive(completed);
|
||||
deliveredButton.interactable = completed && !delivered;
|
||||
disabledButtonObject.SetActive(!deliveredButton.interactable);
|
||||
|
||||
// 納品する
|
||||
var achieved = gameData.CompletedOrderList.Count == orderList.Count(x => x != 0);
|
||||
achievedObject.SetActive(achieved);
|
||||
deliveredButton.interactable = achieved;
|
||||
// 納品
|
||||
deliveredButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(AchievedCallbackTag, new Action(() =>
|
||||
{
|
||||
// 獲得
|
||||
var rarityList = SpreadsheetDataManager.Instance.GetBaseDataList<RarityData>(Const.RarityDataSheet);
|
||||
var bonus = CalcBonus(rarityList, gameData.CompletedOrderList, bulkOrderData.shopLevel);
|
||||
var bonus = CalcBonus(rarityList, gameData.CompletedProductList, bulkOrderData.shopLevel);
|
||||
gameData.Coin = CoinManager.Instance.OwnCoin;
|
||||
CoinManager.Instance.AddCoinWithEffect(bulkOrderData.rewardCoin + bonus);
|
||||
gameData.Heart += bulkOrderData.rewardHeart;
|
||||
|
|
@ -100,14 +103,13 @@ public class BulkOrder : MonoBehaviour
|
|||
|
||||
// カウントリセット
|
||||
gameData.OrderConditionCount = 0;
|
||||
gameData.CurrentLevelOrderCount++;
|
||||
gameData.DeliveredOrder.Add(bulkOrderData.id);
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"current:{gameData.CurrentLevelOrderCount} max:{bulkOrderData.maxOrder}");
|
||||
Debug.Log($"current:{gameData.DeliveredOrder.Count} max:{bulkOrderData.maxOrder}");
|
||||
#endif
|
||||
// オーダー上限を超えるとそのLevelでの注文終了
|
||||
if (gameData.CurrentLevelOrderCount == bulkOrderData.maxOrder)
|
||||
if (gameData.DeliveredOrder.Count == bulkOrderData.maxOrder)
|
||||
{
|
||||
gameData.CurrentLevelOrderCount = 0;
|
||||
gameData.AchievedOrderLevel = bulkOrderData.shopLevel;
|
||||
}
|
||||
GameDataManager.SaveGameData();
|
||||
|
|
@ -125,20 +127,23 @@ public class BulkOrder : MonoBehaviour
|
|||
var productList = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet);
|
||||
if (productList.FirstOrDefault(data => data.id == bulkOrderData.productId1) is ProductData data1)
|
||||
{
|
||||
itemView1.SetData(data1, bulkOrderData.count1);
|
||||
itemView1.SetButtonActive(itemView1.CheckAmount(data1));
|
||||
if (gameData.CompletedOrderList.FirstOrDefault(data => data.Number == 1) is BulkOrderResultData resultData)
|
||||
var countByVolume = bulkOrderData.count1 / data1.volume;
|
||||
var productData = new ProductData(data1, countByVolume);
|
||||
productData.volume *= countByVolume;
|
||||
itemView1.SetData(productData);
|
||||
itemView1.SetButtonActive(itemView1.CheckAmount(productData));
|
||||
if (gameData.CompletedProductList.FirstOrDefault(data => data.Number == 1) is BulkOrderResultData resultData)
|
||||
{
|
||||
itemView1.SetCooked(resultData.Rarity);
|
||||
}
|
||||
itemView1.gameObject.SetActive(true);
|
||||
itemView1.CookingButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(Const.ProductViewTypeTag, ProductViewType.BulkOrder);
|
||||
LocalCacheManager.Save(MaterialNumberTag, 1);
|
||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, data1);
|
||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData);
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.RecipeChoice);
|
||||
}).AddTo(itemView1);
|
||||
itemView1.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -146,12 +151,22 @@ public class BulkOrder : MonoBehaviour
|
|||
}
|
||||
if (productList.FirstOrDefault(data => data.id == bulkOrderData.productId2) is ProductData data2)
|
||||
{
|
||||
itemView2.SetData(data2, bulkOrderData.count2);
|
||||
itemView2.SetButtonActive(itemView2.CheckAmount(data2));
|
||||
if (gameData.CompletedOrderList.FirstOrDefault(data => data.Number == 2) is BulkOrderResultData resultData)
|
||||
var countByVolume = bulkOrderData.count2 / data2.volume;
|
||||
var productData = new ProductData(data2, countByVolume);
|
||||
productData.volume *= countByVolume;
|
||||
itemView2.SetData(productData);
|
||||
itemView2.SetButtonActive(itemView2.CheckAmount(productData));
|
||||
if (gameData.CompletedProductList.FirstOrDefault(data => data.Number == 2) is BulkOrderResultData resultData)
|
||||
{
|
||||
itemView2.SetCooked(resultData.Rarity);
|
||||
}
|
||||
itemView2.CookingButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(Const.ProductViewTypeTag, ProductViewType.BulkOrder);
|
||||
LocalCacheManager.Save(MaterialNumberTag, 2);
|
||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData);
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.RecipeChoice);
|
||||
}).AddTo(itemView2);
|
||||
itemView2.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
|
|
@ -160,12 +175,22 @@ public class BulkOrder : MonoBehaviour
|
|||
}
|
||||
if (productList.FirstOrDefault(data => data.id == bulkOrderData.productId3) is ProductData data3)
|
||||
{
|
||||
itemView3.SetData(data3, bulkOrderData.count3);
|
||||
itemView3.SetButtonActive(itemView3.CheckAmount(data3));
|
||||
if (gameData.CompletedOrderList.FirstOrDefault(data => data.Number == 3) is BulkOrderResultData resultData)
|
||||
var countByVolume = bulkOrderData.count3 / data3.volume;
|
||||
var productData = new ProductData(data3, countByVolume);
|
||||
productData.volume *= countByVolume;
|
||||
itemView3.SetData(productData);
|
||||
itemView3.SetButtonActive(itemView3.CheckAmount(productData));
|
||||
if (gameData.CompletedProductList.FirstOrDefault(data => data.Number == 3) is BulkOrderResultData resultData)
|
||||
{
|
||||
itemView3.SetCooked(resultData.Rarity);
|
||||
}
|
||||
itemView3.CookingButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(Const.ProductViewTypeTag, ProductViewType.BulkOrder);
|
||||
LocalCacheManager.Save(MaterialNumberTag, 3);
|
||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData);
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.RecipeChoice);
|
||||
}).AddTo(itemView3);
|
||||
itemView3.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class BulkOrderAchievedView : MonoBehaviour
|
|||
var gameData = GameDataManager.GameData;
|
||||
var messageList = SpreadsheetDataManager.Instance.GetBaseDataList<BulkOrderTextData>(Const.BulkOrderTextDataSheet);
|
||||
var rarityList = SpreadsheetDataManager.Instance.GetBaseDataList<RarityData>(Const.RarityDataSheet);
|
||||
var bonus = BulkOrder.CalcBonus(rarityList, gameData.CompletedOrderList, orderData.shopLevel);
|
||||
var bonus = BulkOrder.CalcBonus(rarityList, gameData.CompletedProductList, orderData.shopLevel);
|
||||
heartText.text = orderData.rewardHeart.ToString();
|
||||
coinText.text = orderData.rewardCoin.ToString();
|
||||
bonusCoinText.text = bonus.ToString();
|
||||
|
|
|
|||
|
|
@ -23,17 +23,16 @@ public class BulkOrderItemView : MonoBehaviour
|
|||
|
||||
public IObservable<Unit> CookingButton => cookingButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||
|
||||
public void SetData(ProductData data, int wantStock)
|
||||
public void SetData(ProductData data)
|
||||
{
|
||||
var materialCount = wantStock / data.volume;
|
||||
stockText.text = wantStock.ToString();
|
||||
stockText.text = data.volume.ToString();
|
||||
nameText.text = data.name;
|
||||
cornText.text = string.Format(amountFormat, data.MaterialList[0].amount * materialCount);
|
||||
cornText.text = string.Format(amountFormat, data.MaterialList[0].amount);
|
||||
packageIconTarget.DestroyAllChildrens();
|
||||
Instantiate(data.GetIconPrefab(), packageIconTarget);
|
||||
|
||||
material1Text.text = string.Format(amountFormat, data.MaterialList[1].amount * materialCount);
|
||||
material2Text.text = string.Format(amountFormat, data.MaterialList[2].amount * materialCount);
|
||||
material1Text.text = string.Format(amountFormat, data.MaterialList[1].amount);
|
||||
material2Text.text = string.Format(amountFormat, data.MaterialList[2].amount);
|
||||
var shopData = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(Const.ShopDataSheet);
|
||||
if (shopData.FirstOrDefault(sData => sData.itemId == data.MaterialList[1].id)?.GetIconPrefab() is Transform prefab1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ public class KitchenManager : MonoBehaviour
|
|||
orderIndicatorView.TappedPhone.ThrottleFirst(TimeSpan.FromSeconds(1f)).Take(1).Subscribe(_ =>
|
||||
{
|
||||
// タップで更新
|
||||
gameData.CompletedOrderList.Clear();
|
||||
gameData.CompletedProductList.Clear();
|
||||
gameData.DeliveredOrder.Clear();
|
||||
gameData.OrderIdInProgress = result.nextOrderId;
|
||||
if (nextMessageList.Exists(data => data.id == gameData.OrderTextId))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,9 +114,10 @@ public sealed class GameData {
|
|||
[DataMember(Name = "Data32")]
|
||||
public int AchievedOrderLevel;
|
||||
[DataMember(Name = "Data33")]
|
||||
public List<BulkOrderResultData> CompletedOrderList;
|
||||
public List<BulkOrderResultData> CompletedProductList;
|
||||
[DataMember(Name = "Data34")]
|
||||
public int CurrentLevelOrderCount;
|
||||
private int[] deliveredOrder;
|
||||
public List<int> DeliveredOrder;
|
||||
|
||||
// mission
|
||||
[DataMember(Name = "Data1001")]
|
||||
|
|
@ -235,7 +236,8 @@ public sealed class GameData {
|
|||
Pans = Pans ?? new int[0];
|
||||
TotalSalesList = TotalSalesList ?? new List<ProductStockData>();
|
||||
AchievedMission = achievedMission?.ToList() ?? new List<int>();
|
||||
CompletedOrderList = CompletedOrderList ?? new List<BulkOrderResultData>();
|
||||
CompletedProductList = CompletedProductList ?? new List<BulkOrderResultData>();
|
||||
DeliveredOrder = deliveredOrder?.ToList() ?? new List<int>();
|
||||
}
|
||||
private Dictionary<int, int> ArrayToDictionary(KeyValueOfintint[] array){
|
||||
var dictionary = new Dictionary<int, int>();
|
||||
|
|
@ -251,6 +253,7 @@ public sealed class GameData {
|
|||
// newAvatarIdArray = newAvatarIdList.ToArray();
|
||||
// lastAdRewardTimeArray = lastAdRewardTimeList.ToArray();
|
||||
achievedMission = AchievedMission.ToArray();
|
||||
deliveredOrder = DeliveredOrder.ToArray();
|
||||
}
|
||||
private KeyValueOfintint[] DictionaryToArray(Dictionary<int, int> dictionary){
|
||||
var array = new KeyValueOfintint[dictionary.Count];
|
||||
|
|
|
|||
|
|
@ -163,17 +163,38 @@ public sealed class ProductData
|
|||
{
|
||||
if (materialList == null)
|
||||
{
|
||||
materialList = new List<(int id, int amount)>
|
||||
{
|
||||
(material1Id,15 * volume),
|
||||
(material2Id,1),
|
||||
(material3Id,1),
|
||||
};
|
||||
ChangeAmount(1);
|
||||
}
|
||||
return materialList;
|
||||
}
|
||||
}
|
||||
|
||||
public ProductData(ProductData productData, int value)
|
||||
{
|
||||
id = productData.id;
|
||||
nameId = productData.nameId;
|
||||
name = productData.name;
|
||||
shopLevel = productData.shopLevel;
|
||||
price = productData.price;
|
||||
volume = productData.volume;
|
||||
text = productData.text;
|
||||
material1Id = productData.material1Id;
|
||||
material2Id = productData.material2Id;
|
||||
material3Id = productData.material3Id;
|
||||
prefabName = productData.prefabName;
|
||||
ChangeAmount(value);
|
||||
}
|
||||
|
||||
private void ChangeAmount(int value)
|
||||
{
|
||||
materialList = new List<(int id, int amount)>
|
||||
{
|
||||
(material1Id,15 * volume * value),
|
||||
(material2Id,1 * value),
|
||||
(material3Id,1 * value),
|
||||
};
|
||||
}
|
||||
|
||||
public int GetMaterialCount()
|
||||
{
|
||||
return materialList.Count(material => material.id != Const.NotSetMaterialId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue