Make the score display a UIPage as well
This commit is contained in:
@@ -221,13 +221,14 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 5708275729410901669}
|
- component: {fileID: 5708275729410901669}
|
||||||
- component: {fileID: 7927991410039509668}
|
- component: {fileID: 7927991410039509668}
|
||||||
|
- component: {fileID: 210707674214358126}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: DivingGameOverScreen
|
m_Name: DivingGameOverScreen
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &5708275729410901669
|
--- !u!224 &5708275729410901669
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -263,7 +264,22 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: b37e3dc225aa25143af8ab61f827ae8b, type: 3}
|
m_Script: {fileID: 11500000, guid: b37e3dc225aa25143af8ab61f827ae8b, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: '::'
|
m_EditorClassIdentifier: '::'
|
||||||
|
PageName:
|
||||||
|
transitionDuration: 0.3
|
||||||
finalScoreText: {fileID: 1520153022985003366}
|
finalScoreText: {fileID: 1520153022985003366}
|
||||||
|
canvasGroup: {fileID: 0}
|
||||||
|
--- !u!225 &210707674214358126
|
||||||
|
CanvasGroup:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1555823719300990817}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Alpha: 1
|
||||||
|
m_Interactable: 1
|
||||||
|
m_BlocksRaycasts: 1
|
||||||
|
m_IgnoreParentGroups: 0
|
||||||
--- !u!1 &1649201712728354542
|
--- !u!1 &1649201712728354542
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -362,10 +378,10 @@ RectTransform:
|
|||||||
- {fileID: 6376054842187975836}
|
- {fileID: 6376054842187975836}
|
||||||
m_Father: {fileID: 754661265897109340}
|
m_Father: {fileID: 754661265897109340}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 600, y: -50}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 286.66666, y: 100}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &1768576830901014477
|
--- !u!222 &1768576830901014477
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@@ -749,7 +765,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier: AppleHillsScripts::CinematicsManager
|
m_EditorClassIdentifier: AppleHillsScripts::CinematicsManager
|
||||||
cinematicSpritesGameObject: {fileID: 9166576207668444836}
|
cinematicSpritesGameObject: {fileID: 9166576207668444836}
|
||||||
cinematicBackground: {fileID: 3837694223035649714}
|
cinematicBackground: {fileID: 3837694223035649714}
|
||||||
divingGameOverScreen: {fileID: 1555823719300990817}
|
divingGameOverScreen: {fileID: 7927991410039509668}
|
||||||
playableDirector: {fileID: 291412605997816487}
|
playableDirector: {fileID: 291412605997816487}
|
||||||
--- !u!320 &291412605997816487
|
--- !u!320 &291412605997816487
|
||||||
PlayableDirector:
|
PlayableDirector:
|
||||||
@@ -820,10 +836,10 @@ RectTransform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 2759880600983436529}
|
m_Father: {fileID: 2759880600983436529}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 142.4, y: -43}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 284.8, y: 86}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &2205574065701906917
|
--- !u!222 &2205574065701906917
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@@ -1107,10 +1123,10 @@ RectTransform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 2759880600983436529}
|
m_Father: {fileID: 2759880600983436529}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 398.3, y: -43}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 227, y: 86}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &8369606923535336432
|
--- !u!222 &8369606923535336432
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@@ -1245,10 +1261,10 @@ RectTransform:
|
|||||||
- {fileID: 7050613403854909741}
|
- {fileID: 7050613403854909741}
|
||||||
m_Father: {fileID: 754661265897109340}
|
m_Father: {fileID: 754661265897109340}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 293.3333, y: -50}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 286.66666, y: 100}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &2782310018074465201
|
--- !u!222 &2782310018074465201
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@@ -1378,10 +1394,10 @@ RectTransform:
|
|||||||
- {fileID: 2648603254918360288}
|
- {fileID: 2648603254918360288}
|
||||||
m_Father: {fileID: 754661265897109340}
|
m_Father: {fileID: 754661265897109340}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 906.6666, y: -50}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 286.66666, y: 100}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &8344156654954553365
|
--- !u!222 &8344156654954553365
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -343,15 +343,15 @@ LineRenderer:
|
|||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_Positions:
|
m_Positions:
|
||||||
- {x: -0.15602553, y: 4.0749445, z: 0}
|
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||||
- {x: -0.1566351, y: 3.9736376, z: 0}
|
- {x: -0.1566351, y: 3.9736378, z: 0}
|
||||||
- {x: -0.1572447, y: 3.8729854, z: 0}
|
- {x: -0.1572447, y: 3.8729858, z: 0}
|
||||||
- {x: -0.15785426, y: 3.772987, z: 0}
|
- {x: -0.15785426, y: 3.7729874, z: 0}
|
||||||
- {x: -0.15846384, y: 3.6736436, z: 0}
|
- {x: -0.15846384, y: 3.6736438, z: 0}
|
||||||
- {x: -0.15907341, y: 3.574954, z: 0}
|
- {x: -0.15907341, y: 3.5749545, z: 0}
|
||||||
- {x: -0.15968299, y: 3.4769192, z: 0}
|
- {x: -0.15968299, y: 3.4769197, z: 0}
|
||||||
- {x: -0.16029257, y: 3.3795385, z: 0}
|
- {x: -0.16029257, y: 3.379539, z: 0}
|
||||||
- {x: -0.16090216, y: 3.2828126, z: 0}
|
- {x: -0.16090216, y: 3.2828128, z: 0}
|
||||||
- {x: -0.16151173, y: 3.1867409, z: 0}
|
- {x: -0.16151173, y: 3.186741, z: 0}
|
||||||
- {x: -0.16212131, y: 3.0913236, z: 0}
|
- {x: -0.16212131, y: 3.0913236, z: 0}
|
||||||
m_Parameters:
|
m_Parameters:
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
@@ -1700,16 +1700,16 @@ LineRenderer:
|
|||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_Positions:
|
m_Positions:
|
||||||
- {x: -0.15602553, y: 4.074945, z: 0}
|
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||||
- {x: -0.11662118, y: 3.8796225, z: 0}
|
- {x: -0.11662118, y: 3.8796222, z: 0}
|
||||||
- {x: -0.07721684, y: 3.7057447, z: 0}
|
- {x: -0.07721684, y: 3.7057445, z: 0}
|
||||||
- {x: -0.03781248, y: 3.5533109, z: 0}
|
- {x: -0.03781248, y: 3.5533106, z: 0}
|
||||||
- {x: 0.0015918687, y: 3.4223216, z: 0}
|
- {x: 0.0015918687, y: 3.4223216, z: 0}
|
||||||
- {x: 0.040996216, y: 3.3127766, z: 0}
|
- {x: 0.040996216, y: 3.3127766, z: 0}
|
||||||
- {x: 0.08040057, y: 3.2246761, z: 0}
|
- {x: 0.08040057, y: 3.2246761, z: 0}
|
||||||
- {x: 0.11980491, y: 3.15802, z: 0}
|
- {x: 0.11980491, y: 3.15802, z: 0}
|
||||||
- {x: 0.15920927, y: 3.1128082, z: 0}
|
- {x: 0.15920927, y: 3.1128082, z: 0}
|
||||||
- {x: 0.1986136, y: 3.0890405, z: 0}
|
- {x: 0.1986136, y: 3.0890408, z: 0}
|
||||||
- {x: 0.23801796, y: 3.0867176, z: 0}
|
- {x: 0.23801796, y: 3.0867176, z: 0}
|
||||||
m_Parameters:
|
m_Parameters:
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
@@ -2555,8 +2555,8 @@ LineRenderer:
|
|||||||
- {x: -0.25665125, y: 3.5455208, z: 0}
|
- {x: -0.25665125, y: 3.5455208, z: 0}
|
||||||
- {x: -0.29019317, y: 3.412991, z: 0}
|
- {x: -0.29019317, y: 3.412991, z: 0}
|
||||||
- {x: -0.32373506, y: 3.3024335, z: 0}
|
- {x: -0.32373506, y: 3.3024335, z: 0}
|
||||||
- {x: -0.35727698, y: 3.2138486, z: 0}
|
- {x: -0.35727698, y: 3.2138484, z: 0}
|
||||||
- {x: -0.39081886, y: 3.147236, z: 0}
|
- {x: -0.39081886, y: 3.1472359, z: 0}
|
||||||
- {x: -0.4243608, y: 3.1025958, z: 0}
|
- {x: -0.4243608, y: 3.1025958, z: 0}
|
||||||
- {x: -0.45790267, y: 3.0799282, z: 0}
|
- {x: -0.45790267, y: 3.0799282, z: 0}
|
||||||
- {x: -0.4914446, y: 3.079233, z: 0}
|
- {x: -0.4914446, y: 3.079233, z: 0}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Bootstrap;
|
using Bootstrap;
|
||||||
using Core;
|
using Core;
|
||||||
|
using UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.AddressableAssets;
|
using UnityEngine.AddressableAssets;
|
||||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||||
using UnityEngine.Playables;
|
using UnityEngine.Playables;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UI.Core;
|
||||||
|
|
||||||
namespace Cinematics
|
namespace Cinematics
|
||||||
{
|
{
|
||||||
@@ -25,7 +27,7 @@ namespace Cinematics
|
|||||||
private bool _isCinematicPlaying = false;
|
private bool _isCinematicPlaying = false;
|
||||||
public bool IsCinematicPlaying => _isCinematicPlaying;
|
public bool IsCinematicPlaying => _isCinematicPlaying;
|
||||||
public GameObject cinematicBackground;
|
public GameObject cinematicBackground;
|
||||||
public GameObject divingGameOverScreen;
|
public DivingGameOverScreen divingGameOverScreen;
|
||||||
|
|
||||||
// Dictionary to track addressable handles by PlayableDirector
|
// Dictionary to track addressable handles by PlayableDirector
|
||||||
private Dictionary<PlayableDirector, AsyncOperationHandle<PlayableAsset>> _addressableHandles
|
private Dictionary<PlayableDirector, AsyncOperationHandle<PlayableAsset>> _addressableHandles
|
||||||
@@ -204,7 +206,20 @@ namespace Cinematics
|
|||||||
|
|
||||||
public void ShowGameOverScreen()
|
public void ShowGameOverScreen()
|
||||||
{
|
{
|
||||||
divingGameOverScreen.SetActive(true);
|
if (divingGameOverScreen != null && UIPageController.Instance != null)
|
||||||
|
{
|
||||||
|
UIPageController.Instance.PushPage(divingGameOverScreen);
|
||||||
|
}
|
||||||
|
else if (divingGameOverScreen != null)
|
||||||
|
{
|
||||||
|
// Fallback if UIPageController is not available
|
||||||
|
divingGameOverScreen.gameObject.SetActive(true);
|
||||||
|
Logging.Warning("[CinematicsManager] UIPageController not found, falling back to simple activation.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logging.Warning("[CinematicsManager] DivingGameOverScreen reference is not set!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,27 +146,18 @@ namespace UI.CardSystem
|
|||||||
var backpackInput = backpackIcon.gameObject.GetComponentInParent<BackpackInput>();
|
var backpackInput = backpackIcon.gameObject.GetComponentInParent<BackpackInput>();
|
||||||
InputManager.Instance.RegisterOverrideConsumer(backpackInput);
|
InputManager.Instance.RegisterOverrideConsumer(backpackInput);
|
||||||
|
|
||||||
// If no pages are open, push the main menu
|
PageController.PushPage(mainMenuPage);
|
||||||
if (PageController.CurrentPage == null)
|
|
||||||
|
// Clear notification for unseen cards when opening menu
|
||||||
|
if (_hasUnseenCards)
|
||||||
{
|
{
|
||||||
PageController.PushPage(mainMenuPage);
|
_hasUnseenCards = false;
|
||||||
|
|
||||||
// Clear notification for unseen cards when opening menu
|
|
||||||
if (_hasUnseenCards)
|
|
||||||
{
|
|
||||||
_hasUnseenCards = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide the backpack button when entering menu
|
|
||||||
if (backpackButton != null)
|
|
||||||
{
|
|
||||||
backpackButton.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (PageController.CurrentPage == mainMenuPage)
|
|
||||||
|
// Hide the backpack button when entering menu
|
||||||
|
if (backpackButton != null)
|
||||||
{
|
{
|
||||||
// If main menu is open, pop it
|
backpackButton.gameObject.SetActive(false);
|
||||||
PageController.PopPage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,8 +175,28 @@ namespace UI.CardSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Check if any page in the stack has "Card" or "Album" in the name
|
||||||
|
bool hasCardOrAlbumPage = false;
|
||||||
|
if (PageController != null && PageController.PageStack != null)
|
||||||
|
{
|
||||||
|
foreach (var page in PageController.PageStack)
|
||||||
|
{
|
||||||
|
if (page != null && page.PageName != null)
|
||||||
|
{
|
||||||
|
if (page.PageName.Contains("Card") || page.PageName.Contains("Album"))
|
||||||
|
{
|
||||||
|
hasCardOrAlbumPage = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide backpack button if there's a card/album page in the stack
|
||||||
if (backpackButton != null)
|
if (backpackButton != null)
|
||||||
backpackButton.gameObject.SetActive(false);
|
{
|
||||||
|
backpackButton.gameObject.SetActive(!hasCardOrAlbumPage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update menu if it's the main menu page
|
// Update menu if it's the main menu page
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace UI.Core
|
|||||||
|
|
||||||
private Stack<UIPage> _pageStack = new Stack<UIPage>();
|
private Stack<UIPage> _pageStack = new Stack<UIPage>();
|
||||||
public UIPage CurrentPage => _pageStack.Count > 0 ? _pageStack.Peek() : null;
|
public UIPage CurrentPage => _pageStack.Count > 0 ? _pageStack.Peek() : null;
|
||||||
|
public IEnumerable<UIPage> PageStack => _pageStack;
|
||||||
|
|
||||||
// Event fired when the page stack changes
|
// Event fired when the page stack changes
|
||||||
public event Action<UIPage> OnPageChanged;
|
public event Action<UIPage> OnPageChanged;
|
||||||
|
|||||||
@@ -3,47 +3,117 @@ using Core;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using Minigames.DivingForPictures;
|
using Minigames.DivingForPictures;
|
||||||
|
using UI.Core;
|
||||||
|
using Pixelplacement;
|
||||||
|
|
||||||
public class DivingGameOverScreen : MonoBehaviour
|
namespace UI
|
||||||
{
|
{
|
||||||
[SerializeField]
|
public class DivingGameOverScreen : UIPage
|
||||||
private TextMeshProUGUI finalScoreText;
|
|
||||||
|
|
||||||
void OnEnable()
|
|
||||||
{
|
{
|
||||||
if (DivingGameManager.Instance != null)
|
[SerializeField]
|
||||||
|
private TextMeshProUGUI finalScoreText;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private CanvasGroup canvasGroup;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
{
|
{
|
||||||
int finalScore = DivingGameManager.Instance.PlayerScore;
|
// Ensure we have a CanvasGroup for transitions
|
||||||
finalScoreText.text = $"{finalScore}";
|
if (canvasGroup == null)
|
||||||
|
canvasGroup = GetComponent<CanvasGroup>();
|
||||||
|
if (canvasGroup == null)
|
||||||
|
canvasGroup = gameObject.AddComponent<CanvasGroup>();
|
||||||
|
|
||||||
|
canvasGroup.alpha = 0f;
|
||||||
|
canvasGroup.interactable = false;
|
||||||
|
canvasGroup.blocksRaycasts = false;
|
||||||
|
gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the page transitions in. Updates the score display.
|
||||||
|
/// </summary>
|
||||||
|
protected override void DoTransitionIn(Action onComplete)
|
||||||
|
{
|
||||||
|
// Update score when showing the screen
|
||||||
|
if (DivingGameManager.Instance != null)
|
||||||
|
{
|
||||||
|
int finalScore = DivingGameManager.Instance.PlayerScore;
|
||||||
|
finalScoreText.text = $"{finalScore}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canvasGroup != null)
|
||||||
|
{
|
||||||
|
canvasGroup.interactable = true;
|
||||||
|
canvasGroup.blocksRaycasts = true;
|
||||||
|
canvasGroup.alpha = 0f;
|
||||||
|
Tween.Value(0f, 1f, v => canvasGroup.alpha = v, transitionDuration, 0f,
|
||||||
|
Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onComplete?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the page transitions out.
|
||||||
|
/// </summary>
|
||||||
|
protected override void DoTransitionOut(Action onComplete)
|
||||||
|
{
|
||||||
|
if (canvasGroup != null)
|
||||||
|
{
|
||||||
|
canvasGroup.interactable = false;
|
||||||
|
canvasGroup.blocksRaycasts = false;
|
||||||
|
Tween.Value(canvasGroup.alpha, 0f, v => canvasGroup.alpha = v, transitionDuration, 0f,
|
||||||
|
Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onComplete?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void PlayAgain()
|
||||||
|
{
|
||||||
|
// Pop this page from the stack before reloading
|
||||||
|
if (UIPageController.Instance != null && UIPageController.Instance.CurrentPage == this)
|
||||||
|
{
|
||||||
|
UIPageController.Instance.PopPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
|
||||||
|
await SceneManagerService.Instance.ReloadCurrentScene(progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Exits to the main menu scene.
|
||||||
|
/// </summary>
|
||||||
|
public async void ExitToAppleHills()
|
||||||
|
{
|
||||||
|
// Pop this page from the stack before switching scenes
|
||||||
|
if (UIPageController.Instance != null && UIPageController.Instance.CurrentPage == this)
|
||||||
|
{
|
||||||
|
UIPageController.Instance.PopPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
|
||||||
|
await SceneManagerService.Instance.SwitchSceneAsync("AppleHillsOverworld", progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Exits to the Quarry scene.
|
||||||
|
/// </summary>
|
||||||
|
public async void ExitToQuarry()
|
||||||
|
{
|
||||||
|
// Pop this page from the stack before switching scenes
|
||||||
|
if (UIPageController.Instance != null && UIPageController.Instance.CurrentPage == this)
|
||||||
|
{
|
||||||
|
UIPageController.Instance.PopPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
|
||||||
|
await SceneManagerService.Instance.SwitchSceneAsync("Quarry", progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void PlayAgain()
|
|
||||||
{
|
|
||||||
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
|
|
||||||
await SceneManagerService.Instance.ReloadCurrentScene(progress);;
|
|
||||||
gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Exits to the main menu scene.
|
|
||||||
/// </summary>
|
|
||||||
public async void ExitToAppleHills()
|
|
||||||
{
|
|
||||||
gameObject.SetActive(false);
|
|
||||||
// Replace with the actual scene name as set in Build Settings
|
|
||||||
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
|
|
||||||
await SceneManagerService.Instance.SwitchSceneAsync("AppleHillsOverworld", progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Exits to the main menu scene.
|
|
||||||
/// </summary>
|
|
||||||
public async void ExitToQuarry()
|
|
||||||
{
|
|
||||||
gameObject.SetActive(false);
|
|
||||||
// Replace with the actual scene name as set in Build Settings
|
|
||||||
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
|
|
||||||
await SceneManagerService.Instance.SwitchSceneAsync("Quarry", progress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user