private void AddDesign(int designid) { DesignInfo designInfo = this._app.GameDatabase.GetDesignInfo(designid); if (designInfo.Class == ShipClass.BattleRider && !this.CanMountBattleRider(designInfo)) { return; } if (!this.SelectedDesigns.ContainsKey(designid)) { this.SelectedDesigns.Add(designid, 1); } else { Dictionary <int, int> selectedDesigns; int index; (selectedDesigns = this.SelectedDesigns)[index = designid] = selectedDesigns[index] + 1; } int selectedDesign = this.SelectedDesigns[designid]; List <CarrierWingData> list = RiderManager.GetDesignBattleriderWingData(this._app, designInfo).ToList <CarrierWingData>(); if (list.Any <CarrierWingData>()) { DialogLoaFleetCompositor.RiderStruct riderStruct = new DialogLoaFleetCompositor.RiderStruct(); foreach (CarrierWingData carrierWingData in list) { riderStruct.WingData.Add(new DialogLoaFleetCompositor.RiderWingStruct() { wingdata = carrierWingData }); } riderStruct.CarrierDesignID = designid; riderStruct.SelectedDesignCarrierKey = selectedDesign; this.RiderListMap.Add(riderStruct); } if (designInfo.Class != ShipClass.BattleRider) { return; } WeaponEnums.TurretClasses? turretclass = StrategicAI.BattleRiderMountSet.GetMatchingTurretClass(designInfo); DialogLoaFleetCompositor.RiderStruct riderStruct1 = this.RiderListMap.FirstOrDefault <DialogLoaFleetCompositor.RiderStruct>((Func <DialogLoaFleetCompositor.RiderStruct, bool>)(x => x.WingData.Any <DialogLoaFleetCompositor.RiderWingStruct>((Func <DialogLoaFleetCompositor.RiderWingStruct, bool>)(j => { WeaponEnums.TurretClasses turretClasses = j.wingdata.Class; WeaponEnums.TurretClasses?nullable = turretclass; if ((turretClasses != nullable.GetValueOrDefault() ? 0 : (nullable.HasValue ? 1 : 0)) != 0) { return(!j.riders.Any <int>()); } return(false); })))); if (riderStruct1 != null) { DialogLoaFleetCompositor.RiderWingStruct riderWingStruct = riderStruct1.WingData.First <DialogLoaFleetCompositor.RiderWingStruct>((Func <DialogLoaFleetCompositor.RiderWingStruct, bool>)(x => { WeaponEnums.TurretClasses turretClasses = x.wingdata.Class; WeaponEnums.TurretClasses?nullable = turretclass; if ((turretClasses != nullable.GetValueOrDefault() ? 0 : (nullable.HasValue ? 1 : 0)) != 0) { return(!x.riders.Any <int>()); } return(false); })); foreach (int slotIndex in riderWingStruct.wingdata.SlotIndexes) { riderWingStruct.riders.Add(designid); } Dictionary <int, int> selectedDesigns; int index; (selectedDesigns = this.SelectedDesigns)[index = designid] = selectedDesigns[index] + (riderWingStruct.wingdata.SlotIndexes.Count - 1); } if (this.SelectedClass != RealShipClasses.BattleRider && this.SelectedClass != RealShipClasses.BattleShip && this.SelectedClass != RealShipClasses.BattleCruiser) { return; } this.SyncDesignListList(this.SelectedClass); }
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); } }