示例#1
0
        /// <summary>
        /// ワンポイントテロップのLoad
        /// </summary>
        private void LoadOnePointTelop()
        {
            // テロップテーブルをロードする
            this.LoadTelopTable();

            this.TelopDetailGroupBox.Visible = false;

            // コンボボックスにアイテムを装填する
            this.TelopMatchSoundComboBox.DataSource    = SoundController.Instance.EnumlateWave();
            this.TelopMatchSoundComboBox.ValueMember   = "FullPath";
            this.TelopMatchSoundComboBox.DisplayMember = "Name";

            this.TelopDelaySoundComboBox.DataSource    = SoundController.Instance.EnumlateWave();
            this.TelopDelaySoundComboBox.ValueMember   = "FullPath";
            this.TelopDelaySoundComboBox.DisplayMember = "Name";

            this.TelopPlay1Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play((string)this.TelopMatchSoundComboBox.SelectedValue ?? string.Empty);
            };

            this.TelopPlay2Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play((string)this.TelopDelaySoundComboBox.SelectedValue ?? string.Empty);
            };

            this.TelopSpeak1Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play(this.TelopMatchTTSTextBox.Text);
            };

            this.TelopSpeak2Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play(this.TelopDelayTTSTextBox.Text);
            };

            this.TelopTreeView.AfterCheck += (s1, e1) =>
            {
                var source = e1.Node.Tag as OnePointTelop;
                if (source != null)
                {
                    source.Enabled = e1.Node.Checked;
                }

                // キャッシュを無効にする
                TableCompiler.Instance.RecompileTickers();

                // テロップの有効・無効が変化した際に、標準のスペルタイマーに反映する
                SpellsController.Instance.ApplyToNormalSpellTimer();
            };

            this.TelopTreeView.AfterSelect += (s1, e1) =>
            {
                this.ShowTelopDetail(
                    e1.Node.Tag as OnePointTelop);
            };

            this.TelopSelectJobButton.Click += async(s1, e1) =>
            {
                var src = this.TelopDetailGroupBox.Tag as OnePointTelop;
                if (src != null)
                {
                    using (var f = new SelectJobForm())
                    {
                        f.JobFilter = src.JobFilter;
                        if (await Task.Run(() => f.ShowDialog(this.ParentForm)) ==
                            DialogResult.OK)
                        {
                            src.JobFilter = f.JobFilter;

                            // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青)
                            this.TelopSelectJobButton.ForeColor = src.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor;
                        }
                    }
                }
            };

            this.TelopSelectZoneButton.Click += async(s1, e1) =>
            {
                var src = this.TelopDetailGroupBox.Tag as OnePointTelop;
                if (src != null)
                {
                    using (var f = new SelectZoneForm())
                    {
                        f.ZoneFilter = src.ZoneFilter;
                        if (await Task.Run(() => f.ShowDialog(this.ParentForm)) ==
                            DialogResult.OK)
                        {
                            src.ZoneFilter = f.ZoneFilter;

                            // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青)
                            this.TelopSelectZoneButton.ForeColor = src.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor;
                        }
                    }
                }
            };

            this.TelopSetConditionButton.Click += async(s1, e1) =>
            {
                var src = this.TelopDetailGroupBox.Tag as OnePointTelop;
                if (src != null)
                {
                    using (var f = new SetConditionForm())
                    {
                        f.TimersMustRunning  = src.TimersMustRunningForStart;
                        f.TimersMustStopping = src.TimersMustStoppingForStart;
                        if (await Task.Run(() => f.ShowDialog(this.ParentForm)) ==
                            DialogResult.OK)
                        {
                            src.TimersMustRunningForStart  = f.TimersMustRunning;
                            src.TimersMustStoppingForStart = f.TimersMustStopping;

                            // 条件設定ボタンの色を変える(未設定:黒、設定有:青)
                            this.TelopSetConditionButton.ForeColor =
                                (src.TimersMustRunningForStart.Length != 0 || src.TimersMustStoppingForStart.Length != 0) ?
                                Color.Blue :
                                Button.DefaultForeColor;
                        }
                    }
                }
            };

            // テロップの一時表示チェックボックス
            this.TemporarilyDisplayTickerCheckBox.CheckedChanged += (s1, e1) =>
            {
                var src = this.TelopDetailGroupBox.Tag as OnePointTelop;
                if (src == null)
                {
                    return;
                }

                src.IsTemporaryDisplay = this.TemporarilyDisplayTickerCheckBox.Checked;

                TableCompiler.Instance.RecompileTickers();
            };

            this.TelopExportButton.Click   += this.TelopExportButton_Click;
            this.TelopImportButton.Click   += this.TelopImportButton_Click;
            this.TelopClearAllButton.Click += this.TelopClearAllButton_Click;
            this.TelopAddButton.Click      += this.TelopAddButton_Click;
            this.TelopUpdateButton.Click   += this.TelopUpdateButton_Click;
            this.TelopDeleteButton.Click   += this.TelopDeleteButton_Click;
        }
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender">イベント発生元</param>
        /// <param name="e">イベント引数</param>
        private void ConfigPanel_Load(object sender, EventArgs e)
        {
            this.LoadSpellTimerTable();

            this.DetailGroupBox.Visible      = false;
            this.DetailPanelGroupBox.Visible = false;

            // コンボボックスにアイテムを装填する
            this.MatchSoundComboBox.DataSource    = SoundController.Instance.EnumlateWave();
            this.MatchSoundComboBox.ValueMember   = "FullPath";
            this.MatchSoundComboBox.DisplayMember = "Name";

            this.OverSoundComboBox.DataSource    = SoundController.Instance.EnumlateWave();
            this.OverSoundComboBox.ValueMember   = "FullPath";
            this.OverSoundComboBox.DisplayMember = "Name";

            this.BeforeSoundComboBox.DataSource    = SoundController.Instance.EnumlateWave();
            this.BeforeSoundComboBox.ValueMember   = "FullPath";
            this.BeforeSoundComboBox.DisplayMember = "Name";

            this.TimeupSoundComboBox.DataSource    = SoundController.Instance.EnumlateWave();
            this.TimeupSoundComboBox.ValueMember   = "FullPath";
            this.TimeupSoundComboBox.DisplayMember = "Name";

            // イベントを設定する
            this.SpellTimerTreeView.AfterSelect += this.SpellTimerTreeView_AfterSelect;
            this.AddButton.Click    += this.AddButton_Click;
            this.UpdateButton.Click += this.UpdateButton_Click;
            this.DeleteButton.Click += this.DeleteButton_Click;

            this.Play1Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play((string)this.MatchSoundComboBox.SelectedValue ?? string.Empty);
            };

            this.Play2Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play((string)this.OverSoundComboBox.SelectedValue ?? string.Empty);
            };

            this.Play3Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play((string)this.TimeupSoundComboBox.SelectedValue ?? string.Empty);
            };

            this.Play4Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play((string)this.BeforeSoundComboBox.SelectedValue ?? string.Empty);
            };

            this.Speak1Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play(this.MatchTextToSpeakTextBox.Text);
            };

            this.Speak2Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play(this.OverTextToSpeakTextBox.Text);
            };

            this.Speak3Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play(this.TimeupTextToSpeakTextBox.Text);
            };

            this.Speak4Button.Click += (s1, e1) =>
            {
                SoundController.Instance.Play(this.BeforeTextToSpeakTextBox.Text);
            };

            this.SpellTimerTreeView.AfterCheck += (s1, e1) =>
            {
                var source = e1.Node.Tag as Spell;
                if (source != null)
                {
                    source.Enabled    = e1.Node.Checked;
                    source.UpdateDone = false;
                }
                else
                {
                    foreach (TreeNode node in e1.Node.Nodes)
                    {
                        var sourceChild = node.Tag as Spell;
                        if (sourceChild != null)
                        {
                            sourceChild.Enabled = e1.Node.Checked;
                        }

                        node.Checked = e1.Node.Checked;
                    }
                }

                // キャッシュを無効にする
                TableCompiler.Instance.RecompileSpells();

                // スペルの有効・無効が変化した際に、標準のスペルタイマーに反映する
                SpellsController.Instance.ApplyToNormalSpellTimer();
            };

            this.SelectJobButton.Click += async(s1, e1) =>
            {
                var src = this.DetailGroupBox.Tag as Spell;
                if (src != null)
                {
                    using (var f = new SelectJobForm())
                    {
                        f.JobFilter = src.JobFilter;
                        if (await Task.Run(() => f.ShowDialog(this.ParentForm)) ==
                            DialogResult.OK)
                        {
                            src.JobFilter = f.JobFilter;

                            // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青)
                            this.SelectJobButton.ForeColor = src.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor;
                        }
                    }
                }
            };

            this.SelectZoneButton.Click += async(s1, e1) =>
            {
                var src = this.DetailGroupBox.Tag as Spell;
                if (src != null)
                {
                    using (var f = new SelectZoneForm())
                    {
                        f.ZoneFilter = src.ZoneFilter;
                        if (await Task.Run(() => f.ShowDialog(this.ParentForm)) ==
                            DialogResult.OK)
                        {
                            src.ZoneFilter = f.ZoneFilter;

                            // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青)
                            this.SelectZoneButton.ForeColor = src.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor;
                        }
                    }
                }
            };

            this.SetConditionButton.Click += async(s1, e1) =>
            {
                var src = this.DetailGroupBox.Tag as Spell;
                if (src != null)
                {
                    using (var f = new SetConditionForm())
                    {
                        f.TimersMustRunning  = src.TimersMustRunningForStart;
                        f.TimersMustStopping = src.TimersMustStoppingForStart;

                        if (await Task.Run(() => f.ShowDialog(this.ParentForm)) ==
                            DialogResult.OK)
                        {
                            src.TimersMustRunningForStart  = f.TimersMustRunning;
                            src.TimersMustStoppingForStart = f.TimersMustStopping;

                            // 条件設定ボタンの色を変える(未設定:黒、設定有:青)
                            this.SetConditionButton.ForeColor =
                                (src.TimersMustRunningForStart.Length != 0 || src.TimersMustStoppingForStart.Length != 0) ?
                                Color.Blue :
                                Button.DefaultForeColor;
                        }
                    }
                }
            };

            // アイコン選択ボタンの挙動を設定する
            this.SelectIconButton.Click += async(s1, e1) =>
            {
                var selectedIcon = (string)this.SelectIconButton.Tag;
                var spell        = this.DetailGroupBox.Tag as Spell;

                var result = await SelectIconForm.ShowDialogAsync(
                    selectedIcon,
                    this,
                    spell);

                if (result.Result)
                {
                    ActInvoker.Invoke(() =>
                    {
                        this.SelectIconButton.Tag = result.Icon;
                        this.SelectIconButton.BackgroundImageLayout = ImageLayout.Zoom;

                        this.SelectIconButton.BackgroundImage           = null;
                        this.SelectIconButton.FlatAppearance.BorderSize = 1;
                        var icon = IconController.Instance.GetIconFile(result.Icon);
                        if (icon != null &&
                            File.Exists(icon.FullPath))
                        {
                            this.SelectIconButton.BackgroundImage = System.Drawing.Image.FromFile(
                                icon.FullPath);
                            this.SelectIconButton.FlatAppearance.BorderSize = 0;
                        }

                        this.SpellVisualSetting.SpellIcon = result.Icon;
                        this.SpellVisualSetting.RefreshSampleImage();
                    });
                }
            };

            this.SpellIconSizeUpDown.ValueChanged += (s1, e1) =>
            {
                this.SpellVisualSetting.SpellIconSize = (int)this.SpellIconSizeUpDown.Value;
                this.SpellVisualSetting.RefreshSampleImage();
            };

            this.HideSpellNameCheckBox.CheckedChanged += (s1, e1) =>
            {
                this.SpellVisualSetting.HideSpellName = this.HideSpellNameCheckBox.Checked;
                this.SpellVisualSetting.RefreshSampleImage();
            };

            this.OverlapRecastTimeCheckBox.CheckedChanged += (s1, e1) =>
            {
                this.SpellVisualSetting.OverlapRecastTime = this.OverlapRecastTimeCheckBox.Checked;
                this.SpellVisualSetting.RefreshSampleImage();
            };

            // スペルの一時表示チェックボックス
            this.TemporarilyDisplaySpellCheckBox.CheckedChanged += (s1, e1) =>
            {
                var src = this.DetailGroupBox.Tag as Spell;
                if (src == null)
                {
                    return;
                }

                src.IsTemporaryDisplay = this.TemporarilyDisplaySpellCheckBox.Checked;
                src.UpdateDone         = false;

                TableCompiler.Instance.RecompileSpells();
            };

            // スペルパネル単位のエクスポート
            this.ExportBySpellPanelButton.Click += this.ExportBySpellPanelButton_Click;

            // オプションのロードメソッドを呼ぶ
            this.LoadOption();
            this.LoadDQXOption();

            // ワンポイントテロップのロードメソッドを呼ぶ
            this.LoadOnePointTelop();

            // 戦闘アナライザのロードメソッドを呼ぶ
            this.LoadCombatAnalyzer();
        }