アップデート待ってねPopup追加
This commit is contained in:
parent
9726536df0
commit
5da45a65e3
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using UniRx;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace MyGame.Scenes.Main.Scripts
|
||||||
|
{
|
||||||
|
public class UpdateDialog : MonoBehaviour
|
||||||
|
{
|
||||||
|
private static readonly string CallbackTag = "UpdateDialogCallback";
|
||||||
|
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
||||||
|
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
||||||
|
|
||||||
|
[SerializeField] private Animator backgroundAnimator;
|
||||||
|
[SerializeField] private Button closeButton;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
closeButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
||||||
|
{
|
||||||
|
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
||||||
|
LocalCacheManager.Remove(CallbackTag);
|
||||||
|
transform.parent.SetLocalScale(0);
|
||||||
|
backgroundAnimator.SetTrigger(CloseTrigger);
|
||||||
|
this.CallWaitForSeconds(.25f, () =>
|
||||||
|
{
|
||||||
|
TransitionManager.Instance.UnloadScene(GameScenes.Update);
|
||||||
|
});
|
||||||
|
}).AddTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ShowDialog(Action onClose = null){
|
||||||
|
LocalCacheManager.Save(CallbackTag, onClose);
|
||||||
|
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7ac380b2956543a6a6b17c6150b154c0
|
||||||
|
timeCreated: 1636956028
|
||||||
|
|
@ -382,7 +382,7 @@ MonoBehaviour:
|
||||||
m_GameObject: {fileID: 360429215}
|
m_GameObject: {fileID: 360429215}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 9f6d1b5b8f3a49e4a93060301fc842db, type: 3}
|
m_Script: {fileID: 11500000, guid: 7ac380b2956543a6a6b17c6150b154c0, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
backgroundAnimator: {fileID: 780755706}
|
backgroundAnimator: {fileID: 780755706}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using MyGame.Scenes.Main.Scripts;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.PlayerLoop;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class ShopLevelUp : MonoBehaviour
|
public class ShopLevelUp : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static readonly string DataTag = "ShopLevelUpData";
|
public static readonly string DataTag = "ShopLevelUpData";
|
||||||
public static readonly string CallbackTag = "CallbackData";
|
public static readonly string CallbackTag = "ShopLevelUpCallback";
|
||||||
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
||||||
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
||||||
|
|
||||||
|
|
@ -19,13 +21,19 @@ public class ShopLevelUp : MonoBehaviour
|
||||||
[SerializeField] private Button closeButton;
|
[SerializeField] private Button closeButton;
|
||||||
[SerializeField] private GameObject summaryObject;
|
[SerializeField] private GameObject summaryObject;
|
||||||
|
|
||||||
|
private int shopLevel;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
var shopLevel = LocalCacheManager.Load<int>(DataTag);
|
shopLevel = LocalCacheManager.Load<int>(DataTag);
|
||||||
var scriptList = SpreadsheetDataManager.Instance.GetBaseDataList<BrotherScriptData>(Const.ScriptDataSheet);
|
var scriptList = SpreadsheetDataManager.Instance.GetBaseDataList<BrotherScriptData>(Const.ScriptDataSheet);
|
||||||
var targetScriptList = scriptList.Where(data => data.id == shopLevel).ToList();
|
var targetScriptList = scriptList.Where(data => data.id == shopLevel).ToList();
|
||||||
closeButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
closeButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
||||||
{
|
{
|
||||||
|
GameDataManager.GameData.ViewedShopLevel = shopLevel;
|
||||||
|
GameDataManager.GameData.OrderConditionCount = 0;
|
||||||
|
GameDataManager.SaveGameData();
|
||||||
|
|
||||||
transform.SetLocalScale(0);
|
transform.SetLocalScale(0);
|
||||||
backgroundAnimator.SetTrigger(CloseTrigger);
|
backgroundAnimator.SetTrigger(CloseTrigger);
|
||||||
this.CallWaitForSeconds(.25f, () =>
|
this.CallWaitForSeconds(.25f, () =>
|
||||||
|
|
@ -36,23 +44,13 @@ public class ShopLevelUp : MonoBehaviour
|
||||||
LocalCacheManager.Save(BrotherConversation.ScriptDataTag, targetScriptList);
|
LocalCacheManager.Save(BrotherConversation.ScriptDataTag, targetScriptList);
|
||||||
LocalCacheManager.Save(BrotherConversation.CallbackTag, new Action(() =>
|
LocalCacheManager.Save(BrotherConversation.CallbackTag, new Action(() =>
|
||||||
{
|
{
|
||||||
GameDataManager.GameData.ViewedShopLevel = shopLevel;
|
OnClose();
|
||||||
GameDataManager.GameData.OrderConditionCount = 0;
|
|
||||||
GameDataManager.SaveGameData();
|
|
||||||
HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true);
|
|
||||||
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
|
||||||
LocalCacheManager.Remove(CallbackTag);
|
|
||||||
}));
|
}));
|
||||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation);
|
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GameDataManager.GameData.ViewedShopLevel = shopLevel;
|
OnClose();
|
||||||
GameDataManager.GameData.OrderConditionCount = 0;
|
|
||||||
GameDataManager.SaveGameData();
|
|
||||||
HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true);
|
|
||||||
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
|
||||||
LocalCacheManager.Remove(CallbackTag);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
|
|
@ -69,4 +67,24 @@ public class ShopLevelUp : MonoBehaviour
|
||||||
summaryObject.SetActive(true);
|
summaryObject.SetActive(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnClose()
|
||||||
|
{
|
||||||
|
// 店舗レベル15以降実装後不要になる処理
|
||||||
|
if (shopLevel == Const.MaxShopLevel)
|
||||||
|
{
|
||||||
|
UpdateDialog.ShowDialog(() =>
|
||||||
|
{
|
||||||
|
HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true);
|
||||||
|
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
||||||
|
LocalCacheManager.Remove(CallbackTag);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HeartMeter.Instance.SetShopLevel(GameDataManager.GameData.ViewedShopLevel, true);
|
||||||
|
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
||||||
|
LocalCacheManager.Remove(CallbackTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ public static class Const {
|
||||||
public static readonly int DefaultMachineLevel = 1;
|
public static readonly int DefaultMachineLevel = 1;
|
||||||
public static readonly int DefaultRecipeId = 1;
|
public static readonly int DefaultRecipeId = 1;
|
||||||
public static readonly int DefaultPanId = 1;
|
public static readonly int DefaultPanId = 1;
|
||||||
|
public static readonly int MaxShopLevel = 14;
|
||||||
public static readonly int TankCapacity = 20;
|
public static readonly int TankCapacity = 20;
|
||||||
public static readonly int SpecialShopLevel = 9999;
|
public static readonly int SpecialShopLevel = 9999;
|
||||||
public static readonly int SpecialCategory = 9999;
|
public static readonly int SpecialCategory = 9999;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ public enum GameScenes
|
||||||
WatchMovieCoin,
|
WatchMovieCoin,
|
||||||
WatchMovieCoinGet,
|
WatchMovieCoinGet,
|
||||||
ApplicationExitConfirmDialog,
|
ApplicationExitConfirmDialog,
|
||||||
|
Update,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SceneType
|
public enum SceneType
|
||||||
|
|
|
||||||
|
|
@ -101,4 +101,7 @@ EditorBuildSettings:
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/MyGame/Scenes/ApplicationExitConfirmDialog/ApplicationExitConfirmDialog.unity
|
path: Assets/MyGame/Scenes/ApplicationExitConfirmDialog/ApplicationExitConfirmDialog.unity
|
||||||
guid: c25d0bb8eeefa744eb98fc07808adad7
|
guid: c25d0bb8eeefa744eb98fc07808adad7
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/MyGame/Scenes/Main/Update.unity
|
||||||
|
guid: 940b0354731698e4381318e56969feaf
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue