예제 #1
0
 /// <summary>
 /// Instantiates a popup.
 /// </summary>
 private void FullInventoryPopup()
 {
     if (popupDialog != null)
     {
         return;
     }
     SetUpPopup();
     popupDialog = GameObject.Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();
     popupDialog.SetUpPopup(inventoryFullTitleKey, inventoryFullMessageKey,
                            buttons, ExecutionState.PopupPause, i => { });
 }
예제 #2
0
        /// <summary>
        /// Saves the game.
        /// </summary>
        public void SaveGame()
        {
            if (popup != null)
            {
                return;
            }
            GameMaster.Instance.SaveGame();
            popup = Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();
            var button = new List <CanvasPopupDialog.ButtonSettings> {
                confirmCancelButtons[0]
            };

            popup.SetUpPopup(gameSavedTitleKey.key, gameSavedMessageKey.key, button, ExecutionState.PopupPause, i => {});
        }
예제 #3
0
        /// <summary>
        /// Return to the main menu.
        /// </summary>
        public void ReturnToMainMenu()
        {
            if (popup != null)
            {
                return;
            }
            popup = Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();

            popup.SetUpPopup(backToMenuTitleKey.key, backToMenuMessageKey.key, gameSaveProgressSavedKey.key, confirmCancelButtons, ExecutionState.PopupPause,
                             i => {
                if (i == 0)
                {
                    BackToMenu();
                }
            });
        }
예제 #4
0
        /// <summary>
        /// Quits the game.
        /// </summary>
        public void QuitGame()
        {
            if (popup != null)
            {
                return;
            }
            popup = Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();

            popup.SetUpPopup(quitGameTitleKey.key, quitGameMessageKey.key, gameSaveProgressSavedKey.key, confirmCancelButtons, ExecutionState.PopupPause,
                             i => {
                if (i != 0)
                {
                    return;
                }
                GameMaster.Instance.SaveGame();
                Invoke(nameof(Quit), fadeAnimationDuration);
            });
        }
예제 #5
0
        /// <summary>
        /// Starts the store closing sequence.
        /// </summary>
        public void TriggerStoreClose()
        {
            if (popupDialog != null)
            {
                return;
            }
            closeButton.interactable = false;

            popupDialog = Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();
            popupDialog.SetUpPopup(closeStoreTitleKey.key,
                                   closeStoreMessageKey.key,
                                   confirmCancelButtons, ExecutionState.PopupPause, i => {
                if (i == 0)
                {
                    CloseStore();
                }

                closeButton.interactable = true;
            });
        }
예제 #6
0
        /// <summary>
        /// Opens the popup to change floors.
        /// </summary>
        private void DisplayPopupToChangeFloors()
        {
            if (popupDialog != null)
            {
                return;
            }

            popupDialog = Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();

            popupDialog.SetUpPopup(titleKey.key, messageKey.key, travelButtons, ExecutionState.PopupPause, i => {
                if (i <= 0)
                {
                    TeleportPlayerToNextFloor();
                }
                else
                {
                    FloorTravelTrigger.OnResetTriggerLock?.Invoke();
                }
            });
        }
예제 #7
0
        /// <summary>
        /// Triggers the sleep popup.
        /// </summary>
        public void StartSleep()
        {
            if (popupDialog != null)
            {
                return;
            }

            popupDialog = Instantiate(popupPrefab).GetComponent <CanvasPopupDialog>();

            canTriggerSleep = false;

            canvasGroup.interactable = true;
            popupDialog.SetUpPopup(titleKey.key, messageKey.key, sleepButtons, ExecutionState.PopupPause, i => {
                if (i == 0)
                {
                    Sleep();
                }
                else
                {
                    Invoke(nameof(SleepCooldown), sleepTriggerCooldown);
                }
            });
        }