//private static readonly string UIStationInvoicesList = "stationinvoicelist";
        private static Budget PreBuildLists(App app, PlayerInfo playerInfo, string panelName)
        {
            bool stratModifier = app.GetStratModifier<bool>(Kerberos.Sots.Data.StratModifiers.EnableTrade, app.LocalPlayer.ID);

            Budget budget = Budget.GenerateBudget(app.Game, playerInfo, null, BudgetProjection.Pessimistic);

            double num3 = (double)((1f - playerInfo.RateGovernmentResearch) * 100f);
            double num4 = (double)(playerInfo.RateGovernmentSecurity * 100f);
            double num5 = (double)(playerInfo.RateSecurityOperations * 100f);
            double num6 = (double)(playerInfo.RateSecurityIntelligence * 100f);
            double num7 = (double)(playerInfo.RateSecurityCounterIntelligence * 100f);
            double num8 = (double)(playerInfo.RateGovernmentStimulus * 100f);
            double num9 = (double)(playerInfo.RateStimulusMining * 100f);
            double num10 = (double)(playerInfo.RateStimulusColonization * 100f);
            double num11 = (double)(playerInfo.RateStimulusTrade * 100f);
            double num12 = (double)(playerInfo.RateGovernmentSavings * 100f);
            float arg_29B_0 = playerInfo.RateGovernmentResearch;
            double num13 = (double)(playerInfo.RateResearchCurrentProject * 100f);
            double num14 = (double)(playerInfo.RateResearchSpecialProject * 100f);
            double num15 = (double)(playerInfo.RateResearchSalvageResearch * 100f);
            string text = budget.TotalRevenue.ToString("N0");
            string text2 = budget.ProjectedGovernmentSpending.ToString("N0");
            string text3 = budget.ResearchSpending.ProjectedTotal.ToString("N0");
            string text4 = budget.SecuritySpending.ProjectedTotal.ToString("N0");
            double num16 = budget.SecuritySpending.ProjectedOperations;
            string text5 = num16.ToString("N0");
            num16 = budget.SecuritySpending.ProjectedIntelligence;
            string text6 = num16.ToString("N0");
            num16 = budget.SecuritySpending.ProjectedCounterIntelligence;
            string text7 = num16.ToString("N0");
            string text8 = budget.StimulusSpending.ProjectedTotal.ToString("N0");
            num16 = budget.StimulusSpending.ProjectedMining;
            string text9 = num16.ToString("N0");
            num16 = budget.StimulusSpending.ProjectedColonization;
            string text10 = num16.ToString("N0");
            num16 = budget.StimulusSpending.ProjectedTrade;
            string text11 = num16.ToString("N0");
            string text12 = budget.NetSavingsIncome.ToString("N0");
            string text13 = budget.CurrentSavings.ToString("N0");
            string text14 = budget.SavingsInterest.ToString("N0");
            string text15 = budget.ProjectedSavings.ToString("N0");
            num16 = budget.ResearchSpending.ProjectedCurrentProject;
            string text16 = num16.ToString("N0");
            num16 = budget.ResearchSpending.ProjectedSpecialProject;
            string text17 = num16.ToString("N0");
            num16 = budget.ResearchSpending.ProjectedSalvageResearch;
            string text18 = num16.ToString("N0");
            string text19 = (budget.ColonySupportExpenses + budget.CurrentShipUpkeepExpenses + budget.CurrentStationUpkeepExpenses + budget.CorruptionExpenses + budget.DebtInterest).ToString("N0");
            string text20 = (budget.TotalExpenses + budget.PendingBuildStationsCost + budget.PendingStationsModulesCost + budget.PendingBuildShipsCost).ToString("N0");
            string text21 = budget.ColonySupportExpenses.ToString("N0");
            string text22 = budget.CurrentShipUpkeepExpenses.ToString("N0");
            string text23 = budget.CurrentStationUpkeepExpenses.ToString("N0");
            string text24 = budget.CorruptionExpenses.ToString("N0");
            string text25 = budget.DebtInterest.ToString("N0");
            string text26 = budget.TaxRevenue.ToString("N0");
            string text27 = text2;
            string text28 = text20;
            string text29 = text3;
            string text30 = text13;
            string text31 = text15;

             string text40 = budget.PendingBuildShipsCost.ToString("N0");
            string text41 = (budget.PendingBuildStationsCost + budget.PendingStationsModulesCost).ToString("N0");
            string text42 = (budget.TotalExpenses + budget.TotalBuildShipCosts + budget.TotalBuildStationsCost + budget.TotalStationsModulesCost).ToString("N0");
            string text43 = "Turn " + app.GameDatabase.GetTurnCount().ToString("N0");
            app.UI.SetEnabled(EmpireSummaryStateBehaviour.UITradeSlider, stratModifier);
            app.UI.SetEnabled(EmpireSummaryStateBehaviour.UIMiningSlider, app.GameDatabase.PlayerHasTech(app.LocalPlayer.ID, "IND_Mega-Strip_Mining"));
            if (app.LocalPlayer.Faction.Name == "loa" && app.GameDatabase.GetPlayerInfo(app.LocalPlayer.ID).Savings < 0.0)
            {
                app.UI.SetEnabled(EmpireSummaryStateBehaviour.UIGovernmentResearchSlider, false);
            }
            else
            {
                app.UI.SetEnabled(EmpireSummaryStateBehaviour.UIGovernmentResearchSlider, true);
            }
            if (panelName != EmpireSummaryStateBehaviour.UIGovernmentResearchSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UIGovernmentResearchSlider, (int)num3);
            }
            if (panelName != EmpireSummaryStateBehaviour.UISecuritySlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UISecuritySlider, (int)num4);
            }
            if (budget.ProjectedGovernmentSpending > 0.0)
            {
                app.UI.ClearSliderNotches(EmpireSummaryStateBehaviour.UISecuritySlider);
                app.UI.AddSliderNotch(EmpireSummaryStateBehaviour.UISecuritySlider, budget.RequiredSecurity);
                if (app.GameDatabase.GetSliderNotchSettingInfo(app.LocalPlayer.ID, UISlidertype.SecuritySlider) != null)
                {
                    app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UISecuritySlider, budget.RequiredSecurity);
                    EmpireSummaryState.DistributeGovernmentSpending(app.Game, EmpireSummaryState.GovernmentSpendings.Security, (float)Math.Min((double)((float)budget.RequiredSecurity / 100f), 1.0), playerInfo);
                }
            }
            if (panelName != EmpireSummaryStateBehaviour.UIOperationsSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UIOperationsSlider, (int)num5);
            }
            if (panelName != EmpireSummaryStateBehaviour.UIIntelSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UIIntelSlider, (int)num6);
            }
            if (panelName != EmpireSummaryStateBehaviour.UICounterIntelSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UICounterIntelSlider, (int)num7);
            }
            if (panelName != EmpireSummaryStateBehaviour.UIStimulusSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UIStimulusSlider, (int)num8);
            }
            if (panelName != EmpireSummaryStateBehaviour.UIMiningSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UIMiningSlider, (int)num9);
            }
            if (panelName != EmpireSummaryStateBehaviour.UIColonizationSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UIColonizationSlider, (int)num10);
            }
            if (panelName != EmpireSummaryStateBehaviour.UITradeSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UITradeSlider, (int)num11);
            }
            if (panelName != EmpireSummaryStateBehaviour.UISavingsSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UISavingsSlider, (int)num12);
            }
            if (panelName != EmpireSummaryStateBehaviour.UICurrentProjectSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UICurrentProjectSlider, (int)num13);
            }
            if (panelName != EmpireSummaryStateBehaviour.UISpecialProjectSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UISpecialProjectSlider, (int)num14);
            }
            if (panelName != EmpireSummaryStateBehaviour.UISalvageResearchSlider)
            {
                app.UI.SetSliderValue(EmpireSummaryStateBehaviour.UISalvageResearchSlider, (int)num15);
            }
            app.UI.SetText("incomeValue", text);
            app.UI.SetText("governmentValue", text2);
            app.UI.SetText("researchValue", text3);
            app.UI.SetText("researchTotalValue", text3);
            app.UI.SetText("securityValue", text4);
            app.UI.SetText("operationsValue", text5);
            app.UI.SetText("intelValue", text6);
            app.UI.SetText("counterIntelValue", text7);
            app.UI.SetText("stimulusValue", text8);
            app.UI.SetText("miningValue", text9);
            app.UI.SetText("colonizationValue", text10);
            app.UI.SetText("tradeValue", text11);
            app.UI.SetText("savingsValue", text12);
            app.UI.SetText("interestValue", text14);
            app.UI.SetText("treasuryValue", text13);
            app.UI.SetText("projectedTreasuryValue", text15);
            app.UI.SetText("currentProjectValue", text16);
            app.UI.SetText("specialProjectValue", text17);
            app.UI.SetText("salvageResearchValue", text18);
            app.UI.SetText("expensesValue", text19);
            app.UI.SetText("colonyDevelopmentValue", text21);
            app.UI.SetText("fleetMaintenanceValue", text22);
            app.UI.SetText("stationMaintenanceValue", text23);
            app.UI.SetText("embezzlementValue", text24);
            app.UI.SetText("debtInterestValue", text25);
            app.UI.SetVisible("embezzlementValue", app.LocalPlayer.Faction.Name != "loa");
            app.UI.SetVisible("debtInterestValue", app.LocalPlayer.Faction.Name != "loa");
            app.UI.SetVisible("interestValue", app.LocalPlayer.Faction.Name != "loa");
            app.UI.SetVisible("InterestLabel", app.LocalPlayer.Faction.Name != "loa");
            app.UI.SetVisible("embezzlementString", app.LocalPlayer.Faction.Name != "loa");
            app.UI.SetVisible("debtString", app.LocalPlayer.Faction.Name != "loa");
            app.UI.SetText("summaryGovernmentValue", text27);
            app.UI.SetText("summaryExpensesValue", text28);
            app.UI.SetText("summaryResearchValue", text29);
            app.UI.SetText("summarySavingsValue", text30);
            app.UI.SetText("summaryProjectedValue", text31);
            app.UI.SetText("turn_label", text43);
            app.UI.SetText(EmpireSummaryStateBehaviour.UIShipInvoicesCost, text40);
            app.UI.SetText(EmpireSummaryStateBehaviour.UIStationInvoicesCost, text41);
            app.UI.SetText(EmpireSummaryStateBehaviour.UIColonyDevCost, text21);
            app.UI.SetText(EmpireSummaryStateBehaviour.UIColonyIncome, text26);
            app.UI.SetText(EmpireSummaryStateBehaviour.UIFinancialDue, text20);
            app.UI.SetText(EmpireSummaryStateBehaviour.UIFinancialDueTotal, text42);
            app.UI.SetPropertyColor("summaryProjectedValue", "color", 255f, 255f, 255f);

            int empireBiosphere = app.GameDatabase.GetEmpireBiosphere(app.LocalPlayer.ID);
            string text37 = empireBiosphere.ToString("N0");
            app.UI.SetText("biospherevalue", text37);

            double empirePopulation = app.GameDatabase.GetEmpirePopulation(app.LocalPlayer.ID);
            float empireEconomy = app.GameDatabase.GetEmpireEconomy(app.LocalPlayer.ID);
            double tradeRevenue = budget.TradeRevenue;
            int? empireMorale = app.GameDatabase.GetEmpireMorale(app.LocalPlayer.ID);

            string text35 = empirePopulation.ToString("N0");
            string text36 = empireEconomy.ToString("N0");
            string text38 = tradeRevenue.ToString("N0");
            string text39 = empireMorale.HasValue ? empireMorale.Value.ToString("N0") : "n/a";

            app.UI.SetText("populationvalue", text35);
            app.UI.SetText("economyvalue", text36);
            app.UI.SetText("tradeunitsvalue", text38);
            app.UI.SetText("averagemoralevalue", text39);

            int num = app.GameDatabase.GetStationInfosByPlayerID(app.LocalPlayer.ID).Count<StationInfo>();

            int numColonies = app.GameDatabase.GetNumColonies(app.LocalPlayer.ID);
            int numProvinces = app.GameDatabase.GetNumProvinces(app.LocalPlayer.ID);
            int num2 = app.GameDatabase.GetFleetInfosByPlayerID(app.LocalPlayer.ID, Kerberos.Sots.Data.FleetType.FL_NORMAL).Count<FleetInfo>();
            int numShips = app.GameDatabase.GetNumShips(app.LocalPlayer.ID);

            Kerberos.Sots.Data.EmpireHistoryData lastEmpireHistoryForPlayer = app.GameDatabase.GetLastEmpireHistoryForPlayer(app.LocalPlayer.ID);
            Kerberos.Sots.Framework.Vector3 value = new Kerberos.Sots.Framework.Vector3(255f, 255f, 255f);
            Kerberos.Sots.Framework.Vector3 value2 = new Kerberos.Sots.Framework.Vector3(0f, 255f, 0f);
            Kerberos.Sots.Framework.Vector3 value3 = new Kerberos.Sots.Framework.Vector3(255f, 0f, 0f);
            if (lastEmpireHistoryForPlayer != null)
            {
                if (numColonies > lastEmpireHistoryForPlayer.colonies)
                {
                    app.UI.SetPropertyColor("coloniesvalue", "color", value2);
                }
                else
                {
                    if (numColonies < lastEmpireHistoryForPlayer.colonies)
                    {
                        app.UI.SetPropertyColor("coloniesvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("coloniesvalue", "color", value);
                    }
                }
                if (numProvinces > lastEmpireHistoryForPlayer.provinces)
                {
                    app.UI.SetPropertyColor("provincesvalue", "color", value2);
                }
                else
                {
                    if (numProvinces < lastEmpireHistoryForPlayer.provinces)
                    {
                        app.UI.SetPropertyColor("provincesvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("provincesvalue", "color", value);
                    }
                }
                if (num > lastEmpireHistoryForPlayer.bases)
                {
                    app.UI.SetPropertyColor("basesvalue", "color", value2);
                }
                else
                {
                    if (num < lastEmpireHistoryForPlayer.bases)
                    {
                        app.UI.SetPropertyColor("basesvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("basesvalue", "color", value);
                    }
                }
                if (num2 > lastEmpireHistoryForPlayer.fleets)
                {
                    app.UI.SetPropertyColor("fleetsvalue", "color", value2);
                }
                else
                {
                    if (num2 < lastEmpireHistoryForPlayer.fleets)
                    {
                        app.UI.SetPropertyColor("fleetsvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("fleetsvalue", "color", value);
                    }
                }
                if (numShips > lastEmpireHistoryForPlayer.ships)
                {
                    app.UI.SetPropertyColor("shipsvalue", "color", value2);
                }
                else
                {
                    if (numShips < lastEmpireHistoryForPlayer.ships)
                    {
                        app.UI.SetPropertyColor("shipsvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("shipsvalue", "color", value);
                    }
                }
                if (empirePopulation > lastEmpireHistoryForPlayer.empire_pop)
                {
                    app.UI.SetPropertyColor("populationvalue", "color", value2);
                }
                else
                {
                    if (empirePopulation < lastEmpireHistoryForPlayer.empire_pop)
                    {
                        app.UI.SetPropertyColor("populationvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("populationvalue", "color", value);
                    }
                }
                if (empireEconomy > lastEmpireHistoryForPlayer.empire_economy)
                {
                    app.UI.SetPropertyColor("economyvalue", "color", value2);
                }
                else
                {
                    if (empireEconomy < lastEmpireHistoryForPlayer.empire_economy)
                    {
                        app.UI.SetPropertyColor("economyvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("economyvalue", "color", value);
                    }
                }
                if (empireBiosphere > lastEmpireHistoryForPlayer.empire_biosphere)
                {
                    app.UI.SetPropertyColor("biospherevalue", "color", value2);
                }
                else
                {
                    if (empireBiosphere < lastEmpireHistoryForPlayer.empire_biosphere)
                    {
                        app.UI.SetPropertyColor("biospherevalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("biospherevalue", "color", value);
                    }
                }
                if (tradeRevenue > lastEmpireHistoryForPlayer.empire_trade)
                {
                    app.UI.SetPropertyColor("tradeunitsvalue", "color", value2);
                }
                else
                {
                    if (tradeRevenue < lastEmpireHistoryForPlayer.empire_trade)
                    {
                        app.UI.SetPropertyColor("tradeunitsvalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("tradeunitsvalue", "color", value);
                    }
                }
                if (empireMorale > lastEmpireHistoryForPlayer.empire_morale)
                {
                    app.UI.SetPropertyColor("averagemoralevalue", "color", value2);
                }
                else
                {
                    if (empireMorale < lastEmpireHistoryForPlayer.empire_morale)
                    {
                        app.UI.SetPropertyColor("averagemoralevalue", "color", value3);
                    }
                    else
                    {
                        app.UI.SetPropertyColor("averagemoralevalue", "color", value);
                    }
                }
            }

            string str = numColonies.ToString("N0");
            string str2 = numProvinces.ToString("N0");

            string text32 = num.ToString("N0");
            string text33 = num2.ToString("N0");
            string text34 = numShips.ToString("N0");

            app.UI.SetText("coloniesvalue", str + " " + App.Localize("@UI_PLANET_MANAGER_OWNED_PLANETS"));
            app.UI.SetText("provincesvalue", str2 + " " + App.Localize("@UI_STARMAPVIEW_PROVINCE_DISPLAY"));
            app.UI.SetText("basesvalue", text32);
            app.UI.SetText("fleetsvalue", text33);
            app.UI.SetText("shipsvalue", text34);

            return budget;
        }