リビジョン | da2111e0f4677ac240796093b0308f47ef39683d (tree) |
---|---|
日時 | 2018-09-01 16:29:58 |
作者 | Kazuhiro Fujieda <fujieda@user...> |
コミッター | Kazuhiro Fujieda |
艦種別表示を復活させる
@@ -60,6 +60,7 @@ namespace KancolleSniffer | ||
60 | 60 | public Size Size { get; set; } |
61 | 61 | public string Mode { get; set; } |
62 | 62 | public ShipCategory ShipCategories { get; set; } = ShipCategory.All; |
63 | + public bool ShipType; | |
63 | 64 | public bool ShowHpInPercent { get; set; } |
64 | 65 | public ListForm.SortOrder SortOrder { get; set; } = ListForm.SortOrder.ExpToNext; |
65 | 66 | public List<List<int>> ShipGroup { get; set; } |
@@ -78,6 +78,7 @@ namespace KancolleSniffer | ||
78 | 78 | this.labelFleet2 = new System.Windows.Forms.Label(); |
79 | 79 | this.labelFleet1 = new System.Windows.Forms.Label(); |
80 | 80 | this.panelSType = new System.Windows.Forms.Panel(); |
81 | + this.checkBoxSTypeDetails = new System.Windows.Forms.CheckBox(); | |
81 | 82 | this.checkBoxSTypeAll = new System.Windows.Forms.CheckBox(); |
82 | 83 | this.checkBoxSTypeAuxiliary = new System.Windows.Forms.CheckBox(); |
83 | 84 | this.checkBoxSTypeSubmarine = new System.Windows.Forms.CheckBox(); |
@@ -88,13 +89,13 @@ namespace KancolleSniffer | ||
88 | 89 | this.checkBoxSTypeAircraftCarrier = new System.Windows.Forms.CheckBox(); |
89 | 90 | this.checkBoxSTypeBattleShip = new System.Windows.Forms.CheckBox(); |
90 | 91 | this.labelSTypeButton = new System.Windows.Forms.Label(); |
92 | + this.labelSType = new System.Windows.Forms.Label(); | |
91 | 93 | this.airBattleResultPanel = new KancolleSniffer.View.AirBattleResultPanel(); |
92 | 94 | this.battleResultPanel = new KancolleSniffer.View.BattleResultPanel(); |
93 | 95 | this.antiAirPanel = new KancolleSniffer.View.AntiAirPanel(); |
94 | 96 | this.fleetPanel = new KancolleSniffer.View.FleetPanel(); |
95 | 97 | this.itemTreeView = new KancolleSniffer.View.ItemTreeView(); |
96 | 98 | this.shipListPanel = new KancolleSniffer.View.ShipListPanel(); |
97 | - this.labelSType = new System.Windows.Forms.Label(); | |
98 | 99 | this.contextMenuStripShipList.SuspendLayout(); |
99 | 100 | this.contextMenuStrip.SuspendLayout(); |
100 | 101 | this.panelGroupHeader.SuspendLayout(); |
@@ -410,6 +411,7 @@ namespace KancolleSniffer | ||
410 | 411 | // panelSType |
411 | 412 | // |
412 | 413 | this.panelSType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; |
414 | + this.panelSType.Controls.Add(this.checkBoxSTypeDetails); | |
413 | 415 | this.panelSType.Controls.Add(this.checkBoxSTypeAll); |
414 | 416 | this.panelSType.Controls.Add(this.checkBoxSTypeAuxiliary); |
415 | 417 | this.panelSType.Controls.Add(this.checkBoxSTypeSubmarine); |
@@ -426,6 +428,17 @@ namespace KancolleSniffer | ||
426 | 428 | this.panelSType.Visible = false; |
427 | 429 | this.panelSType.Click += new System.EventHandler(this.panelSType_Click); |
428 | 430 | // |
431 | + // checkBoxSTypeDetails | |
432 | + // | |
433 | + this.checkBoxSTypeDetails.AutoSize = true; | |
434 | + this.checkBoxSTypeDetails.Location = new System.Drawing.Point(49, 45); | |
435 | + this.checkBoxSTypeDetails.Name = "checkBoxSTypeDetails"; | |
436 | + this.checkBoxSTypeDetails.Size = new System.Drawing.Size(48, 16); | |
437 | + this.checkBoxSTypeDetails.TabIndex = 9; | |
438 | + this.checkBoxSTypeDetails.Text = "種別"; | |
439 | + this.checkBoxSTypeDetails.UseVisualStyleBackColor = true; | |
440 | + this.checkBoxSTypeDetails.Click += new System.EventHandler(this.checkBoxSTypeDetails_Click); | |
441 | + // | |
429 | 442 | // checkBoxSTypeAll |
430 | 443 | // |
431 | 444 | this.checkBoxSTypeAll.AutoSize = true; |
@@ -535,6 +548,16 @@ namespace KancolleSniffer | ||
535 | 548 | this.labelSTypeButton.TabIndex = 19; |
536 | 549 | this.labelSTypeButton.Click += new System.EventHandler(this.labelSTypeButton_Click); |
537 | 550 | // |
551 | + // labelSType | |
552 | + // | |
553 | + this.labelSType.AutoSize = true; | |
554 | + this.labelSType.Location = new System.Drawing.Point(74, 8); | |
555 | + this.labelSType.Name = "labelSType"; | |
556 | + this.labelSType.Size = new System.Drawing.Size(29, 12); | |
557 | + this.labelSType.TabIndex = 20; | |
558 | + this.labelSType.Text = "艦種"; | |
559 | + this.labelSType.Click += new System.EventHandler(this.labelSTypeButton_Click); | |
560 | + // | |
538 | 561 | // airBattleResultPanel |
539 | 562 | // |
540 | 563 | this.airBattleResultPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
@@ -607,16 +630,6 @@ namespace KancolleSniffer | ||
607 | 630 | this.shipListPanel.Size = new System.Drawing.Size(238, 263); |
608 | 631 | this.shipListPanel.TabIndex = 0; |
609 | 632 | // |
610 | - // labelSType | |
611 | - // | |
612 | - this.labelSType.AutoSize = true; | |
613 | - this.labelSType.Location = new System.Drawing.Point(74, 8); | |
614 | - this.labelSType.Name = "labelSType"; | |
615 | - this.labelSType.Size = new System.Drawing.Size(29, 12); | |
616 | - this.labelSType.TabIndex = 20; | |
617 | - this.labelSType.Text = "艦種"; | |
618 | - this.labelSType.Click += new System.EventHandler(this.labelSTypeButton_Click); | |
619 | - // | |
620 | 633 | // ListForm |
621 | 634 | // |
622 | 635 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
@@ -716,5 +729,6 @@ namespace KancolleSniffer | ||
716 | 729 | private System.Windows.Forms.CheckBox checkBoxSTypeBattleShip; |
717 | 730 | private System.Windows.Forms.Label labelSTypeButton; |
718 | 731 | private System.Windows.Forms.Label labelSType; |
732 | + private System.Windows.Forms.CheckBox checkBoxSTypeDetails; | |
719 | 733 | } |
720 | 734 | } |
\ No newline at end of file |
@@ -219,6 +219,7 @@ namespace KancolleSniffer | ||
219 | 219 | for (var type = 0; type < _shipTypeCheckBoxes.Length; type++) |
220 | 220 | _shipTypeCheckBoxes[type].Checked = ((int)_config.ShipList.ShipCategories & (1 << type)) != 0; |
221 | 221 | checkBoxSTypeAll.Checked = _config.ShipList.ShipCategories == ShipCategory.All; |
222 | + checkBoxSTypeDetails.Checked = _config.ShipList.ShipType; | |
222 | 223 | } |
223 | 224 | |
224 | 225 | private void ShipListForm_FormClosing(object sender, FormClosingEventArgs e) |
@@ -425,5 +426,12 @@ namespace KancolleSniffer | ||
425 | 426 | panelSType.Visible = visible; |
426 | 427 | labelSTypeButton.BackColor = visible ? CustomColors.ActiveButtonColor : DefaultBackColor; |
427 | 428 | } |
429 | + | |
430 | + private void checkBoxSTypeDetails_Click(object sender, EventArgs e) | |
431 | + { | |
432 | + _config.ShipList.ShipType = checkBoxSTypeDetails.Checked; | |
433 | + UpdateList(); | |
434 | + SetActiveControl(); | |
435 | + } | |
428 | 436 | } |
429 | 437 | } |
\ No newline at end of file |
@@ -108,9 +108,19 @@ namespace KancolleSniffer.View | ||
108 | 108 | { |
109 | 109 | var ships = FilterByShipTypes( |
110 | 110 | _mode == "修復" ? sniffer.RepairList : FilterByGroup(sniffer.ShipList, _mode), |
111 | - config.ShipCategories); | |
111 | + config.ShipCategories).ToArray(); | |
112 | 112 | var order = _mode == "修復" ? ListForm.SortOrder.Repair : config.SortOrder; |
113 | - _shipList = ships.OrderBy(s => s, new CompareShip(false, order)).ToArray(); | |
113 | + if (!config.ShipType) | |
114 | + { | |
115 | + _shipList = ships.OrderBy(s => s, new CompareShip(false, order)).ToArray(); | |
116 | + return; | |
117 | + } | |
118 | + _shipList = ships.Select(ship => new {Id = ship.Spec.ShipType, Name = ship.Spec.ShipTypeName}) | |
119 | + .Distinct().Select(type => new ShipStatus | |
120 | + { | |
121 | + Spec = new ShipSpec { Name = type.Name, ShipType = type.Id}, | |
122 | + Level = 1000, | |
123 | + }).Concat(ships).OrderBy(ship => ship, new CompareShip(true, order)).ToArray(); | |
114 | 124 | } |
115 | 125 | |
116 | 126 | private IEnumerable<ShipStatus> FilterByGroup(IEnumerable<ShipStatus> ships, string group) |
@@ -121,7 +131,7 @@ namespace KancolleSniffer.View | ||
121 | 131 | return from s in ships where GroupSettings[g].Contains(s.Id) select s; |
122 | 132 | } |
123 | 133 | |
124 | - private readonly int[][] _shipTypeIds = | |
134 | + private static readonly int[][] ShipTypeIds = | |
125 | 135 | { |
126 | 136 | new[] // 戦艦 |
127 | 137 | { |
@@ -169,11 +179,22 @@ namespace KancolleSniffer.View | ||
169 | 179 | } |
170 | 180 | }; |
171 | 181 | |
182 | + private static readonly int[] ShipTypeSortIds = CreateShipTypeSortIds(); | |
183 | + | |
184 | + private static int[] CreateShipTypeSortIds() | |
185 | + { | |
186 | + var ids = ShipTypeIds.SelectMany(x => x).ToArray(); | |
187 | + var res = new int[ids.Max() + 1]; | |
188 | + for (var i = 0; i < ids.Length; i++) | |
189 | + res[ids[i]] = i; | |
190 | + return res; | |
191 | + } | |
192 | + | |
172 | 193 | private IEnumerable<ShipStatus> FilterByShipTypes(IEnumerable<ShipStatus> ships, ShipCategory shipTypes) |
173 | 194 | { |
174 | - var ids = Enumerable.Range(0, _shipTypeIds.Length) | |
195 | + var ids = Enumerable.Range(0, ShipTypeIds.Length) | |
175 | 196 | .Where(type => ((int)shipTypes & (1 << type)) != 0) |
176 | - .SelectMany(type => _shipTypeIds[type]).ToArray(); | |
197 | + .SelectMany(type => ShipTypeIds[type]).ToArray(); | |
177 | 198 | return ships.Where(ship => ids.Contains(ship.Spec.ShipType)); |
178 | 199 | } |
179 | 200 |
@@ -197,7 +218,7 @@ namespace KancolleSniffer.View | ||
197 | 218 | if (_shipType) |
198 | 219 | { |
199 | 220 | if (a.Spec.ShipType != b.Spec.ShipType) |
200 | - return a.Spec.ShipType - b.Spec.ShipType; | |
221 | + return ShipTypeSortIds[a.Spec.ShipType] - ShipTypeSortIds[b.Spec.ShipType]; | |
201 | 222 | if (a.Level != b.Level) |
202 | 223 | { |
203 | 224 | if (a.Level == 1000) |
@@ -480,6 +501,7 @@ namespace KancolleSniffer.View | ||
480 | 501 | if (s.Level == 1000) // 艦種の表示 |
481 | 502 | { |
482 | 503 | SetShipType(i); |
504 | + panel.Visible = true; | |
483 | 505 | return; |
484 | 506 | } |
485 | 507 | labels[0].SetHp(s); |
@@ -502,7 +524,6 @@ namespace KancolleSniffer.View | ||
502 | 524 | labels[4].SetName(null); |
503 | 525 | labels[5].SetFleet(null); |
504 | 526 | labels[5].Text = s.Name; |
505 | - _labelPanelList[i].Visible = true; | |
506 | 527 | } |
507 | 528 | |
508 | 529 | private void SetGrouping(int i) |