Esempio n. 1
0
        public void ToggleDifficultyAndAromas()
        {
            if (difficultyButtons.activeSelf == true)
            {
                difficultyButtons.SetActive(false);
                aromaButtons.SetActive(true);
                menuTitle.SetKey("aromas_menu_title");
                toggleButtonText.SetKey("difficulty_button");

                difficultyTitle.SetKey("aromas_title");
                difficultyDes.SetKey("aromas_des");
            }
            else
            {
                difficultyButtons.SetActive(true);
                aromaButtons.SetActive(false);
                menuTitle.SetKey("difficulty_menu_title");
                toggleButtonText.SetKey("aromas_button");

                if (difficultyModifierToBe == 0.75f)
                {
                    difficultyTitle.SetKey("casual_title");
                    difficultyDes.SetKey("casual_des");
                }
                else
                {
                    difficultyTitle.SetKey("normal_title");
                    difficultyDes.SetKey("normal_des");
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Special notification indicating a quest has been taken
        /// </summary>
        /// <param name="questName"></param>
        public void SetQuestNotification(string questName)
        {
            titleText.SetKey("QUEST_toast");
            descriptionText.SetKey(questName + "_quest_title");

            b.interactable = false;
            SetVisible(true);
            fadeOuter = StartCoroutine(FadeOut());
        }
Esempio n. 3
0
 /// <summary>
 /// Changes the displayed text
 /// </summary>
 /// <param name="textKey"> Localized key for text to display </param>
 public void SetKey(string textKey)
 {
     if (this.colour != "normal")
     {
         SetColour("normal");
     }
     textBackgroundCanvas.alpha = 1;
     eventText.SetKey(textKey);
     displayedAttack = null;
 }
Esempio n. 4
0
        /// <summary>
        /// Iniitalize with properties
        /// </summary>
        /// <param name="areaName"></param>
        /// <param name="class0"></param>
        /// <param name="class1"></param>
        /// <param name="score"></param>
        /// <param name="subAreaIndex"></param>
        public void Init(string areaName, string class0, string class1, int score, int subAreaIndex)
        {
            visualHolder.SetActive(true);
            pm0Sprite.sprite = statsMenu.GetClassSprite(class0);
            pm1Sprite.sprite = statsMenu.GetClassSprite(class1);
            scoreAmountText.SetText(score.ToString());

            if (areaName == "GreyWastes")
            {
                background.color = new Color32(39, 39, 39, 255);
            }
            subAreaCard.sprite = statsMenu.GetSubAreaSprite(areaName, subAreaIndex);
            subAreaName.SetKey(areaName + subAreaIndex);
        }
Esempio n. 5
0
        private float lerpSpeed = 4;        /// <value> Speed at which canvas fades in and out </value>

        /// <summary>
        /// Sets the quest display, showing the quest name and
        /// an informative prompt, before making it visible
        /// </summary>
        /// <param name="questName"></param>
        public void SetQuest(string questName, string startEvent, string nextEvent)
        {
            this.questName  = questName;
            this.startEvent = startEvent;
            this.nextEvent  = nextEvent;

            titleText.SetKey(questName + "_quest_title");
            subtitleText.SetKey(questName + "_quest_sub");
            questSprite.sprite = Resources.Load <Sprite>("Sprites/Quests/" + questName);

            SetVisible(true);
        }
Esempio n. 6
0
        /// <summary>
        /// Visually show that a class has been selected.
        /// Changes a class button's sprite state to pressed and enables the select button.
        /// Also changes the displayed class info.
        /// </summary>
        /// <param name="cb"> Class button to change appearance of </param>
        public void SelectDifficultyButton(int index)
        {
            if (index == 0)
            {
                difficultyModifierToBe = 0.75f;
                difficultyTitle.SetKey("casual_title");
                difficultyDes.SetKey("casual_des");
            }
            else
            {
                difficultyModifierToBe = 1f;
                difficultyTitle.SetKey("normal_title");
                difficultyDes.SetKey("normal_des");
            }

            for (int i = 0; i < difficultyBtss.Length; i++)
            {
                if (i == index)
                {
                    difficultyBtss[i].SetColor("na0");
                }
                else
                {
                    difficultyBtss[i].SetColor("normal");
                }
            }
            GameManager.instance.gsDataCurrent.difficultyModifier = difficultyModifierToBe;

            CalculateScoreModifier(true);
        }
Esempio n. 7
0
 /// <summary>
 /// Changes the displayed text
 /// </summary>
 /// <param name="textKey"> Localized key for text to display </param>
 public void SetKey(string textName, string textKey)
 {
     if (textName == "title")
     {
         titleText.SetKey(textKey);
     }
     else if (textName == "subtitle")
     {
         subtitleText.SetKey(textKey);
     }
     else if (textName == "description")
     {
         descriptionText.SetKey(textKey);
     }
     else if (textName == "value")
     {
         valueText.SetKey(textKey);
     }
     else
     {
         Debug.LogError("TextName " + textName + " does not exist");
     }
 }
Esempio n. 8
0
        private bool isWin;                     /// <value> True if this game ended in victory </value>

        /// <summary>
        /// Initializes all properties so the gameOverMenu can show the correct info
        /// </summary>
        /// <param name="isWin"> true if game was won (player reached last subArea), false otherwise </param>
        /// <param name="midPoints"> List of subArea indexes that were visited </param>
        /// <param name="subAreaProg"> Current subArea's progress</param>
        public void Init(bool isWin, List <int> midPoints, string areaName, int subAreaIndex, int subAreaProg, string timeString)
        {
            gameObject.SetActive(true);
            this.isWin = isWin;

            if (isWin == true)
            {
                gameOverTitle.SetKey("game_completed_title");
                gameOverDes.SetKey("game_completed_des");
                scoreTitle.SetKey("final_score_title");
            }
            else
            {
                gameOverTitle.SetKey("game_over_title");
                gameOverDes.SetKey("game_over_" + areaName + subAreaIndex);
                scoreTitle.SetKey("score_title");
            }

            /*
             *  First icon will be the start, last icon will be the end (so only midpoints need to be positioned and have their sprites changed).
             *  Note that for now, the start and end icons are hardcoded via the scene (TODO: Change that)
             */
            float midPointDist = (int)(frontFill.rectTransform.sizeDelta.x / (midPoints.Count + 1));

            for (int i = 0; i < midPoints.Count; i++)
            {
                pbis[i + 1].SetPosition((int)midPointDist * (i + 1), 0);
                pbis[i + 1].SetSprite(Resources.Load <Sprite>("Sprites/Menu/" + GameManager.instance.areaName + "Icons/" + midPoints[i]));
                if (midPoints[i] != -1)     // leave progressBarICons as ? if they were not reached
                {
                    fillAmount += midPointDist / frontFill.rectTransform.sizeDelta.x;
                }
            }
            midPointBarSeg = 1f / (midPoints.Count + 1);
            fillAmount    += (subAreaProg / 100f) * (1f / (midPoints.Count + 1));

            monstersAmount.SetText(GameManager.instance.monstersKilled.ToString());
            WAXAmount.SetText(GameManager.instance.WAXobtained.ToString());
            eventsAmount.SetText(GameManager.instance.totalEvents.ToString());
            timeAmount.SetText(timeString);
            scoreAmount.SetText(CalculateScore().ToString());

            if (GameManager.instance.gsDataCurrent.achievementsUnlocked[(int)achievementConstants.ABSOLUTEMASTERY] == false && isWin == true &&
                GameManager.instance.gsData.difficultyModifier == 1f)
            {
                string[] partyComp = PartyManager.instance.GetPartyCompositionSorted();
                for (int i = 0; i < GameManager.instance.gsDataCurrent.partyCombos.GetLength(0); i++)
                {
                    bool match = true;
                    for (int j = 0; j < partyComp.Length; j++)
                    {
                        if (GameManager.instance.gsDataCurrent.partyCombos[i, j] != partyComp[j])
                        {
                            match = false;
                            break;
                        }
                    }
                    if (match == true)
                    {
                        GameManager.instance.gsDataCurrent.partyCombos[i, 0] = null;  // setting first entry in a combo to null means its been completed
                        break;
                    }
                }
                for (int i = 0; i < GameManager.instance.gsDataCurrent.partyCombos.GetLength(0); i++)
                {
                    if (GameManager.instance.gsDataCurrent.partyCombos[i, 0] != null)
                    {
                        break;
                    }
                    else if (i == GameManager.instance.gsDataCurrent.partyCombos.GetLength(0) - 1)
                    {
                        GameManager.instance.gsDataCurrent.achievementsUnlocked[(int)achievementConstants.ABSOLUTEMASTERY] = true;
                        EventManager.instance.SetAchievementNotification((int)achievementConstants.ABSOLUTEMASTERY, true);
                    }
                }
            }
            if (GameManager.instance.gsDataCurrent.achievementsUnlocked[(int)achievementConstants.NOTIME] == false && isWin == true &&
                GameManager.instance.gsData.difficultyModifier == 1f)
            {
                if (TimeSpan.FromSeconds(GameManager.instance.timeTaken).TotalSeconds < 720)
                {
                    GameManager.instance.gsDataCurrent.achievementsUnlocked[(int)achievementConstants.NOTIME] = true;
                    EventManager.instance.SetAchievementNotification((int)achievementConstants.NOTIME, true);
                }
            }

            GameManager.instance.AddHighScoreData(CalculateScore(), subAreaIndex);
        }
Esempio n. 9
0
        public void SetNotification(bool[] types, string[] amounts)
        {
            int    typesCount = 0;
            string titleKey   = "";

            string[] descriptionKeys = new string[] { "none_label", "none_label", "none_label", "none_label", "none_label", "none_label", "none_label" };
            string[] amountStrings   = new string[7];

            if (types[(int)toastType.HP] == true)
            {
                titleKey           = "HP_toast";
                descriptionKeys[0] = "HP_label";
                amountStrings[0]   = "<color=#EA323C>" + amounts[0] + "</color>";
                typesCount++;
            }
            if (types[(int)toastType.MP] == true)
            {
                titleKey           = "MP_toast";
                descriptionKeys[1] = "MP_label";
                amountStrings[1]   = "<color=#502BFF>" + amounts[1] + "</color>";
                typesCount++;
            }
            if (types[(int)toastType.EXP] == true)
            {
                titleKey           = "EXP_toast";
                descriptionKeys[2] = "EXP_label";
                amountStrings[2]   = amounts[2];
                typesCount++;
            }
            if (types[(int)toastType.WAX] == true)
            {
                titleKey           = "WAX_toast";
                descriptionKeys[3] = "WAX_label_coloured";
                amountStrings[3]   = "<color=#FFCD02>" + amounts[3] + "</color>";
                typesCount++;
            }
            if (types[(int)toastType.SE] == true)
            {
                titleKey           = "SE_toast";
                descriptionKeys[4] = amounts[4];    // for status effects, just showing the SE name is enough (no fancy descriptors)
                amountStrings[4]   = "";
                typesCount++;
            }
            if (types[(int)toastType.PROGRESS] == true)
            {
                titleKey           = "PROG_toast";
                descriptionKeys[5] = "PROG_label";
                amountStrings[5]   = amounts[5] + "%";
                typesCount++;
            }
            if (types[(int)toastType.QUESTCOMPLETE] == true)
            {
                titleKey           = amounts[6] + "_quest_complete_title"; // Completing a quest overrides all possible title keys
                descriptionKeys[6] = "none_label";
                amountStrings[6]   = "";
                typesCount++;
            }

            if (typesCount > 1 && types[(int)toastType.QUESTCOMPLETE] == false)
            {
                titleText.SetKey("generic_toast");
            }
            else
            {
                titleText.SetKey(titleKey);
            }
            descriptionText.SetMultipleKeysAndAppend(descriptionKeys, amountStrings);

            b.interactable = false;
            SetVisible(true);
            fadeOuter = StartCoroutine(FadeOut());
        }
Esempio n. 10
0
 /// <summary>
 /// Sets the text to be displayed
 /// </summary>
 /// <param name="key"> String key that corresponds to dictionary </param>
 public void SetKey(string key)
 {
     actionText.SetKey(key);
 }
Esempio n. 11
0
 /// <summary>
 /// Updates the subArea card and title
 /// </summary>
 /// <param name="subAreaCardSprite"></param>
 /// <param name="cardName"></param>
 public void UpdateSubAreaCard(Sprite subAreaCardSprite, string cardName)
 {
     subAreaCard.sprite = subAreaCardSprite;
     subAreaName.SetKey(cardName);
 }
Esempio n. 12
0
        public Image textBackground;        /// <value> Image behind text </value>

        /// <summary>
        /// Changes the displayed text
        /// </summary>
        /// <param name="textKey"> Localized key for text to display </param>
        public void SetText(string textKey)
        {
            textBackground.gameObject.SetActive(true);
            eventText.SetKey(textKey);
        }
Esempio n. 13
0
 private void SetTipText()
 {
     tipText.SetKey("tip" + Random.Range(0, tipNum) + "_des");
 }