private void UpdateRecruitButtonState()
    {
        TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>();
        bool        flag = false;

        TroopSlot[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            TroopSlot troopSlot = array[i];
            if (troopSlot.IsEmpty())
            {
                flag = true;
                break;
            }
        }
        bool flag2 = GarrisonStatus.Resources() >= this.m_shipmentCost;

        this.m_itemResourceCostText.set_color((!flag2) ? Color.get_red() : Color.get_white());
        this.m_recruitButtonText.set_color(new Color(1f, 0.82f, 0f, 1f));
        if (!flag)
        {
            this.m_recruitButtonText.set_text(StaticDB.GetString("SLOTS_FULL", null));
            this.m_recruitButtonText.set_color(new Color(0.5f, 0.5f, 0.5f, 1f));
        }
        else if (!flag2)
        {
            this.m_recruitButtonText.set_text(StaticDB.GetString("CANT_AFFORD", "Can't Afford"));
            this.m_recruitButtonText.set_color(new Color(0.5f, 0.5f, 0.5f, 1f));
        }
        else if (this.m_isTroop)
        {
            this.m_recruitButtonText.set_text(StaticDB.GetString("RECRUIT", null));
        }
        else
        {
            this.m_recruitButtonText.set_text(StaticDB.GetString("PLACE_ORDER", null));
        }
        if (flag && flag2)
        {
            this.m_recruitTroopsButton.set_interactable(true);
        }
        else
        {
            this.m_recruitTroopsButton.set_interactable(false);
        }
    }
Exemple #2
0
    public void SetCombatAllyChampion(JamGarrisonFollower follower, int garrMissionID, int missionCost)
    {
        this.m_combatAllyMissionID = garrMissionID;
        this.m_combatAllyChampion  = follower;
        this.m_combatAllyAbilityDisplay.SetSpell(this.m_combatAllyChampion.ZoneSupportSpellID);
        this.m_combatAllySlot.SetFollower(follower.GarrFollowerID);
        GarrFollowerRec record  = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
        CreatureRec     record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeCreatureID : record.AllianceCreatureID);

        if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
        {
            this.m_combatAllyName.text = record.TitleName;
        }
        else if (record != null)
        {
            this.m_combatAllyName.text = record2.Name;
        }
        this.m_combatAllyName.color = GeneralHelpers.GetQualityColor(this.m_combatAllyChampion.Quality);
        if (missionCost <= GarrisonStatus.Resources())
        {
            this.m_useItemButtonLabel.text = StaticDB.GetString("ASSIGN_CHAMPION", null);
        }
        else
        {
            this.m_useItemButtonLabel.text    = StaticDB.GetString("CANT_AFFORD", "Can't Afford");
            this.m_useItemButtonLabel.color   = Color.red;
            this.m_useItemButton.interactable = false;
        }
        int numActiveChampions = GeneralHelpers.GetNumActiveChampions();
        int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers();

        this.m_isOverMaxChampionSoftCap = false;
        this.m_needMoreResources        = false;
        if (numActiveChampions > maxActiveFollowers)
        {
            this.m_isOverMaxChampionSoftCap = true;
        }
        if (GarrisonStatus.Resources() < missionCost)
        {
            this.m_needMoreResources = true;
        }
        this.SetCombatAllyAvailabilityStatus();
    }
Exemple #3
0
    public void Init()
    {
        FollowerInventoryListItem[] componentsInChildren = this.m_combatAllyListContent.GetComponentsInChildren <FollowerInventoryListItem>(true);
        FollowerInventoryListItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            FollowerInventoryListItem followerInventoryListItem = array[i];
            Object.DestroyImmediate(followerInventoryListItem.get_gameObject());
        }
        int         num        = 0;
        IEnumerator enumerator = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        this.CreateCombatAllyItems(jamGarrisonMobileMission.MissionRecID, (int)record.MissionCost);
                        num = (int)record.MissionCost;
                        break;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        if (num <= GarrisonStatus.Resources())
        {
            this.m_combatAllyCost.set_text(string.Concat(new object[]
            {
                StaticDB.GetString("COST2", "Cost:"),
                " <color=#ffffffff>",
                num,
                "</color>"
            }));
        }
        else
        {
            this.m_combatAllyCost.set_text(string.Concat(new object[]
            {
                StaticDB.GetString("COST2", "Cost:"),
                " <color=#ff0000ff>",
                num,
                "</color>"
            }));
        }
        Sprite sprite = GeneralHelpers.LoadCurrencyIcon(1220);

        if (sprite != null)
        {
            this.m_combatAllyCostResourceIcon.set_sprite(sprite);
        }
    }
 private void UpdateCurrencyDisplayAmount()
 {
     this.m_currencyAmountText.set_text(GarrisonStatus.Resources().ToString("N0"));
 }
Exemple #5
0
    private void UpdateRecruitButtonState()
    {
        bool flag = GarrisonStatus.Resources() >= this.m_shipmentCost;

        this.m_itemResourceCostText.color = ((!flag) ? Color.red : Color.white);
        bool flag2 = true;

        if (this.m_charShipmentRec != null && !PersistentShipmentData.CanOrderShipmentType(this.m_charShipmentRec.ID))
        {
            flag2 = false;
        }
        if (this.m_isArtifactResearch && ArtifactKnowledgeData.s_artifactKnowledgeInfo != null)
        {
            if (this.m_akResearchDisabled)
            {
                this.m_recruitTroopsButton.gameObject.SetActive(false);
            }
            if (!flag2 || ArtifactKnowledgeData.s_artifactKnowledgeInfo.CurrentLevel >= ArtifactKnowledgeData.s_artifactKnowledgeInfo.MaxLevel)
            {
                this.m_recruitButtonText.text           = StaticDB.GetString("PLACE_ORDER", null);
                this.m_recruitButtonText.color          = new Color(0.5f, 0.5f, 0.5f, 1f);
                this.m_recruitTroopsButton.interactable = false;
                return;
            }
        }
        TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        bool        flag3 = false;

        foreach (TroopSlot troopSlot in componentsInChildren)
        {
            if (troopSlot.IsEmpty())
            {
                flag3 = true;
                break;
            }
        }
        this.m_recruitButtonText.color = new Color(1f, 0.82f, 0f, 1f);
        if (!flag3)
        {
            this.m_recruitButtonText.text  = StaticDB.GetString("SLOTS_FULL", null);
            this.m_recruitButtonText.color = new Color(0.5f, 0.5f, 0.5f, 1f);
        }
        else if (!flag)
        {
            this.m_recruitButtonText.text  = StaticDB.GetString("CANT_AFFORD", "Can't Afford");
            this.m_recruitButtonText.color = new Color(0.5f, 0.5f, 0.5f, 1f);
        }
        else if (this.m_isTroop)
        {
            this.m_recruitButtonText.text = StaticDB.GetString("RECRUIT", null);
        }
        else
        {
            this.m_recruitButtonText.text = StaticDB.GetString("PLACE_ORDER", null);
        }
        if (flag3 && flag && flag2)
        {
            this.m_recruitTroopsButton.interactable = true;
        }
        else
        {
            this.m_recruitTroopsButton.interactable = false;
            this.m_recruitButtonText.color          = new Color(0.5f, 0.5f, 0.5f, 1f);
        }
    }
    public void SetTalent(TalentTreeItemAbilityButton abilityButton)
    {
        this.m_abilityButton = abilityButton;
        this.m_garrTalentRec = StaticDB.garrTalentDB.GetRecord(abilityButton.GetTalentID());
        this.m_talentName.set_text(this.m_garrTalentRec.Name);
        this.m_talentDescription.set_text(WowTextParser.parser.Parse(this.m_garrTalentRec.Description, 0));
        this.m_talentDescription.set_supportRichText(WowTextParser.parser.IsRichText());
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, this.m_garrTalentRec.IconFileDataID);

        if (sprite != null)
        {
            this.m_abilityIcon.set_sprite(sprite);
        }
        this.m_researchTimeAndCostSection.SetActive(false);
        int num = (!abilityButton.CanRespec()) ? this.m_garrTalentRec.ResearchCost : this.m_garrTalentRec.RespecCost;

        this.m_resourceCostText.set_text(((GarrisonStatus.Resources() >= num) ? "<color=#ffffffff>" : "<color=#FF0000FF>") + ((!abilityButton.CanRespec()) ? this.m_garrTalentRec.ResearchCost : this.m_garrTalentRec.RespecCost) + "</color>");
        Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon((int)this.m_garrTalentRec.ResearchCostCurrencyTypesID);

        if (sprite2 != null)
        {
            this.m_resourceIcon.set_sprite(sprite2);
        }
        Duration duration = new Duration((!abilityButton.CanRespec()) ? this.m_garrTalentRec.ResearchDurationSecs : this.m_garrTalentRec.RespecDurationSecs, false);

        this.m_researchDurationText.set_text(duration.DurationString);
        this.m_yourResourcesDisplayObj.SetActive(false);
        if (abilityButton.CanResearch() || abilityButton.CanRespec())
        {
            this.m_availableForResearchSection.SetActive(true);
            this.m_unavailableForResearchSection.SetActive(false);
            this.m_researchOrRespecText.set_text((!abilityButton.CanRespec()) ? StaticDB.GetString("RESEARCH", null) : StaticDB.GetString("RESPEC", null));
            this.m_yourResourcesDisplayObj.SetActive(true);
            this.m_researchTimeAndCostSection.SetActive(true);
        }
        else
        {
            this.m_availableForResearchSection.SetActive(false);
            this.m_unavailableForResearchSection.SetActive(true);
            if (this.m_abilityButton.IsOwned())
            {
                this.m_yourResourcesDisplayObj.SetActive(false);
                this.m_statusText.set_text("<color=#ffffffff>" + StaticDB.GetString("TALENT_OWNED", null) + "</color>");
            }
            else if (this.m_abilityButton.IsResearching())
            {
                Duration duration2 = new Duration((!abilityButton.IsRespec()) ? ((int)this.m_abilityButton.GetRemainingResearchTime()) : ((int)this.m_abilityButton.GetRemainingRespecTime()), false);
                this.m_statusText.set_text(string.Concat(new string[]
                {
                    "<color=#FFC600FF>",
                    StaticDB.GetString("TIME_LEFT", null),
                    "</color> <color=#ffffffff>",
                    duration2.DurationString,
                    "</color>"
                }));
            }
            else if (GarrisonStatus.Resources() < num)
            {
                this.m_researchTimeAndCostSection.SetActive(true);
                this.m_yourResourcesDisplayObj.SetActive(true);
                this.m_statusText.set_text("<color=#FF0000FF>" + StaticDB.GetString("NEED_MORE_RESOURCES", null) + "</color>");
            }
            else if (this.m_talentTreePanel.AnyTalentIsResearching())
            {
                this.m_statusText.set_text("<color=#FF0000FF>" + StaticDB.GetString("ALREADY_RESEARCHING", null) + "</color>");
            }
            else
            {
                string whyCantResearch = this.m_abilityButton.GetWhyCantResearch();
                if (whyCantResearch != null && whyCantResearch != string.Empty)
                {
                    this.m_statusText.set_text("<color=#FF0000FF>" + whyCantResearch + "</color>");
                }
                else
                {
                    this.m_statusText.set_text("<color=#FF0000FF>" + StaticDB.GetString("MUST_RESEARCH_PREVIOUS_TIER", null) + "</color>");
                }
            }
        }
    }