/// <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 => { }); }
/// <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 => {}); }
/// <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(); } }); }
/// <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); }); }
/// <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; }); }
/// <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(); } }); }
/// <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); } }); }