Esempio n. 1
0
        /// <summary>
        ///     追加ボタン押下時の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnAddButtonClick(object sender, EventArgs e)
        {
            // 兵科リストボックスの選択項目がなければ戻る
            if (branchListBox.SelectedIndex < 0)
            {
                return;
            }
            Branch branch = (Branch)(branchListBox.SelectedIndex + 1);

            // 国家リストボックスの選択項目がなければ戻る
            if (countryListBox.SelectedIndex < 0)
            {
                return;
            }
            Country country = Countries.Tags[countryListBox.SelectedIndex];

            string prefix = prefixComboBox.Text;
            string suffix = suffixComboBox.Text;
            int    start  = (int)startNumericUpDown.Value;
            int    end    = (int)endNumericUpDown.Value;

            Log.Info("[CorpsName] Add: {0}-{1} {2} {3} [{4}] <{5}>", start, end, prefix, suffix,
                     Branches.GetName(branch), Countries.Strings[(int)country]);

            // 軍団名を一括追加する
            CorpsNames.AddSequential(prefix, suffix, start, end, branch, country);

            // 軍団名リストの表示を更新する
            UpdateNameList();

            // 編集済みフラグが更新されるため表示を更新する
            branchListBox.Refresh();
            countryListBox.Refresh();

            // 履歴を更新する
            _prefixHistory.Add(prefix);
            _suffixHistory.Add(suffix);

            HoI2EditorController.Settings.CorpsNameEditor.PrefixHistory = _prefixHistory.Get().ToList();
            HoI2EditorController.Settings.CorpsNameEditor.SuffixHistory = _suffixHistory.Get().ToList();

            // 履歴コンボボックスを更新する
            UpdateAddHistory();
        }
Esempio n. 2
0
        /// <summary>
        /// Displays available buildings in currently selected branch
        /// </summary>
        private void ShowBranch()
        {
            //Collection of valid buildings
            List <Buildings> validBuildings = new List <Buildings>();

            ClearBranch(); //Clear window from buildings

            //Get set of valid buildings
            foreach (Buildings b in branch.GetBuildings())
            {
                //Upgrade
                if (upgrade && (b.GetGrade() == buildingLogic.ActualBuilding.GetGrade() ||
                                ((b.GetBranch() == buildingLogic.ActualBuilding.GetBranch() ||
                                  buildingLogic.ActualBuilding.GetBranch() == Branches.NONE) &&
                                 b.GetGrade() == buildingLogic.ActualBuilding.GetGrade() + 1)) &&
                    b != buildingLogic.ActualBuilding)
                {
                    validBuildings.Add(b);
                }

                //Downgrade
                else if (!upgrade && b.GetGrade() == buildingLogic.ActualBuilding.GetGrade() - 1 &&
                         b != buildingLogic.ActualBuilding)
                {
                    validBuildings.Add(b);
                }
            }

            //Display branch name
            gameObject.transform.Find("Branch").GetComponent <Text>().text = string.Format("Odvětví: {0}", branch.GetName());

            //Display valid buildings
            for (int selectionIdx = 0; selectionIdx < validBuildings.Count; selectionIdx++)
            {
                gameObject.transform.Find("Selection" + selectionIdx).Find("Name").GetComponent <Text>().text = validBuildings[selectionIdx].GetName();
                DisplayProductionConsumption(selectionIdx, validBuildings[selectionIdx]);
            }

            displayedBuildings = validBuildings;
        }