示例#1
0
            public TableFleetControl(FormFleet parent)
            {
                #region Initialize

                Name           = new Label();
                Name.Text      = "[" + parent.FleetID.ToString() + "]";
                Name.Anchor    = AnchorStyles.Left;
                Name.ForeColor = parent.MainFontColor;
                Name.Padding   = new Padding(0, 1, 0, 1);
                Name.Margin    = new Padding(2, 0, 2, 0);
                Name.AutoSize  = true;
                //Name.Visible = false;
                Name.Cursor = Cursors.Help;

                StateMain           = new ImageLabel();
                StateMain.Anchor    = AnchorStyles.Left;
                StateMain.ForeColor = parent.MainFontColor;
                StateMain.ImageList = ResourceManager.Instance.Icons;
                StateMain.Padding   = new Padding(2, 2, 2, 2);
                StateMain.Margin    = new Padding(2, 0, 2, 0);
                StateMain.AutoSize  = true;

                AirSuperiority            = new ImageLabel();
                AirSuperiority.Anchor     = AnchorStyles.Left;
                AirSuperiority.ForeColor  = parent.MainFontColor;
                AirSuperiority.ImageList  = ResourceManager.Instance.Equipments;
                AirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter;
                AirSuperiority.Padding    = new Padding(2, 2, 2, 2);
                AirSuperiority.Margin     = new Padding(2, 0, 2, 0);
                AirSuperiority.AutoSize   = true;

                SearchingAbility            = new ImageLabel();
                SearchingAbility.Anchor     = AnchorStyles.Left;
                SearchingAbility.ForeColor  = parent.MainFontColor;
                SearchingAbility.ImageList  = ResourceManager.Instance.Equipments;
                SearchingAbility.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedRecon;
                SearchingAbility.Padding    = new Padding(2, 2, 2, 2);
                SearchingAbility.Margin     = new Padding(2, 0, 2, 0);
                SearchingAbility.AutoSize   = true;

                AntiAirPower            = new ImageLabel();
                AntiAirPower.Anchor     = AnchorStyles.Left;
                AntiAirPower.ForeColor  = parent.MainFontColor;
                AntiAirPower.ImageList  = ResourceManager.Instance.Equipments;
                AntiAirPower.ImageIndex = (int)ResourceManager.EquipmentContent.HighAngleGun;
                AntiAirPower.Padding    = new Padding(2, 2, 2, 2);
                AntiAirPower.Margin     = new Padding(2, 0, 2, 0);
                AntiAirPower.AutoSize   = true;


                ConfigurationChanged(parent);

                ToolTipInfo = parent.ToolTipInfo;
                State       = FleetData.FleetStates.NoShip;
                Timer       = DateTime.Now;

                #endregion
            }
示例#2
0
 public void ResetState()
 {
     State = FleetData.FleetStates.NoShip;
 }
示例#3
0
            public void Update(FleetData fleet)
            {
                KCDatabase db = KCDatabase.Instance;

                if (fleet == null)
                {
                    return;
                }



                Name.Text = fleet.Name;
                {
                    int levelSum = fleet.MembersInstance.Sum(s => s != null ? s.Level : 0);

                    int fueltotal = fleet.MembersInstance.Sum(s => s == null ? 0 : (int)Math.Floor(s.FuelMax * (s.IsMarried ? 0.85 : 1.00)));
                    int ammototal = fleet.MembersInstance.Sum(s => s == null ? 0 : (int)Math.Floor(s.AmmoMax * (s.IsMarried ? 0.85 : 1.00)));

                    int fuelunit = fleet.MembersInstance.Sum(s => s == null ? 0 : (int)Math.Floor(s.MasterShip.Fuel * 0.2 * (s.IsMarried ? 0.85 : 1.00)));
                    int ammounit = fleet.MembersInstance.Sum(s => s == null ? 0 : (int)Math.Floor(s.MasterShip.Ammo * 0.2 * (s.IsMarried ? 0.85 : 1.00)));

                    int speed = fleet.MembersWithoutEscaped.Min(s => s == null ? 10 : s.Speed);

                    double expeditionBonus = Calculator.GetExpeditionBonus(fleet);
                    int    tp = Calculator.GetTPDamage(fleet);

                    ToolTipInfo.SetToolTip(Name, string.Format(
                                               "Lv合計: {0} / 平均: {1:0.00}\r\n{2}艦隊\r\nドラム缶搭載: {3}個 ({4}艦)\r\n大発動艇搭載: {5}個 ({6}艦, +{7:p1})\r\n輸送量(TP): S {8} / A {9}\r\n総積載: 燃 {10} / 弾 {11}\r\n(1戦当たり 燃 {12} / 弾 {13})",
                                               levelSum,
                                               (double)levelSum / Math.Max(fleet.Members.Count(id => id != -1), 1),
                                               Constants.GetSpeed(speed),
                                               fleet.MembersInstance.Sum(s => s == null ? 0 : s.SlotInstanceMaster.Count(q => q == null ? false : q.CategoryType == 30)),
                                               fleet.MembersInstance.Count(s => s == null ? false : s.SlotInstanceMaster.Any(q => q == null ? false : q.CategoryType == 30)),
                                               fleet.MembersInstance.Sum(s => s == null ? 0 : s.SlotInstanceMaster.Count(q => q == null ? false : q.CategoryType == 24 || q.CategoryType == 46)),
                                               fleet.MembersInstance.Count(s => s == null ? false : s.SlotInstanceMaster.Any(q => q == null ? false : q.CategoryType == 24 || q.CategoryType == 46)),
                                               expeditionBonus,
                                               tp,
                                               (int)(tp * 0.7),
                                               fueltotal,
                                               ammototal,
                                               fuelunit,
                                               ammounit
                                               ));
                }


                State = FleetData.UpdateFleetState(fleet, StateMain, ToolTipInfo, State, ref Timer);


                //制空戦力計算
                {
                    int  airSuperiority = fleet.GetAirSuperiority();
                    bool includeLevel   = Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 1;
                    AirSuperiority.Text = airSuperiority.ToString();
                    ToolTipInfo.SetToolTip(AirSuperiority,
                                           string.Format("確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n({4}: {5})\r\n",
                                                         (int)(airSuperiority / 3.0),
                                                         (int)(airSuperiority / 1.5),
                                                         Math.Max((int)(airSuperiority * 1.5 - 1), 0),
                                                         Math.Max((int)(airSuperiority * 3.0 - 1), 0),
                                                         includeLevel ? "熟練度なし" : "熟練度あり",
                                                         includeLevel ? Calculator.GetAirSuperiorityIgnoreLevel(fleet) : Calculator.GetAirSuperiority(fleet)));
                }


                //索敵能力計算
                SearchingAbility.Text = fleet.GetSearchingAbilityString();
                {
                    StringBuilder sb         = new StringBuilder();
                    double        probStart  = fleet.GetContactProbability();
                    var           probSelect = fleet.GetContactSelectionProbability();

                    sb.AppendFormat("(旧)2-5式: {0}\r\n2-5式(秋): {1}\r\n2-5新秋簡易式: {2}\r\n判定式(33): {3}\r\n新判定式(33):\r\n 分岐点係数1: {4:f2}\r\n 分岐点係数3: {5:f2}\r\n 分岐点係数4: {6:f2}\r\n\r\n触接開始率: \r\n 確保 {7:p1} / 優勢 {8:p1}\r\n",
                                    fleet.GetSearchingAbilityString(0),
                                    fleet.GetSearchingAbilityString(1),
                                    fleet.GetSearchingAbilityString(2),
                                    fleet.GetSearchingAbilityString(3),
                                    Math.Floor(Calculator.GetSearchingAbility_New33(fleet, 1) * 100) / 100,
                                    Math.Floor(Calculator.GetSearchingAbility_New33(fleet, 3) * 100) / 100,
                                    Math.Floor(Calculator.GetSearchingAbility_New33(fleet, 4) * 100) / 100,
                                    probStart,
                                    probStart * 0.6);

                    if (probSelect.Count > 0)
                    {
                        sb.AppendLine("触接選択率: ");

                        foreach (var p in probSelect.OrderBy(p => p.Key))
                        {
                            sb.AppendFormat(" 命中{0} : {1:p1}\r\n", p.Key, p.Value);
                        }
                    }

                    ToolTipInfo.SetToolTip(SearchingAbility, sb.ToString());
                }

                // 対空能力計算
                {
                    var    sb        = new StringBuilder();
                    double lineahead = Calculator.GetAdjustedFleetAAValue(fleet, 1);

                    AntiAirPower.Text = lineahead.ToString("0.0");

                    sb.AppendFormat("艦隊防空\r\n単縦陣: {0:0.0} / 複縦陣: {1:0.0} / 輪形陣: {2:0.0}\r\n",
                                    lineahead,
                                    Calculator.GetAdjustedFleetAAValue(fleet, 2),
                                    Calculator.GetAdjustedFleetAAValue(fleet, 3));

                    ToolTipInfo.SetToolTip(AntiAirPower, sb.ToString());
                }
            }