private void CheckMissionRequirements()
        {
            ShipRole          shipRole       = this.CheckRequiredShips();
            List <DesignInfo> designInfoList = new List <DesignInfo>();

            foreach (int key in this.SelectedDesigns.Keys)
            {
                for (int index = 0; index < this.SelectedDesigns[key]; ++index)
                {
                    DesignInfo designInfo = this._app.GameDatabase.GetDesignInfo(key);
                    designInfoList.Add(designInfo);
                }
            }
            int num1 = 0;
            int num2 = 0;
            int num3 = 0;

            foreach (DesignInfo designInfo in designInfoList)
            {
                num2 += designInfo.CommandPointCost;
                if (this._app.GameDatabase.GetDesignCommandPointQuota(this._app.AssetDatabase, designInfo.ID) > num3)
                {
                    num3 = this._app.GameDatabase.GetDesignCommandPointQuota(this._app.AssetDatabase, designInfo.ID);
                }
                num1 += designInfo.GetPlayerProductionCost(this._app.GameDatabase, this._app.LocalPlayer.ID, false, new float?());
            }
            if (num3 >= num2)
            {
                this._app.UI.SetEnabled(this._app.UI.Path(this.ID, "okButton"), false);
                switch (shipRole)
                {
                case ShipRole.COMMAND:
                    this._app.UI.SetText(this._app.UI.Path(this.ID, "requirement"), "Fleet Requires Command Ship");
                    break;

                case ShipRole.COLONIZER:
                    this._app.UI.SetText(this._app.UI.Path(this.ID, "requirement"), "Fleet Requires Colonizer");
                    break;

                case ShipRole.CONSTRUCTOR:
                    this._app.UI.SetText(this._app.UI.Path(this.ID, "requirement"), "Fleet Requires Construction Ship");
                    break;

                default:
                    this._app.UI.SetText(this._app.UI.Path(this.ID, "requirement"), "");
                    this._app.UI.SetEnabled(this._app.UI.Path(this.ID, "okButton"), true);
                    break;
                }
            }
            else
            {
                if (num3 >= num2)
                {
                    return;
                }
                this._app.UI.SetEnabled(this._app.UI.Path(this.ID, "okButton"), false);
                this._app.UI.SetText(this._app.UI.Path(this.ID, "requirement"), "Not Enough CP to support Fleet");
            }
        }
예제 #2
0
        public static void SyncCost(App game, string panel, DesignInfo design)
        {
            int    num = design.SavingsCost;
            int    playerProductionCost = design.GetPlayerProductionCost(game.GameDatabase, game.LocalPlayer.ID, true, new float?());
            string text1 = GameSession.CalculateShipUpkeepCost(game.AssetDatabase, design, 1f, false).ToString("N0");
            string text2 = string.Format("({0})", (object)GameSession.CalculateShipUpkeepCost(game.AssetDatabase, design, 1f, true).ToString("N0"));

            switch (design.Class)
            {
            case ShipClass.Cruiser:
                num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierCR, game.LocalPlayer.ID));
                break;

            case ShipClass.Dreadnought:
                num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierDN, game.LocalPlayer.ID));
                break;

            case ShipClass.Leviathan:
                num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierLV, game.LocalPlayer.ID));
                break;

            case ShipClass.Station:
                RealShipClasses?realShipClass = design.GetRealShipClass();
                if ((realShipClass.GetValueOrDefault() != RealShipClasses.Platform ? 0 : (realShipClass.HasValue ? 1 : 0)) != 0)
                {
                    num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierPF, game.LocalPlayer.ID));
                    break;
                }
                break;
            }
            string text3 = design.SavingsCost.ToString("N0");
            string text4 = design.GetPlayerProductionCost(game.GameDatabase, game.LocalPlayer.ID, false, new float?()).ToString("N0");
            string text5 = num.ToString("N0");
            string text6 = playerProductionCost.ToString("N0");

            game.UI.SetText(game.UI.Path(panel, "gameShipSavCost"), text3);
            game.UI.SetText(game.UI.Path(panel, "gameShipConCost"), text4);
            game.UI.SetText(game.UI.Path(panel, "gameProtoSavCost"), text5);
            game.UI.SetText(game.UI.Path(panel, "gameProtoConCost"), text6);
            game.UI.SetText(game.UI.Path(panel, "gameShipUpkeepCost"), text1);
            game.UI.SetText(game.UI.Path(panel, "gameShipResUpkeepCost"), text2);
        }
        protected void SyncCompositionStats()
        {
            List <DesignInfo> designInfoList = new List <DesignInfo>();

            foreach (int key in this.SelectedDesigns.Keys)
            {
                for (int index = 0; index < this.SelectedDesigns[key]; ++index)
                {
                    DesignInfo designInfo = this._app.GameDatabase.GetDesignInfo(key);
                    designInfoList.Add(designInfo);
                }
            }
            int num1 = 0;
            int num2 = 0;
            int num3 = 0;

            foreach (DesignInfo designInfo in designInfoList)
            {
                num2 += designInfo.CommandPointCost;
                if (this._app.GameDatabase.GetDesignCommandPointQuota(this._app.AssetDatabase, designInfo.ID) > num3)
                {
                    num3 = this._app.GameDatabase.GetDesignCommandPointQuota(this._app.AssetDatabase, designInfo.ID);
                }
                num1 += designInfo.GetPlayerProductionCost(this._app.GameDatabase, this._app.LocalPlayer.ID, false, new float?());
            }
            this._app.UI.SetText(this._app.UI.Path(this.ID, "CommandPointValue"), num2.ToString("N0") + "/" + num3.ToString("N0"));
            int cubeMassForTransit = Kerberos.Sots.StarFleet.StarFleet.GetMaxLoaFleetCubeMassForTransit(this._app.Game, this._app.LocalPlayer.ID);

            this._app.UI.SetText(this._app.UI.Path(this.ID, "ConstructionPointValue"), num1.ToString("N0") + "/" + cubeMassForTransit.ToString("N0"));
            int num4 = 0;
            int num5 = 0;

            foreach (DialogLoaFleetCompositor.RiderStruct riderList in this.RiderListMap)
            {
                foreach (DialogLoaFleetCompositor.RiderWingStruct riderWingStruct in riderList.WingData)
                {
                    num5 += riderWingStruct.wingdata.SlotIndexes.Count;
                    num4 += riderWingStruct.riders.Count;
                }
            }
            this._app.UI.SetText(this._app.UI.Path(this.ID, "BattleRiderValue"), num4.ToString() + "/" + num5.ToString());
        }
예제 #4
0
        protected void SyncCompoShips(int Compositionid)
        {
            //DialogLoaFleetSelector.<> c__DisplayClass13 CS$<> 8__locals1 = new DialogLoaFleetSelector.<> c__DisplayClass13();
            LoaFleetComposition loaFleetComposition = this._app.GameDatabase.GetLoaFleetCompositions().FirstOrDefault((LoaFleetComposition x) => x.ID == Compositionid);

            if (loaFleetComposition != null)
            {
                this.selectedcompo = new int?(Compositionid);
                List <DesignInfo> list = Kerberos.Sots.StarFleet.StarFleet.GetDesignBuildOrderForComposition(this._app.Game, this._basefleet.ID, loaFleetComposition, this._mission).ToList <DesignInfo>();
                int fleetLoaCubeValue  = Kerberos.Sots.StarFleet.StarFleet.GetFleetLoaCubeValue(this._app.Game, this._basefleet.ID);
                int num = 0;
                List <DesignInfo> list2 = (from X in list
                                           where X.Class == ShipClass.BattleRider
                                           select X).ToList <DesignInfo>();
                this._app.UI.ClearItems(this._app.UI.Path(new string[]
                {
                    base.ID,
                    DialogLoaFleetSelector.UIShipList
                }));
                foreach (DesignInfo designInfo in list)
                {
                    if (designInfo.Class != ShipClass.BattleRider && !(designInfo.GetRealShipClass() == RealShipClasses.BoardingPod) && !(designInfo.GetRealShipClass() == RealShipClasses.Drone) && !(designInfo.GetRealShipClass() == RealShipClasses.EscapePod))
                    {
                        this._app.UI.AddItem(this._app.UI.Path(new string[]
                        {
                            base.ID,
                            DialogLoaFleetSelector.UIShipList
                        }), "", DialogLoaFleetSelector.designlistid, designInfo.Name);
                        string itemGlobalID = this._app.UI.GetItemGlobalID(this._app.UI.Path(new string[]
                        {
                            base.ID,
                            DialogLoaFleetSelector.UIShipList
                        }), "", DialogLoaFleetSelector.designlistid, "");
                        this._app.UI.SetText(this._app.UI.Path(new string[]
                        {
                            itemGlobalID,
                            "designName"
                        }), designInfo.Name);
                        this._app.UI.SetVisible(this._app.UI.Path(new string[]
                        {
                            itemGlobalID,
                            "designDeleteButton"
                        }), false);
                        if (num + designInfo.GetPlayerProductionCost(this._app.GameDatabase, this._basefleet.PlayerID, false, null) <= fleetLoaCubeValue)
                        {
                            this._app.UI.SetPropertyColor(this._app.UI.Path(new string[]
                            {
                                itemGlobalID,
                                "designName"
                            }), "color", new Vector3(255f, 255f, 255f));
                            num += designInfo.GetPlayerProductionCost(this._app.GameDatabase, this._basefleet.PlayerID, false, null);
                        }
                        else
                        {
                            this._app.UI.SetPropertyColor(this._app.UI.Path(new string[]
                            {
                                itemGlobalID,
                                "designName"
                            }), "color", new Vector3(255f, 0f, 0f));
                        }
                        DialogLoaFleetSelector.designlistid++;
                        List <CarrierWingData> list3 = RiderManager.GetDesignBattleriderWingData(this._app, designInfo).ToList <CarrierWingData>();
                        using (List <CarrierWingData> .Enumerator enumerator2 = list3.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                //DialogLoaFleetSelector.<> c__DisplayClass16 CS$<> 8__locals2 = new DialogLoaFleetSelector.<> c__DisplayClass16();
                                //CS$<> 8__locals2.CS$<> 8__locals14 = CS$<> 8__locals1;
                                CarrierWingData   wd          = enumerator2.Current;
                                List <DesignInfo> classriders = (from x in list2
                                                                 where StrategicAI.BattleRiderMountSet.GetMatchingTurretClass(x) == wd.Class
                                                                 select x).ToList <DesignInfo>();
                                if (classriders.Any <DesignInfo>() && wd.SlotIndexes.Any <int>())
                                {
                                    BattleRiderTypes SelectedType = (from x in classriders
                                                                     where classriders.Count((DesignInfo j) => j.ID == x.ID) >= wd.SlotIndexes.Count
                                                                     select x).First <DesignInfo>().GetMissionSectionAsset().BattleRiderType;
                                    DesignInfo designInfo2 = classriders.FirstOrDefault((DesignInfo x) => x.GetMissionSectionAsset().BattleRiderType == SelectedType && classriders.Count((DesignInfo j) => j.ID == x.ID) >= wd.SlotIndexes.Count);
                                    foreach (int num2 in wd.SlotIndexes)
                                    {
                                        if (designInfo2 != null)
                                        {
                                            this._app.UI.AddItem(this._app.UI.Path(new string[]
                                            {
                                                base.ID,
                                                DialogLoaFleetSelector.UIShipList
                                            }), "", DialogLoaFleetSelector.designlistid, designInfo2.Name);
                                            itemGlobalID = this._app.UI.GetItemGlobalID(this._app.UI.Path(new string[]
                                            {
                                                base.ID,
                                                DialogLoaFleetSelector.UIShipList
                                            }), "", DialogLoaFleetSelector.designlistid, "");
                                            this._app.UI.SetText(this._app.UI.Path(new string[]
                                            {
                                                itemGlobalID,
                                                "designName"
                                            }), designInfo2.Name);
                                            this._app.UI.SetVisible(this._app.UI.Path(new string[]
                                            {
                                                itemGlobalID,
                                                "designDeleteButton"
                                            }), false);
                                            if (num + designInfo2.GetPlayerProductionCost(this._app.GameDatabase, this._basefleet.PlayerID, false, null) <= fleetLoaCubeValue)
                                            {
                                                this._app.UI.SetPropertyColor(this._app.UI.Path(new string[]
                                                {
                                                    itemGlobalID,
                                                    "designName"
                                                }), "color", new Vector3(255f, 255f, 255f));
                                                num += designInfo2.GetPlayerProductionCost(this._app.GameDatabase, this._basefleet.PlayerID, false, null);
                                            }
                                            else
                                            {
                                                this._app.UI.SetPropertyColor(this._app.UI.Path(new string[]
                                                {
                                                    itemGlobalID,
                                                    "designName"
                                                }), "color", new Vector3(255f, 0f, 0f));
                                            }
                                            list2.Remove(designInfo2);
                                            DialogLoaFleetSelector.designlistid++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                this.SyncCompoInfo(loaFleetComposition);
            }
        }