private KCDatabase() { MasterShips = new IDDictionary <ShipDataMaster>(); ShipTypes = new IDDictionary <ShipType>(); ShipGraphics = new IDDictionary <ShipGraphicData>(); MasterEquipments = new IDDictionary <EquipmentDataMaster>(); EquipmentTypes = new IDDictionary <EquipmentType>(); Ships = new IDDictionary <ShipData>(); Equipments = new IDDictionary <EquipmentData>(); Admiral = new AdmiralData(); MasterUseItems = new IDDictionary <UseItemMaster>(); UseItems = new IDDictionary <UseItem>(); Arsenals = new IDDictionary <ArsenalData>(); Docks = new IDDictionary <DockData>(); Development = new DevelopmentData(); Fleet = new FleetManager(); Material = new MaterialData(); Quest = new QuestManager(); QuestProgress = new QuestProgressManager(); Battle = new BattleManager(); MapArea = new IDDictionary <MapAreaData>(); MapInfo = new IDDictionary <MapInfoData>(); Mission = new IDDictionary <MissionData>(); ShipGroup = new ShipGroupManager(); BaseAirCorps = new IDDictionary <BaseAirCorpsData>(); RelocatedEquipments = new IDDictionary <RelocationData>(); FleetPreset = new FleetPresetManager(); }
public void UpdateSortShips() { if (Utility.Configuration.Config.UI.AllowSortIndexing) { // 几种不同的 ID // s.MasterID 获取时的 ID ( 每个舰娘独立,作为 KEY 使用 ) // s.ShipID 舰娘 ID ( 每种改装状态独立,以下排序未使用 ) // s.SortID 排序 ID ( 图鉴 ID ) ShipsOrder.Clear(); // 舰种序 var ShipsTypeSorted = Ships.Values.OrderBy(s => s.MasterShip.SortID); /* * var ShipsTypeSorted = Ships.Values.OrderByDescending(s => s.MasterShip.ShipType) * .ThenBy(s => s.SortID) * .ThenByDescending(s => s.Level) * .ThenBy(s => s.MasterID); */ int index = 1; foreach (var ship in ShipsTypeSorted) { ShipsOrder.Add(ship.MasterID, new int[] { 0, 0, index, 0, 0 }); index++; } // 舰种序(单舰种) foreach (ShipTypes shipType in Enum.GetValues(typeof(ShipTypes))) { var ShipsTypeSorted2 = Ships.Values.Where(s => s.MasterShip.ShipType == shipType) .OrderBy(s => s.MasterShip.SortID); index = 1; foreach (var ship in ShipsTypeSorted2) { ShipsOrder[ship.MasterID][3] = index; index++; } } // Lv 序 & 改装「他」序 var ShipsLvSorted = Ships.Values.OrderByDescending(s => s.Level) .ThenBy(s => s.MasterShip.SortID); /* * .ThenBy(s => s.SortID) * .ThenBy(s => s.MasterID); */ index = 1; // 寻找已在舰队中的舰娘 List <int> ShipsInFleet = new List <int>(); FleetManager fm = KCDatabase.Instance.Fleet; foreach (var f in fm.Fleets.Values) { foreach (int s in f.Members) { if (s != -1) { ShipsInFleet.Add(s); } } //ShipsInFleet.AddRange(f.Members); } //ShipsInFleet.RemoveAll(s => s == -1); int count = Ships.Values.Count() - ShipsInFleet.Count; foreach (var ship in ShipsLvSorted) { ShipsOrder[ship.MasterID][0] = index; index++; if (!ShipsInFleet.Contains(ship.MasterID)) { ShipsOrder[ship.MasterID][4] = count; count--; } } // Lv序(单舰种) foreach (ShipTypes shipType in Enum.GetValues(typeof(ShipTypes))) { var ShipsLvSorted2 = Ships.Values.Where(s => s.MasterShip.ShipType == shipType) .OrderByDescending(s => s.Level) .ThenBy(s => s.MasterShip.SortID); index = 1; foreach (var ship in ShipsLvSorted2) { ShipsOrder[ship.MasterID][1] = index; index++; } } } }
private KCDatabase() { MasterShips = new IDDictionary<ShipDataMaster>(); ShipTypes = new IDDictionary<ShipType>(); MasterEquipments = new IDDictionary<EquipmentDataMaster>(); EquipmentTypes = new IDDictionary<EquipmentType>(); Ships = new IDDictionary<ShipData>(); Equipments = new IDDictionary<EquipmentData>(); Admiral = new AdmiralData(); MasterUseItems = new IDDictionary<UseItemMaster>(); UseItems = new IDDictionary<UseItem>(); Arsenals = new IDDictionary<ArsenalData>(); Docks = new IDDictionary<DockData>(); Fleet = new FleetManager(); Material = new MaterialData(); Quest = new QuestManager(); QuestProgress = new QuestProgressManager(); Battle = new BattleManager(); MapInfo = new IDDictionary<MapInfoData>(); Mission = new IDDictionary<MissionData>(); ShipGroup = new ShipGroupManager(); }