\r
namespace KancolleSniffer.View\r
{\r
- public class FleetPanel : Panel\r
+ public class FleetPanel : PanelWithToolTip\r
{\r
private const int LineHeight = 14;\r
private const int LabelHeight = 12;\r
- private Record[] _table;\r
+ private Record[] _table = new Record[0];\r
private readonly List<FleetLabels> _labelList = new List<FleetLabels>();\r
private readonly List<Panel> _panelList = new List<Panel>();\r
- private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true, AutoPopDelay = 10000};\r
\r
- private class Record\r
+ public FleetPanel()\r
+ {\r
+ ToolTip.AutoPopDelay = 10000;\r
+ }\r
+\r
+ public class Record\r
{\r
public string Fleet { get; set; }\r
public string Fleet2 { get; set; }\r
\r
public void Update(Sniffer sniffer)\r
{\r
- CreateTable(sniffer);\r
+ _table = CreateTable(sniffer);\r
SuspendLayout();\r
CreateLabels();\r
SetRecords();\r
}\r
}\r
\r
- private void CreateTable(Sniffer sniffer)\r
+ public Record[] CreateTable(Sniffer sniffer)\r
{\r
var list = new List<Record>();\r
var fn = new[] {"第一", "第二", "第三", "第四"};\r
{\r
var total = new Total();\r
var shipRecords = new List<Record>();\r
+ var speed = int.MaxValue;\r
foreach (var ship in fleet.ActualShips)\r
{\r
var equips = new List<Record>();\r
for (var i = 0; i < ship.Slot.Count; i++)\r
{\r
var item = ship.Slot[i];\r
- var onslot = ship.OnSlot[i];\r
+ var onSlot = ship.OnSlot[i];\r
var max = ship.Spec.MaxEq[i];\r
if (item.Empty)\r
continue;\r
- var airspec = "";\r
+ var airSpec = "";\r
if (item.Spec.IsDiveBomber) // 爆撃\r
{\r
- airspec = "航空戦 " +\r
- (25 + (int)((item.Spec.Bomber + item.BomberLevelBonus) * Math.Sqrt(onslot)));\r
+ airSpec = "航空戦 " +\r
+ (25 + (int)((item.Spec.Bomber + item.BomberLevelBonus) * Math.Sqrt(onSlot)));\r
}\r
else if (item.Spec.IsTorpedoBomber)\r
{\r
- var normal = 25 + item.Spec.Torpedo * Math.Sqrt(onslot);\r
- airspec = "航空戦 " + (int)(normal * 0.8) + "/" + (int)(normal * 1.5);\r
+ var normal = 25 + item.Spec.Torpedo * Math.Sqrt(onSlot);\r
+ airSpec = "航空戦 " + (int)(normal * 0.8) + "/" + (int)(normal * 1.5);\r
}\r
equips.Add(new Record\r
{\r
Equip = GenEquipString(item),\r
- Spec = item.Spec.IsAircraft ? $"+{item.Alv} {onslot}/{max}" : "",\r
- AircraftSpec = airspec,\r
+ Spec = item.Spec.IsAircraft ? $"+{item.Alv} {onSlot}/{max}" : "",\r
+ AircraftSpec = airSpec,\r
Color = item.Spec.Color\r
});\r
}\r
equips.Add(new Record {Equip = GenEquipString(item), Color = item.Spec.Color});\r
}\r
total.Add(ship);\r
+ speed = Math.Min(speed, ship.Speed);\r
var fire = ship.EffectiveFirepower;\r
+ // ReSharper disable IdentifierTypo\r
var subm = ship.EffectiveAntiSubmarine;\r
var torp = ship.EffectiveTorpedo;\r
var night = ship.NightBattlePower;\r
var oasa = ship.CanOpeningAntiSubmarineAttack ? "*" : "";\r
+ // ReSharper restore IdentifierTypo\r
var record = new Record\r
{\r
Ship = (ship.Escaped ? "[避]" : "") + ship.Name + " Lv" + ship.Level,\r
var tp = fleet.TransportPoint;\r
if (sniffer.IsCombinedFleet && fleet.Number == 0)\r
tp += sniffer.Fleets[1].TransportPoint;\r
+ var speedName = speed == int.MaxValue ? "" : new[] {"", "低速", "高速", "高速+", "最速"}[speed / 5];\r
list.Add(new Record\r
{\r
- Fleet = fn[fleet.Number] + HideIfZero(" Lv", total.Level) +\r
- HideIfZero(" ドラム缶", total.Drum) + HideIfZero("(", total.DrumShips, "隻)") +\r
- HideIfZero(" 大発", daihatsu * 100, "%"),\r
- Fleet2 = "計:" +\r
- "火" + CutOverFlow(total.FirePower) +\r
- " 空" + CutOverFlow(total.AntiAir) +\r
- " 潜" + CutOverFlow(total.AntiSubmarine) +\r
- " 索" + CutOverFlow(total.LoS) + "\r\n" +\r
- $"戦闘:燃{total.Fuel / 5}弾{total.Bull / 5} 支援:燃{total.Fuel / 2}弾{(int)(total.Bull * 0.8)}" +\r
- (sniffer.IsCombinedFleet && fleet.Number == 1\r
- ? ""\r
- : $"\r\nTP:S{(int)tp} A{(int)(tp * 0.7)}")\r
+ Fleet = fn[fleet.Number] + " " + speedName,\r
+ Fleet2 =\r
+ "計:" + HideIfZero(" Lv", total.Level) +\r
+ HideIfZero(" ド", total.Drum) + HideIfZero("(", total.DrumShips, "隻)") +\r
+ HideIfZero(" 大", daihatsu * 100, "%") + "\r\n" +\r
+ " 火" + CutOverFlow(total.FirePower) +\r
+ " 空" + CutOverFlow(total.AntiAir) +\r
+ " 潜" + CutOverFlow(total.AntiSubmarine) +\r
+ " 索" + CutOverFlow(total.LoS) + "\r\n" +\r
+ $"戦闘:燃{total.Fuel / 5}弾{total.Bull / 5} 支援:燃{total.Fuel / 2}弾{(int)(total.Bull * 0.8)}" +\r
+ (sniffer.IsCombinedFleet && fleet.Number == 1\r
+ ? ""\r
+ : $"\r\nTP:S{(int)tp} A{(int)(tp * 0.7)}")\r
});\r
list.AddRange(shipRecords);\r
}\r
- if (sniffer.BaseAirCorps != null)\r
+ if (sniffer.AirBase != null)\r
{\r
var name = new[] {"第一", "第二", "第三"};\r
- foreach (var baseInfo in sniffer.BaseAirCorps)\r
+ foreach (var baseInfo in sniffer.AirBase)\r
{\r
list.Add(new Record {Fleet = baseInfo.AreaName + " 基地航空隊"});\r
var i = 0;\r
{\r
if (i >= name.Length)\r
break;\r
- var corpsFp = airCorps.FighterPower;\r
+ var corpsFp = airCorps.CalcFighterPower();\r
+ var airCombat = new[] { (int)corpsFp[0].AirCombat, (int)corpsFp[1].AirCombat };\r
+ var interception = new[] { (int)corpsFp[0].Interception, (int)corpsFp[1].Interception };\r
+ var different = interception[0] != airCombat[0];\r
string spec;\r
string spec2;\r
if (airCorps.Action == 2)\r
{\r
- spec = "制空:" + RangeString(corpsFp.Interception);\r
- spec2 = corpsFp.IsInterceptor ? "制空(出撃):" + RangeString(corpsFp.AirCombat) : "";\r
+ spec = "制空:" + RangeString(interception);\r
+ spec2 = different ? "制空(出撃):" + RangeString(airCombat) : "";\r
}\r
else\r
{\r
- spec = "制空:" + RangeString(corpsFp.AirCombat);\r
- spec2 = corpsFp.IsInterceptor ? "制空(防空):" + RangeString(corpsFp.Interception) : "";\r
+ spec = "制空:" + RangeString(airCombat);\r
+ spec2 = different ? "制空(防空):" + RangeString(interception) : "";\r
}\r
var cost = airCorps.CostForSortie;\r
list.Add(new Record\r
{\r
Ship = name[i++] + " " + airCorps.ActionName,\r
Ship2 = $"出撃コスト:燃{cost[0]}弾{cost[1]}",\r
- Spec = spec + " 距離:" + airCorps.Distance,\r
+ Spec = spec + $" 距離:{airCorps.Distance}",\r
Spec2 = spec2\r
});\r
list.AddRange(airCorps.Planes.Select(plane =>\r
{\r
var planeFp = plane.FighterPower;\r
+ airCombat = new[] {(int)planeFp[0].AirCombat, (int)planeFp[1].AirCombat};\r
+ interception = new[] {(int) planeFp[0].Interception, (int)planeFp[1].Interception };\r
+ different = interception[0] != airCombat[0];\r
return new Record\r
{\r
Equip = plane.State != 1 ? plane.StateName : GenEquipString(plane.Slot),\r
Spec = plane.State != 1 ? "" : $"+{plane.Slot.Alv} {plane.Count}/{plane.MaxCount}",\r
AircraftSpec =\r
- $"距離:{plane.Slot.Spec.Distance} 制空:{RangeString(planeFp.AirCombat)}" +\r
- (planeFp.IsInterceptor ? $" 防空:{RangeString(planeFp.Interception)}" : ""),\r
+ $"距離:{plane.Slot.Spec.Distance} 制空:{RangeString(airCombat)}" +\r
+ (different ? $" 防空:{RangeString(interception)}" : ""),\r
Color = plane.Slot.Spec.Color\r
};\r
}));\r
}\r
}\r
}\r
- _table = list.ToArray();\r
+ return list.ToArray();\r
}\r
\r
private string RangeString(int[] fp) => fp[0] == fp[1] ? fp[0].ToString() : $"{fp[0]}~{fp[1]}";\r
labels.Fleet.Text = e.Fleet;\r
labels.Name.SetName(e.Ship);\r
if (e.Ship2 != "")\r
- _toolTip.SetToolTip(labels.Name, e.Ship2);\r
+ ToolTip.SetToolTip(labels.Name, e.Ship2);\r
labels.Equip.Text = e.Equip;\r
labels.EquipColor.Visible = e.Equip != "";\r
labels.EquipColor.BackColor = e.Color;\r
labels.Spec.Text = e.Spec;\r
if (e.Fleet != "" && e.Fleet2 != "")\r
- _toolTip.SetToolTip(labels.Fleet, e.Fleet2);\r
- _toolTip.SetToolTip(labels.Equip, e.AircraftSpec != "" ? e.AircraftSpec : "");\r
- _toolTip.SetToolTip(labels.Spec, e.Spec2 != "" ? e.Spec2 : "");\r
+ ToolTip.SetToolTip(labels.Fleet, e.Fleet2);\r
+ ToolTip.SetToolTip(labels.Equip, e.AircraftSpec != "" ? e.AircraftSpec : "");\r
+ ToolTip.SetToolTip(labels.Spec, e.Spec2 != "" ? e.Spec2 : "");\r
lbp.Visible = true;\r
}\r
\r
var y = (int)Math.Round(ShipLabel.ScaleFactor.Height * LineHeight * i);\r
AutoScrollPosition = new Point(0, y);\r
}\r
-\r
- protected override void ScaleControl(SizeF factor, BoundsSpecified specified)\r
- {\r
- base.ScaleControl(factor, specified);\r
- if (factor.Height > 1)\r
- _toolTip.Font = new Font(_toolTip.Font.FontFamily, _toolTip.Font.Size * factor.Height);\r
- }\r
}\r
}
\ No newline at end of file