Esempio n. 1
0
 /// <summary>
 ///     コピーコンストラクタ
 /// </summary>
 /// <param name="original">複製元の指揮官データ</param>
 public Leader(Leader original)
 {
     Country     = original.Country;
     Id          = original.Id;
     Name        = original.Name;
     PictureName = original.PictureName;
     Skill       = original.Skill;
     MaxSkill    = original.Skill;
     for (int i = 0; i < RankLength; i++)
     {
         RankYear[i] = original.RankYear[i];
     }
     StartYear      = original.StartYear;
     EndYear        = original.EndYear;
     RetirementYear = original.RetirementYear;
     IdealRank      = original.IdealRank;
     Traits         = original.Traits;
     Experience     = original.Experience;
     Loyalty        = original.Loyalty;
     Branch         = original.Branch;
 }
Esempio n. 2
0
        /// <summary>
        ///     指揮官リストに項目を挿入する
        /// </summary>
        /// <param name="leader">挿入対象の項目</param>
        /// <param name="index">挿入先の位置</param>
        private void InsertListItem(Leader leader, int index)
        {
            // 絞り込みリストに項目を挿入する
            _list.Insert(index, leader);

            // 指揮官リストビューに項目を挿入する
            ListViewItem item = CreateLeaderListViewItem(leader);
            leaderListView.Items.Insert(index, item);

            // 挿入した項目を選択する
            leaderListView.Items[index].Focused = true;
            leaderListView.Items[index].Selected = true;
            leaderListView.EnsureVisible(index);
        }
Esempio n. 3
0
        /// <summary>
        ///     編集項目の値を更新する
        /// </summary>
        /// <param name="leader">指揮官データ</param>
        private void UpdateEditableItemsValue(Leader leader)
        {
            // 編集項目の値を更新する
            countryComboBox.SelectedIndex = leader.Country != Country.None ? (int) leader.Country - 1 : -1;
            idNumericUpDown.Value = leader.Id;
            nameTextBox.Text = leader.Name;
            branchComboBox.SelectedIndex = leader.Branch != Branch.None ? (int) leader.Branch - 1 : -1;
            idealRankComboBox.SelectedIndex = leader.IdealRank != LeaderRank.None ? (int) leader.IdealRank - 1 : -1;
            skillNumericUpDown.Value = leader.Skill;
            maxSkillNumericUpDown.Value = leader.MaxSkill;
            experienceNumericUpDown.Value = leader.Experience;
            loyaltyNumericUpDown.Value = leader.Loyalty;
            startYearNumericUpDown.Value = leader.StartYear;
            endYearNumericUpDown.Value = leader.EndYear;
            if (Misc.EnableRetirementYearLeaders)
            {
                retirementYearLabel.Enabled = true;
                retirementYearNumericUpDown.Enabled = true;
                retirementYearNumericUpDown.Value = leader.RetirementYear;
                retirementYearNumericUpDown.Text = IntHelper.ToString((int) retirementYearNumericUpDown.Value);
            }
            else
            {
                retirementYearLabel.Enabled = false;
                retirementYearNumericUpDown.Enabled = false;
                retirementYearNumericUpDown.ResetText();
            }
            rankYearNumericUpDown1.Value = leader.RankYear[0];
            rankYearNumericUpDown2.Value = leader.RankYear[1];
            rankYearNumericUpDown3.Value = leader.RankYear[2];
            rankYearNumericUpDown4.Value = leader.RankYear[3];
            pictureNameTextBox.Text = leader.PictureName;
            UpdateLeaderPicture(leader);

            // 特性チェックボックスの状態を更新する
            logisticsWizardCheckBox.Checked = (leader.Traits & LeaderTraits.LogisticsWizard) != 0;
            defensiveDoctrineCheckBox.Checked = (leader.Traits & LeaderTraits.DefensiveDoctrine) != 0;
            offensiveDoctrineCheckBox.Checked = (leader.Traits & LeaderTraits.OffensiveDoctrine) != 0;
            winterSpecialistCheckBox.Checked = (leader.Traits & LeaderTraits.WinterSpecialist) != 0;
            tricksterCheckBox.Checked = (leader.Traits & LeaderTraits.Trickster) != 0;
            engineerCheckBox.Checked = (leader.Traits & LeaderTraits.Engineer) != 0;
            fortressBusterCheckBox.Checked = (leader.Traits & LeaderTraits.FortressBuster) != 0;
            panzerLeaderCheckBox.Checked = (leader.Traits & LeaderTraits.PanzerLeader) != 0;
            commandoCheckBox.Checked = (leader.Traits & LeaderTraits.Commando) != 0;
            oldGuardCheckBox.Checked = (leader.Traits & LeaderTraits.OldGuard) != 0;
            seaWolfCheckBox.Checked = (leader.Traits & LeaderTraits.SeaWolf) != 0;
            blockadeRunnerCheckBox.Checked = (leader.Traits & LeaderTraits.BlockadeRunner) != 0;
            superiorTacticianCheckBox.Checked = (leader.Traits & LeaderTraits.SuperiorTactician) != 0;
            spotterCheckBox.Checked = (leader.Traits & LeaderTraits.Spotter) != 0;
            tankBusterCheckBox.Checked = (leader.Traits & LeaderTraits.TankBuster) != 0;
            carpetBomberCheckBox.Checked = (leader.Traits & LeaderTraits.CarpetBomber) != 0;
            nightFlyerCheckBox.Checked = (leader.Traits & LeaderTraits.NightFlyer) != 0;
            fleetDestroyerCheckBox.Checked = (leader.Traits & LeaderTraits.FleetDestroyer) != 0;
            desertFoxCheckBox.Checked = (leader.Traits & LeaderTraits.DesertFox) != 0;
            jungleRatCheckBox.Checked = (leader.Traits & LeaderTraits.JungleRat) != 0;
            urbanWarfareSpecialistCheckBox.Checked = (leader.Traits & LeaderTraits.UrbanWarfareSpecialist) != 0;
            rangerCheckBox.Checked = (leader.Traits & LeaderTraits.Ranger) != 0;
            mountaineerCheckBox.Checked = (leader.Traits & LeaderTraits.Mountaineer) != 0;
            hillsFighterCheckBox.Checked = (leader.Traits & LeaderTraits.HillsFighter) != 0;
            counterAttackerCheckBox.Checked = (leader.Traits & LeaderTraits.CounterAttacker) != 0;
            assaulterCheckBox.Checked = (leader.Traits & LeaderTraits.Assaulter) != 0;
            encirclerCheckBox.Checked = (leader.Traits & LeaderTraits.Encircler) != 0;
            ambusherCheckBox.Checked = (leader.Traits & LeaderTraits.Ambusher) != 0;
            disciplinedCheckBox.Checked = (leader.Traits & LeaderTraits.Disciplined) != 0;
            elasticDefenceSpecialistCheckBox.Checked = (leader.Traits & LeaderTraits.ElasticDefenceSpecialist) != 0;
            blitzerCheckBox.Checked = (leader.Traits & LeaderTraits.Blitzer) != 0;
        }
Esempio n. 4
0
 /// <summary>
 ///     指揮官画像ピクチャーボックスの項目を更新する
 /// </summary>
 /// <param name="leader">指揮官データ</param>
 private void UpdateLeaderPicture(Leader leader)
 {
     if (!string.IsNullOrEmpty(leader.PictureName) &&
         (leader.PictureName.IndexOfAny(Path.GetInvalidPathChars()) < 0))
     {
         string fileName = Game.GetReadFileName(Game.PersonPicturePathName,
             Path.ChangeExtension(leader.PictureName, ".bmp"));
         leaderPictureBox.ImageLocation = File.Exists(fileName) ? fileName : "";
     }
     else
     {
         leaderPictureBox.ImageLocation = "";
     }
 }
Esempio n. 5
0
        /// <summary>
        ///     編集項目の色を更新する
        /// </summary>
        /// <param name="leader"></param>
        private void UpdateEditableItemsColor(Leader leader)
        {
            // コンボボックスの色を更新する
            countryComboBox.Refresh();
            branchComboBox.Refresh();
            idealRankComboBox.Refresh();

            // 編集項目の色を更新する
            idNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.Id) ? Color.Red : SystemColors.WindowText;
            nameTextBox.ForeColor = leader.IsDirty(LeaderItemId.Name) ? Color.Red : SystemColors.WindowText;
            skillNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.Skill) ? Color.Red : SystemColors.WindowText;
            maxSkillNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.MaxSkill)
                ? Color.Red
                : SystemColors.WindowText;
            experienceNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.Experience)
                ? Color.Red
                : SystemColors.WindowText;
            loyaltyNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.Loyalty) ? Color.Red : SystemColors.WindowText;
            startYearNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.StartYear)
                ? Color.Red
                : SystemColors.WindowText;
            endYearNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.EndYear) ? Color.Red : SystemColors.WindowText;
            retirementYearNumericUpDown.ForeColor = leader.IsDirty(LeaderItemId.RetirementYear)
                ? Color.Red
                : SystemColors.WindowText;
            rankYearNumericUpDown1.ForeColor = leader.IsDirty(LeaderItemId.Rank3Year)
                ? Color.Red
                : SystemColors.WindowText;
            rankYearNumericUpDown2.ForeColor = leader.IsDirty(LeaderItemId.Rank2Year)
                ? Color.Red
                : SystemColors.WindowText;
            rankYearNumericUpDown3.ForeColor = leader.IsDirty(LeaderItemId.Rank1Year)
                ? Color.Red
                : SystemColors.WindowText;
            rankYearNumericUpDown4.ForeColor = leader.IsDirty(LeaderItemId.Rank0Year)
                ? Color.Red
                : SystemColors.WindowText;
            pictureNameTextBox.ForeColor = leader.IsDirty(LeaderItemId.PictureName)
                ? Color.Red
                : SystemColors.WindowText;

            // 特性チェックボックスの項目色を更新する
            logisticsWizardCheckBox.ForeColor = leader.IsDirty(LeaderItemId.LogisticsWizard)
                ? Color.Red
                : SystemColors.WindowText;
            defensiveDoctrineCheckBox.ForeColor = leader.IsDirty(LeaderItemId.DefensiveDoctrine)
                ? Color.Red
                : SystemColors.WindowText;
            offensiveDoctrineCheckBox.ForeColor = leader.IsDirty(LeaderItemId.OffensiveDoctrine)
                ? Color.Red
                : SystemColors.WindowText;
            winterSpecialistCheckBox.ForeColor = leader.IsDirty(LeaderItemId.WinterSpecialist)
                ? Color.Red
                : SystemColors.WindowText;
            tricksterCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Trickster) ? Color.Red : SystemColors.WindowText;
            engineerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Engineer) ? Color.Red : SystemColors.WindowText;
            fortressBusterCheckBox.ForeColor = leader.IsDirty(LeaderItemId.FortressBuster)
                ? Color.Red
                : SystemColors.WindowText;
            panzerLeaderCheckBox.ForeColor = leader.IsDirty(LeaderItemId.PanzerLeader)
                ? Color.Red
                : SystemColors.WindowText;
            commandoCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Commando) ? Color.Red : SystemColors.WindowText;
            oldGuardCheckBox.ForeColor = leader.IsDirty(LeaderItemId.OldGuard) ? Color.Red : SystemColors.WindowText;
            seaWolfCheckBox.ForeColor = leader.IsDirty(LeaderItemId.SeaWolf) ? Color.Red : SystemColors.WindowText;
            blockadeRunnerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.BlockadeRunner)
                ? Color.Red
                : SystemColors.WindowText;
            superiorTacticianCheckBox.ForeColor = leader.IsDirty(LeaderItemId.SuperiorTactician)
                ? Color.Red
                : SystemColors.WindowText;
            spotterCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Spotter) ? Color.Red : SystemColors.WindowText;
            tankBusterCheckBox.ForeColor = leader.IsDirty(LeaderItemId.TankBuster) ? Color.Red : SystemColors.WindowText;
            carpetBomberCheckBox.ForeColor = leader.IsDirty(LeaderItemId.CarpetBomber)
                ? Color.Red
                : SystemColors.WindowText;
            nightFlyerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.NightFlyer) ? Color.Red : SystemColors.WindowText;
            fleetDestroyerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.FleetDestroyer)
                ? Color.Red
                : SystemColors.WindowText;
            desertFoxCheckBox.ForeColor = leader.IsDirty(LeaderItemId.DesertFox) ? Color.Red : SystemColors.WindowText;
            jungleRatCheckBox.ForeColor = leader.IsDirty(LeaderItemId.JungleRat) ? Color.Red : SystemColors.WindowText;
            urbanWarfareSpecialistCheckBox.ForeColor = leader.IsDirty(LeaderItemId.UrbanWarfareSpecialist)
                ? Color.Red
                : SystemColors.WindowText;
            rangerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Ranger) ? Color.Red : SystemColors.WindowText;
            mountaineerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Mountaineer)
                ? Color.Red
                : SystemColors.WindowText;
            hillsFighterCheckBox.ForeColor = leader.IsDirty(LeaderItemId.HillsFighter)
                ? Color.Red
                : SystemColors.WindowText;
            counterAttackerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.CounterAttacker)
                ? Color.Red
                : SystemColors.WindowText;
            assaulterCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Assaulter) ? Color.Red : SystemColors.WindowText;
            encirclerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Encircler) ? Color.Red : SystemColors.WindowText;
            ambusherCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Ambusher) ? Color.Red : SystemColors.WindowText;
            disciplinedCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Disciplined)
                ? Color.Red
                : SystemColors.WindowText;
            elasticDefenceSpecialistCheckBox.ForeColor = leader.IsDirty(LeaderItemId.ElasticDefenceSpecialist)
                ? Color.Red
                : SystemColors.WindowText;
            blitzerCheckBox.ForeColor = leader.IsDirty(LeaderItemId.Blitzer) ? Color.Red : SystemColors.WindowText;
        }
Esempio n. 6
0
        /// <summary>
        ///     新規ボタン押下時の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnNewButtonClick(object sender, EventArgs e)
        {
            Leader leader;
            Leader selected = GetSelectedLeader();
            if (selected != null)
            {
                // 選択項目がある場合、国タグやIDを引き継いで項目を作成する
                leader = new Leader(selected)
                {
                    Id = Leaders.GetNewId(selected.Country),
                    Name = "",
                    PictureName = ""
                };

                // 指揮官ごとの編集済みフラグを設定する
                leader.SetDirtyAll();

                // 指揮官リストに項目を挿入する
                Leaders.InsertItem(leader, selected);
                InsertListItem(leader, leaderListView.SelectedIndices[0] + 1);
            }
            else
            {
                Country country = Countries.Tags[countryListBox.SelectedIndex];
                // 新規項目を作成する
                leader = new Leader
                {
                    Country = country,
                    Id = Leaders.GetNewId(country),
                    Branch = Branch.None,
                    IdealRank = LeaderRank.None,
                    StartYear = 1930,
                    EndYear = 1990,
                    RetirementYear = 1999
                };
                leader.RankYear[0] = 1930;
                leader.RankYear[1] = 1990;
                leader.RankYear[2] = 1990;
                leader.RankYear[3] = 1990;

                // 指揮官ごとの編集済みフラグを設定する
                leader.SetDirtyAll();

                // 指揮官リストに項目を追加する
                Leaders.AddItem(leader);
                AddListItem(leader);

                // 編集項目を有効化する
                EnableEditableItems();
            }

            // 国家ごとの編集済みフラグを設定する
            Leaders.SetDirty(leader.Country);

            // ファイル一覧に存在しなければ追加する
            if (!Leaders.FileNameMap.ContainsKey(leader.Country))
            {
                Leaders.FileNameMap.Add(leader.Country, Game.GetLeaderFileName(leader.Country));
                Leaders.SetDirtyList();
            }
        }
Esempio n. 7
0
        /// <summary>
        ///     指揮官リストに項目を追加する
        /// </summary>
        /// <param name="leader">挿入対象の項目</param>
        private void AddListItem(Leader leader)
        {
            // 絞り込みリストに項目を追加する
            _list.Add(leader);

            // 指揮官リストビューに項目を追加する
            leaderListView.Items.Add(CreateLeaderListViewItem(leader));

            // 追加した項目を選択する
            leaderListView.Items[leaderListView.Items.Count - 1].Focused = true;
            leaderListView.Items[leaderListView.Items.Count - 1].Selected = true;
            leaderListView.EnsureVisible(leaderListView.Items.Count - 1);
        }
Esempio n. 8
0
        /// <summary>
        ///     指揮官リストビューの項目を作成する
        /// </summary>
        /// <param name="leader">指揮官データ</param>
        /// <returns>指揮官リストビューの項目</returns>
        private static ListViewItem CreateLeaderListViewItem(Leader leader)
        {
            ListViewItem item = new ListViewItem
            {
                Text = Countries.Strings[(int) leader.Country],
                Tag = leader
            };
            item.SubItems.Add(IntHelper.ToString(leader.Id));
            item.SubItems.Add(leader.Name);
            item.SubItems.Add(Branches.GetName(leader.Branch));
            item.SubItems.Add(IntHelper.ToString(leader.Skill));
            item.SubItems.Add(IntHelper.ToString(leader.MaxSkill));
            item.SubItems.Add(IntHelper.ToString(leader.StartYear));
            item.SubItems.Add(IntHelper.ToString(leader.EndYear));
            item.SubItems.Add(GetLeaderTraitsText(leader.Traits));

            return item;
        }
Esempio n. 9
0
        /// <summary>
        ///     複製ボタン押下時の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnCloneButtonClick(object sender, EventArgs e)
        {
            // 選択項目がなければ何もしない
            Leader selected = GetSelectedLeader();
            if (selected == null)
            {
                return;
            }

            // 選択項目を引き継いで項目を作成する
            Leader leader = new Leader(selected)
            {
                Id = Leaders.GetNewId(selected.Country)
            };

            // 指揮官ごとの編集済みフラグを設定する
            leader.SetDirtyAll();

            // 指揮官リストに項目を挿入する
            Leaders.InsertItem(leader, selected);
            InsertListItem(leader, leaderListView.SelectedIndices[0] + 1);

            // 国家ごとの編集済みフラグを設定する
            Leaders.SetDirty(leader.Country);
        }