コミットメタ情報

リビジョンefb6a40e4341a4ae182dd47a88f46aa5410772ba (tree)
日時2018-05-21 19:10:00
作者Kazuhiro Fujieda <fujieda@user...>
コミッターKazuhiro Fujieda

ログメッセージ

メインの艦隊番号のダブルクリックで艦隊情報をコピーする

変更サマリ

差分

--- a/KancolleSniffer/MainForm.cs
+++ b/KancolleSniffer/MainForm.cs
@@ -1107,6 +1107,7 @@ namespace KancolleSniffer
11071107 {
11081108 a[fleet].Tag = fleet;
11091109 a[fleet].Click += labelFleet_Click;
1110+ a[fleet].DoubleClick += labelFleet_DoubleClick;
11101111 }
11111112 }
11121113 }
@@ -1139,6 +1140,24 @@ namespace KancolleSniffer
11391140 labelFleet1.Text = _combinedFleet ? "連合" : "第一";
11401141 }
11411142
1143+ private void labelFleet_DoubleClick(object sender, EventArgs e)
1144+ {
1145+ if (!_started)
1146+ return;
1147+ var fleet = (int)((Label)sender).Tag;
1148+ var text = TextGenerator.GenerateFleetData(_sniffer, fleet);
1149+ if (string.IsNullOrEmpty(text))
1150+ return;
1151+ Clipboard.SetText(text);
1152+ _tooltipCopy.Active = true;
1153+ _tooltipCopy.Show("コピーしました。", (Label)sender);
1154+ Task.Run(async () =>
1155+ {
1156+ await Task.Delay(1000);
1157+ _tooltipCopy.Active = false;
1158+ });
1159+ }
1160+
11421161 private readonly Color _activeButtonColor = Color.FromArgb(152, 179, 208);
11431162
11441163 private void labelBucketHistoryButton_Click(object sender, EventArgs e)
--- a/KancolleSniffer/TextGenerator.cs
+++ b/KancolleSniffer/TextGenerator.cs
@@ -59,40 +59,56 @@ namespace KancolleSniffer
5959 {
6060 var dict = new ItemName();
6161 var sb = new StringBuilder();
62+ for (var f = 0; f < ShipInfo.FleetCount; f++)
63+ sb.Append(GenerateFleetData(sniffer, f, dict));
64+ sb.Append(GenerateBaseAirCorps(sniffer, dict));
65+ return sb.ToString();
66+ }
67+
68+ public static string GenerateFleetData(Sniffer sniffer, int fleet)
69+ {
70+ return GenerateFleetData(sniffer, fleet, new ItemName()).ToString();
71+ }
72+
73+ private static StringBuilder GenerateFleetData(Sniffer sniffer, int fleet, ItemName dict)
74+ {
75+ var sb = new StringBuilder();
6276 var fn = new[] {"第一艦隊", "第二艦隊", "第三艦隊", "第四艦隊"};
63- for (var f = 0; f < fn.Length; f++)
64- {
65- sb.Append(fn[f] + "\r\n");
66- sb.Append(string.Concat(from s in sniffer.GetShipStatuses(f)
67- select ($"{s.Name} Lv{s.Level} " +
68- string.Join(",",
69- from item in s.AllSlot
70- where item.Id != -1
71- select dict[item.Spec.Name] + ItemStatusString(item))).TrimEnd(' ') + "\r\n"));
72- var fp = sniffer.GetFighterPower(f);
73- sb.Append($"制空: {(fp[0] == fp[1] ? fp[0].ToString() : fp[0] + "~" + fp[1])} " +
74- $"索敵: {sniffer.GetFleetLineOfSights(f, 1):F1}\r\n");
75- }
76- if (sniffer.BaseAirCorps != null)
77+ sb.Append(fn[fleet] + "\r\n");
78+ sb.Append(string.Concat(from s in sniffer.GetShipStatuses(fleet)
79+ select ($"{s.Name} Lv{s.Level} " +
80+ string.Join(",",
81+ from item in s.AllSlot
82+ where item.Id != -1
83+ select dict[item.Spec.Name] + ItemStatusString(item))).TrimEnd(' ') + "\r\n"));
84+ var fp = sniffer.GetFighterPower(fleet);
85+ sb.Append($"制空: {(fp[0] == fp[1] ? fp[0].ToString() : fp[0] + "~" + fp[1])} " +
86+ $"索敵: {sniffer.GetFleetLineOfSights(fleet, 1):F1}\r\n");
87+ return sb;
88+ }
89+
90+ private static StringBuilder GenerateBaseAirCorps(Sniffer sniffer, ItemName dict)
91+ {
92+ var sb = new StringBuilder();
93+ if (sniffer.BaseAirCorps == null)
94+ return sb;
95+ foreach (var baseInfo in sniffer.BaseAirCorps)
7796 {
78- foreach (var baseInfo in sniffer.BaseAirCorps)
97+ sb.Append(baseInfo.AreaName + " 基地航空隊\r\n");
98+ var i = 0;
99+ var name = new[] {"第一 ", "第二 ", "第三 "};
100+ foreach (var airCorps in baseInfo.AirCorps)
79101 {
80- sb.Append(baseInfo.AreaName + " 基地航空隊\r\n");
81- var i = 0;
82- var name = new[] {"第一 ", "第二 ", "第三 "};
83- foreach (var airCorps in baseInfo.AirCorps)
84- {
85- sb.Append(name[i++]);
86- sb.Append(
87- string.Join(",",
88- from plane in airCorps.Planes
89- select plane.State == 1
90- ? dict[plane.Slot.Spec.Name] + ItemStatusString(plane.Slot)
91- : plane.StateName) + "\r\n");
92- }
102+ sb.Append(name[i++]);
103+ sb.Append(
104+ string.Join(",",
105+ from plane in airCorps.Planes
106+ select plane.State == 1
107+ ? dict[plane.Slot.Spec.Name] + ItemStatusString(plane.Slot)
108+ : plane.StateName) + "\r\n");
93109 }
94110 }
95- return sb.ToString();
111+ return sb;
96112 }
97113
98114 private static string ItemStatusString(ItemStatus item)
旧リポジトリブラウザで表示