OSDN Git Service

基地航空隊の配備のコストを資材の変動に反映する
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / EquipPanel.cs
index 723c2b0..fb1ae64 100644 (file)
@@ -1,19 +1,16 @@
 // Copyright (C) 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
 //\r
-// This program is part of KancolleSniffer.\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
 //\r
-// KancolleSniffer is free software: you can redistribute it and/or modify\r
-// it under the terms of the GNU General Public License as published by\r
-// the Free Software Foundation, either version 3 of the License, or\r
-// (at your option) any later version.\r
+//    http://www.apache.org/licenses/LICENSE-2.0\r
 //\r
-// This program is distributed in the hope that it will be useful,\r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-// GNU General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
 \r
 using System;\r
 using System.Collections.Generic;\r
@@ -29,16 +26,18 @@ namespace KancolleSniffer
         private EquipColumn[] _equipList;\r
         private readonly List<ShipLabel[]> _labelList = new List<ShipLabel[]>();\r
         private readonly List<Panel> _panelList = new List<Panel>();\r
-        private readonly ToolTip _toolTip = new ToolTip();\r
+        private readonly ToolTip _toolTip = new ToolTip {ShowAlways = true};\r
 \r
         private class EquipColumn\r
         {\r
             public string Fleet { get; set; }\r
+            public string Fleet2 { get; set; }\r
             public string Ship { get; set; }\r
             public int Id { get; set; }\r
             public string Equip { get; set; }\r
             public Color Color { get; set; }\r
             public string Spec { get; set; }\r
+            public string Spec2 { get; set; }\r
             public string AircraftSpec { get; set; }\r
 \r
             public EquipColumn()\r
@@ -61,6 +60,7 @@ namespace KancolleSniffer
         {\r
             var list = new List<EquipColumn>();\r
             var fn = new[] {"第一艦隊", "第二艦隊", "第三艦隊", "第四艦隊"};\r
+            var tp = 0.0;\r
             for (var f = 0; f < fn.Length; f++)\r
             {\r
                 var drumTotal = 0;\r
@@ -73,12 +73,11 @@ namespace KancolleSniffer
                     var equips = new List<EquipColumn>();\r
                     for (var i = 0; i < s.Slot.Length; i++)\r
                     {\r
-                        var slot = s.Slot[i];\r
+                        var item = s.Slot[i];\r
                         var onslot = s.OnSlot[i];\r
                         var max = s.Spec.MaxEq[i];\r
-                        if (slot == -1)\r
+                        if (item.Id == -1)\r
                             continue;\r
-                        var item = sniffer.Item.ItemDict[slot];\r
                         if (item.Spec.Name == "ドラム缶(輸送用)")\r
                             drum++;\r
                         var airspec = "";\r
@@ -104,23 +103,36 @@ namespace KancolleSniffer
                             Color = item.Spec.Color\r
                         });\r
                     }\r
-                    if (s.SlotEx > 0)\r
+                    if (s.SlotEx.Id > 0)\r
                     {\r
-                        var item = sniffer.Item.ItemDict[s.SlotEx];\r
+                        var item = s.SlotEx;\r
                         equips.Add(new EquipColumn {Equip = item.Spec.Name, Color = item.Spec.Color});\r
                     }\r
                     if (drum != 0)\r
                         drumShips++;\r
                     drumTotal += drum;\r
                     levelTotal += s.Level;\r
-                    var rfp = s.RealFirepower;\r
-                    var ras = s.RealAntiSubmarine;\r
-                    ships.Add(new EquipColumn\r
+                    if (f < 2)\r
+                        tp += s.TransportPoint;\r
+                    var fire = s.RealFirepower;\r
+                    var subm = s.RealAntiSubmarine;\r
+                    var torp = s.RealTorpedo;\r
+                    var night = s.NightBattlePower;\r
+                    var ship = new EquipColumn\r
                     {\r
                         Ship = (s.Escaped ? "[避]" : "") + s.Name + " Lv" + s.Level,\r
                         Id = s.Id,\r
-                        Spec = (rfp == 0 ? "" : "砲" + rfp) + (ras == 0 ? "" : " 潜" + ras)\r
-                    });\r
+                        // ReSharper disable CompareOfFloatsByEqualityOperator\r
+                        Spec = (fire == 0 ? "" : $"砲{fire:f1}") + (subm == 0 ? "" : $" 潜{subm:f1}"),\r
+                        Spec2 = (torp == 0 ? "" : $"雷{torp:f1}") + (night == 0 ? "" : $" 夜{night:f1}")\r
+                        // ReSharper restore CompareOfFloatsByEqualityOperator\r
+                    };\r
+                    if (ship.Spec == "")\r
+                    {\r
+                        ship.Spec = ship.Spec2;\r
+                        ship.Spec2 = "";\r
+                    }\r
+                    ships.Add(ship);\r
                     ships.AddRange(equips);\r
                 }\r
                 list.Add(new EquipColumn\r
@@ -130,6 +142,7 @@ namespace KancolleSniffer
                 });\r
                 list.AddRange(ships);\r
             }\r
+            list[0].Fleet2 = $"TP: S{(int)tp} A{(int)(tp * 0.7)}";\r
             _equipList = list.ToArray();\r
         }\r
 \r
@@ -193,7 +206,10 @@ namespace KancolleSniffer
             labels[3].Visible = e.Equip != "";\r
             labels[3].BackColor = e.Color;\r
             labels[4].Text = e.Spec;\r
+            if (e.Fleet != "" && e.Fleet2 != "")\r
+                _toolTip.SetToolTip(labels[0], e.Fleet2);\r
             _toolTip.SetToolTip(labels[2], e.AircraftSpec != "" ? e.AircraftSpec : "");\r
+            _toolTip.SetToolTip(labels[4], e.Spec2 != "" ? e.Spec2 : "");\r
             lbp.Visible = true;\r
         }\r
 \r