//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Memory_GameController() { this.keyCnf = new KeyconfigPadImpl(); this.buttonsFrame = new int[4 + this.KeyCnf.NCount_MaxButton + 1]; this.buttonsPressingFrame = new int[4 + this.KeyCnf.NCount_MaxButton + 1]; this.nKeyRepeatFrames = int.MaxValue; // 3; this.enumCurKeyForCnf = EnumGamepadkeyBit.Up; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void Open(int nPlayer, KeyconfigPadImpl keycnfPad, out string sErrorMsg) { TextBox pctxt; switch (nPlayer) { case 2: pctxt = this.textBox2; break; case 3: pctxt = this.textBox3; break; case 4: pctxt = this.textBox4; break; default: pctxt = this.textBox1; break; } // 1~12 for (int nNum = 1; nNum < 13; nNum++) { EnumGamepadkeyIx enumGa = Utility_KeyconfigArray.IntTo(nNum); EnumGamepadkeyBit enumGp = keycnfPad.KeyconfigArray[(int)enumGa]; switch (enumGp) { case EnumGamepadkeyBit.Up: // [↑] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Right: // [→] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Down: // [↓] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Left: // [←] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.A: // [A] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.B: // [B] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.X: // [X] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Y: // [Y] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.L: // [L] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.R: // [R] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Start: // [Start] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Select: // [Select] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; default: break; } } sErrorMsg = ""; return; }
//──────────────────────────────────────── public void Open(int nPlayer, KeyconfigPadImpl keycnfPad,out string sErrorMsg) { Usercontrol_VwdKeycnf ucGmctrlOneCnf = this.usercontrol_VwdKeycnfArray[nPlayer]; // 1~12 for (int nNum = 1; nNum < 13; nNum++ ) { EnumGamepadkeyIx gaEnum = Utility_KeyconfigArray.IntTo(nNum); EnumGamepadkeyBit gpEnum = keycnfPad.KeyconfigArray[(int)gaEnum]; switch (gpEnum) { case EnumGamepadkeyBit.Up: // [↑] ucGmctrlOneCnf.PctxtUp.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Right: // [→] ucGmctrlOneCnf.PctxtRight.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Down: // [↓] ucGmctrlOneCnf.PctxtDown.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Left: // [←] ucGmctrlOneCnf.PctxtLeft.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.A: // [A] ucGmctrlOneCnf.PctxtA.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.B: // [B] ucGmctrlOneCnf.PctxtB.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.X: // [X] ucGmctrlOneCnf.PctxtX.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Y: // [Y] ucGmctrlOneCnf.PctxtY.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.L: // [L] ucGmctrlOneCnf.PctxtL.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.R: // [R] ucGmctrlOneCnf.PctxtR.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Start: // [Start] ucGmctrlOneCnf.PctxtStart.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Select: // [Select] ucGmctrlOneCnf.PctxtSelect.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; default: break; } } sErrorMsg = ""; return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void Open(int nPlayer, KeyconfigPadImpl keycnfPad, out string sErrorMsg) { Usercontrol_VwdKeycnf ucGmctrlOneCnf = this.usercontrol_VwdKeycnfArray[nPlayer]; // 1~12 for (int nNum = 1; nNum < 13; nNum++) { EnumGamepadkeyIx gaEnum = Utility_KeyconfigArray.IntTo(nNum); EnumGamepadkeyBit gpEnum = keycnfPad.KeyconfigArray[(int)gaEnum]; switch (gpEnum) { case EnumGamepadkeyBit.Up: // [↑] ucGmctrlOneCnf.PctxtUp.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Right: // [→] ucGmctrlOneCnf.PctxtRight.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Down: // [↓] ucGmctrlOneCnf.PctxtDown.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Left: // [←] ucGmctrlOneCnf.PctxtLeft.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.A: // [A] ucGmctrlOneCnf.PctxtA.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.B: // [B] ucGmctrlOneCnf.PctxtB.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.X: // [X] ucGmctrlOneCnf.PctxtX.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Y: // [Y] ucGmctrlOneCnf.PctxtY.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.L: // [L] ucGmctrlOneCnf.PctxtL.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.R: // [R] ucGmctrlOneCnf.PctxtR.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Start: // [Start] ucGmctrlOneCnf.PctxtStart.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; case EnumGamepadkeyBit.Select: // [Select] ucGmctrlOneCnf.PctxtSelect.Text = Utility_KeyconfigArray.ToString_Display(gaEnum); break; default: break; } } sErrorMsg = ""; return; }
//──────────────────────────────────────── public void XTo( out KeyconfigImpl out_Keycnf, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); Log_Reports log_Reports_Load = new Log_ReportsImpl(pg_Method); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "XToO", log_Reports_Load); // // out_Keycnf = new KeyconfigImpl(); CsvTo_Table_HumaninputImpl csvTo = new CsvTo_Table_HumaninputImpl(); Request_ReadsTable oRequest_TableReads = new Request_ReadsTableImpl(); { Configurationtree_NodeImpl cf_ConfigStack = new Configurationtree_NodeImpl(Info_Operating.Name_Library + ":" + this.GetType().Name + "#<init>:", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_1", cf_ConfigStack); cf_Fpath.InitPath( "Editor-config/GAME_PAD/Key-config.csv", log_Reports ); Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); oRequest_TableReads.Expression_Filepath = ec_Fpath; if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } Format_Table_Humaninput o_TableFormat = new Format_Table_HumaninputImpl(); out_Keycnf.O_Table_Keycnf = csvTo.Read( oRequest_TableReads, o_TableFormat, true, log_Reports ); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } // // テーブルを上から1行ずつ読んでいきます。 // foreach (DataRow dataRow in out_Keycnf.O_Table_Keycnf.DataTable.Rows) { //NO ID Expl PLAYER BEFORE AFTER // プレイヤー番号 int nPlayer; { Int_HumaninputImpl o_Player = (Int_HumaninputImpl)dataRow["PLAYER"]; if (Int_HumaninputImpl.TryParse( o_Player, out nPlayer, EnumOperationIfErrorvalue.Error, 0, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } // BEFORE EnumGamepadkeyIx enumGmkeyArray; { string sBefore; string sDebug1 = ""; string sDebug2 = ""; String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["BEFORE"]; if (String_HumaninputImpl.TryParse( o_Before, out sBefore, sDebug1, sDebug2, pg_Method, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } switch (sBefore) { case "Up": enumGmkeyArray = EnumGamepadkeyIx.Up; break; case "Right": enumGmkeyArray = EnumGamepadkeyIx.Right; break; case "Down": enumGmkeyArray = EnumGamepadkeyIx.Down; break; case "Left": enumGmkeyArray = EnumGamepadkeyIx.Left; break; case "0": enumGmkeyArray = EnumGamepadkeyIx.B0; break; case "1": enumGmkeyArray = EnumGamepadkeyIx.B1; break; case "2": enumGmkeyArray = EnumGamepadkeyIx.B2; break; case "3": enumGmkeyArray = EnumGamepadkeyIx.B3; break; case "4": enumGmkeyArray = EnumGamepadkeyIx.B4; break; case "5": enumGmkeyArray = EnumGamepadkeyIx.B5; break; case "6": enumGmkeyArray = EnumGamepadkeyIx.B6; break; case "7": enumGmkeyArray = EnumGamepadkeyIx.B7; break; default: // エラー enumGmkeyArray = EnumGamepadkeyIx.B0; break; } } // AFTER EnumGamepadkeyBit gmkeyPushEnum; { string sAfter; string sDebug1 = ""; string sDebug2 = ""; String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["AFTER"]; if (String_HumaninputImpl.TryParse( o_Before, out sAfter, sDebug1, sDebug2, pg_Method, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } switch (sAfter) { case "Up": gmkeyPushEnum = EnumGamepadkeyBit.Up; break; case "Right": gmkeyPushEnum = EnumGamepadkeyBit.Right; break; case "Down": gmkeyPushEnum = EnumGamepadkeyBit.Down; break; case "Left": gmkeyPushEnum = EnumGamepadkeyBit.Left; break; case "A": gmkeyPushEnum = EnumGamepadkeyBit.A; break; case "B": gmkeyPushEnum = EnumGamepadkeyBit.B; break; case "X": gmkeyPushEnum = EnumGamepadkeyBit.X; break; case "Y": gmkeyPushEnum = EnumGamepadkeyBit.Y; break; case "L": gmkeyPushEnum = EnumGamepadkeyBit.L; break; case "R": gmkeyPushEnum = EnumGamepadkeyBit.R; break; case "Select": gmkeyPushEnum = EnumGamepadkeyBit.Select; break; case "Start": gmkeyPushEnum = EnumGamepadkeyBit.Start; break; default: // エラー gmkeyPushEnum = EnumGamepadkeyBit.A; break; } } // // 記憶 // KeyconfigPadImpl keycnfPad; if (out_Keycnf.Dic_KeyCnf.ContainsKey(nPlayer)) { keycnfPad = out_Keycnf.Dic_KeyCnf[nPlayer]; } else { keycnfPad = new KeyconfigPadImpl(); } keycnfPad.KeyconfigArray[(int)enumGmkeyArray] = gmkeyPushEnum; out_Keycnf.Dic_KeyCnf[nPlayer] = keycnfPad; } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports_Load); log_Reports_Load.EndLogging(pg_Method); return; }
//──────────────────────────────────────── public void XTo( out KeyconfigImpl out_Keycnf, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); Log_Reports log_Reports_Load = new Log_ReportsImpl(pg_Method); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "XToO",log_Reports_Load); // // out_Keycnf = new KeyconfigImpl(); CsvTo_Table_HumaninputImpl csvTo = new CsvTo_Table_HumaninputImpl(); Request_ReadsTable oRequest_TableReads = new Request_ReadsTableImpl(); { Configurationtree_NodeImpl cf_ConfigStack = new Configurationtree_NodeImpl(Info_Operating.Name_Library + ":" + this.GetType().Name + "#<init>:",null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_1", cf_ConfigStack); cf_Fpath.InitPath( "Editor-config/GAME_PAD/Key-config.csv", log_Reports ); Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); oRequest_TableReads.Expression_Filepath = ec_Fpath; if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } Format_Table_Humaninput o_TableFormat = new Format_Table_HumaninputImpl(); out_Keycnf.O_Table_Keycnf = csvTo.Read( oRequest_TableReads, o_TableFormat, true, log_Reports ); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } // // テーブルを上から1行ずつ読んでいきます。 // foreach (DataRow dataRow in out_Keycnf.O_Table_Keycnf.DataTable.Rows) { //NO ID Expl PLAYER BEFORE AFTER // プレイヤー番号 int nPlayer; { Int_HumaninputImpl o_Player = (Int_HumaninputImpl)dataRow["PLAYER"]; if (Int_HumaninputImpl.TryParse( o_Player, out nPlayer, EnumOperationIfErrorvalue.Error, 0, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } // BEFORE EnumGamepadkeyIx enumGmkeyArray; { string sBefore; string sDebug1 = ""; string sDebug2 = ""; String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["BEFORE"]; if (String_HumaninputImpl.TryParse( o_Before, out sBefore, sDebug1, sDebug2, pg_Method, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } switch (sBefore) { case "Up": enumGmkeyArray = EnumGamepadkeyIx.Up; break; case "Right": enumGmkeyArray = EnumGamepadkeyIx.Right; break; case "Down": enumGmkeyArray = EnumGamepadkeyIx.Down; break; case "Left": enumGmkeyArray = EnumGamepadkeyIx.Left; break; case "0": enumGmkeyArray = EnumGamepadkeyIx.B0; break; case "1": enumGmkeyArray = EnumGamepadkeyIx.B1; break; case "2": enumGmkeyArray = EnumGamepadkeyIx.B2; break; case "3": enumGmkeyArray = EnumGamepadkeyIx.B3; break; case "4": enumGmkeyArray = EnumGamepadkeyIx.B4; break; case "5": enumGmkeyArray = EnumGamepadkeyIx.B5; break; case "6": enumGmkeyArray = EnumGamepadkeyIx.B6; break; case "7": enumGmkeyArray = EnumGamepadkeyIx.B7; break; default: // エラー enumGmkeyArray = EnumGamepadkeyIx.B0; break; } } // AFTER EnumGamepadkeyBit gmkeyPushEnum; { string sAfter; string sDebug1 = ""; string sDebug2 = ""; String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["AFTER"]; if (String_HumaninputImpl.TryParse( o_Before, out sAfter, sDebug1, sDebug2, pg_Method, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } switch (sAfter) { case "Up": gmkeyPushEnum = EnumGamepadkeyBit.Up; break; case "Right": gmkeyPushEnum = EnumGamepadkeyBit.Right; break; case "Down": gmkeyPushEnum = EnumGamepadkeyBit.Down; break; case "Left": gmkeyPushEnum = EnumGamepadkeyBit.Left; break; case "A": gmkeyPushEnum = EnumGamepadkeyBit.A; break; case "B": gmkeyPushEnum = EnumGamepadkeyBit.B; break; case "X": gmkeyPushEnum = EnumGamepadkeyBit.X; break; case "Y": gmkeyPushEnum = EnumGamepadkeyBit.Y; break; case "L": gmkeyPushEnum = EnumGamepadkeyBit.L; break; case "R": gmkeyPushEnum = EnumGamepadkeyBit.R; break; case "Select": gmkeyPushEnum = EnumGamepadkeyBit.Select; break; case "Start": gmkeyPushEnum = EnumGamepadkeyBit.Start; break; default: // エラー gmkeyPushEnum = EnumGamepadkeyBit.A; break; } } // // 記憶 // KeyconfigPadImpl keycnfPad; if (out_Keycnf.Dic_KeyCnf.ContainsKey(nPlayer)) { keycnfPad = out_Keycnf.Dic_KeyCnf[nPlayer]; } else { keycnfPad = new KeyconfigPadImpl(); } keycnfPad.KeyconfigArray[(int)enumGmkeyArray] = gmkeyPushEnum; out_Keycnf.Dic_KeyCnf[nPlayer] = keycnfPad; } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports_Load); log_Reports_Load.EndLogging(pg_Method); return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// フォームのロード時。 /// </summary> public void Load() { Log_Method pg_Method = new Log_MethodImpl(0); Log_Reports log_Reports_Load = new Log_ReportsImpl(pg_Method); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Load", log_Reports_Load); // // // タイトル { StringBuilder s = new StringBuilder(); s.Append("GamePad v"); s.Append(Application.ProductVersion); s.Append(" - Xenon Tools"); this.Form1.Text = s.ToString(); } // キー設定 { KeyconfigImpl keycnf; // キーコンフィグ読取 { XTo_KeyconfigImpl xToO = new XTo_KeyconfigImpl(); xToO.XTo( out keycnf, log_Reports_Load ); this.Input.Table_Humaninput_Keyconfig = keycnf.O_Table_Keycnf; } // キー設定(1P) if (keycnf.Dic_KeyCnf.ContainsKey(1)) { KeyconfigPadImpl keycnfPad = keycnf.Dic_KeyCnf[1]; { string sErrorMsg; this.Form1.UsercontrolPage2.Open(1, keycnfPad, out sErrorMsg); if ("" != sErrorMsg) { // エラー if (log_Reports_Load.CanCreateReport) { Log_RecordReports r = log_Reports_Load.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー111!", pg_Method); r.Message = sErrorMsg; log_Reports_Load.EndCreateReport(); } goto gt_EndMethod; } } { string sErrorMsg; this.Form1.UsercontrolPage3.Open(1, keycnfPad, out sErrorMsg); if ("" != sErrorMsg) { // エラー if (log_Reports_Load.CanCreateReport) { Log_RecordReports r = log_Reports_Load.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー112!", pg_Method); r.Message = sErrorMsg; log_Reports_Load.EndCreateReport(); } goto gt_EndMethod; } } } } // タイマー開始。 this.Form1.Pctmr1.Enabled = true; goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports_Load); log_Reports_Load.EndLogging(pg_Method); }
//──────────────────────────────────────── public void Open(int nPlayer, KeyconfigPadImpl keycnfPad, out string sErrorMsg) { TextBox pctxt; switch(nPlayer) { case 2: pctxt = this.textBox2; break; case 3: pctxt = this.textBox3; break; case 4: pctxt = this.textBox4; break; default: pctxt = this.textBox1; break; } // 1~12 for (int nNum = 1; nNum < 13; nNum++) { EnumGamepadkeyIx enumGa = Utility_KeyconfigArray.IntTo(nNum); EnumGamepadkeyBit enumGp = keycnfPad.KeyconfigArray[(int)enumGa]; switch (enumGp) { case EnumGamepadkeyBit.Up: // [↑] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Right: // [→] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Down: // [↓] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Left: // [←] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.A: // [A] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.B: // [B] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.X: // [X] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Y: // [Y] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.L: // [L] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.R: // [R] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Start: // [Start] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; case EnumGamepadkeyBit.Select: // [Select] pctxt.Text += Utility_KeyconfigArray.ToString_Display(enumGa); break; default: break; } } sErrorMsg = ""; return; }