Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (cachedSovereignName != GameDataManager.Instance.dataStore.sovereignName)
     {
         cachedSovereignName     = GameDataManager.Instance.dataStore.sovereignName;
         sovereignNameLabel.text = strings[0] + GameDataManager.Instance.dataStore.sovereignName;
     }
     if (cachedSovereignMugshot != GameDataManager.Instance.dataStore.sovereignMugshot)
     {
         cachedSovereignMugshot  = GameDataManager.Instance.dataStore.sovereignMugshot;
         sovereignMugshot.sprite = GameDataManager.Instance.dataStore.sovereignAdventurer.GetMugshotGraphic();
     }
     if (cachedSovereignTactic != GameDataManager.Instance.dataStore.sovereignTactic)
     {
         cachedSovereignTactic    = GameDataManager.Instance.dataStore.sovereignTactic;
         sovereignTacticDesc.text = Adventurer.GetAttackDescription(GameDataManager.Instance.dataStore.sovereignTactic);
     }
     if (cachedSovereignSpecial != GameDataManager.Instance.dataStore.sovereignSkill)
     {
         cachedSovereignSpecial    = GameDataManager.Instance.dataStore.sovereignSkill;
         sovereignSpecialDesc.text = Adventurer.GetSpecialDescription(GameDataManager.Instance.dataStore.sovereignSkill);
     }
     if (cachedSovereignTitle != GameDataManager.Instance.dataStore.sovereignAdventurer.fullTitle)
     {
         cachedSovereignTitle    = GameDataManager.Instance.dataStore.sovereignAdventurer.fullTitle;
         sovereignTitleArea.text = cachedSovereignTitle;
     }
     if (cachedSovereignWpn != GameDataManager.Instance.dataStore.sovWpn_Set)
     {
         UpdateTextFieldWithWpnInfo(GameDataManager.Instance.dataStore.sovWpn_Set, ref cachedSovereignWpn, ref strings, ref sovereignWpnArea);
     }
     if (rowPlacementButton != null && rowPlacementButton.interactable != (GameDataManager.Instance.dataStore.sovereignEquippedWeaponType == WpnType.Knives))
     {
         rowPlacementButton.interactable = (GameDataManager.Instance.dataStore.sovereignEquippedWeaponType == WpnType.Knives);
     }
     if (cachedSovereignRowState != GameDataManager.Instance.dataStore.sovereignOnBackRow)
     {
         cachedSovereignRowState = GameDataManager.Instance.dataStore.sovereignOnBackRow;
         if (cachedSovereignRowState)
         {
             rowPlacementArea.text = strings[35];
         }
         else
         {
             rowPlacementArea.text = strings[34];
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (adventurer == null)
        {
            if (GameDataManager.Instance.dataStore.houseAdventurers[houseAdventurerIndex] != null && GameDataManager.Instance.dataStore.housingLevel > houseAdventurerIndex)
            {
                adventurer = GameDataManager.Instance.dataStore.houseAdventurers[houseAdventurerIndex];
            }
        }
        if (adventurer != null && adventurer.initialized)
        {
            if (panelBG != null)
            {
                if (housePopup != null)
                {
                    if (housePopup.inspectedAdventurer == adventurer)
                    {
                        panelBG.color = activeColor;
                    }
                    else
                    {
                        panelBG.color = defaultColor;
                    }
                }
                else if (swapPopup != null)
                {
                    if (swapPopup.partyMemberIndexInMainArray == houseAdventurerIndex)
                    {
                        panelBG.color = activeColor;
                    }
                    else if (houseAdventurerIndex == GameDataManager.Instance.dataStore.partyAdventurer0Index || houseAdventurerIndex == GameDataManager.Instance.dataStore.partyAdventurer1Index || houseAdventurerIndex == GameDataManager.Instance.dataStore.partyAdventurer2Index)
                    {
                        panelBG.color = Color.clear;
                    }
                    else
                    {
                        panelBG.color = defaultColor;
                    }
                }
            }
            if (selfButton != null)
            {
                if (housePopup != null)
                {
                    selfButton.interactable = (housePopup.inspectedAdventurer != adventurer);
                }
                else if (swapPopup != null)
                {
                    selfButton.interactable = swapPopup.partyMemberIndexInMainArray == houseAdventurerIndex || (houseAdventurerIndex != GameDataManager.Instance.dataStore.partyAdventurer0Index && houseAdventurerIndex != GameDataManager.Instance.dataStore.partyAdventurer1Index && houseAdventurerIndex != GameDataManager.Instance.dataStore.partyAdventurer2Index);
                }
            }
            if (interior != null)
            {
                if (!interior.activeInHierarchy)
                {
                    interior.SetActive(true);
                }
            }

            if (adventurerName.text != adventurer.fullName)
            {
                adventurerName.text = adventurer.fullName;
            }
            if (adventurerTitle.text != adventurer.title)
            {
                adventurerTitle.text = adventurer.title;
            }
            if (cachedAdventurerMugshot != adventurer.mugshot)
            {
                cachedAdventurerMugshot = adventurer.mugshot;
                mugshot.sprite          = adventurer.GetMugshotGraphic();
            }
            if (adventurerStats != null)
            {
                if (cachedAdventurerStats[0] != adventurer.HP || cachedAdventurerStats[1] != adventurer.Martial || cachedAdventurerStats[2] != adventurer.Magic || cachedAdventurerStats[3] != adventurer.Speed)
                {
                    cachedAdventurerStats = new int[] { adventurer.HP, adventurer.Martial, adventurer.Magic, adventurer.Speed };
                    adventurerStats.text  = strings[0] + cachedAdventurerStats[0].ToString() + strings[1] + cachedAdventurerStats[1].ToString() + strings[2] +
                                            cachedAdventurerStats[2].ToString() + strings[3] + cachedAdventurerStats[3].ToString();
                }
            }
            if (adventurerSpecial != null)
            {
                if (cachedAdventurerSpecial != adventurer.special)
                {
                    cachedAdventurerSpecial = adventurer.special;
                    adventurerSpecial.text  = Adventurer.GetSpecialDescription(cachedAdventurerSpecial);
                }
            }
            if (adventurerAttacks != null)
            {
                if (cachedAdventurerAttacks[0] != adventurer.attacks[0] || cachedAdventurerAttacks[1] != adventurer.attacks[1])
                {
                    cachedAdventurerAttacks = adventurer.attacks.Clone() as BattlerAction[];
                    string[] attacksStrings = { "", "" };
                    for (int i = 0; i < cachedAdventurerAttacks.Length && i < 2; i++)
                    {
                        if (cachedAdventurerAttacks[i] != BattlerAction.None)
                        {
                            attacksStrings[i] = Adventurer.GetAttackName(cachedAdventurerAttacks[i]);
                        }
                        else
                        {
                            attacksStrings[i] = "";
                        }
                    }
                    adventurerAttacks.text = attacksStrings[0] + System.Environment.NewLine + attacksStrings[1];
                }
            }
        }
        else if (interior != null && interior.activeInHierarchy)
        {
            interior.SetActive(false);
        }
    }
 void Start()
 {
     calledShotsText.text = Adventurer.GetSpecialDescription(AdventurerSpecial.CalledShots);
     hammerSmashText.text = Adventurer.GetSpecialDescription(AdventurerSpecial.HammerSmash);
     protectText.text     = Adventurer.GetSpecialDescription(AdventurerSpecial.Protect);
 }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        if (GameDataManager.Instance.dataStore.housingLevel != houseLvCached)
        {
            RecalcScrollRectSize();
        }
        if (outbuildingButton != null)
        {
            if (housingUnitUpgraded && outbuildingButton.IsActive())
            {
                outbuildingButton.gameObject.SetActive(false);
            }
            else if (!housingUnitUpgraded && !outbuildingButton.IsActive())
            {
                outbuildingButton.gameObject.SetActive(true);
            }
        }
        if (promoteButton != null)
        {
            bool v = false;
            if (inspectedAdventurer.advClass == AdventurerClass.Warrior)
            {
                for (int i = 1; i > 1 << 31;)
                {
                    if (GameDataManager.Instance.WarriorPromoteUnlocked((WarriorPromotes)i))
                    {
                        v = true;
                        break;
                    }
                    i = i << 1;
                }
            }
            else if (inspectedAdventurer.advClass == AdventurerClass.Mystic)
            {
                for (int i = 1; i > 1 << 31;)
                {
                    if (GameDataManager.Instance.MysticPromoteUnlocked((MysticPromotes)i))
                    {
                        v = true;
                        break;
                    }
                    i = i << 1;
                }
            }
            if (promoteButton.activeSelf != v)
            {
                promoteButton.SetActive(v);
            }
        }
        if (inspectedAdventurer.fullName != cachedName)
        {
            cachedName     = inspectedAdventurer.fullName;
            nameLabel.text = strings[4] + inspectedAdventurer.fullName;
        }
        if (cachedAdventurerMugshot != inspectedAdventurer.mugshot)
        {
            cachedAdventurerMugshot = inspectedAdventurer.mugshot;
            mugshot.sprite          = inspectedAdventurer.GetMugshotGraphic();
        }
        if (inspectedAdventurer.title != titleLabel.text)
        {
            titleLabel.text = inspectedAdventurer.title;
        }
        if (adventurerHPCached != inspectedAdventurer.HP || adventurerMartialCached != inspectedAdventurer.Martial ||
            adventurerMagicCached != inspectedAdventurer.Magic || adventurerSpeedCached != inspectedAdventurer.Speed)
        {
            adventurerHPCached      = inspectedAdventurer.HP;
            adventurerMartialCached = inspectedAdventurer.Martial;
            adventurerMagicCached   = inspectedAdventurer.Magic;
            adventurerSpeedCached   = inspectedAdventurer.Speed;
            statsLabel.text         = strings[0] + adventurerHPCached.ToString() + strings[1] + adventurerMartialCached.ToString() + strings[2] + adventurerMagicCached.ToString() + strings[3] + adventurerSpeedCached.ToString();
        }
        bool attacksChanged = false;

        if (adventurerAttacksCached == null || adventurerAttacksCached.Length != inspectedAdventurer.attacks.Length)
        {
            attacksChanged = true;
        }
        else
        {
#pragma warning disable 162 // VS reports a false-alarm unreachable code warning on the next line because of the compound loop conditional, so we silence that - and, yes, it is a false alarm
            for (int i = 0; (i < adventurerAttacksCached.Length && i < inspectedAdventurer.attacks.Length); i++)
#pragma warning restore 162 // because we _do_ want to know if unreachable code is detected, it's just not actually present there
            {
                attacksChanged = true;
                break;
            }
        }
        if (attacksChanged)
        {
            string[] attacksStrings = { "", "", "" };
            adventurerAttacksCached = inspectedAdventurer.attacks;
            for (int i = 0; i < adventurerAttacksCached.Length && i < 3; i++)
            {
                if (inspectedAdventurer.attacks[i] != BattlerAction.None)
                {
                    attacksStrings[i] = Adventurer.GetAttackName(inspectedAdventurer.attacks[i]);
                }
                else
                {
                    attacksStrings[i] = "";
                }
            }
            attacksLabel.text = attacksStrings[0] + '\n' + attacksStrings[1] + '\n' + attacksStrings[2];
        }
        if (adventurerSpecialCached != inspectedAdventurer.special)
        {
            adventurerSpecialCached = inspectedAdventurer.special;
            specialLabel.text       = Adventurer.GetSpecialDescription(adventurerSpecialCached);
        }
        if (awakenButton != null)
        {
            if (inspectedAdventurer.isElite)
            {
                if ((inspectedAdventurer.awakened == awakenButton.gameObject.activeSelf))
                {
                    awakenButton.gameObject.SetActive(!inspectedAdventurer.awakened);
                    awakenedLabel.gameObject.SetActive(!awakenButton.gameObject.activeSelf);
                }
            }
            else if (awakenButton.gameObject.activeSelf || awakenedLabel.gameObject.activeSelf)
            {
                awakenButton.gameObject.SetActive(false);
                awakenedLabel.gameObject.SetActive(false);
            }
        }
        if (biography.text != inspectedAdventurer.bioText)
        {
            biography.text = inspectedAdventurer.bioText;
        }
    }