Пример #1
0
        private void RestartGameWithSetupAsked(Kv kv)
        {
            Ap.Game.Pause();

            int moveID = kv.GetInt32("MoveID");
            int wMin   = kv.GetInt32("WhiteMin");
            int wSec   = kv.GetInt32("WhiteSec");
            int bMin   = kv.GetInt32("BlackMin");
            int bSec   = kv.GetInt32("BlackSec");

            DialogResult dr = SetupMatch.Show(this.ParentForm, moveID, base.Game.DbGame.TournamentMatchID, kv.GetInt32("SenderUserID"), kv.GetInt32("ReceiverUserID"), wMin, wSec, bMin, bSec, false);

            ResetGameE reset = ResetGameE.Decline;

            if (dr == DialogResult.OK)
            {
                reset = ResetGameE.Accepted;
            }

            SocketClient.RestartGameWithSetup(reset, base.Game.DbGame.GameID, moveID, kv.GetInt32("SenderUserID"), base.Game.DbGame.OpponentUserID, wMin, wSec, bMin, bSec, false);

            if (reset == ResetGameE.Decline)
            {
                Ap.Game.Resume();
            }
        }
Пример #2
0
        private void ResetGameAsked(Kv kv)
        {
            Ap.Game.Pause();
            ResetGameE reset = ResetGameE.Decline;

            if (MessageForm.Confirm(this, MsgE.ConfirmRestartTournamentMatch) == DialogResult.Yes)
            {
                reset = ResetGameE.Accepted;
            }
            else
            {
                Ap.Game.Resume();
            }

            SocketClient.RestartGame(kv.GetInt32("TournamentID"), kv.Get("MatchIDs"), kv.GetInt32("TournamentDirectorID"), kv.GetInt32("SenderUserID"), kv.GetInt32("ReceiverUserID"), reset, kv.GetBool("IsResetFromLastMove"), kv.Get("GameXml"));
        }
Пример #3
0
        public static void RestartGameWithSetup(ResetGameE methodID, int gameID, int moveID, int senderUserID, int receiverUserID,
                                                int wMin, int wSec, int bMin, int bSec, bool isTournamentDirector)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.RestartGameWithSetup);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("ResetGame", (int)methodID);
            kv.Set("GameID", gameID);
            kv.Set("MoveID", moveID);
            kv.Set("SenderUserID", senderUserID);
            kv.Set("ReceiverUserID", receiverUserID);
            kv.Set("WhiteMin", wMin);
            kv.Set("WhiteSec", wSec);
            kv.Set("BlackMin", bMin);
            kv.Set("BlackSec", bSec);
            kv.Set("IsTournamentDirector", isTournamentDirector);

            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
Пример #4
0
        private void RestartGameWithSetup(Kv kv)
        {
            ResetGameE reset = (ResetGameE)kv.GetInt32("ResetGame");

            switch (reset)
            {
            case ResetGameE.Asked:
                RestartGameWithSetupAsked(kv);
                break;

            case ResetGameE.Accepted:
                RestartGameWithSetupAccepted(kv);
                break;

            case ResetGameE.Decline:
                RestartGameWithSetupDecline(kv);
                break;

            case ResetGameE.ResetAsked:
                RestartGameWithSetupResetAsked(kv);
                break;
            }
        }
Пример #5
0
        private void RestartGame(Kv kv)
        {
            ResetGameE resetGame = (ResetGameE)kv.GetInt32("ResetGame");

            switch (resetGame)
            {
            case ResetGameE.Asked:
                ResetGameAsked(kv);
                break;

            case ResetGameE.Accepted:
                ResetGameAccepted(kv);
                break;

            case ResetGameE.Decline:
                ResetGameDecline();
                break;

            case ResetGameE.ResetAsked:
                RestartGameResetAsked(kv);
                break;
            }
        }
        public static void RestartGame(int tournamentID, string matchIDs, int tournamentDirectorID, int senderUserID, int receiverUserID, ResetGameE resetGameID, bool isResetFromLastMove, string gameXml)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.RestartGame);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("TournamentDirectorID", tournamentDirectorID);
            kv.Set("TournamentID", tournamentID);
            kv.Set("MatchIDs", matchIDs);
            kv.Set("SenderUserID", senderUserID);
            kv.Set("ReceiverUserID", receiverUserID);
            kv.Set("ResetGame", (int)resetGameID);
            kv.Set("IsResetFromLastMove", isResetFromLastMove);
            kv.Set("GameXml", gameXml);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }