/// <summary> /// イベントの設定。 /// </summary> /// <param name="obj_shogiGui"></param> public virtual void Step3_SetEvent(object obj_shogiGui) { MainGui_Csharp shogibanGui1 = (MainGui_Csharp)obj_shogiGui; //---------- // [成る]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnNaru"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnNaru; } //---------- // [成らない]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnNaranai"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnNaranai; } //---------- // [クリアー]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnClear"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnClear; } //---------- // [再生]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnPlay"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnPlay; } //---------- // [コマ送り]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnForward"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnForward; } //---------- // [巻戻し]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnBackward"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnBackward; } //---------- // ログ出せボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnLogdase"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnLogdase; } //---------- // [壁置く]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnKabeOku"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnKabeOku; } //---------- // [出力切替]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnSyuturyokuKirikae"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnSyuturyokuKirikae; } //---------- // [▲]~[打]符号ボタン //---------- { string[] buttonNames = new string[] { "BtnFugo_Sente" // [▲]~[打]符号ボタン , "BtnFugo_Gote" , "BtnFugo_1" , "BtnFugo_2" , "BtnFugo_3" , "BtnFugo_4" , "BtnFugo_5" , "BtnFugo_6" , "BtnFugo_7" , "BtnFugo_8" , "BtnFugo_9" , "BtnFugo_Dou" , "BtnFugo_Fu" , "BtnFugo_Hisya" , "BtnFugo_Kaku" , "BtnFugo_Kyo" , "BtnFugo_Kei" , "BtnFugo_Gin" , "BtnFugo_Kin" , "BtnFugo_Oh" , "BtnFugo_Gyoku" , "BtnFugo_Tokin" , "BtnFugo_Narikyo" , "BtnFugo_Narikei" , "BtnFugo_Narigin" , "BtnFugo_Ryu" , "BtnFugo_Uma" , "BtnFugo_Yoru" , "BtnFugo_Hiku" , "BtnFugo_Agaru" , "BtnFugo_Migi" , "BtnFugo_Hidari" , "BtnFugo_Sugu" , "BtnFugo_Nari" , "BtnFugo_Funari" , "BtnFugo_Da" }; foreach (string buttonName in buttonNames) { UserWidget widget = shogibanGui1.GetWidget(buttonName); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnKakusyuFugo; } } //---------- // [全消]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnFugo_Zenkesi"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnZenkesi; } //---------- // [ここから採譜]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnFugo_KokokaraSaifu"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnKokokaraSaifu; } //---------- // 初期配置ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnSyokihaichi"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnSyokihaichi; } //---------- // [向き]ボタン //---------- { UserWidget widget = shogibanGui1.GetWidget("BtnMuki"); widget.Delegate_MouseHitEvent = Event_CsharpImpl.GetInstance().Delegate_BtnMuki; } }
/// <summary> /// シングルトン。 /// </summary> /// <returns></returns> public static Event_CsharpImpl GetInstance() { if (null == Event_CsharpImpl.instance) { Event_CsharpImpl ins = new Event_CsharpImpl(); Event_CsharpImpl.instance = ins; // // [成る]ボタンのイベント。 // ins.delegate_BtnNaru = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; shogibanGui2.SetNaruFlag(true); ins.After_NaruNaranai_ButtonPushed( shogibanGui2 , btnKoma_Selected ); }; // // [成らない]ボタンのイベント。 // ins.delegate_BtnNaranai = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; shogibanGui2.SetNaruFlag(false); ins.After_NaruNaranai_ButtonPushed( shogibanGui2 , btnKoma_Selected ); }; // // [クリアー]ボタンのイベント。 // ins.delegate_BtnClear = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; Util_Lua_Csharp.ShogiGui = shogibanGui2; Util_Lua_Csharp.Perform("click_clearButton"); }; // // [再生]ボタンのイベント。 // ins.delegate_BtnPlay = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; Util_Lua_Csharp.ShogiGui = shogibanGui2; Util_Lua_Csharp.Perform("click_playButton"); }; // // [コマ送り]ボタンのイベント。 // ins.delegate_BtnForward = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp mainGui3 = (MainGui_Csharp)obj_shogiGui2; string restText = Util_Function_Csharp.ReadLine_FromTextbox(); Util_Functions_Server.Komaokuri_Srv( ref restText, mainGui3.Link_Server.Model_Taikyoku, mainGui3.Model_Manual); Util_Function_Csharp.Komaokuri_Gui(restText, mainGui3); Util_Menace.Menace(mainGui3);// メナス }; // // [巻き戻し]ボタンのイベント。 // ins.delegate_BtnBackward = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; Finger movedKoma; Finger foodKoma;//取られた駒 string fugoJStr; if (!Util_Functions_Server.Makimodosi_Srv(out movedKoma, out foodKoma, out fugoJStr, shogibanGui2.Link_Server.Model_Taikyoku)) { goto gt_EndBlock; } Util_Function_Csharp.Makimodosi_Gui(shogibanGui2, movedKoma, foodKoma, fugoJStr, Util_Function_Csharp.ReadLine_FromTextbox()); Util_Menace.Menace(shogibanGui2);//メナス gt_EndBlock: ; }; // // [ログ出せ]ボタンのイベント。 // ins.delegate_BtnLogdase = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; shogibanGui2.Logdase(); }; // // [壁置く]ボタンのイベント。 // ins.delegate_BtnKabeOku = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; UserWidget widget = shogibanGui2.GetWidget("BtnKabeOku"); // [壁置く]←→[駒動かす]切替 switch (widget.Text) { case "壁置く": widget.Text = "駒動かす"; break; default: widget.Text = "壁置く"; break; } shogibanGui2.RepaintRequest.SetFlag_RefreshRequest(); }; // // [出力切替]ボタンのイベント。 // ins.delegate_BtnSyuturyokuKirikae = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; switch (shogibanGui2.SyuturyokuKirikae) { case SyuturyokuKirikae.Japanese: shogibanGui2.SetSyuturyokuKirikae(SyuturyokuKirikae.Sfen); break; case SyuturyokuKirikae.Sfen: shogibanGui2.SetSyuturyokuKirikae(SyuturyokuKirikae.Html); break; case SyuturyokuKirikae.Html: shogibanGui2.SetSyuturyokuKirikae(SyuturyokuKirikae.Japanese); break; } shogibanGui2.RepaintRequest.SyuturyokuRequest = RepaintRequestGedanTxt.Kifu; }; // // [各種符号]ボタンのイベント。 // ins.delegate_BtnKakusyuFugo = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; UserWidget userWidget = (UserWidget)userWidget2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; UserWidget widget = shogibanGui2.GetWidget(userWidget.Name); shogibanGui2.RepaintRequest.SetNyuryokuTextTail(widget.Fugo); }; // // [全消]ボタンのイベント。 // ins.delegate_BtnZenkesi = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; shogibanGui2.RepaintRequest.NyuryokuText = ""; }; // // [ここから採譜]ボタンのイベント。 // ins.delegate_BtnKokokaraSaifu = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; UtilKifuTree282.SetStartpos_KokokaraSaifu(shogibanGui2.Link_Server.Model_Taikyoku.Kifu, shogibanGui2.Link_Server.Model_Taikyoku.Kifu.CurNode.Value.KyokumenConst.KaisiPside); shogibanGui2.RepaintRequest.SyuturyokuRequest = RepaintRequestGedanTxt.Kifu; }; // // [初期配置]ボタンのイベント。 // ins.delegate_BtnSyokihaichi = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp shogibanGui2 = (MainGui_Csharp)obj_shogiGui2; Util_Function_Csharp.Perform_SyokiHaichi(shogibanGui2); }; // // [向き]ボタンのイベント。 // ins.delegate_BtnMuki = ( object obj_shogiGui2 , object userWidget2 // UerWidget , object btnKoma_Selected2 ) => { Shape_BtnKoma btnKoma_Selected = (Shape_BtnKoma)btnKoma_Selected2; MainGui_Csharp mainGui3 = (MainGui_Csharp)obj_shogiGui2; Shape_BtnKoma movedKoma = mainGui3.Shape_PnlTaikyoku.Btn_MovedKoma(); RO_Star koma; Finger figKoma = Fingers.Error_1; if (null != movedKoma) { //>>>>> 移動直後の駒があるとき koma = Util_Starlightable.AsKoma(mainGui3.Model_Manual.GuiSkyConst.StarlightIndexOf(movedKoma.Finger).Now); figKoma = movedKoma.Finger; } else if (null != btnKoma_Selected) { //>>>>> 選択されている駒があるとき koma = Util_Starlightable.AsKoma(mainGui3.Model_Manual.GuiSkyConst.StarlightIndexOf(btnKoma_Selected.Koma).Now); figKoma = btnKoma_Selected.Koma; } else { koma = null; } if (null != koma) { KifuNode modifyNode = new KifuNodeImpl( mainGui3.Link_Server.Model_Taikyoku.Kifu.CurNode.Key,//現在の局面を流用 new KyokumenWrapper( SkyConst.NewInstance_OverwriteOrAdd_Light( mainGui3.Model_Manual.GuiSkyConst, -1,//そのまま figKoma, new RO_Starlight( new RO_Star( Conv_Playerside.Reverse(koma.Pside),//向きを逆さにします。 koma.Masu, koma.Komasyurui ) ) ) ) ); // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // ここで局面データを変更します。 // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ string jsaFugoStr; Util_Functions_Server.SetCurNode_Srv( mainGui3.Link_Server.Model_Taikyoku, mainGui3.Model_Manual, modifyNode, out jsaFugoStr); mainGui3.RepaintRequest.SetFlag_RefreshRequest(); } }; } return(Event_CsharpImpl.instance); }