Esempio n. 1
0
    private void CreateEmpireFilters(List <global::Empire> empiresToSelect = null)
    {
        if (empiresToSelect != null && empiresToSelect.Count == 1 && empiresToSelect[0] == base.Empire)
        {
            empiresToSelect.Clear();
        }
        this.empireToFilter.Clear();
        DepartmentOfIntelligence agency = base.Empire.GetAgency <DepartmentOfIntelligence>();
        bool         flag = DepartmentOfTheInterior.CanSeeAllExchangeTransactions(base.Empire);
        global::Game game = base.Game as global::Game;

        for (int i = 0; i < game.Empires.Length; i++)
        {
            MajorEmpire majorEmpire = game.Empires[i] as MajorEmpire;
            if (majorEmpire != null)
            {
                if (base.Empire.Index == majorEmpire.Index)
                {
                    this.empireToFilter.Add(majorEmpire);
                }
                else if (!majorEmpire.IsEliminated)
                {
                    DepartmentOfScience agency2 = majorEmpire.GetAgency <DepartmentOfScience>();
                    if (agency2.CanTradeHeroes(true) || agency2.CanTradeUnits(true) || agency2.CanTradeResourcesAndBoosters(true))
                    {
                        if (flag)
                        {
                            this.empireToFilter.Add(majorEmpire);
                        }
                        else if (agency != null && agency.IsEmpireInfiltrated(majorEmpire))
                        {
                            this.empireToFilter.Add(majorEmpire);
                        }
                    }
                }
            }
        }
        this.empireFilterWidth = Mathf.Floor((this.EmpireFiltersContainer.Width - this.EmpireFiltersContainer.HorizontalSpacing * (float)(this.empireToFilter.Count - 1)) / (float)this.empireToFilter.Count);
        this.EmpireFiltersContainer.ReserveChildren(this.empireToFilter.Count, this.EmpireFilterPrefab, "EmpireFilterToggle");
        this.EmpireFiltersContainer.RefreshChildrenIList <global::Empire>(this.empireToFilter, new AgeTransform.RefreshTableItem <global::Empire>(this.SetupEmpireFilterToggle), true, false);
        this.EmpireFiltersContainer.ArrangeChildren();
        if (empiresToSelect != null && empiresToSelect.Count > 0)
        {
            this.SetEmpiresToShow(empiresToSelect);
        }
        else
        {
            this.SetEmpiresToShow(this.empireToFilter);
        }
        AgeTooltip ageTooltip = this.EmpireFilterPrefab.GetComponent <AgeTransform>().AgeTooltip;

        if (ageTooltip != null)
        {
            ageTooltip.Content = "%MarketplaceEmpireFilterDescription";
        }
    }