Ejemplo n.º 1
0
        private void Updated(string apiname, dynamic data)
        {
            TableFleet.SuspendLayout();

            TableFleet.RowCount = KCDatabase.Instance.Fleet.Fleets.Values.Count(f => f.IsAvailable);
            for (int i = 0; i < ControlFleet.Count; i++)
            {
                ControlFleet[i].Update();
            }

            if (KCDatabase.Instance.Fleet.CombinedFlag > 0)
            {
                CombinedTag.Text = Constants.GetCombinedFleet(KCDatabase.Instance.Fleet.CombinedFlag);

                var fleet1 = KCDatabase.Instance.Fleet[1];
                var fleet2 = KCDatabase.Instance.Fleet[2];

                int tp = Calculator.GetTPDamage(fleet1) + Calculator.GetTPDamage(fleet2);

                var members = fleet1.MembersWithoutEscaped.Concat(fleet2.MembersWithoutEscaped).Where(s => s != null);

                // 各艦ごとの ドラム缶 or 大発系 を搭載している個数
                var transport = members.Select(s => s.AllSlotInstanceMaster.Count(eq => eq?.CategoryType == EquipmentTypes.TransportContainer));
                var landing   = members.Select(s => s.AllSlotInstanceMaster.Count(eq => eq?.CategoryType == EquipmentTypes.LandingCraft || eq?.CategoryType == EquipmentTypes.SpecialAmphibiousTank));


                ToolTipInfo.SetToolTip(CombinedTag, string.Format("ドラム缶搭載: {0}個\r\n大発動艇搭載: {1}個\r\n輸送量(TP): S {2} / A {3}\r\n\r\n制空戦力合計: {4}\r\n索敵能力合計: {5:f2}\r\n新判定式(33):\r\n 分岐点係数1: {6:f2}\r\n 分岐点係数2: {7:f2}\r\n 分岐点係数3: {8:f2}\r\n 分岐点係数4: {9:f2}",
                                                                  transport.Sum(),
                                                                  landing.Sum(),
                                                                  tp,
                                                                  (int)Math.Floor(tp * 0.7),
                                                                  Calculator.GetAirSuperiority(fleet1) + Calculator.GetAirSuperiority(fleet2),
                                                                  Math.Floor(fleet1.GetSearchingAbility() * 100) / 100 + Math.Floor(fleet2.GetSearchingAbility() * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 1) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 1) * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 2) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 2) * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 3) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 3) * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 4) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 4) * 100) / 100
                                                                  ));


                CombinedTag.Visible = true;
            }
            else
            {
                CombinedTag.Visible = false;
            }

            if (KCDatabase.Instance.Fleet.AnchorageRepairingTimer > DateTime.MinValue)
            {
                AnchorageRepairingTimer.Text = DateTimeHelper.ToTimeElapsedString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer);
                AnchorageRepairingTimer.Tag  = KCDatabase.Instance.Fleet.AnchorageRepairingTimer;
                ToolTipInfo.SetToolTip(AnchorageRepairingTimer, "泊地修理タイマ\r\n開始: " + DateTimeHelper.TimeToCSVString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer) + "\r\n回復: " + DateTimeHelper.TimeToCSVString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer.AddMinutes(20)));
            }


            LayoutSubInformation();


            TableFleet.ResumeLayout();
        }
        void Updated(string apiname, dynamic data)
        {
            if (IsRemodeling)
            {
                if (apiname == "api_get_member/slot_item")
                {
                    IsRemodeling = false;
                }
                else
                {
                    return;
                }
            }
            if (apiname == "api_req_kaisou/remodeling")
            {
                IsRemodeling = true;
                return;
            }

            KCDatabase db = KCDatabase.Instance;

            if (db.Ships.Count == 0)
            {
                return;
            }

            FleetData fleet = db.Fleet.Fleets[FleetID];

            if (fleet == null)
            {
                return;
            }

            TableFleet.SuspendLayout();
            ControlFleet.Update(fleet);
            TableFleet.Visible = true;
            TableFleet.ResumeLayout();

            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].Update(fleet.Members[i]);
            }
            TableMember.ResumeLayout();


            if (Icon != null)
            {
                ResourceManager.DestroyIcon(Icon);
            }
            Icon = ResourceManager.ImageToIcon(ControlFleet.StateMain.Image);
            if (Parent != null)
            {
                Parent.Refresh();                                       //アイコンを更新するため
            }
        }
Ejemplo n.º 3
0
        private void Updated(string apiname, dynamic data)
        {
            TableFleet.SuspendLayout();

            TableFleet.RowCount = KCDatabase.Instance.Fleet.Fleets.Values.Count(f => f.IsAvailable);
            for (int i = 0; i < ControlFleet.Count; i++)
            {
                ControlFleet[i].Update();
            }

            if (KCDatabase.Instance.Fleet.CombinedFlag > 0)
            {
                CombinedTag.Text = Constants.GetCombinedFleet(KCDatabase.Instance.Fleet.CombinedFlag);

                var fleet1 = KCDatabase.Instance.Fleet[1];
                var fleet2 = KCDatabase.Instance.Fleet[2];

                int tp = Calculator.GetTPDamage(fleet1) + Calculator.GetTPDamage(fleet2);

                ToolTipInfo.SetToolTip(CombinedTag, string.Format("ドラム缶搭載: {0}個\r\n大発動艇搭載: {1}個\r\n輸送量(TP): S {2} / A {3}\r\n\r\n制空戦力合計: {4}\r\n索敵能力合計: {5:f2}\r\n新判定式(33):\r\n 分岐点係数1: {6:f2}\r\n 分岐点係数3: {7:f2}\r\n 分岐点係数4: {8:f2}",
                                                                  fleet1.MembersWithoutEscaped.Sum(s => s == null ? 0 : s.AllSlotInstanceMaster.Count(eq => eq != null && eq.CategoryType == 30)) +
                                                                  fleet2.MembersWithoutEscaped.Sum(s => s == null ? 0 : s.AllSlotInstanceMaster.Count(eq => eq != null && eq.CategoryType == 30)),
                                                                  fleet1.MembersWithoutEscaped.Sum(s => s == null ? 0 : s.AllSlotInstanceMaster.Count(eq => eq != null && eq.CategoryType == 24)) +
                                                                  fleet2.MembersWithoutEscaped.Sum(s => s == null ? 0 : s.AllSlotInstanceMaster.Count(eq => eq != null && eq.CategoryType == 24)),
                                                                  tp,
                                                                  (int)Math.Floor(tp * 0.7),
                                                                  Calculator.GetAirSuperiority(fleet1) + Calculator.GetAirSuperiority(fleet2),
                                                                  Math.Floor(fleet1.GetSearchingAbility() * 100) / 100 + Math.Floor(fleet2.GetSearchingAbility() * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 1) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 1) * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 3) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 3) * 100) / 100,
                                                                  Math.Floor(Calculator.GetSearchingAbility_New33(fleet1, 4) * 100) / 100 + Math.Floor(Calculator.GetSearchingAbility_New33(fleet2, 4) * 100) / 100
                                                                  ));


                CombinedTag.Visible = true;
            }
            else
            {
                CombinedTag.Visible = false;
            }

            if (KCDatabase.Instance.Fleet.AnchorageRepairingTimer > DateTime.MinValue)
            {
                AnchorageRepairingTimer.Text = DateTimeHelper.ToTimeElapsedString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer);
                AnchorageRepairingTimer.Tag  = KCDatabase.Instance.Fleet.AnchorageRepairingTimer;
                ToolTipInfo.SetToolTip(AnchorageRepairingTimer, "泊地修理タイマ\r\n開始: " + DateTimeHelper.TimeToCSVString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer) + "\r\n回復: " + DateTimeHelper.TimeToCSVString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer.AddMinutes(20)));
            }

            TableFleet.ResumeLayout();
        }
        void UpdateTimerTick()
        {
            TableFleet.SuspendLayout();
            {
                FleetData fleet = KCDatabase.Instance.Fleet.Fleets[FleetID];
                if (fleet != null)
                {
                    ControlFleet.Refresh();
                }
            }
            TableFleet.ResumeLayout();

            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].HP.Refresh();
            }
            TableMember.ResumeLayout();
        }
Ejemplo n.º 5
0
        void ConfigurationChanged()
        {
            TableFleet.SuspendLayout();

            Font = Utility.Configuration.Config.UI.MainFont;

            AutoScroll = Utility.Configuration.Config.FormFleet.IsScrollable;

            foreach (var c in ControlFleet)
            {
                c.ConfigurationChanged(this);
            }

            CombinedTag.Font                = Font;
            AnchorageRepairingTimer.Font    = Font;
            AnchorageRepairingTimer.Visible = Utility.Configuration.Config.FormFleet.ShowAnchorageRepairingTimer;

            ControlHelper.SetTableRowStyles(TableFleet, ControlHelper.GetDefaultRowStyle());

            TableFleet.ResumeLayout();
        }
        public FormFleet(FormMain parent, int fleetID)
        {
            InitializeComponent();

            FleetID = fleetID;
            Utility.SystemEvents.UpdateTimerTick += UpdateTimerTick;

            ConfigurationChanged();

            MainFontColor = Color.FromArgb(0x00, 0x00, 0x00);
            SubFontColor  = Color.FromArgb(0x88, 0x88, 0x88);


            //ui init

            ControlHelper.SetDoubleBuffered(TableFleet);
            ControlHelper.SetDoubleBuffered(TableMember);


            TableFleet.Visible = false;
            TableFleet.SuspendLayout();
            TableFleet.BorderStyle = BorderStyle.FixedSingle;
            ControlFleet           = new TableFleetControl(this, TableFleet);
            TableFleet.ResumeLayout();


            TableMember.SuspendLayout();
            ControlMember = new TableMemberControl[6];
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i] = new TableMemberControl(this, TableMember, i);
            }
            TableMember.ResumeLayout();


            ConfigurationChanged();                     //fixme: 苦渋の決断

            Icon = ResourceManager.ImageToIcon(ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet]);
        }