private void OnLevelUpNotification(object senders, EventArgs e) { HUDAnimator.OnLevelUp -= OnLevelUpNotification; PopupController.Callback button1Function = delegate(){ //unregister before registering listener to prevent multiple registering //when using spam click the button HUDAnimator.OnLevelUp -= OnLevelUpNotification; HUDAnimator.OnLevelUp += OnLevelUpNotification; }; // Populate notification entry table Hashtable notificationEntry = new Hashtable(); notificationEntry.Add(NotificationPopupData.PrefabName, "PopupLevelUp"); notificationEntry.Add(NotificationPopupData.Title, Localization.Localize("POPUP_LEVEL_TITLE")); notificationEntry.Add(NotificationPopupData.Message, LevelLogic.Instance.GetLevelUpMessage()); // Already localized notificationEntry.Add(NotificationPopupData.SpecialButtonCallback, button1Function); NotificationUIManager.Instance.AddToQueue(notificationEntry); AudioManager.Instance.PlayClip("fanfare3"); //Send Analytics event Analytics.Instance.LevelUnlocked(LevelLogic.Instance.CurrentLevel); }
private void OnZeroHealthNotification(object sender, EventArgs args) { //Unregister the handler so we don't get multiple notifications of the same thing StatsManager.OnZeroHealth -= OnZeroHealthNotification; PopupController.Callback button1Function = delegate() { StatsManager.Instance.ChangeStats(coinsDelta: -1 * hospitalBillCost, healthDelta: 100, hungerDelta: -1 * moodPunishment, isFloaty: false); //Register the handler again after the notification has been cleared StatsManager.OnZeroHealth += OnZeroHealthNotification; }; string petName = DataManager.Instance.GameData.PetInfo.PetName; string message = string.Format(Localization.Localize("POPUP_ZERO_HEALTH"), petName, hospitalBillCost.ToString()); Hashtable notificationEntry = new Hashtable(); notificationEntry.Add(NotificationPopupData.PrefabName, "PopupZeroHealth"); notificationEntry.Add(NotificationPopupData.Title, null); notificationEntry.Add(NotificationPopupData.Message, message); notificationEntry.Add(NotificationPopupData.SpecialButtonCallback, button1Function); NotificationUIManager.Instance.AddToQueue(notificationEntry); //Send analytics event Analytics.Instance.ZeroHealth(); }
private void ShowPopupPetSick() { //unregister listener after notification is shown once StatsManager.OnHealthyToSick -= OnHealthyToSickHandler; StatsManager.OnHealthyToVerySick -= OnHealthyToSickHandler; // Change the necessary data DataManager.Instance.GameData.SickNotification.IsRemindedThisPlayPeriod = true; DataManager.Instance.GameData.SickNotification.DecreaseReminderCount(); PopupController.Callback button1Function = delegate() { ClickManager.Instance.Lock(UIModeTypes.Store); NavigationUIManager.Instance.HidePanel(); StoreUIManager.OnShortcutModeEnd += CloseShop; StoreUIManager.Instance.OpenToSubCategory("Items", true, StoreShortcutType.SickNotification); }; Hashtable notificationEntry = new Hashtable(); notificationEntry.Add(NotificationPopupData.PrefabName, "PopupPetSick"); notificationEntry.Add(NotificationPopupData.Message, Localization.Localize("POPUP_PET_SICK")); notificationEntry.Add(NotificationPopupData.SpecialButtonCallback, button1Function); NotificationUIManager.Instance.AddToQueue(notificationEntry); AudioManager.Instance.PlayClip("superWellaSick"); }
private IEnumerator ShowSuperWella() { yield return(new WaitForSeconds(1f)); PopupController.Callback okButtonCallback = delegate(){ if (!isDelegateUsed) { isDelegateUsed = true; PetAudioManager.Instance.EnableSound = true; Advance(); } }; //Display tutorial notification Hashtable notificationEntry = new Hashtable(); notificationEntry.Add(NotificationPopupData.PrefabName, "PopupInhalerReminder"); notificationEntry.Add(NotificationPopupData.Title, null); notificationEntry.Add(NotificationPopupData.Message, Localization.Localize("POPUP_INHALER_REMINDER")); notificationEntry.Add(NotificationPopupData.SpecialButtonCallback, okButtonCallback); NotificationUIManager.Instance.AddToQueue(notificationEntry); AudioManager.Instance.PlayClip("superWellaInhalerTutorial"); PetAudioManager.Instance.EnableSound = false; }
// Loads the prefab and inits the prefab's PopupController values public IEnumerator ShowPopup(string prefabName, string title, string message, PopupController.Callback specialButtonCallback) { GameObject popupRef = Resources.Load <GameObject>(prefabName); GameObject popup = GameObjectUtils.AddChildGUI(gameObject, popupRef); PopupController controller = popup.GetComponent <PopupController>(); controller.Init(title, message, specialButtonCallback); yield return(0); // Wait a frame for the popup to finish controller.ShowPopup(); }
/// <summary> /// Shows two notifications telling user how to increase the pet's mood /// </summary> private void ShowPopupNoEnergy() { string petName = DataManager.Instance.GameData.PetInfo.PetName; string popupMessage = string.Format(Localization.Localize("POPUP_NO_ENERGY"), petName); PopupController.Callback okButtonCallback = delegate() { StoreUIManager.OnShortcutModeEnd += CloseShop; ClickManager.Instance.Lock(UIModeTypes.Store); StoreUIManager.Instance.OpenToSubCategory("Food", true, StoreShortcutType.NeedFoodTutorial); }; Hashtable notificationEntry = new Hashtable(); notificationEntry.Add(NotificationPopupData.PrefabName, "PopupNoEnergy"); notificationEntry.Add(NotificationPopupData.Title, Localization.Localize("POPUP_NO_ENERGY_TITLE")); notificationEntry.Add(NotificationPopupData.Message, popupMessage); notificationEntry.Add(NotificationPopupData.SpecialButtonCallback, okButtonCallback); NotificationUIManager.Instance.AddToQueue(notificationEntry); DataManager.Instance.GameData.Tutorial.ListPlayed.Add(TutorialManagerBedroom.TUT_MOOD_DEGRADE); }