兄弟会話終了時の処理をCallback化
This commit is contained in:
parent
fb8ab86254
commit
f56bf7afa0
|
|
@ -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<Action>(CallbackTag, null)?.Invoke();
|
||||
LocalCacheManager.Remove(CallbackTag);
|
||||
TransitionManager.Instance.UnloadScene(GameScenes.Conversation);
|
||||
});
|
||||
}).AddTo(this);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue