コード例 #1
0
 private void Start()
 {
     if (Main.instance.IsNarrowScreen())
     {
         if (this.m_troopSpecificArea != null)
         {
             Main.instance.NudgeX(ref this.m_troopSpecificArea, 30f);
         }
         if (this.m_itemSpecificArea != null)
         {
             Main.instance.NudgeX(ref this.m_itemSpecificArea, 30f);
         }
         if (this.m_troopSlotsRootObject != null)
         {
             GridLayoutGroup component = this.m_troopSlotsRootObject.GetComponent <GridLayoutGroup>();
             if (component != null)
             {
                 Vector2 vector2 = component.spacing;
                 vector2.x         = 20f;
                 component.spacing = vector2;
             }
         }
     }
     if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
     {
         this.m_hordeBanner.SetActive(true);
         this.m_allianceBanner.SetActive(false);
     }
     else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE)
     {
         this.m_hordeBanner.SetActive(false);
         this.m_allianceBanner.SetActive(true);
     }
     Main.instance.ShipmentAddedAction += new Action <int, ulong>(this.HandleShipmentAdded);
     this.m_troopResourceCostText.font  = GeneralHelpers.LoadStandardFont();
     this.m_itemResourceCostText.font   = GeneralHelpers.LoadStandardFont();
     this.m_recruitButtonText.font      = GeneralHelpers.LoadStandardFont();
     this.m_itemName.font        = GeneralHelpers.LoadStandardFont();
     this.m_youReceivedLoot.font = GeneralHelpers.LoadStandardFont();
     this.m_youReceivedLoot.text = StaticDB.GetString("YOU_RECEIVED_LOOT", "You received loot:");
     this.m_akHintText.font      = FontLoader.LoadStandardFont();
     this.m_artifactKnowledgeLevelIncreasedLabel.font = GeneralHelpers.LoadStandardFont();
     this.m_artifactKnowledgeLevelIncreasedLabel.gameObject.SetActive(false);
 }
コード例 #2
0
 public void SetValue(int newValue, bool instant, float delayStartTimerTime = 0f)
 {
     this.m_actualValue = newValue;
     this.m_instant     = instant;
     this.m_timeRemainingUntilStartTimer = delayStartTimerTime;
     this.m_startedTimer = false;
     if (instant)
     {
         this.m_currentValue = newValue;
         if (this.m_numberLabel != null)
         {
             this.m_numberText.text = GeneralHelpers.TextOrderString(newValue.ToString(), this.m_numberLabel);
         }
         else
         {
             this.m_numberText.text = newValue.ToString();
         }
         this.m_numberText.font = FontLoader.LoadStandardFont();
     }
     this.m_initialized = true;
 }
コード例 #3
0
        private void Start()
        {
            if (Main.instance.IsNarrowScreen())
            {
                if (this.m_troopSpecificArea != null)
                {
                    Main.instance.NudgeX(ref this.m_troopSpecificArea, 30f);
                }
                if (this.m_itemSpecificArea != null)
                {
                    Main.instance.NudgeX(ref this.m_itemSpecificArea, 30f);
                }
                if (this.m_troopSlotsRootObject != null)
                {
                    GridLayoutGroup component = this.m_troopSlotsRootObject.GetComponent <GridLayoutGroup>();
                    if (component != null)
                    {
                        Vector2 spacing = component.spacing;
                        spacing.x         = 10f;
                        component.spacing = spacing;
                    }
                }
            }
            Main instance = Main.instance;

            instance.ShipmentAddedAction      = (Action <int, ulong>)Delegate.Combine(instance.ShipmentAddedAction, new Action <int, ulong>(this.HandleShipmentAdded));
            this.m_troopName.font             = GeneralHelpers.LoadStandardFont();
            this.m_troopResourceCostText.font = GeneralHelpers.LoadStandardFont();
            this.m_itemResourceCostText.font  = GeneralHelpers.LoadStandardFont();
            this.m_recruitButtonText.font     = GeneralHelpers.LoadStandardFont();
            this.m_itemName.font        = GeneralHelpers.LoadStandardFont();
            this.m_youReceivedLoot.font = GeneralHelpers.LoadStandardFont();
            this.m_youReceivedLoot.text = StaticDB.GetString("YOU_RECEIVED_LOOT", "You received loot:");
            this.m_akHintText.font      = FontLoader.LoadStandardFont();
            this.m_artifactKnowledgeLevelIncreasedLabel.font = GeneralHelpers.LoadStandardFont();
            this.m_artifactKnowledgeLevelIncreasedLabel.gameObject.SetActive(false);
        }
コード例 #4
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);
        }
コード例 #5
0
 public static Font LoadStandardFont()
 {
     return(FontLoader.LoadStandardFont());
 }
コード例 #6
0
 public static Font LoadFancyFont()
 {
     return(FontLoader.LoadFancyFont());
 }
コード例 #7
0
 private void Start()
 {
     this.m_rewardsLabel.font = FontLoader.LoadStandardFont();
     this.m_rewardsLabel.text = StaticDB.GetString("REWARDS", "Rewards");
     this.m_timeLeftString    = StaticDB.GetString("TIME_LEFT", "Time Left: PH");
 }
コード例 #8
0
 private void Awake()
 {
     this.m_icons          = new List <StackableMapIcon>();
     this.m_iconCount.font = FontLoader.LoadStandardFont();
 }
コード例 #9
0
 protected override void Awake()
 {
     base.font         = FontLoader.LoadFont(this.fontType);
     this.waitingForDB = !StaticDB.StringsAvailable();
     this.LoadStringFromDB();
 }
コード例 #10
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 < (int)componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform)
                    {
                        UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
                    }
                }
                AbilityDisplay[] abilityDisplayArray = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                for (int j = 0; j < (int)abilityDisplayArray.Length; j++)
                {
                    UnityEngine.Object.Destroy(abilityDisplayArray[j].gameObject);
                }
            }
            if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID))
            {
                return;
            }
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID);

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

            if (creatureRec == null)
            {
                return;
            }
            WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[followerID];
            int    d      = creatureRec.ID;
            string str    = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png");
            Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str);

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

            for (int l = 0; l < item.AbilityIDs.Count; l++)
            {
                GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[l]);
                if ((garrAbilityRec.Flags & 512) != 0)
                {
                    if (!flag)
                    {
                        GameObject gameObject = UnityEngine.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 gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                    gameObject1.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    AbilityDisplay abilityDisplay = gameObject1.GetComponent <AbilityDisplay>();
                    abilityDisplay.SetAbility(garrAbilityRec.ID, false, false, null);
                }
            }
            bool flag1 = false;

            for (int m = 0; m < item.AbilityIDs.Count; m++)
            {
                GarrAbilityRec record1 = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[m]);
                if ((record1.Flags & 1) == 0)
                {
                    if ((record1.Flags & 512) == 0)
                    {
                        if (!flag1)
                        {
                            GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab);
                            gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                            flag1 = true;
                            Text text = gameObject2.GetComponent <Text>();
                            if (text != null)
                            {
                                text.text = StaticDB.GetString("ABILITIES", null);
                            }
                        }
                        GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                        gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        AbilityDisplay component1 = gameObject3.GetComponent <AbilityDisplay>();
                        component1.SetAbility(item.AbilityIDs[m], false, false, null);
                    }
                }
            }
            if (item.ZoneSupportSpellID > 0)
            {
                GameObject gameObject4 = UnityEngine.Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab);
                gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                GameObject gameObject5 = UnityEngine.Object.Instantiate <GameObject>(this.m_spellDisplayPrefab);
                gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                gameObject5.GetComponent <SpellDisplay>().SetSpell(item.ZoneSupportSpellID);
                Text componentInChildren = gameObject4.GetComponentInChildren <Text>();
                if (componentInChildren != null)
                {
                    componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null);
                }
            }
            if ((item.Flags & 8) != 0)
            {
                GarrStringRec garrStringRec = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID));
                if (garrStringRec != null)
                {
                    Text text1 = UnityEngine.Object.Instantiate <Text>(this.m_troopDescriptionPrefab);
                    text1.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    text1.text = garrStringRec.Text;
                    text1.font = FontLoader.LoadStandardFont();
                }
            }
            this.InitEquipmentSlots(item);
            this.UpdateChampionButtons(item);
        }