ApplicationExitConfirmDialog追加
This commit is contained in:
		
							parent
							
								
									2ae77eddb5
								
							
						
					
					
						commit
						a7b2b1dd6f
					
				|  | @ -96,6 +96,7 @@ GameObject: | ||||||
|   - component: {fileID: 5400893423074421525} |   - component: {fileID: 5400893423074421525} | ||||||
|   - component: {fileID: 7906393928596777865} |   - component: {fileID: 7906393928596777865} | ||||||
|   - component: {fileID: 7743573513958854474} |   - component: {fileID: 7743573513958854474} | ||||||
|  |   - component: {fileID: 7825871007626831899} | ||||||
|   m_Layer: 0 |   m_Layer: 0 | ||||||
|   m_Name: DontDestroyObject |   m_Name: DontDestroyObject | ||||||
|   m_TagString: Untagged |   m_TagString: Untagged | ||||||
|  | @ -203,6 +204,18 @@ MonoBehaviour: | ||||||
|   m_Script: {fileID: 11500000, guid: 8e2021f1b8ce47f79191ab8732fba298, type: 3} |   m_Script: {fileID: 11500000, guid: 8e2021f1b8ce47f79191ab8732fba298, type: 3} | ||||||
|   m_Name:  |   m_Name:  | ||||||
|   m_EditorClassIdentifier:  |   m_EditorClassIdentifier:  | ||||||
|  | --- !u!114 &7825871007626831899 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 3459593390050872226} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: f68a23c0272694e4e918abbda26859b7, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
| --- !u!1 &8739647597683206087 | --- !u!1 &8739647597683206087 | ||||||
| GameObject: | GameObject: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
|  |  | ||||||
|  | @ -356,6 +356,7 @@ GameObject: | ||||||
|   serializedVersion: 6 |   serializedVersion: 6 | ||||||
|   m_Component: |   m_Component: | ||||||
|   - component: {fileID: 1127484801} |   - component: {fileID: 1127484801} | ||||||
|  |   - component: {fileID: 1127484802} | ||||||
|   m_Layer: 5 |   m_Layer: 5 | ||||||
|   m_Name: Window |   m_Name: Window | ||||||
|   m_TagString: Untagged |   m_TagString: Untagged | ||||||
|  | @ -384,6 +385,22 @@ RectTransform: | ||||||
|   m_AnchoredPosition: {x: 0, y: 57} |   m_AnchoredPosition: {x: 0, y: 57} | ||||||
|   m_SizeDelta: {x: 705, y: 550} |   m_SizeDelta: {x: 705, y: 550} | ||||||
|   m_Pivot: {x: 0.5, y: 0.5} |   m_Pivot: {x: 0.5, y: 0.5} | ||||||
|  | --- !u!114 &1127484802 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 1127484800} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: 197f410dd5604be3b81c5586583cdea0, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
|  |   backgroundAnimator: {fileID: 1178014942} | ||||||
|  |   backButton: {fileID: 1178014945} | ||||||
|  |   closeButton: {fileID: 1561203356} | ||||||
|  |   exitButton: {fileID: 2067370848} | ||||||
| --- !u!1 &1178014940 | --- !u!1 &1178014940 | ||||||
| GameObject: | GameObject: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
|  | @ -396,6 +413,7 @@ GameObject: | ||||||
|   - component: {fileID: 1178014944} |   - component: {fileID: 1178014944} | ||||||
|   - component: {fileID: 1178014943} |   - component: {fileID: 1178014943} | ||||||
|   - component: {fileID: 1178014942} |   - component: {fileID: 1178014942} | ||||||
|  |   - component: {fileID: 1178014945} | ||||||
|   m_Layer: 5 |   m_Layer: 5 | ||||||
|   m_Name: background |   m_Name: background | ||||||
|   m_TagString: Untagged |   m_TagString: Untagged | ||||||
|  | @ -455,7 +473,7 @@ MonoBehaviour: | ||||||
|   m_EditorClassIdentifier:  |   m_EditorClassIdentifier:  | ||||||
|   m_Material: {fileID: 0} |   m_Material: {fileID: 0} | ||||||
|   m_Color: {r: 1, g: 1, b: 0.9372549, a: 0.19607843} |   m_Color: {r: 1, g: 1, b: 0.9372549, a: 0.19607843} | ||||||
|   m_RaycastTarget: 0 |   m_RaycastTarget: 1 | ||||||
|   m_Maskable: 1 |   m_Maskable: 1 | ||||||
|   m_OnCullStateChanged: |   m_OnCullStateChanged: | ||||||
|     m_PersistentCalls: |     m_PersistentCalls: | ||||||
|  | @ -478,6 +496,49 @@ CanvasRenderer: | ||||||
|   m_PrefabAsset: {fileID: 0} |   m_PrefabAsset: {fileID: 0} | ||||||
|   m_GameObject: {fileID: 1178014940} |   m_GameObject: {fileID: 1178014940} | ||||||
|   m_CullTransparentMesh: 0 |   m_CullTransparentMesh: 0 | ||||||
|  | --- !u!114 &1178014945 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 1178014940} | ||||||
|  |   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: 0 | ||||||
|  |   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: 1178014943} | ||||||
|  |   m_OnClick: | ||||||
|  |     m_PersistentCalls: | ||||||
|  |       m_Calls: [] | ||||||
| --- !u!1 &1179090616 | --- !u!1 &1179090616 | ||||||
| GameObject: | GameObject: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,45 @@ | ||||||
|  | using System; | ||||||
|  | using UniRx; | ||||||
|  | using UnityEngine; | ||||||
|  | using UnityEngine.UI; | ||||||
|  | 
 | ||||||
|  | public sealed class ApplicationExitConfirmDialogManager : MonoBehaviour | ||||||
|  | { | ||||||
|  |     private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger"); | ||||||
|  |     private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger"); | ||||||
|  |     [SerializeField] private Animator backgroundAnimator; | ||||||
|  |     [SerializeField] private Button backButton; | ||||||
|  |     [SerializeField] private Button closeButton; | ||||||
|  |     [SerializeField] private Button exitButton; | ||||||
|  | 
 | ||||||
|  |     private void Start() | ||||||
|  |     { | ||||||
|  |         backButton.OnClickAsObservable() | ||||||
|  |             .Merge(closeButton.OnClickAsObservable()) | ||||||
|  |             .Subscribe(_ => | ||||||
|  |             { | ||||||
|  |                 transform.parent.SetLocalScale(0); | ||||||
|  |                 backgroundAnimator.SetTrigger(CloseTrigger); | ||||||
|  |                 this.CallWaitForSeconds(.25f, OnHide); | ||||||
|  |             }).AddTo(this); | ||||||
|  |         exitButton.OnClickAsObservable().Subscribe(_ => OnExit()).AddTo(this); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void OnExit(){ | ||||||
|  | #if UNITY_EDITOR | ||||||
|  |         UnityEditor.EditorApplication.isPlaying = false; | ||||||
|  | #else | ||||||
|  |         UnityEngine.Application.Quit(); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public void OnHide(){ | ||||||
|  |         this.CallWaitForOneFrame(() => { | ||||||
|  |             TransitionManager.Instance.UnloadScene(GameScenes.ApplicationExitConfirmDialog); | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static void ShowDialog(){ | ||||||
|  |         TransitionManager.Instance.LoadSceneAdditive(GameScenes.ApplicationExitConfirmDialog, SceneType.ManualUnloadOnly); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 197f410dd5604be3b81c5586583cdea0 | ||||||
|  | timeCreated: 1634893033 | ||||||
|  | @ -22,7 +22,7 @@ public sealed class InitializeUnitySettings : MonoBehaviour { | ||||||
| //        SRDebug.Init(); | //        SRDebug.Init(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| //        BackButtonManager.Instance.SetGenericAction(ApplicationExitConfirmDialogManager.ShowDialog); |         BackButtonManager.Instance.SetGenericAction(ApplicationExitConfirmDialogManager.ShowDialog); | ||||||
| 
 | 
 | ||||||
|         Application.targetFrameRate = 60; |         Application.targetFrameRate = 60; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue