コード例 #1
0
    private void HeroRefresh(AgeTransform tableitem, Unit hero, int index)
    {
        HeroCard component = tableitem.GetComponent <HeroCard>();

        component.Bind(hero, this.Empire, base.gameObject);
        component.RefreshContent(false, false);
        if (DepartmentOfEducation.IsInjured(hero) || DepartmentOfEducation.IsLocked(hero) || DepartmentOfIntelligence.IsHeroInfiltrating(hero, this.Empire) || DepartmentOfEducation.IsCaptured(hero))
        {
            component.GetComponent <AgeTransform>().Enable = false;
            component.Foreground.Alpha = 0.8f;
        }
        else if (hero.Garrison != null && hero.Garrison.IsInEncounter)
        {
            component.GetComponent <AgeTransform>().Enable = false;
            component.Foreground.Alpha = 0.8f;
        }
        else if (DepartmentOfEducation.CheckGarrisonAgainstSiege(hero, hero.Garrison) && !DepartmentOfEducation.CheckHeroExchangeAgainstSiege(hero.Garrison, this.destination))
        {
            component.GetComponent <AgeTransform>().Enable = false;
            component.Foreground.Alpha = 0.8f;
        }
        else
        {
            component.GetComponent <AgeTransform>().Enable = true;
            component.Foreground.Alpha = 0f;
        }
        if (this.isASpySelection && !hero.CheckUnitAbility(UnitAbility.ReadonlySpy, -1))
        {
            component.GetComponent <AgeTransform>().Enable = false;
            component.Foreground.Alpha = 0.8f;
        }
    }