From f56bf7afa0696903ffa10f69ff635b25aebf6a2a Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 15 Oct 2021 13:03:19 +0900 Subject: [PATCH] =?UTF-8?q?=E5=85=84=E5=BC=9F=E4=BC=9A=E8=A9=B1=E7=B5=82?= =?UTF-8?q?=E4=BA=86=E6=99=82=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92Callback?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Scripts/BrotherConversation.cs | 7 +++---- .../MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs | 10 +++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherConversation.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherConversation.cs index 4758b366..be17ee65 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherConversation.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherConversation.cs @@ -9,6 +9,7 @@ using UnityEngine.UI; public class BrotherConversation : MonoBehaviour { public static readonly string ScriptDataTag = "BrotherConversationScriptData"; + public static readonly string CallbackTag = "BrotherConversationCallback"; private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger"); private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger"); @@ -49,10 +50,8 @@ public class BrotherConversation : MonoBehaviour backgroundAnimator.SetTrigger(CloseTrigger); this.CallWaitForSeconds(.25f, () => { - GameDataManager.GameData.ViewedShopLevel++; - GameDataManager.GameData.OrderConditionCount = 0; - GameDataManager.SaveGameData(); - HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true); + LocalCacheManager.Load(CallbackTag, null)?.Invoke(); + LocalCacheManager.Remove(CallbackTag); TransitionManager.Instance.UnloadScene(GameScenes.Conversation); }); }).AddTo(this); diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs index 76a1797c..b2f1dcf9 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs @@ -33,11 +33,19 @@ public class ShopLevelUp : MonoBehaviour if (targetScriptList.Count > 0) { LocalCacheManager.Save(BrotherConversation.ScriptDataTag, targetScriptList); + LocalCacheManager.Save(BrotherConversation.CallbackTag, new Action(() => + { + GameDataManager.GameData.ViewedShopLevel = shopLevel; + GameDataManager.GameData.OrderConditionCount = 0; + GameDataManager.SaveGameData(); + HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true); + })); TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation); } else { - GameDataManager.GameData.ViewedShopLevel++; + GameDataManager.GameData.ViewedShopLevel = shopLevel; + GameDataManager.GameData.OrderConditionCount = 0; GameDataManager.SaveGameData(); HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true); }