Esempio n. 1
0
        public virtual void Step3_SetEvent(object obj_shogiGui)
        {
            NarabeRoomViewModel shogiGui1 = (NarabeRoomViewModel)obj_shogiGui;

            //----------
            // [成る]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnNaru");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;


                    shogiGui.Shape_PnlTaikyoku.SetNaruFlag(true);
                    this.After_NaruNaranai(
                        shogiGui
                        , btnKoma_Selected
                        );
                };
            }

            //----------
            // [成らない]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnNaranai");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    shogiGui.Shape_PnlTaikyoku.SetNaruFlag(false);
                    this.After_NaruNaranai(
                        shogiGui
                        , btnKoma_Selected
                        );
                };
            }

            //----------
            // [クリアー]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnClear");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Util_Lua_KifuNarabe.ShogiGui = shogiGui;
                    Util_Lua_KifuNarabe.Perform("click_clearButton");
                };
            }

            //----------
            // [再生]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnPlay");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Util_Lua_KifuNarabe.ShogiGui = shogiGui;
                    Util_Lua_KifuNarabe.Perform("click_playButton");
                };
            }

            //----------
            // [コマ送り]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnForward");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    string restText = Util_InGui.ReadLine_FromTextbox();
                    Util_InServer.Komaokuri_Srv(ref restText, shogiGui);
                    Util_InGui.Komaokuri_Gui(restText, shogiGui);
                    Util_Menace.Menace(shogiGui);// メナス
                };
            }

            //----------
            // [巻戻し]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnBackward");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    Finger movedKoma;
                    Finger foodKoma;//取られた駒
                    string fugoJStr;

                    if (!Util_InServer.Makimodosi_Srv(out movedKoma, out foodKoma, out fugoJStr, shogiGui))
                    {
                        goto gt_EndBlock;
                    }

                    Util_InGui.Makimodosi_Gui(shogiGui, movedKoma, foodKoma, fugoJStr, Util_InGui.ReadLine_FromTextbox());
                    Util_Menace.Menace(shogiGui);//メナス

gt_EndBlock:
                    ;
                };
            }


            //----------
            // ログ出せボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnLogdase");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    ui_PnlMain.ShogiGui.Logdase();
                };
            }



            //----------
            // [壁置く]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnKabeOku");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    // [壁置く]←→[駒動かす]切替
                    switch (widget.Text)
                    {
                    case "壁置く":
                        widget.Text = "駒動かす";
                        break;

                    default:
                        widget.Text = "壁置く";
                        break;
                    }

                    shogiGui.ResponseData.ToRedraw();
                };
            }


            //----------
            // [出力切替]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnSyuturyokuKirikae");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    switch (shogiGui.Shape_PnlTaikyoku.SyuturyokuKirikae)
                    {
                    case SyuturyokuKirikae.Japanese:
                        shogiGui.Shape_PnlTaikyoku.SetSyuturyokuKirikae(SyuturyokuKirikae.Sfen);
                        break;

                    case SyuturyokuKirikae.Sfen:
                        shogiGui.Shape_PnlTaikyoku.SetSyuturyokuKirikae(SyuturyokuKirikae.Html);
                        break;

                    case SyuturyokuKirikae.Html:
                        shogiGui.Shape_PnlTaikyoku.SetSyuturyokuKirikae(SyuturyokuKirikae.Japanese);
                        break;
                    }

                    shogiGui.ResponseData.OutputTxt = ResponseGedanTxt.Kifu;
                };
            }

            //----------
            // [▲]~[打]符号ボタン
            //----------
            {
                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 = shogiGui1.Shape_PnlTaikyoku.GetWidget(buttonName);
                    widget.Delegate_MouseHitEvent = (
                        object obj_shogiGui2
                        , Shape_BtnKoma btnKoma_Selected
                        ) =>
                    {
                        NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                        Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                        shogiGui.ResponseData.SetAppendInputTextString(shogiGui.Shape_PnlTaikyoku.GetWidget(buttonName).Fugo);
                    };
                }
            }


            //----------
            // [全消]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnFugo_Zenkesi");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    shogiGui.ResponseData.InputTextString = "";
                };
            }


            //----------
            // [ここから採譜]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnFugo_KokokaraSaifu");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    ui_PnlMain.ShogiGui.GameViewModel.Kifu.SetStartpos_KokokaraSaifu(Util_InServer.CurPside(ui_PnlMain.ShogiGui));
                    shogiGui.ResponseData.OutputTxt = ResponseGedanTxt.Kifu;
                };
            }

            //----------
            // 初期配置ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnSyokihaichi");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    WidgetsLoader_KifuNarabe.Perform_SyokiHaichi(ui_PnlMain);
                };
            }


            //----------
            // [向き]ボタン
            //----------
            {
                UserWidget widget = shogiGui1.Shape_PnlTaikyoku.GetWidget("BtnMuki");
                widget.Delegate_MouseHitEvent = (
                    object obj_shogiGui2
                    , Shape_BtnKoma btnKoma_Selected
                    ) =>
                {
                    NarabeRoomViewModel shogiGui = (NarabeRoomViewModel)obj_shogiGui2;

                    Ui_PnlMain ui_PnlMain = ((Ui_ShogiForm1)shogiGui.OwnerForm).Ui_PnlMain1;

                    Shape_BtnKoma movedKoma = shogiGui.Shape_PnlTaikyoku.Btn_MovedKoma();

                    RO_Star_Koma koma;
                    Finger       figKoma = Fingers.Error_1;

                    if (null != movedKoma)
                    {
                        //>>>>> 移動直後の駒があるとき
                        koma    = Util_Koma.AsKoma(ui_PnlMain.ShogiGui.GameViewModel.GuiSkyConst.StarlightIndexOf(movedKoma.Finger).Now);
                        figKoma = movedKoma.Finger;
                    }
                    else if (null != btnKoma_Selected)
                    {
                        //>>>>> 選択されている駒があるとき
                        koma    = Util_Koma.AsKoma(ui_PnlMain.ShogiGui.GameViewModel.GuiSkyConst.StarlightIndexOf(btnKoma_Selected.Koma).Now);
                        figKoma = btnKoma_Selected.Koma;
                    }
                    else
                    {
                        koma = null;
                    }

                    if (null != koma)
                    {
                        switch (koma.Pside)
                        {
                        case Playerside.P1:
                        {
                            SkyBuffer buffer_Sky = new SkyBuffer(ui_PnlMain.ShogiGui.GameViewModel.GuiSkyConst);

                            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(
                                                                 //figKoma,
                                                                 new RO_Star_Koma(Playerside.P2,
                                                                                  koma.Masu,
                                                                                  Haiyaku184Array.Syurui(koma.Haiyaku))
                                                                 ));

                            KifuNode modifyNode = new KifuNodeImpl(
                                ui_PnlMain.ShogiGui.GameViewModel.Kifu.CurNode.Key,                                //現在の局面を流用
                                new KyokumenWrapper(new SkyConst(buffer_Sky)),
                                ((KifuNode)ui_PnlMain.ShogiGui.GameViewModel.Kifu.CurNode).Tebanside
                                );

                            // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
                            // ここで局面データを変更します。
                            // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
                            Util_InServer.SetCurNode_Srv(ui_PnlMain.ShogiGui, modifyNode);
                            ui_PnlMain.ShogiGui.ResponseData.ToRedraw();
                        }
                        break;

                        case Playerside.P2:
                        {
                            SkyBuffer buffer_Sky = new SkyBuffer(ui_PnlMain.ShogiGui.GameViewModel.GuiSkyConst);

                            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(
                                                                 //figKoma,
                                                                 new RO_Star_Koma(Playerside.P1,
                                                                                  koma.Masu,
                                                                                  Haiyaku184Array.Syurui(koma.Haiyaku))
                                                                 ));

                            KifuNode modifyNode =
                                new KifuNodeImpl(
                                    ui_PnlMain.ShogiGui.GameViewModel.Kifu.CurNode.Key,        //現在の局面を流用
                                    new KyokumenWrapper(new SkyConst(buffer_Sky)),
                                    ((KifuNode)ui_PnlMain.ShogiGui.GameViewModel.Kifu.CurNode).Tebanside
                                    );


                            // ここで局面データを変更します。
                            Util_InServer.SetCurNode_Srv(ui_PnlMain.ShogiGui, modifyNode);
                            ui_PnlMain.ShogiGui.ResponseData.ToRedraw();
                        }
                        break;
                        }
                    }
                };
            }
        }
Esempio n. 2
0
        /// <summary>
        /// ************************************************************************************************************************
        /// 将棋盤の上の駒を、全て駒袋に移動します。 [クリアー]
        /// ************************************************************************************************************************
        /// </summary>
        public static void ClearKifu(NarabeRoomViewModel shogiGui, Response response)
        {
            shogiGui.GameViewModel.Kifu.Clear();// 棋譜を空っぽにします。

            SkyBuffer buffer_Sky = new SkyBuffer(shogiGui.GameViewModel.GuiSkyConst);

            int figKoma;

            // 先手
            figKoma = (int)Finger_Honshogi.SenteOh;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(/*figKoma,*/ new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro01, PieceType.K))); //先手王
            figKoma = (int)Finger_Honshogi.GoteOh;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro02, PieceType.K)));              //後手王

            figKoma = (int)Finger_Honshogi.Hi1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro03, PieceType.R))); //飛
            figKoma = (int)Finger_Honshogi.Hi2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro04, PieceType.R)));

            figKoma = (int)Finger_Honshogi.Kaku1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro05, PieceType.B))); //角
            figKoma = (int)Finger_Honshogi.Kaku2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro06, PieceType.B)));

            figKoma = (int)Finger_Honshogi.Kin1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro07, PieceType.G))); //金
            figKoma = (int)Finger_Honshogi.Kin2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro08, PieceType.G)));
            figKoma = (int)Finger_Honshogi.Kin3;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro09, PieceType.G)));
            figKoma = (int)Finger_Honshogi.Kin4;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro10, PieceType.G)));

            figKoma = (int)Finger_Honshogi.Gin1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro11, PieceType.S))); //銀
            figKoma = (int)Finger_Honshogi.Gin2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro12, PieceType.S)));
            figKoma = (int)Finger_Honshogi.Gin3;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro13, PieceType.S)));
            figKoma = (int)Finger_Honshogi.Gin4;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro14, PieceType.S)));

            figKoma = (int)Finger_Honshogi.Kei1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro15, PieceType.N))); //桂
            figKoma = (int)Finger_Honshogi.Kei2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro16, PieceType.N)));
            figKoma = (int)Finger_Honshogi.Kei3;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro17, PieceType.N)));
            figKoma = (int)Finger_Honshogi.Kei4;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro18, PieceType.N)));

            figKoma = (int)Finger_Honshogi.Kyo1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro19, PieceType.L))); //香
            figKoma = (int)Finger_Honshogi.Kyo2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro20, PieceType.L)));
            figKoma = (int)Finger_Honshogi.Kyo3;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro21, PieceType.L)));
            figKoma = (int)Finger_Honshogi.Kyo4;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro22, PieceType.L)));

            figKoma = (int)Finger_Honshogi.Fu1;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro23, PieceType.P))); //歩
            figKoma = (int)Finger_Honshogi.Fu2;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro24, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu3;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro25, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu4;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro26, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu5;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro27, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu6;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro28, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu7;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro29, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu8;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro30, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu9;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P1, Masu_Honshogi.fukuro31, PieceType.P)));

            figKoma = (int)Finger_Honshogi.Fu10;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro32, PieceType.P))); //歩
            figKoma = (int)Finger_Honshogi.Fu11;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro33, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu12;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro34, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu13;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro35, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu14;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro36, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu15;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro37, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu16;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro38, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu17;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro39, PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu18;
            buffer_Sky.AddOverwriteStarlight(figKoma, new RO_MotionlessStarlight(new RO_Star_Koma(Playerside.P2, Masu_Honshogi.fukuro40, PieceType.P)));


            {
                KifuNode newNode = new KifuNodeImpl(
                    Util_Sky.NullObjectMove,        //ルートなので
                    new KyokumenWrapper(new SkyConst(buffer_Sky)),
                    Playerside.P2
                    );

                Util_InServer.SetCurNode_Srv(shogiGui, newNode);
                response.ToRedraw();

                shogiGui.GameViewModel.Kifu.SetProperty(KifuTreeImpl.PropName_Startpos, "9/9/9/9/9/9/9/9/9 b K1R1B1G2S2N2L2P9 k1r1b1g2s2n2l2p9 1");
            }
        }
Esempio n. 3
0
        public override void Step()
        {
            // 入っているマウス操作イベントのうち、マウスムーブは 1つに 集約 します。
            bool bMouseMove_SceneB_1TumamitaiKoma = false;

            // 入っているマウス操作イベントは、全部捨てていきます。
            MouseEventState[] queue = this.MouseEventQueue.ToArray();
            this.MouseEventQueue.Clear();
            foreach (MouseEventState eventState in queue)
            {
                switch (this.shogiGui.Scene)
                {
                case SceneName.SceneB_1TumamitaiKoma:
                {
                    #region つまみたい駒


                    switch (eventState.Name2)
                    {
                    case MouseEventStateName.Arive:
                    {
                        #region アライブ
                        //------------------------------
                        // メナス
                        //------------------------------
                        Util_Menace.Menace(this.shogiGui);
                        #endregion
                    }
                    break;

                    case MouseEventStateName.MouseMove:
                    {
                        #region マウスムーブ
                        if (bMouseMove_SceneB_1TumamitaiKoma)
                        {
                            continue;
                        }
                        bMouseMove_SceneB_1TumamitaiKoma = true;

                        SkyConst src_Sky = shogiGui.GameViewModel.GuiSkyConst;

                        Point mouse = eventState.MouseLocation;

                        //----------
                        // 将棋盤:升目
                        //----------
                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if ("Masu" == widget.Type && Okiba.ShogiBan == widget.Okiba)
                            {
                                Shape_BtnMasuImpl cell = (Shape_BtnMasuImpl)widget.Object;
                                cell.LightByMouse(mouse.X, mouse.Y);
                                if (cell.Light)
                                {
                                    shogiGui.ResponseData.ToRedraw();
                                }
                                break;
                            }
                        }

                        //----------
                        // 駒置き、駒袋:升目
                        //----------
                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if ("Masu" == widget.Type && widget.Okiba.HasFlag(Okiba.Sente_Komadai | Okiba.Gote_Komadai | Okiba.KomaBukuro))
                            {
                                Shape_BtnMasuImpl cell = (Shape_BtnMasuImpl)widget.Object;
                                cell.LightByMouse(mouse.X, mouse.Y);
                                if (cell.Light)
                                {
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }
                        }

                        //----------
                        // 駒
                        //----------
                        foreach (Shape_BtnKomaImpl btnKoma in shogiGui.Shape_PnlTaikyoku.BtnKomaDoors)
                        {
                            btnKoma.LightByMouse(mouse.X, mouse.Y);
                            if (btnKoma.Light)
                            {
                                shogiGui.ResponseData.ToRedraw();

                                RO_Star_Koma koma = Util_Koma.AsKoma(src_Sky.StarlightIndexOf(btnKoma.Koma).Now);

                                if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(koma.Masu))
                                {
                                    // マウスオーバーした駒の利き
                                    TimedB.Check_MouseoverKomaKiki(shogiGui, btnKoma.Koma);


                                    break;
                                }
                            }
                        }


                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if (widget.IsLight_OnFlowB_1TumamitaiKoma)
                            {
                                widget.LightByMouse(mouse.X, mouse.Y);
                                if (widget.Light)
                                {
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }
                        }
                        #endregion
                    }
                    break;

                    case MouseEventStateName.MouseLeftButtonDown:
                    {
                        #region マウス左ボタンダウン
                        SceneName nextPhaseB = SceneName.Ignore;
                        SkyConst  src_Sky    = shogiGui.GameViewModel.GuiSkyConst;

                        //----------
                        // 駒
                        //----------
                        foreach (Shape_BtnKomaImpl btnKoma in shogiGui.Shape_PnlTaikyoku.BtnKomaDoors)
                        {
                            if (btnKoma.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                            {
                                //>>>>>>>>>> 駒にヒットしました。

                                if (null != shogiGui.Shape_PnlTaikyoku.Btn_TumandeiruKoma(shogiGui))
                                {
                                    //>>>>>>>>>> 既に選択されている駒があります。→★成ろうとしたときの、取られる相手の駒かも。
                                    goto gt_Next1;
                                }

                                // 既に選択されている駒には無効
                                if (shogiGui.Shape_PnlTaikyoku.FigTumandeiruKoma == (int)btnKoma.Koma)
                                {
                                    goto gt_Next1;
                                }



                                if (btnKoma.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))                 //>>>>> 駒をつまみました。
                                {
                                    // 駒をつまみます。
                                    shogiGui.Shape_PnlTaikyoku.SetFigTumandeiruKoma((int)btnKoma.Koma);
                                    shogiGui.Shape_PnlTaikyoku.SelectFirstTouch = true;

                                    nextPhaseB = SceneName.SceneB_2OkuKoma;

                                    shogiGui.Shape_PnlTaikyoku.SetMouseStarlightOrNull2(
                                        src_Sky.StarlightIndexOf(btnKoma.Koma)                //TODO:改造
                                        );

                                    shogiGui.Shape_PnlTaikyoku.SetHMovedKoma(Fingers.Error_1);
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }

gt_Next1:
                            ;
                        }


                        //----------
                        // 既に選択されている駒
                        //----------
                        Shape_BtnKoma btnKoma_Selected = shogiGui.Shape_PnlTaikyoku.Btn_TumandeiruKoma(shogiGui);



                        //----------
                        // 各種ボタン
                        //----------
                        {
                            foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                            {
                                if (widget.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                                {
                                    if (null != widget.Delegate_MouseHitEvent)
                                    {
                                        widget.Delegate_MouseHitEvent(
                                            shogiGui
                                            , btnKoma_Selected
                                            );
                                    }
                                }
                            }
                        }


                        shogiGui.SetScene(nextPhaseB);

                        //------------------------------
                        // このメインパネルの反応
                        //------------------------------
                        shogiGui.Response("MouseOperation");
                        #endregion
                    }
                    break;

                    case MouseEventStateName.MouseLeftButtonUp:
                    {
                        #region マウス左ボタンアップ
                        SkyConst src_Sky = shogiGui.GameViewModel.GuiSkyConst;

                        //----------
                        // 将棋盤:升目
                        //----------
                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if ("Masu" == widget.Type && Okiba.ShogiBan == widget.Okiba)
                            {
                                Shape_BtnMasuImpl cell = (Shape_BtnMasuImpl)widget.Object;
                                if (cell.DeselectByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                                {
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }
                        }

                        //----------
                        // 駒置き、駒袋:升目
                        //----------
                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if ("Masu" == widget.Type && widget.Okiba.HasFlag(Okiba.Sente_Komadai | Okiba.Gote_Komadai | Okiba.KomaBukuro))
                            {
                                Shape_BtnMasuImpl cell = (Shape_BtnMasuImpl)widget.Object;
                                if (cell.DeselectByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                                {
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }
                        }

                        //----------
                        // 駒
                        //----------
                        foreach (Shape_BtnKomaImpl btnKoma in shogiGui.Shape_PnlTaikyoku.BtnKomaDoors)
                        {
                            if (btnKoma.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                            {
                                //>>>>> つまんでいる駒から、指を放しました
                                shogiGui.Shape_PnlTaikyoku.SetFigTumandeiruKoma(-1);


                                RO_Star_Koma koma1 = Util_Koma.AsKoma(src_Sky.StarlightIndexOf((int)btnKoma.Koma).Now);


                                if (Okiba.ShogiBan == Util_Masu.GetOkiba(koma1.Masu))
                                {
                                    //----------
                                    // 移動済表示
                                    //----------
                                    shogiGui.Shape_PnlTaikyoku.SetHMovedKoma(btnKoma.Koma);

                                    //------------------------------
                                    // 棋譜に符号を追加(マウスボタンが放されたとき)TODO:まだ早い。駒が成るかもしれない。
                                    //------------------------------
                                    // 棋譜

                                    Starlight dstStarlight = shogiGui.Shape_PnlTaikyoku.MouseStarlightOrNull2;
                                    System.Diagnostics.Debug.Assert(null != dstStarlight, "mouseStarlightがヌル");

                                    Starlight srcStarlight = src_Sky.StarlightIndexOf(btnKoma.Koma);
                                    System.Diagnostics.Debug.Assert(null != srcStarlight, "komaStarlightがヌル");


                                    ShootingStarlightable move = new RO_ShootingStarlight(
                                        //btnKoma.Koma,
                                        dstStarlight.Now,
                                        srcStarlight.Now,
                                        shogiGui.Shape_PnlTaikyoku.MousePos_FoodKoma != null ? shogiGui.Shape_PnlTaikyoku.MousePos_FoodKoma.Syurui : PieceType.None
                                        );                // 選択している駒の元の場所と、移動先


                                    // TODO: 一手[巻戻し]のときは追加したくない
                                    Node <ShootingStarlightable, KyokumenWrapper> newNode = new KifuNodeImpl(move,
                                                                                                             new KyokumenWrapper(new SkyConst(src_Sky)),
                                                                                                             KifuNodeImpl.GetReverseTebanside(((KifuNode)shogiGui.GameViewModel.Kifu.CurNode).Tebanside)
                                                                                                             );


                                    //マウスの左ボタンを放したときです。
                                    ((KifuNode)KifuNarabe_KifuWrapper.CurNode(shogiGui.GameViewModel.Kifu)).AppendChildA_New(newNode);
                                    Util_InServer.SetCurNode_Srv(shogiGui, newNode);
                                    shogiGui.ResponseData.ToRedraw();


                                    //------------------------------
                                    // 符号表示
                                    //------------------------------
                                    FugoJ fugoJ;

                                    RO_Star_Koma koma2 = Util_Koma.AsKoma(move.LongTimeAgo);

                                    fugoJ = JFugoCreator15Array.ItemMethods[(int)Haiyaku184Array.Syurui(koma2.Haiyaku)](move, new KyokumenWrapper(src_Sky));                //「▲2二角成」なら、馬(dst)ではなくて角(src)。


                                    shogiGui.Shape_PnlTaikyoku.SetFugo(fugoJ.ToText_UseDou(
                                                                           KifuNarabe_KifuWrapper.CurNode(shogiGui.GameViewModel.Kifu)
                                                                           ));



                                    //------------------------------
                                    // チェンジターン
                                    //------------------------------
                                    if (!shogiGui.Shape_PnlTaikyoku.Requested_NaruDialogToShow)
                                    {
                                        shogiGui.ChangeTurn();                //マウス左ボタンを放したのでチェンジターンします。
                                    }

                                    shogiGui.ResponseData.OutputTxt = ResponseGedanTxt.Kifu;
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }
                        }



                        //------------------------------------------------------------
                        // 選択解除か否か
                        //------------------------------------------------------------
                        {
                            foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                            {
                                if (widget.DeselectByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y, shogiGui))
                                {
                                    shogiGui.ResponseData.ToRedraw();
                                }
                            }
                        }

                        //------------------------------
                        // このメインパネルの反応
                        //------------------------------
                        shogiGui.Response("MouseOperation");

                        #endregion
                    }
                    break;
                    }
                    #endregion
                }
                break;

                case SceneName.SceneB_2OkuKoma:
                {
                    #region 置く駒

                    switch (eventState.Name2)
                    {
                    case MouseEventStateName.MouseLeftButtonUp:
                    {
                        #region マウス左ボタンアップ
                        Node <ShootingStarlightable, KyokumenWrapper> siteiNode = KifuNarabe_KifuWrapper.CurNode(shogiGui.GameViewModel.Kifu);
                        SkyConst src_Sky = shogiGui.GameViewModel.GuiSkyConst;


                        //----------
                        // 駒
                        //----------
                        foreach (Shape_BtnKomaImpl btnKoma in shogiGui.Shape_PnlTaikyoku.BtnKomaDoors)
                        {
                            if (btnKoma.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                            {
                                //>>>>> マウスが重なっていました

                                if (shogiGui.Shape_PnlTaikyoku.SelectFirstTouch)
                                {
                                    // クリックのマウスアップ
                                    shogiGui.Shape_PnlTaikyoku.SelectFirstTouch = false;
                                }
                                else
                                {
                                    RO_Star_Koma koma = Util_Koma.AsKoma(src_Sky.StarlightIndexOf(btnKoma.Koma).Now);


                                    if (Okiba.ShogiBan == Util_Masu.GetOkiba(koma.Masu))
                                    {
                                        //>>>>> 将棋盤の上に置いてあった駒から、指を放しました
                                        //System.C onsole.WriteLine("つまんでいる駒を放します。(4)");
                                        shogiGui.Shape_PnlTaikyoku.SetFigTumandeiruKoma(-1);


                                        //----------
                                        // 移動済表示
                                        //----------
                                        shogiGui.Shape_PnlTaikyoku.SetHMovedKoma(btnKoma.Koma);

                                        //------------------------------
                                        // 棋譜に符号を追加(マウスボタンが放されたとき)TODO:まだ早い。駒が成るかもしれない。
                                        //------------------------------

                                        ShootingStarlightable move = new RO_ShootingStarlight(
                                            //btnKoma.Koma,
                                            shogiGui.Shape_PnlTaikyoku.MouseStarlightOrNull2.Now,

                                            src_Sky.StarlightIndexOf(btnKoma.Koma).Now,

                                            shogiGui.Shape_PnlTaikyoku.MousePos_FoodKoma != null ? shogiGui.Shape_PnlTaikyoku.MousePos_FoodKoma.Syurui : PieceType.None
                                            );                // 選択している駒の元の場所と、移動先

                                        ShootingStarlightable last;
                                        {
                                            last = siteiNode.Key;
                                        }
                                        //ShootingStarlightable previousMove = last; //符号の追加が行われる前に退避

                                        Node <ShootingStarlightable, KyokumenWrapper> newNode =
                                            new KifuNodeImpl(
                                                move,
                                                new KyokumenWrapper(new SkyConst(src_Sky)),
                                                KifuNodeImpl.GetReverseTebanside(((KifuNode)shogiGui.GameViewModel.Kifu.CurNode).Tebanside)
                                                );


                                        //マウスの左ボタンを放したときです。
                                        ((KifuNode)KifuNarabe_KifuWrapper.CurNode(shogiGui.GameViewModel.Kifu)).AppendChildA_New(newNode);
                                        Util_InServer.SetCurNode_Srv(shogiGui, newNode);
                                        shogiGui.ResponseData.ToRedraw();


                                        // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
                                        // ここでツリーの内容は変わっている。
                                        // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

                                        //------------------------------
                                        // 符号表示
                                        //------------------------------
                                        RO_Star_Koma koma2 = Util_Koma.AsKoma(move.LongTimeAgo);

                                        FugoJ fugoJ;

                                        fugoJ = JFugoCreator15Array.ItemMethods[(int)Haiyaku184Array.Syurui(koma2.Haiyaku)](move, new KyokumenWrapper(src_Sky));                //「▲2二角成」なら、馬(dst)ではなくて角(src)。

                                        shogiGui.Shape_PnlTaikyoku.SetFugo(fugoJ.ToText_UseDou(
                                                                               KifuNarabe_KifuWrapper.CurNode(shogiGui.GameViewModel.Kifu)
                                                                               ));



                                        //------------------------------
                                        // チェンジターン
                                        //------------------------------
                                        if (!shogiGui.Shape_PnlTaikyoku.Requested_NaruDialogToShow)
                                        {
                                            //System.C onsole.WriteLine("マウス左ボタンを放したのでチェンジターンします。");
                                            shogiGui.ChangeTurn();                //マウス左ボタンを放したのでチェンジターンします。
                                        }

                                        shogiGui.ResponseData.OutputTxt = ResponseGedanTxt.Kifu;
                                        shogiGui.ResponseData.ToRedraw();
                                    }
                                }
                            }
                        }

                        //------------------------------
                        // このメインパネルの反応
                        //------------------------------
                        shogiGui.Response("MouseOperation");
                        #endregion
                    }
                    break;

                    case MouseEventStateName.MouseLeftButtonDown:
                    {
                        #region マウス左ボタンダウン
                        SceneName nextPhaseB = SceneName.Ignore;

                        //System.C onsole.WriteLine("B2マウスダウン");

                        //----------
                        // つまんでいる駒
                        //----------
                        Shape_BtnKoma btnTumandeiruKoma = shogiGui.Shape_PnlTaikyoku.Btn_TumandeiruKoma(shogiGui);
                        if (null == btnTumandeiruKoma)
                        {
                            //System.C onsole.WriteLine("つまんでいる駒なし");
                            goto gt_nextBlock;
                        }

                        //>>>>> 選択されている駒があるとき

                        Starlight tumandeiruLight = shogiGui.GameViewModel.GuiSkyConst.StarlightIndexOf((int)btnTumandeiruKoma.Finger);


                        //----------
                        // 指したい先
                        //----------
                        Shape_BtnMasuImpl btnSasitaiMasu = null;

                        //----------
                        // 将棋盤:升目   <移動先など>
                        //----------
                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if ("Masu" == widget.Type && Okiba.ShogiBan == widget.Okiba)
                            {
                                if (widget.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))                //>>>>> 指したいマスはここです。
                                {
                                    btnSasitaiMasu = (Shape_BtnMasuImpl)widget.Object;
                                    break;
                                }
                            }
                        }


                        //----------
                        // 駒置き、駒袋:升目
                        //----------
                        foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                        {
                            if ("Masu" == widget.Type && widget.Okiba.HasFlag(Okiba.Sente_Komadai | Okiba.Gote_Komadai | Okiba.KomaBukuro))
                            {
                                Shape_BtnMasuImpl btnSasitaiMasu2 = (Shape_BtnMasuImpl)widget.Object;
                                if (btnSasitaiMasu2.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))                //>>>>> 升目をクリックしたとき
                                {
                                    bool match = false;

                                    shogiGui.GameViewModel.GuiSkyConst.Foreach_Starlights((Finger finger, Starlight ml, ref bool toBreak) =>
                                            {
                                                RO_Star_Koma koma = Util_Koma.AsKoma(ml.Now);

                                                if (koma.Masu == btnSasitaiMasu2.Zahyo)
                                                {
                                                    //>>>>> そこに駒が置いてあった。
#if DEBUG
                                                    // MessageBox.Show("駒が置いてあった","デバッグ中");
#endif
                                                    match   = true;
                                                    toBreak = true;
                                                }
                                            });

                                    if (!match)
                                    {
                                        btnSasitaiMasu = btnSasitaiMasu2;
                                        goto gt_EndKomaoki;
                                    }
                                }
                            }
                        }
gt_EndKomaoki:
                        ;

                        if (null == btnSasitaiMasu)
                        {
                            // 指したいマスなし
                            goto gt_nextBlock;
                        }



                        //指したいマスが選択されたとき

                        // TODO:合法手かどうか判定したい。

                        if (Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(btnSasitaiMasu.Zahyo))                //>>>>> 将棋盤:升目   <移動先など>
                        {
                            //------------------------------
                            // 成る/成らない
                            //------------------------------
                            //
                            //      盤上の、不成の駒で、 / 相手陣に入るものか、相手陣から出てくる駒 ※先手・後手区別なし
                            //
                            RO_Star_Koma koma = Util_Koma.AsKoma(tumandeiruLight.Now);

                            if (
                                Okiba.ShogiBan == Util_Masu.Masu_ToOkiba(koma.Masu) && Util_Sky.IsNareruKoma(tumandeiruLight)
                                &&
                                (
                                    Util_Masu.InAitejin(btnSasitaiMasu.Zahyo, Util_InServer.CurPside(shogiGui))
                                    ||
                                    Util_Sky.InAitejin(tumandeiruLight)
                                )
                                )
                            {
                                // 成るか/成らないか ダイアログボックスを表示します。
                                shogiGui.Shape_PnlTaikyoku.Request_NaruDialogToShow(true);
                            }


                            if (shogiGui.Shape_PnlTaikyoku.Requested_NaruDialogToShow)
                            {
                                // 成る/成らないボタン表示
                                shogiGui.Shape_PnlTaikyoku.GetWidget("BtnNaru").Visible    = true;
                                shogiGui.Shape_PnlTaikyoku.GetWidget("BtnNaranai").Visible = true;
                                shogiGui.Shape_PnlTaikyoku.SetNaruMasu(btnSasitaiMasu);
                                nextPhaseB = SceneName.SceneB_3ErabuNaruNaranai;
                            }
                            else
                            {
                                shogiGui.Shape_PnlTaikyoku.GetWidget("BtnNaru").Visible    = false;
                                shogiGui.Shape_PnlTaikyoku.GetWidget("BtnNaranai").Visible = false;

                                // 駒を動かします。
                                {
                                    // GuiからServerへ渡す情報
                                    PieceType syurui;
                                    Starlight dst;
                                    Util_InGui.Komamove1a_49Gui(out syurui, out dst, btnTumandeiruKoma, btnSasitaiMasu, shogiGui);

                                    // ServerからGuiへ渡す情報
                                    bool         torareruKomaAri;
                                    RO_Star_Koma koma_Food_after;
                                    Util_InServer.Komamove1a_50Srv(out torareruKomaAri, out koma_Food_after, dst, btnTumandeiruKoma.Koma, Util_Koma.AsKoma(dst.Now), shogiGui);

                                    Util_InGui.Komamove1a_51Gui(torareruKomaAri, koma_Food_after, shogiGui);
                                }

                                nextPhaseB = SceneName.SceneB_1TumamitaiKoma;
                            }

                            shogiGui.ResponseData.ToRedraw();
                        }
                        else if ((Okiba.Sente_Komadai | Okiba.Gote_Komadai).HasFlag(
                                     Util_Masu.GetOkiba(btnSasitaiMasu.Zahyo)))       //>>>>> 駒置き:升目
                        {
                            //System.C onsole.WriteLine("駒台上");

                            RO_Star_Koma koma = Util_Koma.AsKoma(shogiGui.GameViewModel.GuiSkyConst.StarlightIndexOf(btnTumandeiruKoma.Koma).Now);

                            SkyBuffer buffer_Sky = new SkyBuffer(shogiGui.GameViewModel.GuiSkyConst);
                            buffer_Sky.AddOverwriteStarlight(btnTumandeiruKoma.Koma, new RO_MotionlessStarlight(
                                                                 //btnTumandeiruKoma.Koma,
                                                                 new RO_Star_Koma(Converter04.Okiba_ToPside(Util_Masu.GetOkiba(btnSasitaiMasu.Zahyo)),// 先手の駒置きに駒を置けば、先手の向きに揃えます。
                                                                                  btnSasitaiMasu.Zahyo,
                                                                                  KomaSyurui14Array.NarazuCaseHandle(Haiyaku184Array.Syurui(koma.Haiyaku)))
                                                                 ));
                            shogiGui.GameViewModel.SetGuiSky(new SkyConst(buffer_Sky));

                            nextPhaseB = SceneName.SceneB_1TumamitaiKoma;

                            shogiGui.ResponseData.RedrawStarlights();                // 駒の再描画要求
                            shogiGui.ResponseData.ToRedraw();
                        }


gt_nextBlock:

                        //----------
                        // 既に選択されている駒
                        //----------
                        Shape_BtnKoma btnKoma_Selected = shogiGui.Shape_PnlTaikyoku.Btn_TumandeiruKoma(shogiGui);



                        //----------
                        // 初期配置ボタン
                        //----------

                        {
                            foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                            {
                                if (widget.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                                {
                                    if (null != widget.Delegate_MouseHitEvent)
                                    {
                                        widget.Delegate_MouseHitEvent(
                                            shogiGui
                                            , btnKoma_Selected
                                            );
                                    }
                                }
                            }
                        }


                        shogiGui.SetScene(nextPhaseB);

                        //------------------------------
                        // このメインパネルの反応
                        //------------------------------
                        shogiGui.Response("MouseOperation");
                        #endregion
                    }
                    break;

                    case MouseEventStateName.MouseRightButtonDown:
                    {
                        #region マウス右ボタンダウン
                        // 各駒の、移動済フラグを解除
                        //System.C onsole.WriteLine("つまんでいる駒を放します。(5)");
                        shogiGui.Shape_PnlTaikyoku.SetFigTumandeiruKoma(-1);
                        shogiGui.Shape_PnlTaikyoku.SelectFirstTouch = false;

                        //------------------------------
                        // 状態を戻します。
                        //------------------------------
                        shogiGui.SetScene(SceneName.SceneB_1TumamitaiKoma);

                        //------------------------------
                        // このメインパネルの反応
                        //------------------------------
                        shogiGui.Response("MouseOperation");
                        #endregion
                    }
                    break;
                    }
                    #endregion
                }
                break;

                case SceneName.SceneB_3ErabuNaruNaranai:
                {
                    #region 成る成らない

                    switch (eventState.Name2)
                    {
                    case MouseEventStateName.MouseLeftButtonDown:
                    {
                        #region マウス左ボタンダウン
                        SceneName nextPhaseB = SceneName.Ignore;
                        //GuiSky この関数の途中で変更される。ローカル変数に入れているものは古くなる。

                        //----------
                        // 既に選択されている駒
                        //----------
                        Shape_BtnKoma btnKoma_Selected = shogiGui.Shape_PnlTaikyoku.Btn_TumandeiruKoma(shogiGui);

                        string[] buttonNames = new string[] {
                            "BtnNaru",            // [成る]ボタン
                            "BtnNaranai"          // [成らない]ボタン
                        };
                        foreach (string buttonName in buttonNames)
                        {
                            UserWidget widget = shogiGui.Shape_PnlTaikyoku.GetWidget(buttonName);

                            if (widget.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                            {
                                if (null != widget.Delegate_MouseHitEvent)
                                {
                                    widget.Delegate_MouseHitEvent(
                                        shogiGui
                                        , btnKoma_Selected
                                        );
                                }
                            }
                        }


                        //



                        //----------
                        // 既に選択されている駒
                        //----------
                        //Shape_BtnKomaImpl btnKoma_Selected = shogiGui.Shape_PnlTaikyoku.Btn_TumandeiruKoma(shogiGui);



                        //----------
                        // 初期配置ボタン
                        //----------

                        {
                            foreach (UserWidget widget in shogiGui.Shape_PnlTaikyoku.Widgets.Values)
                            {
                                if (widget.HitByMouse(eventState.MouseLocation.X, eventState.MouseLocation.Y))
                                {
                                    if (null != widget.Delegate_MouseHitEvent)
                                    {
                                        widget.Delegate_MouseHitEvent(
                                            shogiGui
                                            , btnKoma_Selected
                                            );
                                    }
                                }
                            }
                        }


                        shogiGui.SetScene(nextPhaseB);

                        //------------------------------
                        // このメインパネルの反応
                        //------------------------------
                        shogiGui.Response("MouseOperation");
                        #endregion
                    }
                    break;
                    }
                    #endregion
                }
                break;
                }
            }



            //gt_EndMethod1:
            //    ;
        }
Esempio n. 4
0
        /// <summary>
        /// 駒を動かします(1)。マウスボタンが押下されたとき。
        ///
        /// 成る、成らない関連。
        ///
        /// </summary>
        public static void Komamove1a_50Srv(
            out bool torareruKomaAri,
            out RO_Star_Koma koma_Food_after,
            Starlight dst,
            Finger btnTumandeiruKoma_Koma,
            RO_Star_Koma koma1,
            IRoomViewModel roomViewModel
            )
        {
            Finger btnKoma_Food_Koma;

            torareruKomaAri = false;


            // 取られることになる駒のボタン
            btnKoma_Food_Koma = Util_Sky.Fingers_AtMasuNow(roomViewModel.GameViewModel.GuiSkyConst, koma1.Masu).ToFirst();
            if (Fingers.Error_1 == btnKoma_Food_Koma)
            {
                koma_Food_after   = null;
                btnKoma_Food_Koma = Fingers.Error_1;
                goto gt_EndBlock1;
            }



            //>>>>> 取る駒があったとき
            torareruKomaAri = true;

            PieceType koma_Food_pre_Syurui = Util_Koma.AsKoma(roomViewModel.GameViewModel.GuiSkyConst.StarlightIndexOf(btnKoma_Food_Koma).Now).Syurui;


            // その駒は、駒置き場に移動させます。
            SyElement akiMasu;

            switch (koma1.Pside)
            {
            case Playerside.P2:

                akiMasu = KifuIO.GetKomadaiKomabukuroSpace(Okiba.Gote_Komadai, roomViewModel.GameViewModel.GuiSkyConst);
                if (Masu_Honshogi.Error != akiMasu)
                {
                    // 駒台に空きスペースがありました。
                    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                    koma_Food_after = new RO_Star_Koma(
                        Playerside.P2,
                        akiMasu,    //駒台へ
                        KomaSyurui14Array.NarazuCaseHandle(koma_Food_pre_Syurui)
                        );
                }
                else
                {
                    // エラー: 駒台に空きスペースがありませんでした。
                    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                    koma_Food_after = new RO_Star_Koma(
                        Playerside.P2,
                        Util_Masu.OkibaSujiDanToMasu(
                            Okiba.Gote_Komadai,
                            Util_Koma.CTRL_NOTHING_PROPERTY_SUJI,
                            Util_Koma.CTRL_NOTHING_PROPERTY_DAN
                            ),
                        KomaSyurui14Array.NarazuCaseHandle(koma_Food_pre_Syurui)
                        );
                }

                break;

            case Playerside.P1:    //thru
            default:

                akiMasu = KifuIO.GetKomadaiKomabukuroSpace(Okiba.Sente_Komadai, roomViewModel.GameViewModel.GuiSkyConst);
                if (Masu_Honshogi.Error != akiMasu)
                {
                    // 駒台に空きスペースがありました。
                    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                    koma_Food_after = new RO_Star_Koma(
                        Playerside.P1,
                        akiMasu,    //駒台へ
                        KomaSyurui14Array.NarazuCaseHandle(koma_Food_pre_Syurui)
                        );
                }
                else
                {
                    // エラー: 駒台に空きスペースがありませんでした。
                    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                    koma_Food_after = new RO_Star_Koma(
                        Playerside.P1,
                        Util_Masu.OkibaSujiDanToMasu(
                            Okiba.Sente_Komadai,
                            Util_Koma.CTRL_NOTHING_PROPERTY_SUJI,
                            Util_Koma.CTRL_NOTHING_PROPERTY_DAN
                            ),
                        KomaSyurui14Array.NarazuCaseHandle(koma_Food_pre_Syurui)
                        );
                }

                break;
            }



gt_EndBlock1:


            if (torareruKomaAri)
            {
                {
                    SkyBuffer buffer_Sky1;

                    // 取られる動き
                    buffer_Sky1 = new SkyBuffer(roomViewModel.GameViewModel.GuiSkyConst);
                    buffer_Sky1.AddOverwriteStarlight(
                        btnKoma_Food_Koma,
                        new RO_MotionlessStarlight(
                            //btnKoma_Food_Koma,
                            koma_Food_after
                            )
                        );

                    roomViewModel.GameViewModel.SetGuiSky(new SkyConst(buffer_Sky1));
                    // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
                    // 棋譜は変更された。
                    // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
                }

                //------------------------------
                // 成りは解除。
                //------------------------------
                switch (Util_Masu.GetOkiba(koma_Food_after.Masu))
                {
                case Okiba.Sente_Komadai:    //thru
                case Okiba.Gote_Komadai:
                    // 駒台へ移動しました
                    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                    SkyBuffer buffer_Sky2 = new SkyBuffer(roomViewModel.GameViewModel.GuiSkyConst);
                    buffer_Sky2.AddOverwriteStarlight(
                        btnKoma_Food_Koma,
                        new RO_MotionlessStarlight(
                            //btnKoma_Food_Koma,
                            koma_Food_after
                            )
                        );

                    roomViewModel.GameViewModel.SetGuiSky(new SkyConst(buffer_Sky2));
                    // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
                    // 棋譜は変更された。
                    // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

                    break;
                }
            }

            SkyBuffer buffer_Sky = new SkyBuffer(roomViewModel.GameViewModel.GuiSkyConst);

            buffer_Sky.AddOverwriteStarlight(btnTumandeiruKoma_Koma, dst);
            roomViewModel.GameViewModel.SetGuiSky(new SkyConst(buffer_Sky));
            // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
            // 棋譜は変更された。
            // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="kifu"></param>
        /// <param name="restText"></param>
        /// <param name="startposImporter"></param>
        /// <param name="logTag"></param>
        public static void OnChangeSky_Im_Srv(
            IRoomViewModel roomViewModel,
            StartposImporter startposImporter,
            KifuParserA_Genjo genjo
            )
        {
            // SFENの初期配置の書き方(*1)を元に、駒を並べます。
            //
            //     *1…「position startpos moves 7g7f 3c3d 2g2f」といった書き方。
            //

            //------------------------------
            // 駒の配置
            //------------------------------
            {
                // 先後
                Playerside nextTebanside;
                if (startposImporter.RO_SfenStartpos.PsideIsBlack)
                {
                    // 黒は先手。
                    nextTebanside = Converter04.AlternatePside(Playerside.P1);//FIXME:逆か?
                }
                else
                {
                    // 白は後手。
                    nextTebanside = Converter04.AlternatePside(Playerside.P2);//FIXME:逆か?
                }

                ShootingStarlightable move = Util_Sky.NullObjectMove;//ルートなので

                SkyConst src_Sky_New = startposImporter.ToSky();
                Node <ShootingStarlightable, KyokumenWrapper> newNode =
                    new KifuNodeImpl(
                        move,
                        new KyokumenWrapper(new SkyConst(src_Sky_New)),
                        nextTebanside
                        );

                Util_InServer.SetCurNode_Srv(roomViewModel, newNode);// GUIに通知するだけ。
            }


            //------------------------------
            // 先後
            //------------------------------
            if (startposImporter.RO_SfenStartpos.PsideIsBlack)
            {
                // 黒は先手。
                roomViewModel.GameViewModel.Kifu.SetProperty(KifuTreeImpl.PropName_FirstPside, Converter04.AlternatePside(Playerside.P1));//FIXME:逆か?
            }
            else
            {
                // 白は後手。
                roomViewModel.GameViewModel.Kifu.SetProperty(KifuTreeImpl.PropName_FirstPside, Converter04.AlternatePside(Playerside.P2));//FIXME:逆か?
            }

            // 駒袋に表示されている駒を、駒台に表示させます。
            {
                // 駒袋に表示されている駒を、駒台へ表示されるように移します。
                List <PieceType>  syuruiList = new List <PieceType>();
                List <int>        countList  = new List <int>();
                List <Playerside> psideList  = new List <Playerside>();

                //------------------------------------------------------------------------------------------------------------------------
                // 移動計画作成
                //------------------------------------------------------------------------------------------------------------------------

                //------------------------------
                // ▲王
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1K)
                {
                    syuruiList.Add(PieceType.K);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1K);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mK=" + ro_SfenStartpos.Moti1K);
                }

                //------------------------------
                // ▲飛
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1R)
                {
                    syuruiList.Add(PieceType.R);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1R);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mR=" + ro_SfenStartpos.Moti1R);
                }

                //------------------------------
                // ▲角
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1B)
                {
                    syuruiList.Add(PieceType.B);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1B);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mB=" + ro_SfenStartpos.Moti1B);
                }

                //------------------------------
                // ▲金
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1G)
                {
                    syuruiList.Add(PieceType.G);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1G);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mG=" + ro_SfenStartpos.Moti1G);
                }

                //------------------------------
                // ▲銀
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1S)
                {
                    syuruiList.Add(PieceType.S);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1S);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mS=" + ro_SfenStartpos.Moti1S);
                }

                //------------------------------
                // ▲桂
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1N)
                {
                    syuruiList.Add(PieceType.N);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1N);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mN=" + ro_SfenStartpos.Moti1N);
                }

                //------------------------------
                // ▲香
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1L)
                {
                    syuruiList.Add(PieceType.L);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1L);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mL=" + ro_SfenStartpos.Moti1L);
                }

                //------------------------------
                // ▲歩
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti1P)
                {
                    syuruiList.Add(PieceType.P);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti1P);
                    psideList.Add(Playerside.P1);
                    //System.C onsole.WriteLine("mP=" + ro_SfenStartpos.Moti1P);
                }

                //------------------------------
                // △王
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2k)
                {
                    syuruiList.Add(PieceType.K);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2k);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("mk=" + ro_SfenStartpos.Moti2k);
                }

                //------------------------------
                // △飛
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2r)
                {
                    syuruiList.Add(PieceType.R);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2r);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("mr=" + ro_SfenStartpos.Moti2r);
                }

                //------------------------------
                // △角
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2b)
                {
                    syuruiList.Add(PieceType.B);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2b);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("mb=" + ro_SfenStartpos.Moti2b);
                }

                //------------------------------
                // △金
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2g)
                {
                    syuruiList.Add(PieceType.G);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2g);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("mg=" + ro_SfenStartpos.Moti2g);
                }

                //------------------------------
                // △銀
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2s)
                {
                    syuruiList.Add(PieceType.S);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2s);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("ms=" + ro_SfenStartpos.Moti2s);
                }

                //------------------------------
                // △桂
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2n)
                {
                    syuruiList.Add(PieceType.N);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2n);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("mn=" + ro_SfenStartpos.Moti2n);
                }

                //------------------------------
                // △香
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2l)
                {
                    syuruiList.Add(PieceType.L);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2l);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("ml=" + ro_SfenStartpos.Moti2l);
                }

                //------------------------------
                // △歩
                //------------------------------
                if (0 < startposImporter.RO_SfenStartpos.Moti2p)
                {
                    syuruiList.Add(PieceType.P);
                    countList.Add(startposImporter.RO_SfenStartpos.Moti2p);
                    psideList.Add(Playerside.P2);
                    //System.C onsole.WriteLine("mp=" + ro_SfenStartpos.Moti2p);
                }



                //------------------------------------------------------------------------------------------------------------------------
                // 移動
                //------------------------------------------------------------------------------------------------------------------------
                for (int i = 0; i < syuruiList.Count; i++)
                {
                    Playerside itaruPside; //(至)先後
                    Okiba      itaruOkiba; //(至)置き場

                    if (Playerside.P2 == psideList[i])
                    {
                        // 宛:後手駒台
                        itaruPside = Playerside.P2;
                        itaruOkiba = Okiba.Gote_Komadai;
                    }
                    else
                    {
                        // 宛:先手駒台
                        itaruPside = Playerside.P1;
                        itaruOkiba = Okiba.Sente_Komadai;
                    }


                    //------------------------------
                    // 駒を、駒袋から駒台に移動させます。
                    //------------------------------
                    {
                        SkyBuffer buffer_Sky = new SkyBuffer(roomViewModel.GameViewModel.GuiSkyConst);

                        Fingers komas = Util_Sky.Fingers_ByOkibaSyuruiNow(new SkyConst(buffer_Sky), Okiba.KomaBukuro, syuruiList[i]);
                        int     moved = 1;
                        foreach (Finger koma in komas.Items)
                        {
                            // 駒台の空いている枡
                            SyElement akiMasu = KifuIO.GetKomadaiKomabukuroSpace(itaruOkiba, new SkyConst(buffer_Sky));

                            buffer_Sky.AddOverwriteStarlight(koma, new RO_MotionlessStarlight(
                                                                 //koma,
                                                                 new RO_Star_Koma(
                                                                     itaruPside,
                                                                     akiMasu,
                                                                     syuruiList[i]
                                                                     )));

                            if (countList[i] <= moved)
                            {
                                break;
                            }

                            moved++;
                        }
                        roomViewModel.GameViewModel.SetGuiSky(new SkyConst(buffer_Sky));
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// ************************************************************************************************************************
        /// 将棋盤の上の駒を、全て駒袋に移動します。 [クリアー]
        /// ************************************************************************************************************************
        /// </summary>
        public static void ClearKifu(MainGui_Csharp mainGui, RepaintRequest repaintRequest)
        {
            mainGui.Link_Server.Model_Taikyoku.Kifu.Clear();// 棋譜を空っぽにします。

            SkyBuffer buffer_Sky = new SkyBuffer(mainGui.Model_Manual.GuiSkyConst);

            int figKoma;

            // 先手
            figKoma = (int)Finger_Honshogi.SenteOh;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(/*figKoma,*/ new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro01), PieceType.K))); //先手王
            figKoma = (int)Finger_Honshogi.GoteOh;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro02), PieceType.K)));              //後手王

            figKoma = (int)Finger_Honshogi.Hi1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro03), PieceType.R))); //飛
            figKoma = (int)Finger_Honshogi.Hi2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro04), PieceType.R)));

            figKoma = (int)Finger_Honshogi.Kaku1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro05), PieceType.B))); //角
            figKoma = (int)Finger_Honshogi.Kaku2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro06), PieceType.B)));

            figKoma = (int)Finger_Honshogi.Kin1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro07), PieceType.G))); //金
            figKoma = (int)Finger_Honshogi.Kin2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro08), PieceType.G)));
            figKoma = (int)Finger_Honshogi.Kin3;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro09), PieceType.G)));
            figKoma = (int)Finger_Honshogi.Kin4;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro10), PieceType.G)));

            figKoma = (int)Finger_Honshogi.Gin1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro11), PieceType.S))); //銀
            figKoma = (int)Finger_Honshogi.Gin2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro12), PieceType.S)));
            figKoma = (int)Finger_Honshogi.Gin3;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro13), PieceType.S)));
            figKoma = (int)Finger_Honshogi.Gin4;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro14), PieceType.S)));

            figKoma = (int)Finger_Honshogi.Kei1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro15), PieceType.N))); //桂
            figKoma = (int)Finger_Honshogi.Kei2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro16), PieceType.N)));
            figKoma = (int)Finger_Honshogi.Kei3;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro17), PieceType.N)));
            figKoma = (int)Finger_Honshogi.Kei4;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro18), PieceType.N)));

            figKoma = (int)Finger_Honshogi.Kyo1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro19), PieceType.L))); //香
            figKoma = (int)Finger_Honshogi.Kyo2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro20), PieceType.L)));
            figKoma = (int)Finger_Honshogi.Kyo3;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro21), PieceType.L)));
            figKoma = (int)Finger_Honshogi.Kyo4;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro22), PieceType.L)));

            figKoma = (int)Finger_Honshogi.Fu1;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro23), PieceType.P))); //歩
            figKoma = (int)Finger_Honshogi.Fu2;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro24), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu3;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro25), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu4;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro26), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu5;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro27), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu6;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro28), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu7;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro29), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu8;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro30), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu9;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro31), PieceType.P)));

            figKoma = (int)Finger_Honshogi.Fu10;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro32), PieceType.P))); //歩
            figKoma = (int)Finger_Honshogi.Fu11;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro33), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu12;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro34), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu13;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro35), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu14;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro36), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu15;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro37), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu16;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro38), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu17;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro39), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu18;
            buffer_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro40), PieceType.P)));


            {
                KifuNode newNode = new KifuNodeImpl(
                    Util_Sky258A.RootMove,        //ルートなので
                    new KyokumenWrapper(SkyConst.NewInstance(
                                            buffer_Sky,
                                            0//空っぽに戻すので、 0手済みに変更。
                                            ))
                    );

                string jsaFugoStr;
                Util_Functions_Server.SetCurNode_Srv(
                    mainGui.Link_Server.Model_Taikyoku,
                    mainGui.Model_Manual,
                    newNode,
                    out jsaFugoStr);
                repaintRequest.SetFlag_RefreshRequest();

                mainGui.Link_Server.Model_Taikyoku.Kifu.SetProperty(Word_KifuTree.PropName_Startpos, "9/9/9/9/9/9/9/9/9 b K1R1B1G2S2N2L2P9 k1r1b1g2s2n2l2p9 1");
            }
        }