コード例 #1
0
    public void OnClickItemButton()
    {
        if (stageInfo == null)
        {
            return;
        }

        PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;

        popUpWindow.OpenTextWindow("");
        popUpWindow.SetButtonValues(null, null, "Close", delegate { UIManager.Instance.CloseCurrentWindow(); });
        popUpWindow.textField.text             = "";
        popUpWindow.textField.fontSize         = 18;
        popUpWindow.textField.paragraphSpacing = 8;
        popUpWindow.textField.alignment        = TextAlignmentOptions.Left;

        int sum = 0;

        stageInfo.archetypeDropList.ForEach(x => sum += x.weight);

        popUpWindow.textField.text += "<b>Archetype Drops</b>\n";
        foreach (WeightBase archetypeDrop in stageInfo.archetypeDropList.OrderBy(x => x.weight).ToList())
        {
            string name = LocalizationManager.Instance.GetLocalizationText_ArchetypeName(archetypeDrop.idName);
            popUpWindow.textField.text += ((float)archetypeDrop.weight / sum).ToString("p1") + "<indent=6em>" + name + "</indent>\n";
        }
    }
コード例 #2
0
    public void TeamConfirmOnClick()
    {
        if (isTeamSelected)
        {
            int heroesWithoutSkills = 0;
            GameManager.Instance.PlayerStats.lastPlayedWorld = selectedAct;

            foreach (HeroData hero in GameManager.Instance.PlayerStats.heroTeams[GameManager.Instance.selectedTeamNum])
            {
                if (hero == null)
                {
                    continue;
                }
                for (int i = 0; i < 2; i++)
                {
                    if (hero.GetAbilityFromSlot(i) != null && hero.GetAbilityFromSlot(i).IsUsable)
                    {
                        break;
                    }
                    if (i == 1)
                    {
                        heroesWithoutSkills++;
                    }
                }
            }
            if (GameManager.Instance.PlayerStats.EquipmentInventory.Count >= PlayerStats.maxEquipInventory)
            {
                PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;
                popUpWindow.OpenTextWindow("Number of items in inventory is over 350. Recycle unneeded equipment to continue.", 380, 200);
                popUpWindow.textField.fontSize         = 24;
                popUpWindow.textField.paragraphSpacing = 0;
                popUpWindow.textField.alignment        = TextAlignmentOptions.Center;

                popUpWindow.SetButtonValues(null, null, "Confirm", delegate { UIManager.Instance.CloseCurrentWindow(); });
            }
            else if (heroesWithoutSkills > 0)
            {
                PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;
                popUpWindow.OpenTextWindow("One or more Heroes have no usable Abilities.\nContinue anyway?", 380, 200);
                popUpWindow.textField.fontSize         = 24;
                popUpWindow.textField.paragraphSpacing = 0;
                popUpWindow.textField.alignment        = TextAlignmentOptions.Center;

                popUpWindow.SetButtonValues("Confirm", delegate { UIManager.Instance.CloseCurrentWindow(); GameManager.Instance.MoveToBattle(selectedStage); }, "Cancel", delegate { UIManager.Instance.CloseCurrentWindow(); });
            }

            else
            {
                GameManager.Instance.MoveToBattle(selectedStage);
            }
        }
    }
コード例 #3
0
    public void ShowAllPossibleAffixes()
    {
        if (currentItem == null)
        {
            return;
        }
        PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;

        popUpWindow.OpenTextWindow("");
        popUpWindow.SetButtonValues(null, null, "Close", delegate { UIManager.Instance.CloseCurrentWindow(); });
        popUpWindow.textField.text             = "";
        popUpWindow.textField.fontSize         = 18;
        popUpWindow.textField.paragraphSpacing = 8;
        popUpWindow.textField.alignment        = TextAlignmentOptions.Left;
        float levelSkew = craftingModifierWindow.highLevelMod.currentModifier;

        Debug.Log(levelSkew);

        WeightList <AffixBase> possibleAffixes;

        if (currentItem.GetAffixCap() > currentItem.prefixes.Count)
        {
            possibleAffixes = currentItem.GetAllPossiblePrefixes(modifiers, levelSkew);
            if (possibleAffixes.Count > 0)
            {
                popUpWindow.textField.text += "<b>Prefixes</b>\n";
                foreach (var affixBaseWeight in possibleAffixes)
                {
                    float affixPercent = (float)affixBaseWeight.weight / possibleAffixes.Sum * 100f;
                    popUpWindow.textField.text += affixPercent.ToString("F1") + "%" + Affix.BuildAffixString(affixBaseWeight.item, Helpers.AFFIX_STRING_SPACING + 3);
                    popUpWindow.textField.text += "<line-height=0.2em>\n</line-height>";
                }
                popUpWindow.textField.text += "\n";
            }
        }

        if (currentItem.GetAffixCap() > currentItem.suffixes.Count)
        {
            possibleAffixes = currentItem.GetAllPossibleSuffixes(modifiers, levelSkew);
            if (possibleAffixes.Count > 0)
            {
                popUpWindow.textField.text += "<b>Suffixes</b>\n";
                foreach (var affixBaseWeight in possibleAffixes)
                {
                    float affixPercent = (float)affixBaseWeight.weight / possibleAffixes.Sum * 100f;
                    popUpWindow.textField.text += affixPercent.ToString("F1") + "%" + Affix.BuildAffixString(affixBaseWeight.item, Helpers.AFFIX_STRING_SPACING + 3);
                    popUpWindow.textField.text += "<line-height=0.1em>\n</line-height>";
                }
            }
        }
    }
コード例 #4
0
    public void HeroSelect_Callback(HeroData hero)
    {
        if (hero.assignedTeam != -1)
        {
            PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;
            popUpWindow.OpenTextWindow("Hero is currently assigned to a team. Remove hero from team before recycling.", 380, 200);
            popUpWindow.textField.fontSize         = 24;
            popUpWindow.textField.paragraphSpacing = 0;
            popUpWindow.textField.alignment        = TextAlignmentOptions.Center;

            popUpWindow.SetButtonValues(null, null, "Confirm", delegate { UIManager.Instance.CloseCurrentWindow(); });
            return;
        }

        UIManager.Instance.CloseCurrentWindow();

        selectedHero = hero;

        if (selectedHero == null)
        {
            buttonText.text = "Select Hero";
            textBox.text    = "";
            helpText.text   = "";
            ArchetypeButton1.gameObject.SetActive(false);
            ArchetypeButton2.gameObject.SetActive(false);
            confirmButton.interactable = false;
            return;
        }

        buttonText.text = "Lv" + hero.Level + " " + hero.Name;
        helpText.text   = "You may select one archetype to keep. Doing so will decrease the amount of XP stock gained.\n";
        textBox.text    = "XP Stock Gained: " + (hero.Experience * 0.4f).ToString("N0");

        ArchetypeButton1.image.color = Color.white;
        ArchetypeButton1.GetComponentInChildren <TextMeshProUGUI>().text = hero.PrimaryArchetype.Base.LocalizedName;
        ArchetypeButton1.gameObject.SetActive(true);

        if (hero.SecondaryArchetype != null)
        {
            ArchetypeButton2.image.color = Color.white;
            ArchetypeButton2.GetComponentInChildren <TextMeshProUGUI>().text = hero.SecondaryArchetype.Base.LocalizedName;
            ArchetypeButton2.gameObject.SetActive(true);
        }
        else
        {
            ArchetypeButton2.gameObject.SetActive(false);
        }

        confirmButton.interactable = true;
    }
コード例 #5
0
    private void OpenTutorialMessage()
    {
        PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;

        popUpWindow.OpenTextWindow("");
        popUpWindow.SetButtonValues(null, null, "Close", delegate
        {
            UIManager.Instance.CloseCurrentWindow();
            PlayerStats.hasSeenStartingMessage = true;
            SaveManager.CurrentSave.SavePlayerData();
            SaveManager.Save();
        });
        popUpWindow.textField.text             = "You should start by assigning each hero their starting ability and weapons. You'll find them by tapping the Heroes button.\n\nIn the corner of some windows, there is a question mark you can tap to bring up a help page.\n\nThis game is still under development and only up to World 3 has been added.";
        popUpWindow.textField.fontSize         = 18;
        popUpWindow.textField.paragraphSpacing = 8;
        popUpWindow.textField.alignment        = TextAlignmentOptions.Left;
    }
コード例 #6
0
    public void CraftOnClick()
    {
        PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;

        UnityEngine.Events.UnityAction confirmAction;
        string text = "";

        switch (optionType)
        {
        case CraftingOptionType.REROLL_AFFIX:
            text = "Reroll All Affixes?";
            break;

        case CraftingOptionType.REROLL_VALUES:
            text = "Reroll Affix Values?";
            break;

        case CraftingOptionType.ADD_AFFIX:
            text = "Add a Random Affix?";
            break;

        case CraftingOptionType.REMOVE_AFFIX:
            text = "Remove a Random Affix?";
            break;

        case CraftingOptionType.UPGRADE_RARITY:
            text = "Upgrade Rarity and Add a Random Affix?";
            break;

        case CraftingOptionType.TO_NORMAL:
            text = "Clear All Affixes and Turn Item To Normal?";
            break;

        default:
            return;
        }

        confirmAction = delegate { UIManager.Instance.ItemCraftingPanel.ModifyItem(optionType); UIManager.Instance.CloseCurrentWindow(); };
        popUpWindow.OpenTextWindow(text, 380, 150);
        popUpWindow.textField.fontSize         = 27;
        popUpWindow.textField.paragraphSpacing = 0;
        popUpWindow.textField.alignment        = TextAlignmentOptions.Center;

        popUpWindow.SetButtonValues("-" + costText, confirmAction, "Cancel", delegate { UIManager.Instance.CloseCurrentWindow(); });
    }
コード例 #7
0
    public void LockAffixOnClick()
    {
        if (currentItem == null)
        {
            return;
        }
        PopUpWindow popUpWindow = UIManager.Instance.PopUpWindow;

        popUpWindow.OpenVerticalWindow();

        popUpWindow.SetButtonValues("Confirm", delegate { LockAffixConfirm(); }, "Cancel", delegate { UIManager.Instance.CloseCurrentWindow(); });

        TextMeshProUGUI textSlot = Instantiate(UIManager.Instance.textPrefab);

        popUpWindow.AddObjectToViewport(textSlot.gameObject);
        previousLockCount = 0;
        selectedAffixesToLock.Clear();
        foreach (Affix affix in currentItem.prefixes.Concat(currentItem.suffixes))
        {
            Button button = Instantiate(UIManager.Instance.buttonPrefab);
            button.GetComponentInChildren <TextMeshProUGUI>().fontSize = 18;
            button.GetComponentInChildren <TextMeshProUGUI>().text     = Affix.BuildAffixString(affix.Base, 0, null, affix.GetAffixValues(), affix.GetEffectValues());
            button.onClick.AddListener(delegate { LockAffixCallback(affix, textSlot, button); });
            popUpWindow.AddObjectToViewport(button.gameObject);

            if (affix.IsLocked)
            {
                previousLockCount++;
                selectedAffixesToLock.Add(affix);
                button.image.color = Helpers.SELECTION_COLOR;
            }
            else
            {
                button.image.color = new Color(0.8f, 0.8f, 0.8f);
            }
        }

        textSlot.text = "Current Cost: 0 <sprite=10>";
    }