Ejemplo n.º 1
0
 private static void Wait()
 {
     while (!Card.Client.ClientRequest.IsGameStart(game.GameId.ToString(GameServer.GameIdFormat)))
     {
         Thread.Sleep(3000);
     }
     game.IsFirst = Card.Client.ClientRequest.IsFirst(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost);
     game.Init();
     var t = new BattleField();
     t.game = game;
     t.ShowDialog();
 }
Ejemplo n.º 2
0
        private static void Wait()
        {
            while (!Card.Client.ClientRequest.IsGameStart(game.GameId.ToString(GameServer.GameIdFormat)))
            {
                Thread.Sleep(3000);
            }
            game.IsFirst = Card.Client.ClientRequest.IsFirst(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost);
            game.Init();
            var t = new BattleField();

            t.game = game;
            t.ShowDialog();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnJoinGame_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtServerIP.Text)) ClientUtlity.strIP = txtServerIP.Text;
            if (!String.IsNullOrEmpty(txtNickName.Text)) game.PlayerNickName = txtNickName.Text;

            game.IsHost = false;
            if (lstWaitGuest.SelectedItems.Count != 1) return;
            var strWait = lstWaitGuest.SelectedItem.ToString();
            Card.CardUtility.Init(txtCardPath.Text);
            String GameId = Card.Server.ClientUtlity.JoinGame(int.Parse(strWait.Substring(0, strWait.IndexOf("("))), game.PlayerNickName);
            game.GameId = int.Parse(GameId);
            game.IsFirst = Card.Server.ClientUtlity.IsFirst(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost);
            game.Init();
            var t = new BattleField();
            t.game = game;
            t.ShowDialog();
            this.Close();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 开始游戏的请求
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreateGame_Click(object sender, EventArgs e)
        {
            //新建游戏的时候,已经决定游戏的先后手
            if (!String.IsNullOrEmpty(txtServerIP.Text)) ClientUtlity.strIP = txtServerIP.Text;
            if (!String.IsNullOrEmpty(txtNickName.Text)) game.PlayerNickName = txtNickName.Text;

            game.IsHost = true;
            String GameId = Card.Server.ClientUtlity.CreateGame(game.PlayerNickName);
            Card.CardUtility.Init(txtCardPath.Text);
            game.GameId = int.Parse(GameId);
            btnJoinGame.Enabled = false;
            btnRefresh.Enabled = false;
            btnCreateGame.Enabled = false;
            while (!Card.Server.ClientUtlity.IsGameStart(GameId))
            {
                Thread.Sleep(3000);
            }
            game.IsFirst = Card.Server.ClientUtlity.IsFirst(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost);
            game.Init();
            var t = new BattleField();
            t.game = game;
            t.ShowDialog();
            this.Close();
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnJoinGame_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtServerIP.Text))
            {
                ClientRequest.strIP = txtServerIP.Text;
            }
            if (!String.IsNullOrEmpty(txtNickName.Text))
            {
                game.PlayerNickName = txtNickName.Text;
            }
            if (String.IsNullOrEmpty(cmbCardDeck.Text))
            {
                MessageBox.Show("请选择套牌");
                return;
            }
            game.IsHost = false;
            if (lstWaitGuest.SelectedItems.Count != 1)
            {
                return;
            }
            var strWait = lstWaitGuest.SelectedItem.ToString();

            Card.CardUtility.Init(txtCardPath.Text);
            String GameId   = Card.Client.ClientRequest.JoinGame(int.Parse(strWait.Substring(0, strWait.IndexOf("("))), game.PlayerNickName);
            var    CardList = GetCardDeckList();

            Card.Client.ClientRequest.SendDeck(int.Parse(GameId), game.IsHost, CardList);
            game.GameId  = int.Parse(GameId);
            game.IsFirst = Card.Client.ClientRequest.IsFirst(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost);
            game.Init();
            var t = new BattleField();

            t.game = game;
            t.ShowDialog();
            this.Close();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnJoinGame_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtServerIP.Text)) ClientRequest.strIP = txtServerIP.Text;
     if (!String.IsNullOrEmpty(txtNickName.Text)) game.PlayerNickName = txtNickName.Text;
     if (String.IsNullOrEmpty(cmbCardDeck.Text))
     {
         MessageBox.Show("请选择套牌");
         return;
     }
     game.IsHost = false;
     if (lstWaitGuest.SelectedItems.Count != 1) return;
     var strWait = lstWaitGuest.SelectedItem.ToString();
     Engine.Utility.CardUtility.Init(txtCardPath.Text);
     String GameId = Engine.Client.ClientRequest.JoinGame(int.Parse(strWait.Substring(0, strWait.IndexOf("("))), game.PlayerNickName);
     var CardList = GetCardDeckList();
     Engine.Client.ClientRequest.SendDeck(int.Parse(GameId), game.IsHost, CardList);
     game.GameId = int.Parse(GameId);
     game.IsFirst = Engine.Client.ClientRequest.IsFirst(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost);
     game.Init();
     var t = new BattleField();
     t.game = game;
     t.ShowDialog();
     this.Close();
 }