Exemple #1
0
        void ChangeLanguage(bool isFirst, Language language)
        {
            int[]     nature         = new int[5];
            int[]     characteristic = new int[3];
            decimal[] pokemon        = new decimal[3];

            if (!isFirst)
            {
                nature = new int[] {
                    Messages.Instance.Nature[f_ComboBoxNature_1.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_2.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_351.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_352.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_353.Text],
                };

                characteristic = new int[] {
                    Messages.Instance.Characteristic[f_ComboBoxCharacteristic_351.Text],
                    Messages.Instance.Characteristic[f_ComboBoxCharacteristic_352.Text],
                    Messages.Instance.Characteristic[f_ComboBoxCharacteristic_353.Text],
                };

                pokemon = new decimal[]
                {
                    Messages.Instance.Pokemon.ContainsKey(f_ComboBoxPokemon351.Text) ? Messages.Instance.Pokemon[f_ComboBoxPokemon351.Text] : -1,
                    Messages.Instance.Pokemon.ContainsKey(f_ComboBoxPokemon352.Text) ? Messages.Instance.Pokemon[f_ComboBoxPokemon352.Text] : -1,
                    Messages.Instance.Pokemon.ContainsKey(f_ComboBoxPokemon353.Text) ? Messages.Instance.Pokemon[f_ComboBoxPokemon353.Text] : -1
                };
            }

            // 言語のロード
            if (!Messages.Initialize(language))
            {
                MessageBox.Show("言語ファイルの読み込みに失敗しました。\n----------\n" + Messages.ErrorText, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // コンボボックスは一旦値を退避してセット
            int modeIndex = 0;

            int[] abilityIndex = new int[5];

            if (!isFirst)
            {
                modeIndex = f_ComboBoxModeSelector_35.SelectedIndex;
                f_ComboBoxModeSelector_35.Items.Clear();

                f_ComboBoxNature_1.Items.Clear();
                f_ComboBoxNature_2.Items.Clear();
                f_ComboBoxNature_351.Items.Clear();
                f_ComboBoxNature_352.Items.Clear();
                f_ComboBoxNature_353.Items.Clear();

                f_ComboBoxCharacteristic_351.Items.Clear();
                f_ComboBoxCharacteristic_352.Items.Clear();
                f_ComboBoxCharacteristic_353.Items.Clear();

                f_ComboBoxPokemon351.Items.Clear();
                f_ComboBoxPokemon352.Items.Clear();
                f_ComboBoxPokemon353.Items.Clear();

                abilityIndex = new int[] {
                    f_ComboBoxAbility_1.SelectedIndex,
                    f_ComboBoxAbility_2.SelectedIndex,
                    f_ComboBoxAbility_351.SelectedIndex,
                    f_ComboBoxAbility_352.SelectedIndex,
                    f_ComboBoxAbility_353.SelectedIndex,
                };
                f_ComboBoxAbility_1.Items.Clear();
                f_ComboBoxAbility_2.Items.Clear();
                f_ComboBoxAbility_351.Items.Clear();
                f_ComboBoxAbility_352.Items.Clear();
                f_ComboBoxAbility_353.Items.Clear();
            }

            // 設定変更
            m_Preferences.Language = language;

            // メニューアイテムのチェック
            switch (language)
            {
            case Language.Japanese:
                f_MenuItemLanguageJp.Checked    = true;
                f_MenuItemLanguageEn.Checked    = false;
                f_MenuItemLanguageZh.Checked    = false;
                f_MenuItemLanguageZh_TW.Checked = false;
                break;

            case Language.English:
                f_MenuItemLanguageJp.Checked    = false;
                f_MenuItemLanguageEn.Checked    = true;
                f_MenuItemLanguageZh.Checked    = false;
                f_MenuItemLanguageZh_TW.Checked = false;
                break;

            case Language.ChineseZh:
                f_MenuItemLanguageJp.Checked    = false;
                f_MenuItemLanguageEn.Checked    = false;
                f_MenuItemLanguageZh.Checked    = true;
                f_MenuItemLanguageZh_TW.Checked = false;
                break;

            case Language.ChineseZh_TW:
                f_MenuItemLanguageJp.Checked    = false;
                f_MenuItemLanguageEn.Checked    = false;
                f_MenuItemLanguageZh.Checked    = false;
                f_MenuItemLanguageZh_TW.Checked = true;
                break;
            }

            // コントロールにメッセージを適用
            foreach (var pair in m_MultiLanguageControls)
            {
                string str = Messages.Instance.SystemLabel[pair.Key];
                foreach (var control in pair.Value)
                {
                    control.Text = str;
                }
            }

            // パラメータラベル
            f_LabelStatus0_1.Text       = Messages.Instance.Status[0];
            f_LabelStatus1_1.Text       = Messages.Instance.Status[1];
            f_LabelStatus2_1.Text       = Messages.Instance.Status[2];
            f_LabelStatus3_1.Text       = Messages.Instance.Status[3];
            f_LabelStatus4_1.Text       = Messages.Instance.Status[4];
            f_LabelStatus5_1.Text       = Messages.Instance.Status[5];
            f_LabelStatus0_2.Text       = Messages.Instance.Status[0];
            f_LabelStatus1_2.Text       = Messages.Instance.Status[1];
            f_LabelStatus2_2.Text       = Messages.Instance.Status[2];
            f_LabelStatus3_2.Text       = Messages.Instance.Status[3];
            f_LabelStatus4_2.Text       = Messages.Instance.Status[4];
            f_LabelStatus5_2.Text       = Messages.Instance.Status[5];
            f_LabelStatus0_351.Text     = Messages.Instance.Status[0];
            f_LabelStatus1_351.Text     = Messages.Instance.Status[1];
            f_LabelStatus2_351.Text     = Messages.Instance.Status[2];
            f_LabelStatus3_351.Text     = Messages.Instance.Status[3];
            f_LabelStatus4_351.Text     = Messages.Instance.Status[4];
            f_LabelStatus5_351.Text     = Messages.Instance.Status[5];
            f_LabelStatus0_352.Text     = Messages.Instance.Status[0];
            f_LabelStatus1_352.Text     = Messages.Instance.Status[1];
            f_LabelStatus2_352.Text     = Messages.Instance.Status[2];
            f_LabelStatus3_352.Text     = Messages.Instance.Status[3];
            f_LabelStatus4_352.Text     = Messages.Instance.Status[4];
            f_LabelStatus5_352.Text     = Messages.Instance.Status[5];
            f_LabelStatus0_353.Text     = Messages.Instance.Status[0];
            f_LabelStatus1_353.Text     = Messages.Instance.Status[1];
            f_LabelStatus2_353.Text     = Messages.Instance.Status[2];
            f_LabelStatus3_353.Text     = Messages.Instance.Status[3];
            f_LabelStatus4_353.Text     = Messages.Instance.Status[4];
            f_LabelStatus5_353.Text     = Messages.Instance.Status[5];
            f_LabelLevel351.Text        = Messages.Instance.Status[6];
            f_LabelLevel352.Text        = Messages.Instance.Status[6];
            f_LabelLevel353.Text        = Messages.Instance.Status[6];
            f_LabelPokemon351.Text      = Messages.Instance.SystemLabel["Pokemon"];
            f_LabelPokemon352.Text      = Messages.Instance.SystemLabel["Pokemon"];
            f_LabelPokemon353.Text      = Messages.Instance.SystemLabel["Pokemon"];
            f_ButtonIVCalculate351.Text = Messages.Instance.SystemLabel["CalculateIVs"];
            f_ButtonIVCalculate352.Text = Messages.Instance.SystemLabel["CalculateIVs"];
            f_ButtonIVCalculate353.Text = Messages.Instance.SystemLabel["CalculateIVs"];

            // コンボボックス再初期化
            InitializeComboBox();

            // 退避していた選択をセット
            f_ComboBoxModeSelector_35.SelectedIndex = modeIndex;
            if (!isFirst)
            {
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_1, nature[0]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_2, nature[1]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_351, nature[2]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_352, nature[3]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_353, nature[4]);
                PokemonFormUtility.SelectCharacteristicComboBox(f_ComboBoxCharacteristic_351, characteristic[0]);
                PokemonFormUtility.SelectCharacteristicComboBox(f_ComboBoxCharacteristic_352, characteristic[1]);
                PokemonFormUtility.SelectCharacteristicComboBox(f_ComboBoxCharacteristic_353, characteristic[2]);
                f_ComboBoxAbility_1.SelectedIndex   = abilityIndex[0];
                f_ComboBoxAbility_2.SelectedIndex   = abilityIndex[1];
                f_ComboBoxAbility_351.SelectedIndex = abilityIndex[2];
                f_ComboBoxAbility_352.SelectedIndex = abilityIndex[3];
                f_ComboBoxAbility_353.SelectedIndex = abilityIndex[4];

                populateComboBoxes();
                if (pokemon[0] != -1)
                {
                    var idxa = (from i in Messages.Instance.Pokemon.Keys
                                where Messages.Instance.Pokemon[i] == pokemon[0]
                                select i).First();
                    f_ComboBoxPokemon351.SelectedIndex = f_ComboBoxPokemon351.Items.IndexOf(idxa);
                }

                if (pokemon[1] != -1)
                {
                    var idxb = (from i in Messages.Instance.Pokemon.Keys
                                where Messages.Instance.Pokemon[i] == pokemon[1]
                                select i).First();
                    f_ComboBoxPokemon352.SelectedIndex = f_ComboBoxPokemon351.Items.IndexOf(idxb);
                }

                if (pokemon[2] != -1)
                {
                    var idxc = (from i in Messages.Instance.Pokemon.Keys
                                where Messages.Instance.Pokemon[i] == pokemon[2]
                                select i).First();
                    f_ComboBoxPokemon353.SelectedIndex = f_ComboBoxPokemon351.Items.IndexOf(idxc);
                }
            }
        }
Exemple #2
0
        void ChangeLanguage(bool isFirst, Language language)
        {
            int[] nature         = new int[5];
            int[] characteristic = new int[5];

            if (!isFirst)
            {
                nature = new int[] {
                    Messages.Instance.Nature[f_ComboBoxNature_1.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_2.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_351.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_352.Text],
                    Messages.Instance.Nature[f_ComboBoxNature_353.Text],
                };

                characteristic = new int[] {
                    Messages.Instance.Characteristic[f_ComboBoxCharacteristic_351.Text],
                    Messages.Instance.Characteristic[f_ComboBoxCharacteristic_352.Text],
                    Messages.Instance.Characteristic[f_ComboBoxCharacteristic_353.Text],
                };
            }

            // 言語のロード
            if (!Messages.Initialize(language))
            {
                MessageBox.Show("言語ファイルの読み込みに失敗しました。\n----------\n" + Messages.ErrorText, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // コンボボックスは一旦値を退避してセット
            int modeIndex = 0;

            int[] abilityIndex = new int[5];

            if (!isFirst)
            {
                modeIndex = f_ComboBoxModeSelector_35.SelectedIndex;
                f_ComboBoxModeSelector_35.Items.Clear();

                f_ComboBoxNature_1.Items.Clear();
                f_ComboBoxNature_2.Items.Clear();
                f_ComboBoxNature_351.Items.Clear();
                f_ComboBoxNature_352.Items.Clear();
                f_ComboBoxNature_353.Items.Clear();

                f_ComboBoxCharacteristic_351.Items.Clear();
                f_ComboBoxCharacteristic_352.Items.Clear();
                f_ComboBoxCharacteristic_353.Items.Clear();

                abilityIndex = new int[] {
                    f_ComboBoxAbility_1.SelectedIndex,
                    f_ComboBoxAbility_2.SelectedIndex,
                    f_ComboBoxAbility_351.SelectedIndex,
                    f_ComboBoxAbility_352.SelectedIndex,
                    f_ComboBoxAbility_353.SelectedIndex,
                };
                f_ComboBoxAbility_1.Items.Clear();
                f_ComboBoxAbility_2.Items.Clear();
                f_ComboBoxAbility_351.Items.Clear();
                f_ComboBoxAbility_352.Items.Clear();
                f_ComboBoxAbility_353.Items.Clear();
            }

            // 設定変更
            m_Preferences.Language = language;

            // メニューアイテムのチェック
            switch (language)
            {
            case Language.Japanese:
                f_MenuItemLanguageJp.Checked = true;
                f_MenuItemLanguageEn.Checked = false;
                break;

            case Language.English:
                f_MenuItemLanguageJp.Checked = false;
                f_MenuItemLanguageEn.Checked = true;
                break;
            }

            // コントロールにメッセージを適用
            foreach (var pair in m_MultiLanguageControls)
            {
                string str = Messages.Instance.SystemLabel[pair.Key];
                foreach (var control in pair.Value)
                {
                    control.Text = str;
                }
            }

            // パラメータラベル
            f_LabelStatus0_1.Text   = Messages.Instance.Status[0];
            f_LabelStatus1_1.Text   = Messages.Instance.Status[1];
            f_LabelStatus2_1.Text   = Messages.Instance.Status[2];
            f_LabelStatus3_1.Text   = Messages.Instance.Status[3];
            f_LabelStatus4_1.Text   = Messages.Instance.Status[4];
            f_LabelStatus5_1.Text   = Messages.Instance.Status[5];
            f_LabelStatus0_2.Text   = Messages.Instance.Status[0];
            f_LabelStatus1_2.Text   = Messages.Instance.Status[1];
            f_LabelStatus2_2.Text   = Messages.Instance.Status[2];
            f_LabelStatus3_2.Text   = Messages.Instance.Status[3];
            f_LabelStatus4_2.Text   = Messages.Instance.Status[4];
            f_LabelStatus5_2.Text   = Messages.Instance.Status[5];
            f_LabelStatus0_351.Text = Messages.Instance.Status[0];
            f_LabelStatus1_351.Text = Messages.Instance.Status[1];
            f_LabelStatus2_351.Text = Messages.Instance.Status[2];
            f_LabelStatus3_351.Text = Messages.Instance.Status[3];
            f_LabelStatus4_351.Text = Messages.Instance.Status[4];
            f_LabelStatus5_351.Text = Messages.Instance.Status[5];
            f_LabelStatus0_352.Text = Messages.Instance.Status[0];
            f_LabelStatus1_352.Text = Messages.Instance.Status[1];
            f_LabelStatus2_352.Text = Messages.Instance.Status[2];
            f_LabelStatus3_352.Text = Messages.Instance.Status[3];
            f_LabelStatus4_352.Text = Messages.Instance.Status[4];
            f_LabelStatus5_352.Text = Messages.Instance.Status[5];
            f_LabelStatus0_353.Text = Messages.Instance.Status[0];
            f_LabelStatus1_353.Text = Messages.Instance.Status[1];
            f_LabelStatus2_353.Text = Messages.Instance.Status[2];
            f_LabelStatus3_353.Text = Messages.Instance.Status[3];
            f_LabelStatus4_353.Text = Messages.Instance.Status[4];
            f_LabelStatus5_353.Text = Messages.Instance.Status[5];

            // コンボボックス再初期化
            InitializeComboBox();

            // 退避していた選択をセット
            f_ComboBoxModeSelector_35.SelectedIndex = modeIndex;
            if (!isFirst)
            {
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_1, nature[0]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_2, nature[1]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_351, nature[2]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_352, nature[3]);
                PokemonFormUtility.SelectNatureComboBox(f_ComboBoxNature_353, nature[4]);
                PokemonFormUtility.SelectCharacteristicComboBox(f_ComboBoxCharacteristic_351, characteristic[0]);
                PokemonFormUtility.SelectCharacteristicComboBox(f_ComboBoxCharacteristic_352, characteristic[1]);
                PokemonFormUtility.SelectCharacteristicComboBox(f_ComboBoxCharacteristic_353, characteristic[2]);
                f_ComboBoxAbility_1.SelectedIndex   = abilityIndex[0];
                f_ComboBoxAbility_2.SelectedIndex   = abilityIndex[1];
                f_ComboBoxAbility_351.SelectedIndex = abilityIndex[2];
                f_ComboBoxAbility_352.SelectedIndex = abilityIndex[3];
                f_ComboBoxAbility_353.SelectedIndex = abilityIndex[4];
            }
        }