Exemplo n.º 1
0
        private void Updated(string apiname, dynamic data)
        {
            Func <int, Color> getColorFromEventKind = ( int kind ) => {
                switch (kind)
                {
                case 0:
                case 1:
                default:                                //昼夜戦・その他
                    return(SystemColors.ControlText);

                case 2:
                case 3:                                 //夜戦・夜昼戦
                    return(Color.Navy);

                case 4:                                 //航空戦
                case 6:                                 //長距離空襲戦
                    return(Color.DarkGreen);
                }
            };

            if (apiname == "api_port/port")
            {
                BasePanel.Visible = false;
            }
            else if (apiname == "api_req_member/get_practice_enemyinfo")
            {
                TextMapArea.Text           = "演習";
                TextDestination.Text       = string.Format("{0} {1}", data.api_nickname, Constants.GetAdmiralRank((int)data.api_rank));
                TextDestination.ImageAlign = ContentAlignment.MiddleCenter;
                TextDestination.ImageIndex = -1;
                ToolTipInfo.SetToolTip(TextDestination, null);
                TextEventKind.Text         = data.api_cmt;
                TextEventKind.ForeColor    = getColorFromEventKind(0);
                TextEventDetail.Text       = string.Format("Lv. {0} / {1} exp.", data.api_level, data.api_experience[0]);
                TextEventDetail.ImageAlign = ContentAlignment.MiddleCenter;
                TextEventDetail.ImageIndex = -1;
                ToolTipInfo.SetToolTip(TextEventDetail, null);
                TextEnemyFleetName.Text = data.api_deckname;
            }
            else
            {
                CompassData compass = KCDatabase.Instance.Battle.Compass;


                BasePanel.SuspendLayout();
                PanelEnemyFleet.Visible     = false;
                PanelEnemyCandidate.Visible = false;

                _enemyFleetCandidate      = null;
                _enemyFleetCandidateIndex = -1;


                TextMapArea.Text = string.Format("出撃海域 : {0}-{1}{2}", compass.MapAreaID, compass.MapInfoID,
                                                 compass.MapInfo.EventDifficulty > 0 ? " [" + Constants.GetDifficulty(compass.MapInfo.EventDifficulty) + "]" : "");
                {
                    var mapinfo = compass.MapInfo;

                    if (mapinfo.IsCleared)
                    {
                        ToolTipInfo.SetToolTip(TextMapArea, null);
                    }
                    else if (mapinfo.RequiredDefeatedCount != -1)
                    {
                        ToolTipInfo.SetToolTip(TextMapArea, string.Format("撃破: {0} / {1} 回", mapinfo.CurrentDefeatedCount, mapinfo.RequiredDefeatedCount));
                    }
                    else if (mapinfo.MapHPMax > 0)
                    {
                        ToolTipInfo.SetToolTip(TextMapArea, string.Format("{0}: {1} / {2}", mapinfo.GaugeType == 3 ? "TP" : "HP", mapinfo.MapHPCurrent, mapinfo.MapHPMax));
                    }
                    else
                    {
                        ToolTipInfo.SetToolTip(TextMapArea, null);
                    }
                }


                TextDestination.Text = string.Format("次のセル : {0}{1}", compass.Destination, (compass.IsEndPoint ? " (終点)" : ""));
                if (compass.LaunchedRecon != 0)
                {
                    TextDestination.ImageAlign = ContentAlignment.MiddleRight;
                    TextDestination.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane;

                    string tiptext;
                    switch (compass.CommentID)
                    {
                    case 1:
                        tiptext = "敵艦隊発見!";
                        break;

                    case 2:
                        tiptext = "攻撃目標発見!";
                        break;

                    case 3:
                        tiptext = "針路哨戒!";
                        break;

                    default:
                        tiptext = "索敵機発艦!";
                        break;
                    }
                    ToolTipInfo.SetToolTip(TextDestination, tiptext);
                }
                else
                {
                    TextDestination.ImageAlign = ContentAlignment.MiddleCenter;
                    TextDestination.ImageIndex = -1;
                    ToolTipInfo.SetToolTip(TextDestination, null);
                }

                //とりあえずリセット
                TextEventDetail.ImageAlign = ContentAlignment.MiddleCenter;
                TextEventDetail.ImageIndex = -1;
                ToolTipInfo.SetToolTip(TextEventDetail, null);


                TextEventKind.ForeColor = getColorFromEventKind(0);

                {
                    string eventkind = Constants.GetMapEventID(compass.EventID);

                    switch (compass.EventID)
                    {
                    case 0:                                     //初期位置
                    case 1:                                     //不明
                        TextEventDetail.Text = "どうしてこうなった";
                        break;

                    case 2:                                     //資源
                    case 8:                                     //船団護衛成功
                        TextEventDetail.Text = GetMaterialName(compass) + " x " + compass.GetItemAmount;
                        break;

                    case 3:                                     //渦潮
                    {
                        int materialmax = KCDatabase.Instance.Fleet.Fleets.Values
                                          .Where(f => f != null && f.IsInSortie)
                                          .SelectMany(f => f.MembersWithoutEscaped)
                                          .Max(s => {
                                if (s == null)
                                {
                                    return(0);
                                }
                                switch (compass.WhirlpoolItemID)
                                {
                                case 1:
                                    return(s.Fuel);

                                case 2:
                                    return(s.Ammo);

                                default:
                                    return(0);
                                }
                            });

                        TextEventDetail.Text = string.Format("{0} x {1} ({2:p0})",
                                                             Constants.GetMaterialName(compass.WhirlpoolItemID),
                                                             compass.WhirlpoolItemAmount,
                                                             (double)compass.WhirlpoolItemAmount / Math.Max(materialmax, 1));
                    }
                    break;

                    case 4:                                     //通常戦闘
                        if (compass.EventKind >= 2)
                        {
                            eventkind += "/" + Constants.GetMapEventKind(compass.EventKind);

                            TextEventKind.ForeColor = getColorFromEventKind(compass.EventKind);
                        }
                        UpdateEnemyFleet();
                        break;

                    case 5:                                     //ボス戦闘
                        TextEventKind.ForeColor = Color.Red;
                        goto case 4;

                    case 6:                                     //気のせいだった
                        switch (compass.EventKind)
                        {
                        case 0:                                                 //気のせいだった
                        default:
                            TextEventDetail.Text = "";
                            break;

                        case 1:                                                 //敵影を見ず
                            eventkind            = "敵影を見ず";
                            TextEventDetail.Text = "";
                            break;

                        case 2:                                                 //能動分岐
                            eventkind            = "能動分岐";
                            TextEventDetail.Text = string.Join("/", compass.RouteChoices);
                            break;
                        }
                        break;

                    case 7:                                     //航空戦or航空偵察
                        TextEventKind.ForeColor = getColorFromEventKind(compass.EventKind);

                        switch (compass.EventKind)
                        {
                        case 0:                                                 //航空偵察
                            eventkind = "航空偵察";

                            switch (compass.AirReconnaissanceResult)
                            {
                            case 0:
                            default:
                                TextEventDetail.Text = "失敗";
                                break;

                            case 1:
                                TextEventDetail.Text = "成功";
                                break;

                            case 2:
                                TextEventDetail.Text = "大成功";
                                break;
                            }

                            switch (compass.AirReconnaissancePlane)
                            {
                            case 0:
                            default:
                                TextEventDetail.ImageAlign = ContentAlignment.MiddleCenter;
                                TextEventDetail.ImageIndex = -1;
                                break;

                            case 1:
                                TextEventDetail.ImageAlign = ContentAlignment.MiddleLeft;
                                TextEventDetail.ImageIndex = (int)ResourceManager.EquipmentContent.FlyingBoat;
                                break;

                            case 2:
                                TextEventDetail.ImageAlign = ContentAlignment.MiddleLeft;
                                TextEventDetail.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane;
                                break;
                            }

                            if (compass.GetItemID != -1)
                            {
                                TextEventDetail.Text += string.Format(" {0} x {1}", GetMaterialName(compass), compass.GetItemAmount);
                            }

                            break;

                        case 4:                                                 //航空戦
                        default:
                            UpdateEnemyFleet();
                            break;
                        }
                        break;

                    case 9:                                     //揚陸地点
                        TextEventDetail.Text = "";
                        break;

                    default:
                        TextEventDetail.Text = "";
                        break;
                    }
                    TextEventKind.Text = eventkind;
                }

                BasePanel.ResumeLayout();

                BasePanel.Visible = true;
            }
        }
Exemplo n.º 2
0
        private void UpdateAlbumPage(int equipmentID)
        {
            KCDatabase          db = KCDatabase.Instance;
            EquipmentDataMaster eq = db.MasterEquipments[equipmentID];

            if (eq == null)
            {
                return;
            }


            BasePanelEquipment.SuspendLayout();


            //header
            EquipmentID.Tag  = equipmentID;
            EquipmentID.Text = eq.EquipmentID.ToString();
            ToolTipInfo.SetToolTip(EquipmentID, string.Format("Type: [ {0} ]", string.Join(", ", eq.EquipmentType)));
            AlbumNo.Text = eq.AlbumNo.ToString();


            TableEquipmentName.SuspendLayout();

            EquipmentType.Text = eq.CategoryTypeInstance.Name;

            {
                int eqicon = eq.IconType;
                if (eqicon >= (int)ResourceManager.EquipmentContent.Locked)
                {
                    eqicon = (int)ResourceManager.EquipmentContent.Unknown;
                }
                EquipmentType.ImageIndex = eqicon;

                ToolTipInfo.SetToolTip(EquipmentType, GetEquippableShips(equipmentID));
            }
            EquipmentName.Text = eq.Name;
            ToolTipInfo.SetToolTip(EquipmentName, "(右クリックでコピー)");

            TableEquipmentName.ResumeLayout();


            //main parameter
            TableParameterMain.SuspendLayout();

            SetParameterText(Firepower, eq.Firepower);
            SetParameterText(Torpedo, eq.Torpedo);
            SetParameterText(AA, eq.AA);
            SetParameterText(Armor, eq.Armor);
            SetParameterText(ASW, eq.ASW);
            SetParameterText(Evasion, eq.Evasion);
            SetParameterText(LOS, eq.LOS);
            SetParameterText(Accuracy, eq.Accuracy);
            SetParameterText(Bomber, eq.Bomber);

            if (eq.CategoryType == EquipmentTypes.Interceptor)
            {
                TitleAccuracy.Text       = "対爆";
                TitleAccuracy.ImageIndex = (int)ResourceManager.IconContent.ParameterAntiBomber;
                TitleEvasion.Text        = "迎撃";
                TitleEvasion.ImageIndex  = (int)ResourceManager.IconContent.ParameterInterception;
            }
            else
            {
                TitleAccuracy.Text       = "命中";
                TitleAccuracy.ImageIndex = (int)ResourceManager.IconContent.ParameterAccuracy;
                TitleEvasion.Text        = "回避";
                TitleEvasion.ImageIndex  = (int)ResourceManager.IconContent.ParameterEvasion;
            }

            TableParameterMain.ResumeLayout();


            //sub parameter
            TableParameterSub.SuspendLayout();

            Speed.Text        = "なし";      //Constants.GetSpeed( eq.Speed );
            Range.Text        = Constants.GetRange(eq.Range);
            Rarity.Text       = Constants.GetEquipmentRarity(eq.Rarity);
            Rarity.ImageIndex = (int)ResourceManager.IconContent.RarityRed + Constants.GetEquipmentRarityID(eq.Rarity);                 //checkme

            TableParameterSub.ResumeLayout();


            // aircraft
            if (eq.IsAircraft)
            {
                TableAircraft.SuspendLayout();
                AircraftCost.Text = eq.AircraftCost.ToString();
                ToolTipInfo.SetToolTip(AircraftCost, "配備時のボーキ消費:" + ((eq.IsCombatAircraft ? 18 : 4) * eq.AircraftCost));
                AircraftDistance.Text = eq.AircraftDistance.ToString();
                TableAircraft.ResumeLayout();
                TableAircraft.Visible = true;
            }
            else
            {
                TableAircraft.Visible = false;
            }


            //default equipment
            DefaultSlots.BeginUpdate();
            DefaultSlots.Items.Clear();
            foreach (var ship in KCDatabase.Instance.MasterShips.Values)
            {
                if (ship.DefaultSlot != null && ship.DefaultSlot.Contains(equipmentID))
                {
                    DefaultSlots.Items.Add(ship);
                }
            }
            DefaultSlots.EndUpdate();


            Description.Text = eq.Message;


            //arsenal
            TableArsenal.SuspendLayout();

            MaterialFuel.Text    = eq.Material[0].ToString();
            MaterialAmmo.Text    = eq.Material[1].ToString();
            MaterialSteel.Text   = eq.Material[2].ToString();
            MaterialBauxite.Text = eq.Material[3].ToString();

            TableArsenal.ResumeLayout();



            //装備画像を読み込んでみる
            {
                var img =
                    KCResourceHelper.LoadEquipmentImage(equipmentID, KCResourceHelper.ResourceTypeEquipmentCard) ??
                    KCResourceHelper.LoadEquipmentImage(equipmentID, KCResourceHelper.ResourceTypeEquipmentCardSmall);

                if (img != null)
                {
                    EquipmentImage.Image?.Dispose();
                    EquipmentImage.Image = img;
                }
                else
                {
                    EquipmentImage.Image?.Dispose();
                    EquipmentImage.Image = null;
                }
            }


            BasePanelEquipment.ResumeLayout();
            BasePanelEquipment.Visible = true;


            this.Text = "装備図鑑 - " + eq.Name;
        }
        private void UpdateAlbumPage(int equipmentID)
        {
            KCDatabase          db = KCDatabase.Instance;
            EquipmentDataMaster eq = db.MasterEquipments[equipmentID];

            if (eq == null)
            {
                return;
            }


            BasePanelEquipment.SuspendLayout();


            //header
            EquipmentID.Tag  = equipmentID;
            EquipmentID.Text = eq.EquipmentID.ToString();
            ToolTipInfo.SetToolTip(EquipmentID, string.Format("Type: [ {0} ]", string.Join(", ", eq.EquipmentType)));
            AlbumNo.Text = eq.AlbumNo.ToString();


            TableEquipmentName.SuspendLayout();

            EquipmentType.Text = eq.CategoryTypeInstance.Name;

            {
                int eqicon = eq.IconType;
                if (eqicon >= (int)ResourceManager.EquipmentContent.Locked)
                {
                    eqicon = (int)ResourceManager.EquipmentContent.Unknown;
                }
                EquipmentType.ImageIndex = eqicon;

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("装備可能艦種:");
                foreach (var stype in KCDatabase.Instance.ShipTypes.Values)
                {
                    if (stype.EquipmentType.Contains((int)eq.CategoryType))
                    {
                        sb.AppendLine(stype.Name);
                    }
                }
                ToolTipInfo.SetToolTip(EquipmentType, sb.ToString());
            }
            EquipmentName.Text = eq.Name;
            ToolTipInfo.SetToolTip(EquipmentName, "(右クリックでコピー)");

            TableEquipmentName.ResumeLayout();


            //main parameter
            TableParameterMain.SuspendLayout();

            SetParameterText(Firepower, eq.Firepower);
            SetParameterText(Torpedo, eq.Torpedo);
            SetParameterText(AA, eq.AA);
            SetParameterText(Armor, eq.Armor);
            SetParameterText(ASW, eq.ASW);
            SetParameterText(Evasion, eq.Evasion);
            SetParameterText(LOS, eq.LOS);
            SetParameterText(Accuracy, eq.Accuracy);
            SetParameterText(Bomber, eq.Bomber);

            if (eq.CategoryType == EquipmentTypes.Interceptor)
            {
                TitleAccuracy.Text = "対爆";
                TitleEvasion.Text  = "迎撃";
            }
            else
            {
                TitleAccuracy.Text = "命中";
                TitleEvasion.Text  = "回避";
            }

            TableParameterMain.ResumeLayout();


            //sub parameter
            TableParameterSub.SuspendLayout();

            Speed.Text        = "なし";      //Constants.GetSpeed( eq.Speed );
            Range.Text        = Constants.GetRange(eq.Range);
            Rarity.Text       = Constants.GetEquipmentRarity(eq.Rarity);
            Rarity.ImageIndex = (int)ResourceManager.IconContent.RarityRed + Constants.GetEquipmentRarityID(eq.Rarity);                 //checkme

            TableParameterSub.ResumeLayout();


            // aircraft
            if (eq.IsAircraft)
            {
                TableAircraft.SuspendLayout();
                AircraftCost.Text = eq.AircraftCost.ToString();
                ToolTipInfo.SetToolTip(AircraftCost, "配備時のボーキ消費:" + ((eq.IsCombatAircraft ? 18 : 4) * eq.AircraftCost));
                AircraftDistance.Text = eq.AircraftDistance.ToString();
                TableAircraft.ResumeLayout();
                TableAircraft.Visible = true;
            }
            else
            {
                TableAircraft.Visible = false;
            }


            //default equipment
            DefaultSlots.BeginUpdate();
            DefaultSlots.Items.Clear();
            foreach (var ship in KCDatabase.Instance.MasterShips.Values)
            {
                if (ship.DefaultSlot != null && ship.DefaultSlot.Contains(equipmentID))
                {
                    DefaultSlots.Items.Add(ship);
                }
            }
            DefaultSlots.EndUpdate();


            Description.Text = eq.Message;


            //arsenal
            TableArsenal.SuspendLayout();

            MaterialFuel.Text    = eq.Material[0].ToString();
            MaterialAmmo.Text    = eq.Material[1].ToString();
            MaterialSteel.Text   = eq.Material[2].ToString();
            MaterialBauxite.Text = eq.Material[3].ToString();

            TableArsenal.ResumeLayout();



            //装備画像を読み込んでみる
            {
                string path = string.Format(@"{0}\\resources\\image\\slotitem\\card\\{1:D3}.png", Utility.Configuration.Config.Connection.SaveDataPath, equipmentID);
                if (File.Exists(path))
                {
                    try
                    {
                        EquipmentImage.Image = new Bitmap(path);
                    }
                    catch (Exception)
                    {
                        if (EquipmentImage.Image != null)
                        {
                            EquipmentImage.Image.Dispose();
                        }
                        EquipmentImage.Image = null;
                    }
                }
                else
                {
                    if (EquipmentImage.Image != null)
                    {
                        EquipmentImage.Image.Dispose();
                    }
                    EquipmentImage.Image = null;
                }
            }


            BasePanelEquipment.ResumeLayout();
            BasePanelEquipment.Visible = true;


            this.Text = "装備図鑑 - " + eq.Name;
        }
Exemplo n.º 4
0
        private void UpdateEnemyFleetInstant(bool isPractice = false)
        {
            BattleManager bm = KCDatabase.Instance.Battle;
            BattleData    bd;

            switch (bm.BattleMode & BattleManager.BattleModes.BattlePhaseMask)
            {
            case BattleManager.BattleModes.NightOnly:
            case BattleManager.BattleModes.NightDay:
                bd = bm.BattleNight;
                break;

            default:
                bd = bm.BattleDay;
                break;
            }

            int[]   enemies    = bd.Initial.EnemyMembers;
            int[][] slots      = bd.Initial.EnemySlots;
            int[]   levels     = bd.Initial.EnemyLevels;
            int[][] parameters = bd.Initial.EnemyParameters;
            int[]   hps        = bd.Initial.MaxHPs;


            _enemyFleetCandidate      = null;
            _enemyFleetCandidateIndex = -1;



            if ((bm.BattleMode & BattleManager.BattleModes.BattlePhaseMask) != BattleManager.BattleModes.Practice)
            {
                var efcurrent = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();
                var efrecord  = RecordManager.Instance.EnemyFleet[efcurrent.FleetID];
                if (efrecord != null)
                {
                    TextEnemyFleetName.Text = efrecord.FleetName;
                }
                TextEventDetail.Text = "敵艦隊ID: " + efcurrent.FleetID.ToString("x8");
                ToolTipInfo.SetToolTip(TextEventDetail, null);
            }

            TextFormation.Text = Constants.GetFormationShort((int)bd.Searching.FormationEnemy);
            //TextFormation.ImageIndex = (int)ResourceManager.IconContent.BattleFormationEnemyLineAhead + bd.Searching.FormationEnemy - 1;
            TextFormation.Visible = true;
            {
                int air = Calculator.GetAirSuperiority(enemies, slots);
                TextAirSuperiority.Text = isPractice ?
                                          air.ToString() + " ~ " + Calculator.GetAirSuperiorityAtMaxLevel(enemies, slots).ToString() :
                                          air.ToString();
                ToolTipInfo.SetToolTip(TextAirSuperiority, GetAirSuperiorityString(isPractice ? 0 : air));
                TextAirSuperiority.Visible = true;
            }

            TableEnemyMember.SuspendLayout();
            for (int i = 0; i < ControlMembers.Length; i++)
            {
                int shipID = enemies[i];
                ControlMembers[i].Update(shipID, shipID != -1 ? slots[i] : null);

                if (shipID != -1)
                {
                    ControlMembers[i].UpdateEquipmentToolTip(shipID, slots[i], levels[i], hps[i + 6], parameters[i][0], parameters[i][1], parameters[i][2], parameters[i][3]);
                }
            }
            TableEnemyMember.ResumeLayout();
            TableEnemyMember.Visible = true;

            PanelEnemyFleet.Visible = true;

            PanelEnemyCandidate.Visible = false;

            BasePanel.Visible = true;                                   //checkme
        }
        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();
        }
Exemplo n.º 6
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 - 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();
        }
Exemplo n.º 7
0
 private void QuestView_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
 {
     ToolTipInfo.SetToolTip(QuestView, null);
 }
        private void UpdateAlbumPage(int shipID)
        {
            KCDatabase     db   = KCDatabase.Instance;
            ShipDataMaster ship = db.MasterShips[shipID];

            if (ship == null)
            {
                return;
            }


            BasePanelShipGirl.SuspendLayout();

            //header
            TableShipName.SuspendLayout();
            _shipID           = shipID;
            ShipID.Text       = ship.ShipID.ToString();
            AlbumNo.Text      = ship.AlbumNo.ToString();
            ResourceName.Text = string.Format("{0} ver. {1}", ship.ResourceName, ship.ResourceVersion);

            ShipType.Text = ship.IsLandBase ? EncycloRes.LandBase : FormMain.Instance.Translator.GetTranslation(db.ShipTypes[ship.ShipType].Name, Utility.TranslationType.ShipTypes);
            ShipName.Text = ship.NameWithClass;
            ToolTipInfo.SetToolTip(ShipName, !ship.IsAbyssalShip ? ship.NameReading : null);
            TableShipName.ResumeLayout();


            //main parameter
            TableParameterMain.SuspendLayout();

            if (!ship.IsAbyssalShip)
            {
                TitleParameterMin.Text = EncycloRes.Initial;
                TitleParameterMax.Text = EncycloRes.Maximum;

                HPMin.Text = ship.HPMin.ToString();
                HPMax.Text = ship.HPMaxMarried.ToString();

                FirepowerMin.Text = ship.FirepowerMin.ToString();
                FirepowerMax.Text = ship.FirepowerMax.ToString();

                TorpedoMin.Text = ship.TorpedoMin.ToString();
                TorpedoMax.Text = ship.TorpedoMax.ToString();

                AAMin.Text = ship.AAMin.ToString();
                AAMax.Text = ship.AAMax.ToString();

                ArmorMin.Text = ship.ArmorMin.ToString();
                ArmorMax.Text = ship.ArmorMax.ToString();

                ASWMin.Text = GetParameterMinBound(ship.ASW);
                ASWMax.Text = GetParameterMax(ship.ASW);

                EvasionMin.Text = GetParameterMinBound(ship.Evasion);
                EvasionMax.Text = GetParameterMax(ship.Evasion);

                LOSMin.Text = GetParameterMinBound(ship.LOS);
                LOSMax.Text = GetParameterMax(ship.LOS);

                LuckMin.Text = ship.LuckMin.ToString();
                LuckMax.Text = ship.LuckMax.ToString();
            }
            else
            {
                int hp        = ship.HPMin;
                int firepower = ship.FirepowerMax;
                int torpedo   = ship.TorpedoMax;
                int aa        = ship.AAMax;
                int armor     = ship.ArmorMax;
                int asw       = ship.ASW != null && ship.ASW.Maximum != ShipParameterRecord.Parameter.MaximumDefault ? ship.ASW.Maximum : 0;
                int evasion   = ship.Evasion != null && ship.Evasion.Maximum != ShipParameterRecord.Parameter.MaximumDefault ? ship.Evasion.Maximum : 0;
                int los       = ship.LOS != null && ship.LOS.Maximum != ShipParameterRecord.Parameter.MaximumDefault ? ship.LOS.Maximum : 0;
                int luck      = ship.LuckMax;

                if (ship.DefaultSlot != null)
                {
                    int count = ship.DefaultSlot.Count;
                    for (int i = 0; i < count; i++)
                    {
                        EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[ship.DefaultSlot[i]];
                        if (eq == null)
                        {
                            continue;
                        }

                        firepower += eq.Firepower;
                        torpedo   += eq.Torpedo;
                        aa        += eq.AA;
                        armor     += eq.Armor;
                        asw       += eq.ASW;
                        evasion   += eq.Evasion;
                        los       += eq.LOS;
                        luck      += eq.Luck;
                    }
                }

                TitleParameterMin.Text = EncycloRes.BaseValue;
                TitleParameterMax.Text = EncycloRes.WithEquipValue;

                HPMin.Text = ship.HPMin.ToString();
                HPMax.Text = hp.ToString();

                FirepowerMin.Text = ship.FirepowerMax.ToString();
                FirepowerMax.Text = firepower.ToString();

                TorpedoMin.Text = ship.TorpedoMax.ToString();
                TorpedoMax.Text = torpedo.ToString();

                AAMin.Text = ship.AAMax.ToString();
                AAMax.Text = aa.ToString();

                ArmorMin.Text = ship.ArmorMax.ToString();
                ArmorMax.Text = armor.ToString();

                ASWMin.Text = ship.ASW != null && ship.ASW.Maximum != ShipParameterRecord.Parameter.MaximumDefault ? ship.ASW.Maximum.ToString() : "???";
                ASWMax.Text = asw.ToString();

                EvasionMin.Text = ship.Evasion != null && ship.Evasion.Maximum != ShipParameterRecord.Parameter.MaximumDefault ? ship.Evasion.Maximum.ToString() : "???";
                EvasionMax.Text = evasion.ToString();

                LOSMin.Text = ship.LOS != null && ship.LOS.Maximum != ShipParameterRecord.Parameter.MaximumDefault ? ship.LOS.Maximum.ToString() : "???";
                LOSMax.Text = los.ToString();

                LuckMin.Text = ship.LuckMax.ToString();
                LuckMax.Text = luck.ToString();
            }
            UpdateLevelParameter(ship.ShipID);

            TableParameterMain.ResumeLayout();


            //sub parameter
            TableParameterSub.SuspendLayout();

            Speed.Text        = Constants.GetSpeed(ship.Speed);
            Range.Text        = Constants.GetRange(ship.Range);
            Rarity.Text       = Constants.GetShipRarity(ship.Rarity);
            Rarity.ImageIndex = (int)ResourceManager.IconContent.RarityRed + ship.Rarity;

            TableParameterSub.ResumeLayout();

            TableConsumption.SuspendLayout();

            Fuel.Text = ship.Fuel.ToString();
            Ammo.Text = ship.Ammo.ToString();

            string tooltiptext = string.Format(
                EncycloRes.RepairTooltip,
                (ship.Fuel * 0.06),
                (ship.Fuel * 0.032),
                (int)(ship.Fuel * 0.06 * (ship.HPMaxMarried - 1)),
                (int)(ship.Fuel * 0.032 * (ship.HPMaxMarried - 1))
                );

            ToolTipInfo.SetToolTip(TableConsumption, tooltiptext);
            ToolTipInfo.SetToolTip(TitleConsumption, tooltiptext);
            ToolTipInfo.SetToolTip(Fuel, tooltiptext);
            ToolTipInfo.SetToolTip(Ammo, tooltiptext);

            TableConsumption.ResumeLayout();

            Description.Text = ship.MessageAlbum != "" ? ship.MessageAlbum : ship.MessageGet;
            Description.Tag  = ship.MessageAlbum != "" ? 1 : 0;


            //equipment
            TableEquipment.SuspendLayout();

            for (int i = 0; i < Equipments.Length; i++)
            {
                if (ship.Aircraft[i] > 0 || i < ship.SlotSize)
                {
                    Aircrafts[i].Text = ship.Aircraft[i].ToString();
                }
                else
                {
                    Aircrafts[i].Text = "";
                }


                ToolTipInfo.SetToolTip(Equipments[i], null);

                if (ship.DefaultSlot == null)
                {
                    if (i < ship.SlotSize)
                    {
                        Equipments[i].Text       = "???";
                        Equipments[i].ImageIndex = (int)ResourceManager.EquipmentContent.Unknown;
                    }
                    else
                    {
                        Equipments[i].Text       = "";
                        Equipments[i].ImageIndex = (int)ResourceManager.EquipmentContent.Locked;
                    }
                }
                else if (ship.DefaultSlot[i] != -1)
                {
                    EquipmentDataMaster eq = db.MasterEquipments[ship.DefaultSlot[i]];
                    Equipments[i].Text = eq.Name;

                    int eqicon = eq.EquipmentType[3];
                    if (eqicon >= (int)ResourceManager.EquipmentContent.Locked)
                    {
                        eqicon = (int)ResourceManager.EquipmentContent.Unknown;
                    }

                    Equipments[i].ImageIndex = eqicon;

                    {
                        StringBuilder sb = new StringBuilder();

                        sb.AppendFormat("{0} {1}\r\n", eq.CategoryTypeInstance.Name, eq.Name);
                        if (eq.Firepower != 0)
                        {
                            sb.AppendFormat(EncycloRes.Firepower + " {0}{1}\r\n", eq.Firepower > 0 ? "+" : "", eq.Firepower);
                        }
                        if (eq.Torpedo != 0)
                        {
                            sb.AppendFormat(EncycloRes.Torpedo + " {0}{1}\r\n", eq.Torpedo > 0 ? "+" : "", eq.Torpedo);
                        }
                        if (eq.AA != 0)
                        {
                            sb.AppendFormat(EncycloRes.AntiAir + " {0}{1}\r\n", eq.AA > 0 ? "+" : "", eq.AA);
                        }
                        if (eq.Armor != 0)
                        {
                            sb.AppendFormat(EncycloRes.Armor + " {0}{1}\r\n", eq.Armor > 0 ? "+" : "", eq.Armor);
                        }
                        if (eq.ASW != 0)
                        {
                            sb.AppendFormat(EncycloRes.ASW + " {0}{1}\r\n", eq.ASW > 0 ? "+" : "", eq.ASW);
                        }
                        if (eq.Evasion != 0)
                        {
                            sb.AppendFormat(EncycloRes.Evasion + " {0}{1}\r\n", eq.Evasion > 0 ? "+" : "", eq.Evasion);
                        }
                        if (eq.LOS != 0)
                        {
                            sb.AppendFormat(EncycloRes.LoS + " {0}{1}\r\n", eq.LOS > 0 ? "+" : "", eq.LOS);
                        }
                        if (eq.Accuracy != 0)
                        {
                            sb.AppendFormat(EncycloRes.Accuracy + " {0}{1}\r\n", eq.Accuracy > 0 ? "+" : "", eq.Accuracy);
                        }
                        if (eq.Bomber != 0)
                        {
                            sb.AppendFormat(EncycloRes.DiveBomb + " {0}{1}\r\n", eq.Bomber > 0 ? "+" : "", eq.Bomber);
                        }
                        sb.AppendLine(EncycloRes.RightClickForMore);

                        ToolTipInfo.SetToolTip(Equipments[i], sb.ToString());
                    }
                }
                else if (i < ship.SlotSize)
                {
                    Equipments[i].Text       = EncycloRes.None;
                    Equipments[i].ImageIndex = (int)ResourceManager.EquipmentContent.Nothing;
                }
                else
                {
                    Equipments[i].Text       = "";
                    Equipments[i].ImageIndex = (int)ResourceManager.EquipmentContent.Locked;
                }
            }

            TableEquipment.ResumeLayout();


            //arsenal
            TableArsenal.SuspendLayout();
            BuildingTime.Text = DateTimeHelper.ToTimeRemainString(new TimeSpan(0, ship.BuildingTime, 0));

            MaterialFuel.Text    = ship.Material[0].ToString();
            MaterialAmmo.Text    = ship.Material[1].ToString();
            MaterialSteel.Text   = ship.Material[2].ToString();
            MaterialBauxite.Text = ship.Material[3].ToString();

            PowerUpFirepower.Text = ship.PowerUp[0].ToString();
            PowerUpTorpedo.Text   = ship.PowerUp[1].ToString();
            PowerUpAA.Text        = ship.PowerUp[2].ToString();
            PowerUpArmor.Text     = ship.PowerUp[3].ToString();

            TableArsenal.ResumeLayout();


            //remodel
            if (!ship.IsAbyssalShip)
            {
                TableRemodel.SuspendLayout();

                if (ship.RemodelBeforeShipID == 0)
                {
                    RemodelBeforeShipName.Text    = EncycloRes.None;
                    RemodelBeforeLevel.Text       = "";
                    RemodelBeforeLevel.ImageIndex = -1;
                    ToolTipInfo.SetToolTip(RemodelBeforeLevel, null);
                    RemodelBeforeAmmo.Text  = "-";
                    RemodelBeforeSteel.Text = "-";
                }
                else
                {
                    ShipDataMaster sbefore = ship.RemodelBeforeShip;
                    RemodelBeforeShipName.Text    = sbefore.Name;
                    RemodelBeforeLevel.Text       = string.Format("Lv. {0}", sbefore.RemodelAfterLevel);
                    RemodelBeforeLevel.ImageIndex = sbefore.NeedCatapult > 0 ? (int)ResourceManager.IconContent.ItemCatapult : sbefore.NeedBlueprint > 0 ? (int)ResourceManager.IconContent.ItemBlueprint : -1;
                    ToolTipInfo.SetToolTip(RemodelBeforeLevel, GetRemodelItem(sbefore));
                    RemodelBeforeAmmo.Text  = sbefore.RemodelAmmo.ToString();
                    RemodelBeforeSteel.Text = sbefore.RemodelSteel.ToString();
                }

                if (ship.RemodelAfterShipID == 0)
                {
                    RemodelAfterShipName.Text    = EncycloRes.None;
                    RemodelAfterLevel.Text       = "";
                    RemodelAfterLevel.ImageIndex = -1;
                    ToolTipInfo.SetToolTip(RemodelAfterLevel, null);
                    RemodelAfterAmmo.Text  = "-";
                    RemodelAfterSteel.Text = "-";
                }
                else
                {
                    RemodelAfterShipName.Text    = ship.RemodelAfterShip.Name;
                    RemodelAfterLevel.Text       = string.Format("Lv. {0}", ship.RemodelAfterLevel);
                    RemodelAfterLevel.ImageIndex = ship.NeedCatapult > 0 ? (int)ResourceManager.IconContent.ItemCatapult : ship.NeedBlueprint > 0 ? (int)ResourceManager.IconContent.ItemBlueprint : -1;
                    ToolTipInfo.SetToolTip(RemodelAfterLevel, GetRemodelItem(ship));
                    RemodelAfterAmmo.Text  = ship.RemodelAmmo.ToString();
                    RemodelAfterSteel.Text = ship.RemodelSteel.ToString();
                }
                TableRemodel.ResumeLayout();


                TableRemodel.Visible = true;
                TableBattle.Visible  = false;
            }
            else
            {
                TableBattle.SuspendLayout();

                AirSuperiority.Text = Calculator.GetAirSuperiority(ship).ToString();
                DayAttack.Text      = Constants.GetDayAttackKind(Calculator.GetDayAttackKind(ship.DefaultSlot == null ? null : ship.DefaultSlot.ToArray(), ship.ShipID, -1));
                NightAttack.Text    = Constants.GetNightAttackKind(Calculator.GetNightAttackKind(ship.DefaultSlot == null ? null : ship.DefaultSlot.ToArray(), ship.ShipID, -1));

                TableBattle.ResumeLayout();

                TableRemodel.Visible = false;
                TableBattle.Visible  = true;
            }



            BasePanelShipGirl.ResumeLayout();
            BasePanelShipGirl.Visible = true;


            this.Text = EncycloRes.ShipEncyclopedia + " - " + ship.NameWithClass;
        }
Exemplo n.º 9
0
		private void Updated(string apiname, dynamic data)
		{

			Color getColorFromEventKind(int kind)
			{
				switch (kind)
				{
					case 0:
					case 1:
					default:    //昼夜戦・その他
						return Utility.Configuration.Config.UI.ForeColor;
					case 2:
					case 3:     //夜戦・夜昼戦
						return Utility.Configuration.Config.UI.Compass_ColorTextEventKind3;
					case 4:     //航空戦
					case 6:     //長距離空襲戦
						return Utility.Configuration.Config.UI.Compass_ColorTextEventKind6;
					case 5:     // 敵連合
						return Utility.Configuration.Config.UI.Compass_ColorTextEventKind5;
					case 7:     // 夜昼戦(対連合艦隊)
						return Utility.Configuration.Config.UI.Compass_ColorTextEventKind3;
					case 8:     // レーダー射撃
						return Utility.Configuration.Config.UI.Compass_ColorTextEventKind3;
				}
			}

			if (apiname == "api_port/port")
			{

				BasePanel.Visible = false;

			}
			else if (apiname == "api_req_member/get_practice_enemyinfo")
			{

				TextMapArea.Text = GeneralRes.Practice;
				TextDestination.Text = string.Format( "{0} {1}", data.api_nickname, Constants.GetAdmiralRank( (int)data.api_rank ) );
				TextDestination.ImageAlign = ContentAlignment.MiddleCenter;
				TextDestination.ImageIndex = -1;
				ToolTipInfo.SetToolTip(TextDestination, null);
				TextEventKind.Text = data.api_cmt;
				TextEventKind.ForeColor = getColorFromEventKind(0);
				TextEventKind.ImageAlign = ContentAlignment.MiddleCenter;
				TextEventKind.ImageIndex = -1;
				ToolTipInfo.SetToolTip(TextEventKind, null);
				TextEventDetail.Text = string.Format("Lv. {0} / {1} exp.", data.api_level, data.api_experience[0]);
				TextEventDetail.ImageAlign = ContentAlignment.MiddleCenter;
				TextEventDetail.ImageIndex = -1;
				ToolTipInfo.SetToolTip(TextEventDetail, null);
				TextEnemyFleetName.Text = data.api_deckname;

			}
			else
			{

				CompassData compass = KCDatabase.Instance.Battle.Compass;


				BasePanel.SuspendLayout();
				PanelEnemyFleet.Visible = false;
				PanelEnemyCandidate.Visible = false;

				_enemyFleetCandidate = null;
				_enemyFleetCandidateIndex = -1;


				TextMapArea.Text = string.Format( GeneralRes.Map + ": {0}-{1}{2}", compass.MapAreaID, compass.MapInfoID,
					compass.MapInfo.EventDifficulty > 0 ? " [" + Constants.GetDifficulty( compass.MapInfo.EventDifficulty ) + "]" : "" );
				{
					var mapinfo = compass.MapInfo;

					if (mapinfo.RequiredDefeatedCount != -1 && mapinfo.CurrentDefeatedCount < mapinfo.RequiredDefeatedCount)
					{
						ToolTipInfo.SetToolTip(TextMapArea, string.Format("{0} defeated: {1} / {2} times",
							mapinfo.CurrentGaugeIndex > 0 ? $"#{mapinfo.CurrentGaugeIndex} " : "",
							mapinfo.CurrentDefeatedCount, mapinfo.RequiredDefeatedCount));

					}
					else if (mapinfo.MapHPMax > 0)
					{
						int current = compass.MapHPCurrent > 0 ? compass.MapHPCurrent : mapinfo.MapHPCurrent;
						int max = compass.MapHPMax > 0 ? compass.MapHPMax : mapinfo.MapHPMax;

						ToolTipInfo.SetToolTip(TextMapArea, string.Format("{0}{1}: {2} / {3}",
							mapinfo.CurrentGaugeIndex > 0 ? $"#{mapinfo.CurrentGaugeIndex} " : "",
							mapinfo.GaugeType == 3 ? "TP" : "HP", current, max));

					}
					else
					{
						ToolTipInfo.SetToolTip(TextMapArea, null);
					}
				}


				TextDestination.Text = string.Format( GeneralRes.NextNode + ": {0}{1}", compass.DestinationID, ( compass.IsEndPoint ? GeneralRes.EndNode : "" ) );
				if ( compass.LaunchedRecon != 0 ) {
					TextDestination.ImageAlign = ContentAlignment.MiddleRight;
					TextDestination.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane;

					string tiptext;
					switch (compass.CommentID)
					{
						case 1:
							tiptext = "Enemy sighted!";
							break;
						case 2:
							tiptext = "Target sighted!";
							break;
						case 3:
							tiptext = "Course Patrol!";
							break;
						default:
							tiptext = "Enemy plane sighted!";
							break;
					}
					ToolTipInfo.SetToolTip(TextDestination, tiptext);

				}
				else
				{
					TextDestination.ImageAlign = ContentAlignment.MiddleCenter;
					TextDestination.ImageIndex = -1;
					ToolTipInfo.SetToolTip(TextDestination, null);
				}

				//とりあえずリセット
				TextEventDetail.ImageAlign = ContentAlignment.MiddleCenter;
				TextEventDetail.ImageIndex = -1;
				ToolTipInfo.SetToolTip(TextEventDetail, null);


				TextEventKind.ForeColor = getColorFromEventKind(0);

				{
					string eventkind = Constants.GetMapEventID(compass.EventID);

					switch (compass.EventID)
					{

						case 0:     //初期位置
							TextEventDetail.Text = GeneralRes.WhyDidThisHappen;
							break;

						case 2:     //資源
							TextEventKind.ForeColor = Utility.Configuration.Config.UI.Color_Green;
							TextEventDetail.Text = GetMaterialInfo(compass);
							break;
						case 8:		//船団護衛成功
							TextEventDetail.Text = GetMaterialInfo(compass);
							break;

						case 3:     //渦潮
							{
								int materialmax = KCDatabase.Instance.Fleet.Fleets.Values
									.Where(f => f != null && f.IsInSortie)
									.SelectMany(f => f.MembersWithoutEscaped)
									.Max(s =>
									{
										if (s == null) return 0;
										switch (compass.WhirlpoolItemID)
										{
											case 1:
												return s.Fuel;
											case 2:
												return s.Ammo;
											default:
												return 0;
										}
									});

								TextEventDetail.Text = string.Format("{0} x {1} ({2:p0})",
									Constants.GetMaterialName(compass.WhirlpoolItemID),
									compass.WhirlpoolItemAmount,
									(double)compass.WhirlpoolItemAmount / Math.Max(materialmax, 1));

							}
							break;

						case 4:     //通常戦闘
							if (compass.EventKind >= 2)
							{
								eventkind += "/" + Constants.GetMapEventKind(compass.EventKind);

								TextEventKind.ForeColor = getColorFromEventKind(compass.EventKind);
							}
							UpdateEnemyFleet();
							break;

						case 5:		//ボス戦闘
							TextEventKind.ForeColor = Utility.Configuration.Config.UI.Color_Red;

							if (compass.EventKind >= 2)
							{
								eventkind += "/" + Constants.GetMapEventKind(compass.EventKind);
							}
							UpdateEnemyFleet();
							break;

						case 1:     //イベントなし
						case 6:     //気のせいだった
							switch (compass.EventKind)
							{

								case 0:     //気のせいだった
								default:
									break;
								case 1:
									eventkind = "No enemy sighted.";
									break;
								case 2:
									eventkind = "Branch choice:";
									break;
								case 3:
									eventkind = "It's a calm sea.";
									break;
								case 4:
									eventkind = "It's a calm strait.";
									break;
								case 5:
									eventkind = "I need to be careful.";
									break;
								case 6:
									eventkind = "It's a calm sea.";
									break;
							}

							if (compass.RouteChoices != null)
							{
								var nodechoices = new string[compass.RouteChoices.Count];
								for (int i = 0; i < compass.RouteChoices.Count; i++)
								{
									nodechoices[i] = FormMain.Instance.Translator.GetMapNodes(compass.MapAreaID, compass.MapInfoID,
										compass.RouteChoices[i]);
								}
								TextEventDetail.Text = string.Join(" or ", nodechoices);
							}
							else if (compass.FlavorTextType != -1)
							{
								TextEventDetail.Text = "◆";
								ToolTipInfo.SetToolTip(TextEventDetail, compass.FlavorText);
							}
							else
							{
								TextEventDetail.Text = "";
							}

							break;

						case 7:     //航空戦or航空偵察
							TextEventKind.ForeColor = getColorFromEventKind(compass.EventKind);

							switch ( compass.EventKind ) {
								case 0:		//航空偵察
									eventkind = GeneralRes.AerialRecon;

									switch (compass.AirReconnaissanceResult)
									{
										case 0:
										default:
											TextEventDetail.Text = GeneralRes.Failure;
											break;
										case 1:
											TextEventDetail.Text = GeneralRes.Success;
											break;
										case 2:
											TextEventDetail.Text = GeneralRes.GreatSuccess;
											break;
									}

									switch (compass.AirReconnaissancePlane)
									{
										case 0:
										default:
											TextEventDetail.ImageAlign = ContentAlignment.MiddleCenter;
											TextEventDetail.ImageIndex = -1;
											break;
										case 1:
											TextEventDetail.ImageAlign = ContentAlignment.MiddleLeft;
											TextEventDetail.ImageIndex = (int)ResourceManager.EquipmentContent.FlyingBoat;
											break;
										case 2:
											TextEventDetail.ImageAlign = ContentAlignment.MiddleLeft;
											TextEventDetail.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane;
											break;
									}

									if (compass.GetItems.Any())
									{
										TextEventDetail.Text += " " + GetMaterialInfo(compass);
									}

									break;

								case 4:     //航空戦
								default:
									UpdateEnemyFleet();
									break;
							}
							break;

						case 9:     //揚陸地点
							TextEventDetail.Text = "";
							break;

						default:
							TextEventDetail.Text = "";
							break;

					}
					TextEventKind.Text = eventkind;
				}


				if (compass.HasAirRaid)
				{
					TextEventKind.ImageAlign = ContentAlignment.MiddleRight;
					TextEventKind.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedBomber;
					ToolTipInfo.SetToolTip(TextEventKind, "Air raid - " + Constants.GetAirRaidDamage(compass.AirRaidDamageKind));
				}
				else
				{
					TextEventKind.ImageAlign = ContentAlignment.MiddleCenter;
					TextEventKind.ImageIndex = -1;
					ToolTipInfo.SetToolTip(TextEventKind, null);
				}


				BasePanel.ResumeLayout();

				BasePanel.Visible = true;
			}


		}