/// <summary> /// ホットキー変更時のイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnHotKeyChange_Click(object sender, EventArgs e) { this._otherWindowOpen = true; var ksf = new KeySetForm(); ksf.ShowDialog(); ksf.keyType = KeySetForm.KeyType.SINGLE; if (ksf.result == KeySetForm.Result.OK) { CurrentSettingFile.hotKey = ksf.KeyData[0]; this.txtHotKey.Text = KeysToText(ksf.KeyData); } this._otherWindowOpen = false; }
/// <summary> /// データグリッドビューをダブルクリックした際に呼び出される。 /// 主にキーの設定や、スキルアイコンの設定に使用する。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (this.dgv.SelectedCells.Count != 1) { return; } this._otherWindowOpen = true; var sequence = int.Parse((string)this.dgv.Rows[this.dgv.SelectedCells[0].OwningRow.Index].Cells[DgvCol.SEQUENCE].Value); // ReSharper disable once SwitchStatementMissingSomeCases switch (this.dgv.SelectedCells[0].OwningColumn.Name) { case DgvCol.PUSH: { //textbox var ksf = new KeySetForm(); foreach (var act in CurrentSettingFile.Value.Where(act => act.Id == sequence)) { ksf.keyType = KeySetForm.KeyType.MULTI; ksf.ShowDialog(); if (ksf.result == KeySetForm.Result.OK) { act.Push = ksf.KeyData; } break; } if (ksf.result == KeySetForm.Result.OK && ksf.KeyData.Length != 0) { this.dgv.Rows[this.dgv.SelectedCells[0].OwningRow.Index].Cells[this.dgv.SelectedCells[0].OwningColumn.Name].Value = KeysToText(ksf.KeyData, " + "); } ksf.Dispose(); break; } case DgvCol.SEND: { //textbox var ksf = new KeySetForm(); foreach (var act in CurrentSettingFile.Value.Where(act => act.Id == sequence)) { switch (act.Type) { case Act.InstanceType.COMMAND: ksf.keyType = KeySetForm.KeyType.MULTI; ksf.ShowDialog(); if (ksf.result == KeySetForm.Result.OK) { ((Command)(act)).sendList = ksf.KeyData; } break; case Act.InstanceType.BARRAGE: ksf.ShowDialog(); if (ksf.result == KeySetForm.Result.OK) { ((Barrage)act).send = ksf.KeyData[0]; } break; case Act.InstanceType.TOGGLE: ksf.ShowDialog(); if (ksf.result == KeySetForm.Result.OK) { ((Toggle)act).send = ksf.KeyData[0]; } break; case Act.InstanceType.MOUSE: ksf.Dispose(); var msf = new MouseSetForm(((Behavior.Action.Mouse)act).mouseData); msf.ShowDialog(); if (msf.result == MouseSetForm.Result.OK) { if (msf.editedFlag) { EditedFlag = true; } ((Behavior.Action.Mouse)act).mouseData = msf.mouseData; this.dgv.Rows[this.dgv.SelectedCells[0].OwningRow.Index].Cells[this.dgv.SelectedCells[0].OwningColumn.Name].Value = "マウス操作[" + msf.mouseData.Value.Count + "]"; } this._otherWindowOpen = false; return; default: throw new ArgumentOutOfRangeException(); } break; } if (ksf.result == KeySetForm.Result.OK && ksf.KeyData.Length != 0) { this.dgv.Rows[this.dgv.SelectedCells[0].OwningRow.Index].Cells[this.dgv.SelectedCells[0].OwningColumn.Name].Value = KeysToText(ksf.KeyData); } ksf.Dispose(); break; } case DgvCol.ENABLE_SKILL_ICON: case DgvCol.DISABLE_SKILL_ICON: { var ofd = new OpenFileDialog { Filter = "Image File(*.gif;*.jpg;*.bmp;*.wmf;*.png)|*.gif;*.jpg;*.bmp;*.wmf;*.png", Title = "スキルアイコン画像を選択", InitialDirectory = Application.ExecutablePath, RestoreDirectory = true }; if (ofd.ShowDialog() == DialogResult.OK) { this.dgv.Rows[this.dgv.SelectedCells[0].OwningRow.Index].Cells[this.dgv.SelectedCells[0].OwningColumn.Name].Value = new Bitmap(ofd.FileName); foreach (var act in CurrentSettingFile.Value.Where(act => act.Id == sequence)) { switch (this.dgv.SelectedCells[0].OwningColumn.Name) { case DgvCol.ENABLE_SKILL_ICON: act.SkillIcon = new Bitmap(ofd.FileName); break; case DgvCol.DISABLE_SKILL_ICON: act.DisableSkillIcon = new Bitmap(ofd.FileName); break; } } } break; } } this._otherWindowOpen = false; }