コミットメタ情報

リビジョンda2111e0f4677ac240796093b0308f47ef39683d (tree)
日時2018-09-01 16:29:58
作者Kazuhiro Fujieda <fujieda@user...>
コミッターKazuhiro Fujieda

ログメッセージ

艦種別表示を復活させる

変更サマリ

差分

--- a/KancolleSniffer/Config.cs
+++ b/KancolleSniffer/Config.cs
@@ -60,6 +60,7 @@ namespace KancolleSniffer
6060 public Size Size { get; set; }
6161 public string Mode { get; set; }
6262 public ShipCategory ShipCategories { get; set; } = ShipCategory.All;
63+ public bool ShipType;
6364 public bool ShowHpInPercent { get; set; }
6465 public ListForm.SortOrder SortOrder { get; set; } = ListForm.SortOrder.ExpToNext;
6566 public List<List<int>> ShipGroup { get; set; }
--- a/KancolleSniffer/ListForm.Designer.cs
+++ b/KancolleSniffer/ListForm.Designer.cs
@@ -78,6 +78,7 @@ namespace KancolleSniffer
7878 this.labelFleet2 = new System.Windows.Forms.Label();
7979 this.labelFleet1 = new System.Windows.Forms.Label();
8080 this.panelSType = new System.Windows.Forms.Panel();
81+ this.checkBoxSTypeDetails = new System.Windows.Forms.CheckBox();
8182 this.checkBoxSTypeAll = new System.Windows.Forms.CheckBox();
8283 this.checkBoxSTypeAuxiliary = new System.Windows.Forms.CheckBox();
8384 this.checkBoxSTypeSubmarine = new System.Windows.Forms.CheckBox();
@@ -88,13 +89,13 @@ namespace KancolleSniffer
8889 this.checkBoxSTypeAircraftCarrier = new System.Windows.Forms.CheckBox();
8990 this.checkBoxSTypeBattleShip = new System.Windows.Forms.CheckBox();
9091 this.labelSTypeButton = new System.Windows.Forms.Label();
92+ this.labelSType = new System.Windows.Forms.Label();
9193 this.airBattleResultPanel = new KancolleSniffer.View.AirBattleResultPanel();
9294 this.battleResultPanel = new KancolleSniffer.View.BattleResultPanel();
9395 this.antiAirPanel = new KancolleSniffer.View.AntiAirPanel();
9496 this.fleetPanel = new KancolleSniffer.View.FleetPanel();
9597 this.itemTreeView = new KancolleSniffer.View.ItemTreeView();
9698 this.shipListPanel = new KancolleSniffer.View.ShipListPanel();
97- this.labelSType = new System.Windows.Forms.Label();
9899 this.contextMenuStripShipList.SuspendLayout();
99100 this.contextMenuStrip.SuspendLayout();
100101 this.panelGroupHeader.SuspendLayout();
@@ -410,6 +411,7 @@ namespace KancolleSniffer
410411 // panelSType
411412 //
412413 this.panelSType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
414+ this.panelSType.Controls.Add(this.checkBoxSTypeDetails);
413415 this.panelSType.Controls.Add(this.checkBoxSTypeAll);
414416 this.panelSType.Controls.Add(this.checkBoxSTypeAuxiliary);
415417 this.panelSType.Controls.Add(this.checkBoxSTypeSubmarine);
@@ -426,6 +428,17 @@ namespace KancolleSniffer
426428 this.panelSType.Visible = false;
427429 this.panelSType.Click += new System.EventHandler(this.panelSType_Click);
428430 //
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+ //
429442 // checkBoxSTypeAll
430443 //
431444 this.checkBoxSTypeAll.AutoSize = true;
@@ -535,6 +548,16 @@ namespace KancolleSniffer
535548 this.labelSTypeButton.TabIndex = 19;
536549 this.labelSTypeButton.Click += new System.EventHandler(this.labelSTypeButton_Click);
537550 //
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+ //
538561 // airBattleResultPanel
539562 //
540563 this.airBattleResultPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -607,16 +630,6 @@ namespace KancolleSniffer
607630 this.shipListPanel.Size = new System.Drawing.Size(238, 263);
608631 this.shipListPanel.TabIndex = 0;
609632 //
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- //
620633 // ListForm
621634 //
622635 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -716,5 +729,6 @@ namespace KancolleSniffer
716729 private System.Windows.Forms.CheckBox checkBoxSTypeBattleShip;
717730 private System.Windows.Forms.Label labelSTypeButton;
718731 private System.Windows.Forms.Label labelSType;
732+ private System.Windows.Forms.CheckBox checkBoxSTypeDetails;
719733 }
720734 }
\ No newline at end of file
--- a/KancolleSniffer/ListForm.cs
+++ b/KancolleSniffer/ListForm.cs
@@ -219,6 +219,7 @@ namespace KancolleSniffer
219219 for (var type = 0; type < _shipTypeCheckBoxes.Length; type++)
220220 _shipTypeCheckBoxes[type].Checked = ((int)_config.ShipList.ShipCategories & (1 << type)) != 0;
221221 checkBoxSTypeAll.Checked = _config.ShipList.ShipCategories == ShipCategory.All;
222+ checkBoxSTypeDetails.Checked = _config.ShipList.ShipType;
222223 }
223224
224225 private void ShipListForm_FormClosing(object sender, FormClosingEventArgs e)
@@ -425,5 +426,12 @@ namespace KancolleSniffer
425426 panelSType.Visible = visible;
426427 labelSTypeButton.BackColor = visible ? CustomColors.ActiveButtonColor : DefaultBackColor;
427428 }
429+
430+ private void checkBoxSTypeDetails_Click(object sender, EventArgs e)
431+ {
432+ _config.ShipList.ShipType = checkBoxSTypeDetails.Checked;
433+ UpdateList();
434+ SetActiveControl();
435+ }
428436 }
429437 }
\ No newline at end of file
--- a/KancolleSniffer/View/ShipListPanel.cs
+++ b/KancolleSniffer/View/ShipListPanel.cs
@@ -108,9 +108,19 @@ namespace KancolleSniffer.View
108108 {
109109 var ships = FilterByShipTypes(
110110 _mode == "修復" ? sniffer.RepairList : FilterByGroup(sniffer.ShipList, _mode),
111- config.ShipCategories);
111+ config.ShipCategories).ToArray();
112112 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();
114124 }
115125
116126 private IEnumerable<ShipStatus> FilterByGroup(IEnumerable<ShipStatus> ships, string group)
@@ -121,7 +131,7 @@ namespace KancolleSniffer.View
121131 return from s in ships where GroupSettings[g].Contains(s.Id) select s;
122132 }
123133
124- private readonly int[][] _shipTypeIds =
134+ private static readonly int[][] ShipTypeIds =
125135 {
126136 new[] // 戦艦
127137 {
@@ -169,11 +179,22 @@ namespace KancolleSniffer.View
169179 }
170180 };
171181
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+
172193 private IEnumerable<ShipStatus> FilterByShipTypes(IEnumerable<ShipStatus> ships, ShipCategory shipTypes)
173194 {
174- var ids = Enumerable.Range(0, _shipTypeIds.Length)
195+ var ids = Enumerable.Range(0, ShipTypeIds.Length)
175196 .Where(type => ((int)shipTypes & (1 << type)) != 0)
176- .SelectMany(type => _shipTypeIds[type]).ToArray();
197+ .SelectMany(type => ShipTypeIds[type]).ToArray();
177198 return ships.Where(ship => ids.Contains(ship.Spec.ShipType));
178199 }
179200
@@ -197,7 +218,7 @@ namespace KancolleSniffer.View
197218 if (_shipType)
198219 {
199220 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];
201222 if (a.Level != b.Level)
202223 {
203224 if (a.Level == 1000)
@@ -480,6 +501,7 @@ namespace KancolleSniffer.View
480501 if (s.Level == 1000) // 艦種の表示
481502 {
482503 SetShipType(i);
504+ panel.Visible = true;
483505 return;
484506 }
485507 labels[0].SetHp(s);
@@ -502,7 +524,6 @@ namespace KancolleSniffer.View
502524 labels[4].SetName(null);
503525 labels[5].SetFleet(null);
504526 labels[5].Text = s.Name;
505- _labelPanelList[i].Visible = true;
506527 }
507528
508529 private void SetGrouping(int i)
旧リポジトリブラウザで表示