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 = db.EquipmentTypes[eq.EquipmentType[2]].Name;

            {
                int eqicon = eq.EquipmentType[3];
                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(eq.EquipmentType[2]))
                    {
                        sb.AppendLine(stype.Name);
                    }
                }
                ToolTipInfo.SetToolTip(EquipmentType, sb.ToString());
            }
            EquipmentName.Text = eq.Name;

            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 == 48)
            {
                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 (Calculator.IsAircraft(equipmentID, true, true))
            {
                TableAircraft.SuspendLayout();
                AircraftCost.Text = eq.AircraftCost.ToString();
                ToolTipInfo.SetToolTip(AircraftCost, "配備時のボーキ消費:" + ((Calculator.IsAircraft(equipmentID, false) ? 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;
        }
        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;
        }
예제 #3
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}, {1}, {2}, {3}]",
                                                              eq.EquipmentType[0], eq.EquipmentType[1], eq.EquipmentType[2], eq.EquipmentType[3]));
            AlbumNo.Text = eq.AlbumNo.ToString();


            TableEquipmentName.SuspendLayout();

            EquipmentType.Text = FormMain.Instance.Translator.GetTranslation(db.EquipmentTypes[eq.EquipmentType[2]].Name, Utility.TranslationType.EquipmentType);

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

                StringBuilder sb = new StringBuilder();
                sb.AppendLine(EncycloRes.EquippableShips);
                foreach (var stype in KCDatabase.Instance.ShipTypes.Values)
                {
                    if (stype.EquipmentType[eq.EquipmentType[2]])
                    {
                        sb.AppendLine(FormMain.Instance.Translator.GetTranslation(stype.Name, Utility.TranslationType.ShipTypes));
                    }
                }
                ToolTipInfo.SetToolTip(EquipmentType, sb.ToString());
            }
            EquipmentName.Text = eq.Name;

            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);

            TableParameterMain.ResumeLayout();


            //sub parameter
            TableParameterSub.SuspendLayout();

            Speed.Text        = EncycloRes.None;      //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();


            //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 = EncycloRes.EquipmentEncyclopedia + " - " + eq.Name;
        }