void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text    = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            HQLevel.Value = db.Admiral.Level;
            {
                StringBuilder tooltip = new StringBuilder();
                if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                {
                    HQLevel.TextNext  = "next:";
                    HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
                    tooltip.AppendFormat("{0} / {1}\r\n", db.Admiral.Exp, ExpTable.AdmiralExp[db.Admiral.Level + 1].Total);
                }
                else
                {
                    HQLevel.TextNext  = "exp:";
                    HQLevel.ValueNext = db.Admiral.Exp;
                }

                //戦果ツールチップ
                //fixme: もっとましな書き方はなかっただろうか
                {
                    var res = RecordManager.Instance.Resource.GetRecordPrevious();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat(GeneralRes.ThisTime + ": +{0} exp. / " + GeneralRes.RankPoints + " {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordDay();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat(GeneralRes.Today + ": +{0} exp. / " + GeneralRes.RankPoints + " {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordMonth();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat(GeneralRes.ThisMonth + ": +{0} exp. / " + GeneralRes.RankPoints + " {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }

                ToolTipInfo.SetToolTip(HQLevel, tooltip.ToString());
            }

            //Fleet
            FlowPanelFleet.SuspendLayout();
            {
                ShipCount.Text = string.Format("{0}/{1}", RealShipCount, db.Admiral.MaxShipCount);
                if (RealShipCount > db.Admiral.MaxShipCount - 5)
                {
                    ShipCount.BackColor = Utility.ThemeManager.GetColor(Utility.Configuration.Config.UI.Theme, Utility.ThemeColors.RedHighlight);
                }
                else
                {
                    ShipCount.BackColor = Color.Transparent;
                }
                ShipCount.Tag = RealShipCount >= db.Admiral.MaxShipCount;

                EquipmentCount.Text = string.Format("{0}/{1}", RealEquipmentCount, db.Admiral.MaxEquipmentCount);
                if (RealEquipmentCount > db.Admiral.MaxEquipmentCount + 3 - 20)
                {
                    EquipmentCount.BackColor = Utility.ThemeManager.GetColor(Utility.Configuration.Config.UI.Theme, Utility.ThemeColors.RedHighlight);
                }
                else
                {
                    EquipmentCount.BackColor = Color.Transparent;
                }
                EquipmentCount.Tag = RealEquipmentCount >= db.Admiral.MaxEquipmentCount;
            }
            FlowPanelFleet.ResumeLayout();



            var resday   = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddHours(5));
            var resweek  = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddDays(-(((int)DateTime.Now.AddHours(-5).DayOfWeek + 6) % 7)).AddHours(5));                                //月曜日起点
            var resmonth = RecordManager.Instance.Resource.GetRecord(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddHours(5));


            //UseItems
            FlowPanelUseItem.SuspendLayout();

            InstantRepair.Text = db.Material.InstantRepair.ToString();
            ToolTipInfo.SetToolTip(InstantRepair, string.Format(GeneralRes.ChangeTooltip,
                                                                resday == null ? 0 : (db.Material.InstantRepair - resday.InstantRepair),
                                                                resweek == null ? 0 : (db.Material.InstantRepair - resweek.InstantRepair),
                                                                resmonth == null ? 0 : (db.Material.InstantRepair - resmonth.InstantRepair)));

            InstantConstruction.Text = db.Material.InstantConstruction.ToString();
            ToolTipInfo.SetToolTip(InstantConstruction, string.Format(GeneralRes.ChangeTooltip,
                                                                      resday == null ? 0 : (db.Material.InstantConstruction - resday.InstantConstruction),
                                                                      resweek == null ? 0 : (db.Material.InstantConstruction - resweek.InstantConstruction),
                                                                      resmonth == null ? 0 : (db.Material.InstantConstruction - resmonth.InstantConstruction)));

            DevelopmentMaterial.Text = db.Material.DevelopmentMaterial.ToString();
            ToolTipInfo.SetToolTip(DevelopmentMaterial, string.Format(GeneralRes.ChangeTooltip,
                                                                      resday == null ? 0 : (db.Material.DevelopmentMaterial - resday.DevelopmentMaterial),
                                                                      resweek == null ? 0 : (db.Material.DevelopmentMaterial - resweek.DevelopmentMaterial),
                                                                      resmonth == null ? 0 : (db.Material.DevelopmentMaterial - resmonth.DevelopmentMaterial)));

            ModdingMaterial.Text = db.Material.ModdingMaterial.ToString();
            ToolTipInfo.SetToolTip(ModdingMaterial, string.Format(GeneralRes.ChangeTooltip,
                                                                  resday == null ? 0 : (db.Material.ModdingMaterial - resday.ModdingMaterial),
                                                                  resweek == null ? 0 : (db.Material.ModdingMaterial - resweek.ModdingMaterial),
                                                                  resmonth == null ? 0 : (db.Material.ModdingMaterial - resmonth.ModdingMaterial)));

            FurnitureCoin.Text = db.Admiral.FurnitureCoin.ToString();
            {
                int small  = db.UseItems[10] != null ? db.UseItems[10].Count : 0;
                int medium = db.UseItems[11] != null ? db.UseItems[11].Count : 0;
                int large  = db.UseItems[12] != null ? db.UseItems[12].Count : 0;

                ToolTipInfo.SetToolTip(FurnitureCoin,
                                       string.Format("(" + GeneralRes.Small + ") x {0} ( +{1} )\r\n(" + GeneralRes.Medium + ") x {2} ( +{3} )\r\n(" + GeneralRes.Large + ") x {4} ( +{5} )\r\n",
                                                     small, small * 200,
                                                     medium, medium * 400,
                                                     large, large * 700));
            }
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Color overcolor = Utility.ThemeManager.GetColor(Utility.Configuration.Config.UI.Theme, Utility.ThemeColors.OrangeHighlight);

                Fuel.Text      = db.Material.Fuel.ToString();
                Fuel.BackColor = db.Material.Fuel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Fuel, string.Format(GeneralRes.ChangeTooltip,
                                                           resday == null ? 0 : (db.Material.Fuel - resday.Fuel),
                                                           resweek == null ? 0 : (db.Material.Fuel - resweek.Fuel),
                                                           resmonth == null ? 0 : (db.Material.Fuel - resmonth.Fuel)));

                Ammo.Text      = db.Material.Ammo.ToString();
                Ammo.BackColor = db.Material.Ammo < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Ammo, string.Format(GeneralRes.ChangeTooltip,
                                                           resday == null ? 0 : (db.Material.Ammo - resday.Ammo),
                                                           resweek == null ? 0 : (db.Material.Ammo - resweek.Ammo),
                                                           resmonth == null ? 0 : (db.Material.Ammo - resmonth.Ammo)));

                Steel.Text      = db.Material.Steel.ToString();
                Steel.BackColor = db.Material.Steel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Steel, string.Format(GeneralRes.ChangeTooltip,
                                                            resday == null ? 0 : (db.Material.Steel - resday.Steel),
                                                            resweek == null ? 0 : (db.Material.Steel - resweek.Steel),
                                                            resmonth == null ? 0 : (db.Material.Steel - resmonth.Steel)));

                Bauxite.Text      = db.Material.Bauxite.ToString();
                Bauxite.BackColor = db.Material.Bauxite < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Bauxite, string.Format(GeneralRes.ChangeTooltip,
                                                              resday == null ? 0 : (db.Material.Bauxite - resday.Bauxite),
                                                              resweek == null ? 0 : (db.Material.Bauxite - resweek.Bauxite),
                                                              resmonth == null ? 0 : (db.Material.Bauxite - resmonth.Bauxite)));
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }
        void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text    = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            HQLevel.Value = db.Admiral.Level;
            {
                StringBuilder tooltip = new StringBuilder();
                if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                {
                    HQLevel.TextNext  = "next:";
                    HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
                    tooltip.AppendFormat("{0} / {1}\r\n", db.Admiral.Exp, ExpTable.AdmiralExp[db.Admiral.Level + 1].Total);
                }
                else
                {
                    HQLevel.TextNext  = "exp:";
                    HQLevel.ValueNext = db.Admiral.Exp;
                }

                //戦果ツールチップ
                //fixme: もっとましな書き方はなかっただろうか
                {
                    var res = RecordManager.Instance.Resource.GetRecordPrevious();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat(GeneralRes.ThisTime + ": +{0} exp. / " + GeneralRes.RankPoints + " {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordDay();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat(GeneralRes.Today + ": +{0} exp. / " + GeneralRes.RankPoints + " {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordMonth();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat(GeneralRes.ThisMonth + ": +{0} exp. / " + GeneralRes.RankPoints + " {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }

                ToolTipInfo.SetToolTip(HQLevel, tooltip.ToString());
            }

            //Fleet
            FlowPanelFleet.SuspendLayout();
            {
                ShipCount.Text = string.Format("{0}/{1}", RealShipCount, db.Admiral.MaxShipCount);
                if (RealShipCount > db.Admiral.MaxShipCount - 5)
                {
                    ShipCount.BackColor = Color.LightCoral;
                }
                else
                {
                    ShipCount.BackColor = Color.Transparent;
                }
                ShipCount.Tag = RealShipCount >= db.Admiral.MaxShipCount;

                EquipmentCount.Text = string.Format("{0}/{1}", RealEquipmentCount, db.Admiral.MaxEquipmentCount);
                if (RealEquipmentCount > db.Admiral.MaxEquipmentCount + 3 - 20)
                {
                    EquipmentCount.BackColor = Color.LightCoral;
                }
                else
                {
                    EquipmentCount.BackColor = Color.Transparent;
                }
                EquipmentCount.Tag = RealEquipmentCount >= db.Admiral.MaxEquipmentCount;
            }
            FlowPanelFleet.ResumeLayout();

            //UseItems
            FlowPanelUseItem.SuspendLayout();
            InstantRepair.Text       = db.Material.InstantRepair.ToString();
            InstantConstruction.Text = db.Material.InstantConstruction.ToString();
            DevelopmentMaterial.Text = db.Material.DevelopmentMaterial.ToString();
            ModdingMaterial.Text     = db.Material.ModdingMaterial.ToString();
            FurnitureCoin.Text       = db.Admiral.FurnitureCoin.ToString();
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Color overcolor = Color.Moccasin;

                var resday   = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddHours(5));
                var resweek  = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddDays(-(((int)DateTime.Now.AddHours(-5).DayOfWeek + 6) % 7)).AddHours(5));                                    //月曜日起点
                var resmonth = RecordManager.Instance.Resource.GetRecord(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddHours(5));


                Fuel.Text      = db.Material.Fuel.ToString();
                Fuel.BackColor = db.Material.Fuel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Fuel, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Fuel - resday.Fuel),
                                                           resweek == null ? 0 : (db.Material.Fuel - resweek.Fuel),
                                                           resmonth == null ? 0 : (db.Material.Fuel - resmonth.Fuel)));

                Ammo.Text      = db.Material.Ammo.ToString();
                Ammo.BackColor = db.Material.Ammo < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Ammo, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Ammo - resday.Ammo),
                                                           resweek == null ? 0 : (db.Material.Ammo - resweek.Ammo),
                                                           resmonth == null ? 0 : (db.Material.Ammo - resmonth.Ammo)));

                Steel.Text      = db.Material.Steel.ToString();
                Steel.BackColor = db.Material.Steel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Steel, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                            resday == null ? 0 : (db.Material.Steel - resday.Steel),
                                                            resweek == null ? 0 : (db.Material.Steel - resweek.Steel),
                                                            resmonth == null ? 0 : (db.Material.Steel - resmonth.Steel)));

                Bauxite.Text      = db.Material.Bauxite.ToString();
                Bauxite.BackColor = db.Material.Bauxite < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Bauxite, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                              resday == null ? 0 : (db.Material.Bauxite - resday.Bauxite),
                                                              resweek == null ? 0 : (db.Material.Bauxite - resweek.Bauxite),
                                                              resmonth == null ? 0 : (db.Material.Bauxite - resmonth.Bauxite)));
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }
        void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;

            var configUI = Utility.Configuration.Config.UI;

            if (!db.Admiral.IsAvailable)
            {
                return;
            }

            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            {
                StringBuilder tooltip = new StringBuilder();

                var sortieCount = db.Admiral.SortieWin + db.Admiral.SortieLose;
                tooltip.AppendFormat("Sorties: {0} / Win: {1} ({2:p2}) / Lose: {3}\r\n",
                                     sortieCount, db.Admiral.SortieWin, db.Admiral.SortieWin / Math.Max(sortieCount, 1.0), db.Admiral.SortieLose);

                tooltip.AppendFormat("Avg exp per sortie: {0:n2} / per victory: {1:n2}\r\n",
                                     db.Admiral.Exp / Math.Max(sortieCount, 1.0),
                                     db.Admiral.Exp / Math.Max(db.Admiral.SortieWin, 1.0));

                tooltip.AppendFormat("Expeditions: {0} / Success: {1} ({2:p2}) / Failed: {3}\r\n",
                                     db.Admiral.MissionCount, db.Admiral.MissionSuccess, db.Admiral.MissionSuccess / Math.Max(db.Admiral.MissionCount, 1.0), db.Admiral.MissionCount - db.Admiral.MissionSuccess);

                var practiceCount = db.Admiral.PracticeWin + db.Admiral.PracticeLose;
                tooltip.AppendFormat("Naval Exercises: {0} / Win: {1} ({2:p2}) / Lose: {3}\r\n",
                                     practiceCount, db.Admiral.PracticeWin, db.Admiral.PracticeWin / Math.Max(practiceCount, 1.0), db.Admiral.PracticeLose);

                tooltip.AppendFormat("Memedals: {0}\r\n", db.Admiral.Medals);

                ToolTipInfo.SetToolTip(AdmiralName, tooltip.ToString());
            }
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            HQLevel.Value = db.Admiral.Level;
            {
                StringBuilder tooltip = new StringBuilder();
                if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                {
                    HQLevel.TextNext  = "next:";
                    HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
                    tooltip.AppendFormat("{0} / {1}\r\n", db.Admiral.Exp, ExpTable.AdmiralExp[db.Admiral.Level + 1].Total);
                }
                else
                {
                    HQLevel.TextNext  = "exp:";
                    HQLevel.ValueNext = db.Admiral.Exp;
                }

                //戦果ツールチップ
                //fixme: もっとましな書き方はなかっただろうか
                {
                    var res = RecordManager.Instance.Resource.GetRecordPrevious();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("Session: +{0} exp / {1:n2} pt\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordDay();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("Daily: +{0} exp / {1:n2} pt\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordMonth();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("Monthly: +{0} exp / {1:n2} pt\r\n", diff, diff * 7 / 10000.0);
                    }
                }

                ToolTipInfo.SetToolTip(HQLevel, tooltip.ToString());
            }

            //Fleet
            FlowPanelFleet.SuspendLayout();
            {
                ShipCount.Text = string.Format("{0}/{1}", RealShipCount, db.Admiral.MaxShipCount);
                if (RealShipCount > db.Admiral.MaxShipCount - 5)
                {
                    ShipCount.BackColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverBG;
                    ShipCount.ForeColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverFG;
                }
                else
                {
                    ShipCount.BackColor = Color.Transparent;
                    ShipCount.ForeColor = Utility.Configuration.Config.UI.ForeColor;
                }
                ShipCount.Tag = RealShipCount >= db.Admiral.MaxShipCount;

                EquipmentCount.Text = string.Format("{0}/{1}", RealEquipmentCount, db.Admiral.MaxEquipmentCount);
                if (RealEquipmentCount > db.Admiral.MaxEquipmentCount + 3 - 20)
                {
                    EquipmentCount.BackColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverBG;
                    EquipmentCount.ForeColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverFG;
                }
                else
                {
                    EquipmentCount.BackColor = Color.Transparent;
                    EquipmentCount.ForeColor = Utility.Configuration.Config.UI.ForeColor;
                }
                EquipmentCount.Tag = RealEquipmentCount >= db.Admiral.MaxEquipmentCount;
            }
            FlowPanelFleet.ResumeLayout();



            var resday   = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddHours(5));
            var resweek  = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddDays(-(((int)DateTime.Now.AddHours(-5).DayOfWeek + 6) % 7)).AddHours(5));            //月曜日起点
            var resmonth = RecordManager.Instance.Resource.GetRecord(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddHours(5));


            //UseItems
            FlowPanelUseItem.SuspendLayout();

            InstantRepair.Text = db.Material.InstantRepair.ToString();
            if (db.Material.InstantRepair >= 3000)
            {
                InstantRepair.ForeColor = configUI.Headquarters_MaterialMaxFG;
                InstantRepair.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else if (db.Material.InstantRepair < (configUI.HqResLowAlertBucket == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertBucket))
            {
                InstantRepair.ForeColor = configUI.Headquarters_ResourceLowFG;
                InstantRepair.BackColor = configUI.Headquarters_ResourceLowBG;
            }
            else
            {
                InstantRepair.ForeColor = configUI.ForeColor;
                InstantRepair.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(InstantRepair, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                                resday == null ? 0 : (db.Material.InstantRepair - resday.InstantRepair),
                                                                resweek == null ? 0 : (db.Material.InstantRepair - resweek.InstantRepair),
                                                                resmonth == null ? 0 : (db.Material.InstantRepair - resmonth.InstantRepair)));

            InstantConstruction.Text = db.Material.InstantConstruction.ToString();
            if (db.Material.InstantConstruction >= 3000)
            {
                InstantConstruction.ForeColor = configUI.Headquarters_MaterialMaxFG;
                InstantConstruction.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else
            {
                InstantConstruction.ForeColor = configUI.ForeColor;
                InstantConstruction.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(InstantConstruction, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                                      resday == null ? 0 : (db.Material.InstantConstruction - resday.InstantConstruction),
                                                                      resweek == null ? 0 : (db.Material.InstantConstruction - resweek.InstantConstruction),
                                                                      resmonth == null ? 0 : (db.Material.InstantConstruction - resmonth.InstantConstruction)));

            DevelopmentMaterial.Text = db.Material.DevelopmentMaterial.ToString();
            if (db.Material.DevelopmentMaterial >= 3000)
            {
                DevelopmentMaterial.ForeColor = configUI.Headquarters_MaterialMaxFG;
                DevelopmentMaterial.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else
            {
                DevelopmentMaterial.ForeColor = configUI.ForeColor;
                DevelopmentMaterial.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(DevelopmentMaterial, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                                      resday == null ? 0 : (db.Material.DevelopmentMaterial - resday.DevelopmentMaterial),
                                                                      resweek == null ? 0 : (db.Material.DevelopmentMaterial - resweek.DevelopmentMaterial),
                                                                      resmonth == null ? 0 : (db.Material.DevelopmentMaterial - resmonth.DevelopmentMaterial)));

            ModdingMaterial.Text = db.Material.ModdingMaterial.ToString();
            if (db.Material.ModdingMaterial >= 3000)
            {
                ModdingMaterial.ForeColor = configUI.Headquarters_MaterialMaxFG;
                ModdingMaterial.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else
            {
                ModdingMaterial.ForeColor = configUI.ForeColor;
                ModdingMaterial.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(ModdingMaterial, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                                  resday == null ? 0 : (db.Material.ModdingMaterial - resday.ModdingMaterial),
                                                                  resweek == null ? 0 : (db.Material.ModdingMaterial - resweek.ModdingMaterial),
                                                                  resmonth == null ? 0 : (db.Material.ModdingMaterial - resmonth.ModdingMaterial)));

            FurnitureCoin.Text = db.Admiral.FurnitureCoin.ToString();
            if (db.Admiral.FurnitureCoin >= 200000)
            {
                FurnitureCoin.ForeColor = configUI.Headquarters_CoinMaxFG;
                FurnitureCoin.BackColor = configUI.Headquarters_CoinMaxBG;
            }
            else
            {
                FurnitureCoin.ForeColor = configUI.ForeColor;
                FurnitureCoin.BackColor = Color.Transparent;
            }
            {
                int small  = db.UseItems[10]?.Count ?? 0;
                int medium = db.UseItems[11]?.Count ?? 0;
                int large  = db.UseItems[12]?.Count ?? 0;

                ToolTipInfo.SetToolTip(FurnitureCoin,
                                       string.Format("(S) x {0} ( +{1} )\r\n(M) x {2} ( +{3} )\r\n(L) x {4} ( +{5} )\r\n",
                                                     small, small * 200,
                                                     medium, medium * 400,
                                                     large, large * 700));
            }
            UpdateDisplayUseItem();
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Fuel.Text = db.Material.Fuel.ToString();

                if (db.Material.Fuel >= 300000)
                {
                    Fuel.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Fuel.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Fuel < (configUI.HqResLowAlertFuel == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertFuel))
                {
                    Fuel.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Fuel.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Fuel > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Fuel.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Fuel.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Fuel.ForeColor = configUI.ForeColor;
                    Fuel.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Fuel, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Fuel - resday.Fuel),
                                                           resweek == null ? 0 : (db.Material.Fuel - resweek.Fuel),
                                                           resmonth == null ? 0 : (db.Material.Fuel - resmonth.Fuel)));

                Ammo.Text = db.Material.Ammo.ToString();
                if (db.Material.Ammo >= 300000)
                {
                    Ammo.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Ammo.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Ammo < (configUI.HqResLowAlertAmmo == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertAmmo))
                {
                    Ammo.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Ammo.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Ammo > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Ammo.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Ammo.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Ammo.ForeColor = configUI.ForeColor;
                    Ammo.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Ammo, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Ammo - resday.Ammo),
                                                           resweek == null ? 0 : (db.Material.Ammo - resweek.Ammo),
                                                           resmonth == null ? 0 : (db.Material.Ammo - resmonth.Ammo)));

                Steel.Text = db.Material.Steel.ToString();
                if (db.Material.Steel >= 300000)
                {
                    Steel.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Steel.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Steel < (configUI.HqResLowAlertSteel == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertSteel))
                {
                    Steel.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Steel.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Steel > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Steel.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Steel.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Steel.ForeColor = configUI.ForeColor;
                    Steel.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Steel, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                            resday == null ? 0 : (db.Material.Steel - resday.Steel),
                                                            resweek == null ? 0 : (db.Material.Steel - resweek.Steel),
                                                            resmonth == null ? 0 : (db.Material.Steel - resmonth.Steel)));

                Bauxite.Text = db.Material.Bauxite.ToString();
                if (db.Material.Bauxite >= 300000)
                {
                    Bauxite.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Bauxite.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Bauxite < (configUI.HqResLowAlertBauxite == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertBauxite))
                {
                    Bauxite.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Bauxite.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Bauxite > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Bauxite.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Bauxite.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Bauxite.ForeColor = configUI.ForeColor;
                    Bauxite.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Bauxite, string.Format("Daily: {0:+##;-##;±0}\nWeekly: {1:+##;-##;±0}\nMonthly: {2:+##;-##;±0}",
                                                              resday == null ? 0 : (db.Material.Bauxite - resday.Bauxite),
                                                              resweek == null ? 0 : (db.Material.Bauxite - resweek.Bauxite),
                                                              resmonth == null ? 0 : (db.Material.Bauxite - resmonth.Bauxite)));
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }
        void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            if (!db.Admiral.IsAvailable)
            {
                return;
            }


            // 資源上限超過時の色
            Color overcolor = Color.Moccasin;



            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            {
                StringBuilder tooltip = new StringBuilder();

                var sortieCount = db.Admiral.SortieWin + db.Admiral.SortieLose;
                tooltip.AppendFormat("出撃回数: {0} / 出撃勝利: {1} ({2:p2}) / 出撃敗北: {3}\r\n",
                                     sortieCount, db.Admiral.SortieWin, db.Admiral.SortieWin / Math.Max(sortieCount, 1.0), db.Admiral.SortieLose);

                tooltip.AppendFormat("出撃あたりの平均獲得Exp: {0:n2} / 勝利時 {1:n2}\r\n",
                                     db.Admiral.Exp / Math.Max(sortieCount, 1.0),
                                     db.Admiral.Exp / Math.Max(db.Admiral.SortieWin, 1.0));

                tooltip.AppendFormat("遠征回数: {0} / 遠征成功: {1} ({2:p2}) / 遠征失敗: {3}\r\n",
                                     db.Admiral.MissionCount, db.Admiral.MissionSuccess, db.Admiral.MissionSuccess / Math.Max(db.Admiral.MissionCount, 1.0), db.Admiral.MissionCount - db.Admiral.MissionSuccess);

                var practiceCount = db.Admiral.PracticeWin + db.Admiral.PracticeLose;
                tooltip.AppendFormat("演習回数: {0} / 演習勝利: {1} ({2:p2}) / 演習敗北: {3}\r\n",
                                     practiceCount, db.Admiral.PracticeWin, db.Admiral.PracticeWin / Math.Max(practiceCount, 1.0), db.Admiral.PracticeLose);

                tooltip.AppendFormat("甲種勲章保有数: {0}\r\n", db.Admiral.Medals);

                ToolTipInfo.SetToolTip(AdmiralName, tooltip.ToString());
            }
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            HQLevel.Value = db.Admiral.Level;
            {
                StringBuilder tooltip = new StringBuilder();
                if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                {
                    HQLevel.TextNext  = "next:";
                    HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
                    tooltip.AppendFormat("{0} / {1}\r\n", db.Admiral.Exp, ExpTable.AdmiralExp[db.Admiral.Level + 1].Total);
                }
                else
                {
                    HQLevel.TextNext  = "exp:";
                    HQLevel.ValueNext = db.Admiral.Exp;
                }

                //戦果ツールチップ
                //fixme: もっとましな書き方はなかっただろうか
                {
                    var res = RecordManager.Instance.Resource.GetRecordPrevious();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("今回: +{0} exp. / 戦果 {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordDay();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("今日: +{0} exp. / 戦果 {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordMonth();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("今月: +{0} exp. / 戦果 {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }

                ToolTipInfo.SetToolTip(HQLevel, tooltip.ToString());
            }

            //Fleet
            FlowPanelFleet.SuspendLayout();
            {
                ShipCount.Text = string.Format("{0}/{1}", RealShipCount, db.Admiral.MaxShipCount);
                if (RealShipCount > db.Admiral.MaxShipCount - 5)
                {
                    ShipCount.BackColor = Color.LightCoral;
                }
                else
                {
                    ShipCount.BackColor = Color.Transparent;
                }
                ShipCount.Tag = RealShipCount >= db.Admiral.MaxShipCount;

                EquipmentCount.Text = string.Format("{0}/{1}", RealEquipmentCount, db.Admiral.MaxEquipmentCount);
                if (RealEquipmentCount > db.Admiral.MaxEquipmentCount + 3 - 20)
                {
                    EquipmentCount.BackColor = Color.LightCoral;
                }
                else
                {
                    EquipmentCount.BackColor = Color.Transparent;
                }
                EquipmentCount.Tag = RealEquipmentCount >= db.Admiral.MaxEquipmentCount;
            }
            FlowPanelFleet.ResumeLayout();



            var resday   = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddHours(5));
            var resweek  = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddDays(-(((int)DateTime.Now.AddHours(-5).DayOfWeek + 6) % 7)).AddHours(5));            //月曜日起点
            var resmonth = RecordManager.Instance.Resource.GetRecord(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddHours(5));


            //UseItems
            FlowPanelUseItem.SuspendLayout();

            InstantRepair.Text      = db.Material.InstantRepair.ToString();
            InstantRepair.BackColor = db.Material.InstantRepair >= 3000 ? overcolor : Color.Transparent;
            ToolTipInfo.SetToolTip(InstantRepair, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                                resday == null ? 0 : (db.Material.InstantRepair - resday.InstantRepair),
                                                                resweek == null ? 0 : (db.Material.InstantRepair - resweek.InstantRepair),
                                                                resmonth == null ? 0 : (db.Material.InstantRepair - resmonth.InstantRepair)));

            InstantConstruction.Text      = db.Material.InstantConstruction.ToString();
            InstantConstruction.BackColor = db.Material.InstantConstruction >= 3000 ? overcolor : Color.Transparent;
            ToolTipInfo.SetToolTip(InstantConstruction, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                                      resday == null ? 0 : (db.Material.InstantConstruction - resday.InstantConstruction),
                                                                      resweek == null ? 0 : (db.Material.InstantConstruction - resweek.InstantConstruction),
                                                                      resmonth == null ? 0 : (db.Material.InstantConstruction - resmonth.InstantConstruction)));

            DevelopmentMaterial.Text      = db.Material.DevelopmentMaterial.ToString();
            DevelopmentMaterial.BackColor = db.Material.DevelopmentMaterial >= 3000 ? overcolor : Color.Transparent;
            ToolTipInfo.SetToolTip(DevelopmentMaterial, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                                      resday == null ? 0 : (db.Material.DevelopmentMaterial - resday.DevelopmentMaterial),
                                                                      resweek == null ? 0 : (db.Material.DevelopmentMaterial - resweek.DevelopmentMaterial),
                                                                      resmonth == null ? 0 : (db.Material.DevelopmentMaterial - resmonth.DevelopmentMaterial)));

            ModdingMaterial.Text      = db.Material.ModdingMaterial.ToString();
            ModdingMaterial.BackColor = db.Material.ModdingMaterial >= 3000 ? overcolor : Color.Transparent;
            ToolTipInfo.SetToolTip(ModdingMaterial, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                                  resday == null ? 0 : (db.Material.ModdingMaterial - resday.ModdingMaterial),
                                                                  resweek == null ? 0 : (db.Material.ModdingMaterial - resweek.ModdingMaterial),
                                                                  resmonth == null ? 0 : (db.Material.ModdingMaterial - resmonth.ModdingMaterial)));

            FurnitureCoin.Text      = db.Admiral.FurnitureCoin.ToString();
            FurnitureCoin.BackColor = db.Admiral.FurnitureCoin >= 200000 ? overcolor : Color.Transparent;
            {
                int small  = db.UseItems[10]?.Count ?? 0;
                int medium = db.UseItems[11]?.Count ?? 0;
                int large  = db.UseItems[12]?.Count ?? 0;

                ToolTipInfo.SetToolTip(FurnitureCoin,
                                       string.Format("(小) x {0} ( +{1} )\r\n(中) x {2} ( +{3} )\r\n(大) x {4} ( +{5} )\r\n",
                                                     small, small * 200,
                                                     medium, medium * 400,
                                                     large, large * 700));
            }
            UpdateDisplayUseItem();
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Fuel.Text      = db.Material.Fuel.ToString();
                Fuel.BackColor = db.Material.Fuel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Fuel, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Fuel - resday.Fuel),
                                                           resweek == null ? 0 : (db.Material.Fuel - resweek.Fuel),
                                                           resmonth == null ? 0 : (db.Material.Fuel - resmonth.Fuel)));

                Ammo.Text      = db.Material.Ammo.ToString();
                Ammo.BackColor = db.Material.Ammo < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Ammo, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Ammo - resday.Ammo),
                                                           resweek == null ? 0 : (db.Material.Ammo - resweek.Ammo),
                                                           resmonth == null ? 0 : (db.Material.Ammo - resmonth.Ammo)));

                Steel.Text      = db.Material.Steel.ToString();
                Steel.BackColor = db.Material.Steel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Steel, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                            resday == null ? 0 : (db.Material.Steel - resday.Steel),
                                                            resweek == null ? 0 : (db.Material.Steel - resweek.Steel),
                                                            resmonth == null ? 0 : (db.Material.Steel - resmonth.Steel)));

                Bauxite.Text      = db.Material.Bauxite.ToString();
                Bauxite.BackColor = db.Material.Bauxite < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
                ToolTipInfo.SetToolTip(Bauxite, string.Format("今日: {0:+##;-##;±0}\n今週: {1:+##;-##;±0}\n今月: {2:+##;-##;±0}",
                                                              resday == null ? 0 : (db.Material.Bauxite - resday.Bauxite),
                                                              resweek == null ? 0 : (db.Material.Bauxite - resweek.Bauxite),
                                                              resmonth == null ? 0 : (db.Material.Bauxite - resmonth.Bauxite)));
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }
示例#5
0
        void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text    = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            HQLevel.Value = db.Admiral.Level;
            {
                StringBuilder tooltip = new StringBuilder();
                if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                {
                    HQLevel.TextNext  = "next:";
                    HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
                    tooltip.AppendFormat("{0} / {1}\r\n", db.Admiral.Exp, ExpTable.AdmiralExp[db.Admiral.Level + 1].Total);
                }
                else
                {
                    HQLevel.TextNext  = "exp:";
                    HQLevel.ValueNext = db.Admiral.Exp;
                }

                //戦果ツールチップ
                //fixme: もっとましな書き方はなかっただろうか
                {
                    var res = RecordManager.Instance.Resource.GetRecordPrevious();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("前回: +{0} exp. / 戦果 {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordDay();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("今日: +{0} exp. / 戦果 {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }
                {
                    var res = RecordManager.Instance.Resource.GetRecordMonth();
                    if (res != null)
                    {
                        int diff = db.Admiral.Exp - res.HQExp;
                        tooltip.AppendFormat("今月: +{0} exp. / 戦果 {1:n2}\r\n", diff, diff * 7 / 10000.0);
                    }
                }

                ToolTipInfo.SetToolTip(HQLevel, tooltip.ToString());
            }

            //Fleet
            FlowPanelFleet.SuspendLayout();
            ShipCount.Text = string.Format("{0}/{1}", db.Ships.Count, db.Admiral.MaxShipCount);
            if (db.Ships.Count > db.Admiral.MaxShipCount - 5)
            {
                ShipCount.BackColor = Color.LightCoral;
            }
            else
            {
                ShipCount.BackColor = Color.Transparent;
            }

            EquipmentCount.Text = string.Format("{0}/{1}", db.Equipments.Count, db.Admiral.MaxEquipmentCount);
            if (db.Equipments.Count > db.Admiral.MaxEquipmentCount + 3 - 20)
            {
                EquipmentCount.BackColor = Color.LightCoral;
            }
            else
            {
                EquipmentCount.BackColor = Color.Transparent;
            }
            FlowPanelFleet.ResumeLayout();

            //UseItems
            FlowPanelUseItem.SuspendLayout();
            InstantRepair.Text       = db.Material.InstantRepair.ToString();
            InstantConstruction.Text = db.Material.InstantConstruction.ToString();
            DevelopmentMaterial.Text = db.Material.DevelopmentMaterial.ToString();
            ModdingMaterial.Text     = db.Material.ModdingMaterial.ToString();
            FurnitureCoin.Text       = db.Admiral.FurnitureCoin.ToString();
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Color overcolor = Color.Moccasin;
                Fuel.Text      = db.Material.Fuel.ToString();
                Fuel.BackColor = db.Material.Fuel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;

                Ammo.Text      = db.Material.Ammo.ToString();
                Ammo.BackColor = db.Material.Ammo < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;

                Steel.Text      = db.Material.Steel.ToString();
                Steel.BackColor = db.Material.Steel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;

                Bauxite.Text      = db.Material.Bauxite.ToString();
                Bauxite.BackColor = db.Material.Bauxite < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }
示例#6
0
        void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;

            var configUI = Utility.Configuration.Config.UI;

            if (!db.Admiral.IsAvailable)
            {
                return;
            }

            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text    = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            DateTime nowJST = DateTime.UtcNow.AddHours(9);

            HQLevel.Value = db.Admiral.Level;
            {
                StringBuilder tooltip = new StringBuilder();
                bool          showRankingPointsTooltip = true;
                if (Utility.Configuration.Config.UI.ShowGrowthInsteadOfNextInHQ)
                {
                    HQLevel.TextNext = "Growth:";
                    int exp1 = RecordManager.Instance.Resource.GetExpHalfDay(nowJST);
                    if (exp1 == -2013)                       // 年末战果黑洞期,显示全年
                    {
                        HQLevel.TextNext      = string.Format("{0} :", nowJST.Year);
                        HQLevel.TextValueNext = String.Format("{0:n2}", RecordManager.Instance.Resource.GetExpYear(nowJST.Year) * 7 / 10000.0);
                        goto BuildToolTip;
                    }
                    int exp2 = RecordManager.Instance.Resource.GetExpDay(nowJST);
                    if (exp1 >= 0 && exp2 >= 0)
                    {
                        HQLevel.TextValueNext = String.Format(
                            "{0:n2} / {1:n2}",
                            exp1 * 7 / 10000.0,
                            exp2 * 7 / 10000.0
                            );
                    }
                    else
                    {
                        HQLevel.TextValueNext    = "N/A";
                        showRankingPointsTooltip = false;
                    }
                }
                else
                {
                    if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                    {
                        HQLevel.TextNext  = "next:";
                        HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
                    }
                    else
                    {
                        HQLevel.TextNext  = "exp:";
                        HQLevel.ValueNext = db.Admiral.Exp;
                    }
                }

                //戦果ツールチップ
BuildToolTip:
                StringBuilder tooltipAppend = new StringBuilder();

                tooltip.AppendFormat("提督经验 : {0:n0}\r\n", db.Admiral.Exp);
                if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
                {
                    tooltip.AppendFormat("距离升级 : {0:n0} ( 进度 {1:0.00%} )\r\n", ExpTable.GetNextExpAdmiral(db.Admiral.Exp), db.Admiral.Exp / (float)ExpTable.AdmiralExp[db.Admiral.Level + 1].Total);
                }
                else if (db.Admiral.Exp < 180000000)
                {
                    tooltip.AppendFormat("距离上限 : {0:n0} ( 进度 {1:0.00%} )\r\n", 180000000 - db.Admiral.Exp, db.Admiral.Exp / 180000000f);
                }
                else
                {
                    tooltip.AppendFormat("( 已达到经验值上限 )\r\n");
                    showRankingPointsTooltip = false;
                }

                if (showRankingPointsTooltip)
                {
                    int    diff = RecordManager.Instance.Resource.GetExpHalfDay(nowJST, true);
                    double rankingPointsPreviousHalfDay = diff * 7 / 10000.0;
                    tooltipAppend.AppendFormat("半日 : {0:n2}\t( {1} )\r\n", rankingPointsPreviousHalfDay, RecordManager.Instance.Resource.RankingPeriodString);
                    diff = RecordManager.Instance.Resource.GetExpDay(nowJST, true);
                    double rankingPointsPreviousDay = diff * 7 / 10000.0;
                    tooltipAppend.AppendFormat("单日 : {0:n2}\t( {1} )\r\n", rankingPointsPreviousDay, RecordManager.Instance.Resource.RankingPeriodString);
                    diff = RecordManager.Instance.Resource.GetExpMonth(nowJST, true);
                    double rankingPointsPreviousMonth = diff * 7 / 10000.0;
                    tooltipAppend.AppendFormat("单月 : {0:n2}\t( {1} )\r\n", rankingPointsPreviousMonth, RecordManager.Instance.Resource.RankingPeriodString);

                    diff = RecordManager.Instance.Resource.GetExpHalfDay(nowJST);
                    if (diff == -2013)
                    {
                        TimeSpan timeZoneOffset = DateTimeOffset.Now.Offset - new TimeSpan(9, 0, 0);
                        DateTime ends           = new DateTime(nowJST.Year, 12, 31, 0, 0, 0).AddDays(1) + timeZoneOffset;
                        tooltip.AppendFormat("\r\n{0} 年末战果黑洞期 ( ~ {1} )\r\n", nowJST.Year, ends.ToString("yyyy'/'M'/'d HH':'mm"));
                        tooltip.Append(tooltipAppend.ToString());
                        diff = RecordManager.Instance.Resource.GetExpYear(nowJST.Year);
                        double rankingPointsYear = diff * 7 / 10000.0;
                        tooltip.AppendFormat("全年 : {0:n2}\t( {1} )\r\n", rankingPointsYear, RecordManager.Instance.Resource.RankingPeriodString);
                    }
                    else
                    {
                        tooltip.AppendFormat("\r\n{0}\r\n", RecordManager.Instance.Resource.MonthString);
                        double rankingPointsHalfDay = diff * 7 / 10000.0;
                        tooltip.AppendFormat("半日 : {0:n2}\t( {1} )\r\n", rankingPointsHalfDay, RecordManager.Instance.Resource.RankingPeriodString, rankingPointsHalfDay - rankingPointsPreviousHalfDay);
                        diff = RecordManager.Instance.Resource.GetExpDay(nowJST);
                        double rankingPointsDay = diff * 7 / 10000.0;
                        tooltip.AppendFormat("今日 : {0:n2}\t( {1} )\r\n", rankingPointsDay, RecordManager.Instance.Resource.RankingPeriodString, rankingPointsDay - rankingPointsPreviousDay);
                        diff = RecordManager.Instance.Resource.GetExpMonth(nowJST);
                        double rankingPointsMonth = diff * 7 / 10000.0;
                        tooltip.AppendFormat("本月 : {0:n2}\t( {1} )\r\n", rankingPointsMonth, RecordManager.Instance.Resource.RankingPeriodString, rankingPointsMonth - rankingPointsPreviousMonth);

                        tooltip.Append("\r\n上次结算战果\r\n");
                        tooltip.Append(tooltipAppend.ToString());
                    }
                }

                ToolTipInfo.SetToolTip(HQLevel, tooltip.ToString());
            }

            //Fleet
            FlowPanelFleet.SuspendLayout();
            {
                ShipCount.Text = string.Format("{0}/{1}", RealShipCount, db.Admiral.MaxShipCount);
                if (RealShipCount > db.Admiral.MaxShipCount - 5)
                {
                    ShipCount.BackColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverBG;
                    ShipCount.ForeColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverFG;
                }
                else
                {
                    ShipCount.BackColor = Color.Transparent;
                    ShipCount.ForeColor = Utility.Configuration.Config.UI.ForeColor;
                }
                ShipCount.Tag = RealShipCount >= db.Admiral.MaxShipCount;

                EquipmentCount.Text = string.Format("{0}/{1}", RealEquipmentCount, db.Admiral.MaxEquipmentCount);
                if (RealEquipmentCount > db.Admiral.MaxEquipmentCount + 3 - 20)
                {
                    EquipmentCount.BackColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverBG;
                    EquipmentCount.ForeColor = Utility.Configuration.Config.UI.Headquarters_ShipCountOverFG;
                }
                else
                {
                    EquipmentCount.BackColor = Color.Transparent;
                    EquipmentCount.ForeColor = Utility.Configuration.Config.UI.ForeColor;
                }
                EquipmentCount.Tag = RealEquipmentCount >= db.Admiral.MaxEquipmentCount;
            }
            FlowPanelFleet.ResumeLayout();



            var resday   = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddHours(5));
            var resweek  = RecordManager.Instance.Resource.GetRecord(DateTime.Now.AddHours(-5).Date.AddDays(-(((int)DateTime.Now.AddHours(-5).DayOfWeek + 6) % 7)).AddHours(5));            //月曜日起点
            var resmonth = RecordManager.Instance.Resource.GetRecord(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddHours(5));


            //UseItems
            FlowPanelUseItem.SuspendLayout();

            InstantRepair.Text = db.Material.InstantRepair.ToString();
            if (db.Material.InstantRepair >= 3000)
            {
                InstantRepair.ForeColor = configUI.Headquarters_MaterialMaxFG;
                InstantRepair.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else if (db.Material.InstantRepair < (configUI.HqResLowAlertBucket == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertBucket))
            {
                InstantRepair.ForeColor = configUI.Headquarters_ResourceLowFG;
                InstantRepair.BackColor = configUI.Headquarters_ResourceLowBG;
            }
            else
            {
                InstantRepair.ForeColor = configUI.ForeColor;
                InstantRepair.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(InstantRepair, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                                resday == null ? 0 : (db.Material.InstantRepair - resday.InstantRepair),
                                                                resweek == null ? 0 : (db.Material.InstantRepair - resweek.InstantRepair),
                                                                resmonth == null ? 0 : (db.Material.InstantRepair - resmonth.InstantRepair)));

            InstantConstruction.Text = db.Material.InstantConstruction.ToString();
            if (db.Material.InstantConstruction >= 3000)
            {
                InstantConstruction.ForeColor = configUI.Headquarters_MaterialMaxFG;
                InstantConstruction.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else
            {
                InstantConstruction.ForeColor = configUI.ForeColor;
                InstantConstruction.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(InstantConstruction, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                                      resday == null ? 0 : (db.Material.InstantConstruction - resday.InstantConstruction),
                                                                      resweek == null ? 0 : (db.Material.InstantConstruction - resweek.InstantConstruction),
                                                                      resmonth == null ? 0 : (db.Material.InstantConstruction - resmonth.InstantConstruction)));

            DevelopmentMaterial.Text = db.Material.DevelopmentMaterial.ToString();
            if (db.Material.DevelopmentMaterial >= 3000)
            {
                DevelopmentMaterial.ForeColor = configUI.Headquarters_MaterialMaxFG;
                DevelopmentMaterial.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else
            {
                DevelopmentMaterial.ForeColor = configUI.ForeColor;
                DevelopmentMaterial.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(DevelopmentMaterial, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                                      resday == null ? 0 : (db.Material.DevelopmentMaterial - resday.DevelopmentMaterial),
                                                                      resweek == null ? 0 : (db.Material.DevelopmentMaterial - resweek.DevelopmentMaterial),
                                                                      resmonth == null ? 0 : (db.Material.DevelopmentMaterial - resmonth.DevelopmentMaterial)));

            ModdingMaterial.Text = db.Material.ModdingMaterial.ToString();
            if (db.Material.ModdingMaterial >= 3000)
            {
                ModdingMaterial.ForeColor = configUI.Headquarters_MaterialMaxFG;
                ModdingMaterial.BackColor = configUI.Headquarters_MaterialMaxBG;
            }
            else
            {
                ModdingMaterial.ForeColor = configUI.ForeColor;
                ModdingMaterial.BackColor = Color.Transparent;
            }
            ToolTipInfo.SetToolTip(ModdingMaterial, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                                  resday == null ? 0 : (db.Material.ModdingMaterial - resday.ModdingMaterial),
                                                                  resweek == null ? 0 : (db.Material.ModdingMaterial - resweek.ModdingMaterial),
                                                                  resmonth == null ? 0 : (db.Material.ModdingMaterial - resmonth.ModdingMaterial)));

            FurnitureCoin.Text = db.Admiral.FurnitureCoin.ToString();
            if (db.Admiral.FurnitureCoin >= 200000)
            {
                FurnitureCoin.ForeColor = configUI.Headquarters_CoinMaxFG;
                FurnitureCoin.BackColor = configUI.Headquarters_CoinMaxBG;
            }
            else
            {
                FurnitureCoin.ForeColor = configUI.ForeColor;
                FurnitureCoin.BackColor = Color.Transparent;
            }
            {
                int small  = db.UseItems[10]?.Count ?? 0;
                int medium = db.UseItems[11]?.Count ?? 0;
                int large  = db.UseItems[12]?.Count ?? 0;

                ToolTipInfo.SetToolTip(FurnitureCoin,
                                       string.Format("(小) x {0} ( +{1} )\r\n(中) x {2} ( +{3} )\r\n(大) x {4} ( +{5} )\r\n",
                                                     small, small * 200,
                                                     medium, medium * 400,
                                                     large, large * 700));
            }
            UpdateDisplayUseItem();
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Fuel.Text = db.Material.Fuel.ToString();

                if (db.Material.Fuel >= 300000)
                {
                    Fuel.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Fuel.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Fuel < (configUI.HqResLowAlertFuel == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertFuel))
                {
                    Fuel.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Fuel.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Fuel > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Fuel.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Fuel.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Fuel.ForeColor = configUI.ForeColor;
                    Fuel.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Fuel, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Fuel - resday.Fuel),
                                                           resweek == null ? 0 : (db.Material.Fuel - resweek.Fuel),
                                                           resmonth == null ? 0 : (db.Material.Fuel - resmonth.Fuel)));

                Ammo.Text = db.Material.Ammo.ToString();
                if (db.Material.Ammo >= 300000)
                {
                    Ammo.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Ammo.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Ammo < (configUI.HqResLowAlertAmmo == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertAmmo))
                {
                    Ammo.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Ammo.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Ammo > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Ammo.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Ammo.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Ammo.ForeColor = configUI.ForeColor;
                    Ammo.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Ammo, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                           resday == null ? 0 : (db.Material.Ammo - resday.Ammo),
                                                           resweek == null ? 0 : (db.Material.Ammo - resweek.Ammo),
                                                           resmonth == null ? 0 : (db.Material.Ammo - resmonth.Ammo)));

                Steel.Text = db.Material.Steel.ToString();
                if (db.Material.Steel >= 300000)
                {
                    Steel.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Steel.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Steel < (configUI.HqResLowAlertSteel == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertSteel))
                {
                    Steel.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Steel.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Steel > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Steel.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Steel.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Steel.ForeColor = configUI.ForeColor;
                    Steel.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Steel, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                            resday == null ? 0 : (db.Material.Steel - resday.Steel),
                                                            resweek == null ? 0 : (db.Material.Steel - resweek.Steel),
                                                            resmonth == null ? 0 : (db.Material.Steel - resmonth.Steel)));

                Bauxite.Text = db.Material.Bauxite.ToString();
                if (db.Material.Bauxite >= 300000)
                {
                    Bauxite.ForeColor = configUI.Headquarters_ResourceMaxFG;
                    Bauxite.BackColor = configUI.Headquarters_ResourceMaxBG;
                }
                else if (db.Material.Bauxite < (configUI.HqResLowAlertBauxite == -1 ? db.Admiral.MaxResourceRegenerationAmount : configUI.HqResLowAlertBauxite))
                {
                    Bauxite.ForeColor = configUI.Headquarters_ResourceLowFG;
                    Bauxite.BackColor = configUI.Headquarters_ResourceLowBG;
                }
                else if (db.Material.Bauxite > db.Admiral.MaxResourceRegenerationAmount)
                {
                    Bauxite.ForeColor = configUI.Headquarters_ResourceOverFG;
                    Bauxite.BackColor = configUI.Headquarters_ResourceOverBG;
                }
                else
                {
                    Bauxite.ForeColor = configUI.ForeColor;
                    Bauxite.BackColor = Color.Transparent;
                }
                ToolTipInfo.SetToolTip(Bauxite, string.Format("今日 : {0:+##;-##;±0}\n本周 : {1:+##;-##;±0}\n本月 : {2:+##;-##;±0}",
                                                              resday == null ? 0 : (db.Material.Bauxite - resday.Bauxite),
                                                              resweek == null ? 0 : (db.Material.Bauxite - resweek.Bauxite),
                                                              resmonth == null ? 0 : (db.Material.Bauxite - resmonth.Bauxite)));
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }
        void Updated(string apiname, dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            FlowPanelMaster.SuspendLayout();

            //Admiral
            FlowPanelAdmiral.SuspendLayout();
            AdmiralName.Text    = string.Format("{0} {1}", db.Admiral.AdmiralName, Constants.GetAdmiralRank(db.Admiral.Rank));
            AdmiralComment.Text = db.Admiral.Comment;
            FlowPanelAdmiral.ResumeLayout();

            //HQ Level
            HQLevel.Value = db.Admiral.Level;
            if (db.Admiral.Level < ExpTable.AdmiralExp.Max(e => e.Key))
            {
                HQLevel.TextNext  = "next:";
                HQLevel.ValueNext = ExpTable.GetNextExpAdmiral(db.Admiral.Exp);
            }
            else
            {
                HQLevel.TextNext  = "exp:";
                HQLevel.ValueNext = db.Admiral.Exp;
            }


            //Fleet
            FlowPanelFleet.SuspendLayout();
            ShipCount.Text = string.Format("{0}/{1}", db.Ships.Count, db.Admiral.MaxShipCount);
            if (db.Ships.Count > db.Admiral.MaxShipCount - 5)
            {
                ShipCount.BackColor = Color.LightCoral;
            }
            else
            {
                ShipCount.BackColor = Color.Transparent;
            }

            EquipmentCount.Text = string.Format("{0}/{1}", db.Equipments.Count, db.Admiral.MaxEquipmentCount);
            if (db.Equipments.Count > db.Admiral.MaxEquipmentCount - 20)
            {
                EquipmentCount.BackColor = Color.LightCoral;
            }
            else
            {
                EquipmentCount.BackColor = Color.Transparent;
            }
            FlowPanelFleet.ResumeLayout();

            //UseItems
            FlowPanelUseItem.SuspendLayout();
            InstantRepair.Text       = db.Material.InstantRepair.ToString();
            InstantConstruction.Text = db.Material.InstantConstruction.ToString();
            DevelopmentMaterial.Text = db.Material.DevelopmentMaterial.ToString();
            ModdingMaterial.Text     = db.Material.ModdingMaterial.ToString();
            FurnitureCoin.Text       = db.Admiral.FurnitureCoin.ToString();
            FlowPanelUseItem.ResumeLayout();


            //Resources
            FlowPanelResource.SuspendLayout();
            {
                Color overcolor = Color.Moccasin;
                Fuel.Text      = db.Material.Fuel.ToString();
                Fuel.BackColor = db.Material.Fuel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;

                Ammo.Text      = db.Material.Ammo.ToString();
                Ammo.BackColor = db.Material.Ammo < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;

                Steel.Text      = db.Material.Steel.ToString();
                Steel.BackColor = db.Material.Steel < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;

                Bauxite.Text      = db.Material.Bauxite.ToString();
                Bauxite.BackColor = db.Material.Bauxite < db.Admiral.MaxResourceRegenerationAmount ? Color.Transparent : overcolor;
            }
            FlowPanelResource.ResumeLayout();

            FlowPanelMaster.ResumeLayout();
            if (!FlowPanelMaster.Visible)
            {
                FlowPanelMaster.Visible = true;
            }
            AdmiralName.Refresh();
            AdmiralComment.Refresh();
        }