示例#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;
    }