Beispiel #1
0
    public void SetContent(SpellDefinition spellDefinition, Empire empire, GameObject client, bool isInTargetingPhase, bool thereAlreadyIsASpellCasted, Encounter encounter)
    {
        if (empire == null)
        {
            return;
        }
        this.SpellDefinition = spellDefinition;
        this.Empire          = empire;
        this.client          = client;
        this.ShowIcon();
        this.AgeTransform.AgeTooltip.Content    = this.SpellDefinition.Name;
        this.AgeTransform.AgeTooltip.Class      = "Spell";
        this.AgeTransform.AgeTooltip.ClientData = new SpellDefinitionTooltipData(this.Empire, this.Empire, this.SpellDefinition, encounter);
        bool enable;

        if (!isInTargetingPhase)
        {
            enable = false;
        }
        else if (thereAlreadyIsASpellCasted)
        {
            enable = false;
        }
        else
        {
            DepartmentOfTheTreasury     agency = this.Empire.GetAgency <DepartmentOfTheTreasury>();
            ConstructionResourceStock[] array;
            enable = (!ELCPUtilities.SpellUsage_HasSpellBeenUsed(encounter.GUID, empire.Index, spellDefinition.Name) && agency.GetInstantConstructionResourceCostForBuyout(empire, spellDefinition, out array));
        }
        this.AgeTransform.Enable = enable;
    }
Beispiel #2
0
    protected override IEnumerator OnShow(params object[] parameters)
    {
        SpellDefinitionTooltipData spellDefinitionTooltipData = null;

        if (this.context is SpellDefinitionTooltipData)
        {
            spellDefinitionTooltipData = (this.context as SpellDefinitionTooltipData);
        }
        this.Title.Text = string.Empty;
        if (spellDefinitionTooltipData != null)
        {
            if (!this.IsInTargeting(spellDefinitionTooltipData))
            {
                this.Title.Text = AgeLocalizer.Instance.LocalizeString("%SpellWaitForTargetingPhase");
            }
            else if (ELCPUtilities.SpellUsage_HasSpellBeenUsed(spellDefinitionTooltipData.Encounter.GUID, spellDefinitionTooltipData.Empire.Index, spellDefinitionTooltipData.SpellDefinition.Name))
            {
                this.Title.Text = AgeLocalizer.Instance.LocalizeString("%SpellActive");
            }
            else
            {
                bool flag = false;
                if (this.IsSpellAlreadyCasted(spellDefinitionTooltipData, ref flag))
                {
                    if (flag)
                    {
                        this.Title.Text = AgeLocalizer.Instance.LocalizeString("%SpellActive");
                    }
                    else
                    {
                        this.Title.Text = AgeLocalizer.Instance.LocalizeString("%SpellWaitForEndOfCurrentSpell");
                    }
                }
                else
                {
                    this.Title.Text = AgeLocalizer.Instance.LocalizeString("%SpellClickToCast");
                }
            }
        }
        yield return(base.OnShow(parameters));

        yield break;
    }