public void InitPanel(int contributionID, int questID)
        {
            if (this.m_grayscaleShader != null)
            {
                Material material = new Material(this.m_grayscaleShader);
                this.m_buildingTitleBanner.material = material;
            }
            this.m_questID                    = questID;
            this.m_contributionID             = contributionID;
            this.m_buildingName.font          = GeneralHelpers.LoadFancyFont();
            this.m_buildingState.font         = GeneralHelpers.LoadStandardFont();
            this.m_buildingDescription.font   = GeneralHelpers.LoadStandardFont();
            this.m_costLabel.font             = GeneralHelpers.LoadStandardFont();
            this.m_cost.font                  = GeneralHelpers.LoadStandardFont();
            this.m_contributeButtonLabel.font = GeneralHelpers.LoadStandardFont();
            this.m_cantContributeText.font    = GeneralHelpers.LoadStandardFont();
            this.m_cantContributeText.text    = StaticDB.GetString("CANT_CONTRIBUTE", "You can only contribute when the building is under construction.");
            this.m_healthText.font            = GeneralHelpers.LoadStandardFont();
            this.m_gotLootLabel.font          = GeneralHelpers.LoadStandardFont();
            this.m_gotLootLabel.text          = StaticDB.GetString("YOU_RECEIVED_ITEM", "You received item: (PH)");
            this.m_gotLootItemName.font       = GeneralHelpers.LoadStandardFont();
            this.m_gotLootArea.SetActive(false);
            if (!LegionfallData.legionfallDictionary.ContainsKey(contributionID))
            {
                return;
            }
            WrapperContribution contribution = LegionfallData.legionfallDictionary[contributionID].contribution;

            this.m_buildingStateImageFrame_building.gameObject.SetActive(false);
            this.m_buildingStateImageFrame_active.gameObject.SetActive(false);
            this.m_buildingStateImageFrame_underAttack.gameObject.SetActive(false);
            this.m_buildingStateImageFrame_destroyed.gameObject.SetActive(false);
            this.m_contributeArea.SetActive(false);
            this.m_cantContributeArea.SetActive(true);
            this.m_healthText.gameObject.SetActive(true);
            this.m_buildingTitleBanner.material.SetFloat("_GrayscaleAmount", (contribution.State != 4) ? 0f : 1f);
            this.m_buildingTitleBanner.color = ((contribution.State != 4) ? Color.white : Color.gray);
            this.m_progressFillGlow.gameObject.SetActive(false);
            int num;

            switch (contribution.State)
            {
            case 1:
                this.m_progressFillGlow.gameObject.SetActive(true);
                num = contribution.UitextureAtlasMemberIDUnderConstruction;
                this.m_buildingState.text  = StaticDB.GetString("UNDER_CONSTRUCTION", "Under Construction (PH)");
                this.m_buildingState.color = new Color(1f, 0.8235f, 0f, 1f);
                this.m_buildingStateImageFrame_building.gameObject.SetActive(true);
                this.m_contributeArea.SetActive(true);
                this.m_cantContributeArea.SetActive(false);
                this.m_progressFillBar.sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_BarFilling_UnderConstruction");
                break;

            case 2:
                num = contribution.UitextureAtlasMemberIDActive;
                this.m_buildingState.text  = StaticDB.GetString("BUILDING_ACTIVE", "Building Active (PH)");
                this.m_buildingState.color = new Color(0f, 1f, 0f, 1f);
                this.m_buildingStateImageFrame_active.gameObject.SetActive(true);
                this.m_progressFillBar.sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_BarFilling_Active");
                break;

            case 3:
                num = contribution.UitextureAtlasMemberIDUnderAttack;
                this.m_buildingState.text  = StaticDB.GetString("UNDER_ATTACK", "Under Attack (PH)");
                this.m_buildingState.color = new Color(1f, 0f, 0f, 1f);
                this.m_buildingStateImageFrame_underAttack.gameObject.SetActive(true);
                this.m_progressFillBar.sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_BarFilling_UnderAttack");
                break;

            case 4:
                num = contribution.UitextureAtlasMemberIDDestroyed;
                this.m_buildingState.text  = StaticDB.GetString("DESTROYED", "Destroyed (PH)");
                this.m_buildingState.color = new Color(0.6f, 0.6f, 0.6f, 1f);
                this.m_buildingStateImageFrame_destroyed.gameObject.SetActive(true);
                this.m_progressFillBar.sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_BarFilling_UnderConstruction");
                break;

            default:
                return;
            }
            Sprite sprite = null;

            switch (num)
            {
            case 6318:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_CommandCenter_Active-v2");
                break;

            case 6319:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_CommandCenter_Destroyed-v2");
                break;

            case 6320:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_CommandCenter_UnderAttack-v2");
                break;

            case 6321:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_CommandCenter_UnderConstruction-v2");
                break;

            case 6322:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_MageTower_Active-v2");
                break;

            case 6323:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_MageTower_Destroyed-v2");
                break;

            case 6324:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_MageTower_UnderAttack-v2");
                break;

            case 6325:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_MageTower_UnderConstruction-v2");
                break;

            case 6326:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_NetherDisruptor_Active-v2");
                break;

            case 6327:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_NetherDisruptor_Destroyed-v2");
                break;

            case 6328:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_NetherDisruptor_UnderAttack-v2");
                break;

            case 6329:
                sprite = AssetBundleManager.LoadAsset <Sprite>(LegionfallBuildingPanel.LegionfallBundleName, "LegionfallCompanion_NetherDisruptor_UnderConstruction-v2");
                break;
            }
            if (sprite != null)
            {
                this.m_buildingStateImage.sprite = sprite;
            }
            this.m_buildingName.text                 = contribution.Name;
            this.m_buildingDescription.text          = GeneralHelpers.LimitZhLineLength(contribution.Description, 16);
            this.m_progressFillBar.fillAmount        = contribution.UnitCompletion;
            this.m_progressFillGlow.anchorMin        = new Vector2(this.m_progressFillBar.fillAmount, 0.5f);
            this.m_progressFillGlow.anchorMax        = new Vector2(this.m_progressFillBar.fillAmount, 0.5f);
            this.m_progressFillGlow.anchoredPosition = Vector2.zero;
            if (contribution.State == 3)
            {
                this.m_healthText.text = StaticDB.GetString("TIME_LEFT", "Time Left (PH):") + " 123 Hours";
            }
            else
            {
                this.m_healthText.text = ((int)(this.m_progressFillBar.fillAmount * 100f)).ToString() + "%";
            }
            this.m_costLabel.text = StaticDB.GetString("COST", null);
            if (LegionfallData.WarResources() >= contribution.ContributionCurrencyCost)
            {
                this.m_cost.text = LegionfallData.WarResources().ToString("N0") + "/" + contribution.ContributionCurrencyCost;
                this.m_contributeButton.interactable = true;
                this.m_contributeButtonLabel.color   = new Color(1f, 0.859f, 0f, 1f);
            }
            else
            {
                this.m_cost.text = string.Concat(new object[]
                {
                    "<color=#ff0000ff>",
                    LegionfallData.WarResources().ToString("N0"),
                    "</color>/",
                    contribution.ContributionCurrencyCost
                });
                this.m_contributeButton.interactable = false;
                this.m_contributeButtonLabel.color   = new Color(0.6f, 0.6f, 0.6f, 1f);
            }
            this.m_currencyIcon.sprite        = GeneralHelpers.LoadCurrencyIcon(contribution.ContributionCurrencyType);
            this.m_contributeButtonLabel.text = StaticDB.GetString("CONTRIBUTE", "Contribute (PH)");
            SpellDisplay[] componentsInChildren = this.m_buffArea.GetComponentsInChildren <SpellDisplay>();
            foreach (SpellDisplay spellDisplay in componentsInChildren)
            {
                Object.Destroy(spellDisplay.gameObject);
            }
            foreach (int spell in contribution.Spells)
            {
                SpellDisplay spellDisplay2 = Object.Instantiate <SpellDisplay>(this.m_legionfallBuffSpellDisplayPrefab);
                spellDisplay2.transform.SetParent(this.m_buffArea, false);
                spellDisplay2.SetSpell(spell);
                spellDisplay2.SetLocked(contribution.State != 2 && contribution.State != 3);
            }
            iTween.Stop(base.gameObject);
            this.m_progressBarGlow.color      = new Color(1f, 1f, 1f, 0f);
            this.m_progressFillGlowGlow.color = new Color(1f, 1f, 1f, 0f);
        }
Пример #2
0
        public void SetFollower(int followerID)
        {
            this.m_garrFollowerID = followerID;
            if (followerID == 0)
            {
                RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform)
                    {
                        Object.Destroy(componentsInChildren[i].gameObject);
                    }
                }
                AbilityDisplay[] componentsInChildren2 = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                for (int j = 0; j < componentsInChildren2.Length; j++)
                {
                    Object.Destroy(componentsInChildren2[j].gameObject);
                }
            }
            if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID))
            {
                return;
            }
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID);

            if (record == null)
            {
                return;
            }
            CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID);

            if (record2 == null)
            {
                return;
            }
            WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[followerID];
            string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
            Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text);

            if (sprite != null)
            {
                this.followerSnapshot.sprite = sprite;
            }
            RectTransform[] componentsInChildren3 = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
            for (int k = 0; k < componentsInChildren3.Length; k++)
            {
                if (componentsInChildren3[k] != null && componentsInChildren3[k] != this.traitsAndAbilitiesRootObject.transform)
                {
                    Object.Destroy(componentsInChildren3[k].gameObject);
                }
            }
            bool flag = false;

            for (int l = 0; l < follower.AbilityIDs.Count; l++)
            {
                GarrAbilityRec record3 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[l]);
                if ((record3.Flags & 512u) != 0u)
                {
                    if (!flag)
                    {
                        GameObject gameObject = Object.Instantiate <GameObject>(this.specializationHeaderPrefab);
                        gameObject.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        flag = true;
                        Text component = gameObject.GetComponent <Text>();
                        if (component != null)
                        {
                            component.text = StaticDB.GetString("SPECIALIZATION", null);
                        }
                    }
                    GameObject gameObject2 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                    gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>();
                    component2.SetAbility(record3.ID, false, false, null);
                }
            }
            bool flag2 = false;

            for (int m = 0; m < follower.AbilityIDs.Count; m++)
            {
                GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[m]);
                if ((record4.Flags & 1u) == 0u)
                {
                    if ((record4.Flags & 512u) == 0u)
                    {
                        if (!flag2)
                        {
                            GameObject gameObject3 = Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab);
                            gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                            flag2 = true;
                            Text component3 = gameObject3.GetComponent <Text>();
                            if (component3 != null)
                            {
                                component3.text = StaticDB.GetString("ABILITIES", null);
                            }
                        }
                        GameObject gameObject4 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                        gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        AbilityDisplay component4 = gameObject4.GetComponent <AbilityDisplay>();
                        component4.SetAbility(follower.AbilityIDs[m], false, false, null);
                    }
                }
            }
            if (follower.ZoneSupportSpellID > 0)
            {
                GameObject gameObject5 = Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab);
                gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_spellDisplayPrefab);
                gameObject6.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                SpellDisplay component5 = gameObject6.GetComponent <SpellDisplay>();
                component5.SetSpell(follower.ZoneSupportSpellID);
                Text componentInChildren = gameObject5.GetComponentInChildren <Text>();
                if (componentInChildren != null)
                {
                    componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null);
                }
            }
            bool flag3 = (follower.Flags & 8) != 0;

            if (flag3)
            {
                GarrStringRec record5 = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID);
                if (record5 != null)
                {
                    Text text2 = Object.Instantiate <Text>(this.m_troopDescriptionPrefab);
                    text2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    text2.text = record5.Text;
                    text2.font = FontLoader.LoadStandardFont();
                }
            }
            this.InitEquipmentSlots(follower);
            this.UpdateChampionButtons(follower);
        }