店舗開放ダイアログ処理追加
This commit is contained in:
parent
ac9209cf49
commit
e016e0e6ad
|
@ -0,0 +1,40 @@
|
||||||
|
using System;
|
||||||
|
using UniRx;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace MyGame.Scenes.WorldMap.Scripts
|
||||||
|
{
|
||||||
|
public class FoodStandDialog : MonoBehaviour
|
||||||
|
{
|
||||||
|
private static readonly string CallbackTag = "FoodStandDialogCallback";
|
||||||
|
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
||||||
|
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
||||||
|
|
||||||
|
[SerializeField] private Animator backgroundAnimator;
|
||||||
|
[SerializeField] private Button closeButton;
|
||||||
|
[SerializeField] private Text titleText;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
var (cityData, onClose) = LocalCacheManager.Load<(CityData, Action)>(CallbackTag);
|
||||||
|
LocalCacheManager.Remove(CallbackTag);
|
||||||
|
closeButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
||||||
|
{
|
||||||
|
onClose?.Invoke();
|
||||||
|
transform.parent.SetLocalScale(0);
|
||||||
|
backgroundAnimator.SetTrigger(CloseTrigger);
|
||||||
|
this.CallWaitForSeconds(.25f, () =>
|
||||||
|
{
|
||||||
|
TransitionManager.Instance.UnloadScene(GameScenes.WorldMap_FoodStand);
|
||||||
|
});
|
||||||
|
}).AddTo(this);
|
||||||
|
titleText.text = cityData.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ShowDialog(CityData cityData, Action onClose = null){
|
||||||
|
LocalCacheManager.Save(CallbackTag, (cityData, onClose));
|
||||||
|
TransitionManager.Instance.LoadSceneAdditive(GameScenes.WorldMap_FoodStand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bd35379796ba4fa88dfaf64226912af1
|
||||||
|
timeCreated: 1663310221
|
|
@ -8236,6 +8236,7 @@ GameObject:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 9205686914717556668}
|
- component: {fileID: 9205686914717556668}
|
||||||
|
- component: {fileID: 9205686914717556669}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Window
|
m_Name: Window
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -8265,6 +8266,21 @@ RectTransform:
|
||||||
m_AnchoredPosition: {x: 0, y: -280}
|
m_AnchoredPosition: {x: 0, y: -280}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &9205686914717556669
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 9205686914717556667}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bd35379796ba4fa88dfaf64226912af1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
backgroundAnimator: {fileID: 9205686915076572998}
|
||||||
|
closeButton: {fileID: 9205686916003356041}
|
||||||
|
titleText: {fileID: 9205686916117522798}
|
||||||
--- !u!1 &9205686914755245701
|
--- !u!1 &9205686914755245701
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
Loading…
Reference in New Issue