コード例 #1
0
ファイル: MainForm.cs プロジェクト: sompobcmu/eiei
        private void BtnJoin_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = CommandEnum.JoinGame;
            controller.ActionPerformed(wcmd);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: sompobcmu/eiei
        private void OnTimerEvent(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = CommandEnum.RequestUpdate;
            controller.ActionPerformed(wcmd);
        }
コード例 #3
0
        private void BtnLogout_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = CommandEnum.SignOut;
            controller.ActionPerformed(wcmd);
        }
コード例 #4
0
        private void sound_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = WerewolfCommand.CommandEnum.SoundBackground;
            controller.ActionPerformed(wcmd);
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Login           login = (Login)constuctlogin;
            WerewolfCommand wcmd  = new WerewolfCommand();

            wcmd.Action   = CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", login.GetServer() }
            };
            controller.ActionPerformed(wcmd);

            login.Show();
            this.Hide();
            BtnJoin.Show();
            LogoutPanel.Visible    = false;
            this.BackColor         = Color.Gainsboro;
            GBPlayers.ForeColor    = Color.Black;
            GBChat.ForeColor       = Color.Black;
            GBAction.ForeColor     = Color.Black;
            GBStatus.ForeColor     = Color.Black;
            BtnManuLoout.ForeColor = Color.Black;
            if (soundstop2.Visible == true)
            {
                soundstop.Visible = true;
            }
            else
            {
                soundplayloop.Visible = true;
                soundstop.Visible     = false;
            }
            soundstop2.Visible     = false;
            soundplayloop2.Visible = false;
        }
コード例 #6
0
ファイル: Game.cs プロジェクト: bombbae1234/WerewolfClient
        private void btnLeave_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Leave the game?", "Quit", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly);

            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = WerewolfCommand.CommandEnum.CancelJoin;
            controller.ActionPerformed(wcmd);
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: mrkwskiti/WerewolfClient
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = CommandEnum.SignOut;
            controller.ActionPerformed(wcmd);

            Environment.Exit(0);
        }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: TimingKidz/WerewolfClient
        private void BtnJoin_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = CommandEnum.JoinGame;
            controller.ActionPerformed(wcmd);
            GBChat.Visible = true;
            //TbChatBox.Visible = true;
            //textBox2.Visible = true;
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: sompobcmu/eiei
        private void btnStatus_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = WerewolfCommand.CommandEnum.test;
            //controller.ActionPerformed(wcmd);
            string name = controller.Dis();

            AddChatMessage(name);
        }
コード例 #10
0
ファイル: Login.cs プロジェクト: samehot66/WerewolfClient
        private void BtnSignUp_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignUp;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Login", TbLogin.Text }, { "Password", TbPassword.Text }, { "Server", TBServer.Text }
            };
            controller.ActionPerformed(wcmd);
        }
コード例 #11
0
        private void signout_Click(object sender, EventArgs e)
        {
            Login           login = (Login)_loginForm;
            WerewolfCommand wcmd  = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", login.server }
            };
            controller.ActionPerformed(wcmd);
        }
コード例 #12
0
ファイル: MainForm.cs プロジェクト: AphisitKh/WerewolfClient
        private void BtnNewGame_Click(object sender, EventArgs e)
        {
            Login           login = (Login)_loginForm;
            WerewolfCommand wcmd  = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", "http://localhost:2343/werewolf/" }
            };
            controller.ActionPerformed(wcmd);
        }
コード例 #13
0
ファイル: Main.cs プロジェクト: bombbae1234/WerewolfClient
        private void btnLogoff_Click(object sender, EventArgs e)
        {
            if (_isMM)
            {
                btnMM_Click(sender, e);
            }

            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action = WerewolfCommand.CommandEnum.SignOut;
            controller.ActionPerformed(wcmd);
        }
コード例 #14
0
ファイル: MainForm.cs プロジェクト: PoomMi/werewoft
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Login           loginForm = (Login)_loginForm;
            WerewolfCommand wcmd      = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", loginForm.GetServer() }
            };
            controller.ActionPerformed(wcmd);
        }
コード例 #15
0
ファイル: MainForm.cs プロジェクト: sompobcmu/eiei
        private void btnLogout_Click(object sender, EventArgs e)
        {
            Login           server = (Login)formlogin;
            WerewolfCommand wcmd   = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", server.tmp }
            };
            controller.ActionPerformed(wcmd);
        }
コード例 #16
0
ファイル: Login.cs プロジェクト: tomta555/WerewolfClient
 private void Password_Enter(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return)
     {
         WerewolfCommand wcmd = new WerewolfCommand();
         wcmd.Action   = WerewolfCommand.CommandEnum.SignIn;
         wcmd.Payloads = new Dictionary <string, string>()
         {
             { "Login", TbLogin.Text }, { "Password", TbPassword.Text }, { "Server", TBServer.Text }
         };
         controller.ActionPerformed(wcmd);
     }
 }
コード例 #17
0
ファイル: MainForm.cs プロジェクト: booklets2541/Werewolf
        private void btnLogout_Click(object sender, EventArgs e)
        {
            Login           server = (Login)formlogin;
            WerewolfCommand wcmd   = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", server.tmp }
            };
            MessageBox.Show("LOGOUT", "Signout", MessageBoxButtons.OK, MessageBoxIcon.Question);
            controller.ActionPerformed(wcmd);
        }
コード例 #18
0
ファイル: MainForm.cs プロジェクト: AphisitKh/WerewolfClient
        private void BtnPlayerX_Click(object sender, EventArgs e)
        {
            Button btnPlayer = (Button)sender;
            int    index     = (int)btnPlayer.Tag;

            if (players == null)
            {
                // Nothing to do here;
                return;
            }
            if (_actionActivated)
            {
                try
                {
                    _actionActivated    = false;
                    BtnAction.BackColor = Button.DefaultBackColor;
                    AddChatMessage("You perform [" + BtnAction.Text + "] on " + players[index].Name);
                    WerewolfCommand wcmd = new WerewolfCommand();
                    wcmd.Action   = CommandEnum.Action;
                    wcmd.Payloads = new Dictionary <string, string>()
                    {
                        { "Target", players[index].Id.ToString() }
                    };
                    controller.ActionPerformed(wcmd);
                }
                catch (Exception error)
                {
                    MessageBox.Show("not found your target.");
                }
            }
            if (_voteActivated)
            {
                try
                {
                    _voteActivated    = false;
                    BtnVote.BackColor = Button.DefaultBackColor;
                    AddChatMessage("You vote on " + players[index].Name);
                    WerewolfCommand wcmd = new WerewolfCommand();
                    wcmd.Action   = CommandEnum.Vote;
                    wcmd.Payloads = new Dictionary <string, string>()
                    {
                        { "Target", players[index].Id.ToString() }
                    };
                    controller.ActionPerformed(wcmd);
                }
                catch (Exception error)
                {
                    MessageBox.Show("not found your target.");
                }
            }
        }
コード例 #19
0
        private void Emo_Click(object sender, EventArgs e)
        {
            TbChatInput.Text += ((Button)sender).Text;
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action   = CommandEnum.Chat;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Message", TbChatInput.Text }
            };
            TbChatInput.Text = "";
            controller.ActionPerformed(wcmd);
            Emo_hide();
        }
コード例 #20
0
ファイル: Login.cs プロジェクト: Faikavi/Werewolf
        private void BtnSignUp_Click(object sender, EventArgs e)
        {
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignUp;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Login", TbLogin.Text }, { "Password", TbPassword.Text }, { "Server", TBServer.Text }
            };
            controller.ActionPerformed(wcmd);
            player.controls.stop();
            player1.URL = "G Minor - (arranged by Luo Ni Piano Tiles 2).mp3";
            player1.controls.play();
        }
コード例 #21
0
ファイル: MainForm.cs プロジェクト: sompobcmu/eiei
 private void TbChatInput_Enter(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return && TbChatInput.Text != "")
     {
         WerewolfCommand wcmd = new WerewolfCommand();
         wcmd.Action   = CommandEnum.Chat;
         wcmd.Payloads = new Dictionary <string, string>()
         {
             { "Message", TbChatInput.Text }
         };
         TbChatInput.Text = "";
         controller.ActionPerformed(wcmd);
     }
 }
コード例 #22
0
        public override void ActionPerformed(Command cmd)
        {
            foreach (Model m in mList)
            {
                if (m is WerewolfModel && cmd is WerewolfCommand)
                {
                    WerewolfCommand wcmd = (WerewolfCommand)cmd;
                    WerewolfModel   wm   = (WerewolfModel)m;
                    switch (wcmd.Action)
                    {
                    case WerewolfCommand.CommandEnum.SignUp:
                        wm.SignUp(cmd.Payloads["Server"], cmd.Payloads["Login"], cmd.Payloads["Password"]);
                        break;

                    case WerewolfCommand.CommandEnum.SignIn:
                        wm.SignIn(cmd.Payloads["Server"], cmd.Payloads["Login"], cmd.Payloads["Password"]);
                        break;

                    case WerewolfCommand.CommandEnum.SignOut:
                        wm.SignOut();
                        break;

                    case WerewolfCommand.CommandEnum.JoinGame:
                        wm.JoinGame();
                        break;

                    case WerewolfCommand.CommandEnum.CancelJoin:
                        wm.CancelJoin();
                        break;

                    case WerewolfCommand.CommandEnum.RequestUpdate:
                        wm.Update();
                        break;

                    case WerewolfCommand.CommandEnum.Vote:
                        wm.Vote(cmd.Payloads["Target"]);
                        break;

                    case WerewolfCommand.CommandEnum.Action:
                        wm.Action(cmd.Payloads["Target"]);
                        break;

                    case WerewolfCommand.CommandEnum.Chat:
                        wm.Chat(cmd.Payloads["Message"]);
                        break;
                    }
                }
            }
        }
コード例 #23
0
        private void BtnSignIn_Click(object sender, EventArgs e)
        {
            if (TbLogin.Text == "" || TbPassword.Text == "")
            {
                MessageBox.Show("Login or password incorrect, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            WerewolfCommand wcmd = new WerewolfCommand();

            wcmd.Action   = WerewolfCommand.CommandEnum.SignIn;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Login", TbLogin.Text }, { "Password", TbPassword.Text }, { "Server", TBServer.Text }
            };
            controller.ActionPerformed(wcmd);
        }
コード例 #24
0
ファイル: Login.cs プロジェクト: bombbae1234/WerewolfClient
 private void BtnSignUp_Click(object sender, EventArgs e)
 {
     if (TbLogin.Text.Equals("") || TbPassword.Text.Equals(""))
     {
         MessageBox.Show("Please input username and/or password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         WerewolfCommand wcmd = new WerewolfCommand();
         wcmd.Action   = WerewolfCommand.CommandEnum.SignUp;
         wcmd.Payloads = new Dictionary <string, string>()
         {
             { "Login", TbLogin.Text }, { "Password", TbPassword.Text }, { "Server", (cbServerlist.SelectedItem as dynamic).Value }
         };
         controller.ActionPerformed(wcmd);
     }
 }
コード例 #25
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox3.Text == textBox2.Text)
     {
         WerewolfController c    = WerewolfController.GetInstance();
         WerewolfCommand    wcmd = new WerewolfCommand();
         wcmd.Action   = WerewolfCommand.CommandEnum.SignUp;
         wcmd.Payloads = new Dictionary <string, string>()
         {
             { "Login", textBox1.Text }, { "Password", textBox2.Text }, { "Server", TBServer.Text }
         };
         c.ActionPerformed(wcmd);
     }
     else
     {
         MessageBox.Show("Please make sure your passwords match.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
コード例 #26
0
        /// <summary>
        /// use for select to vote or action player on recEngine_SpeechRecognized()
        /// </summary>
        /// <param name="i">number of player 0-15 </param>
        private void voteAndActionForVoiceChat(int i)
        {
            WerewolfCommand wcmd  = new WerewolfCommand();
            int             index = (int)Controls["GBPlayers"].Controls["BtnPlayer" + i].Tag;

            if (_actionActivated)
            {
                try
                {
                    _actionActivated    = false;
                    BtnAction.BackColor = Button.DefaultBackColor;
                    AddChatMessage("You perform [" + BtnAction.Text + "] on " + players[index].Name);
                    wcmd.Action   = CommandEnum.Action;
                    wcmd.Payloads = new Dictionary <string, string>()
                    {
                        { "Target", players[index].Id.ToString() }
                    };
                    controller.ActionPerformed(wcmd);
                }
                catch (Exception ex)
                {
                    AddChatMessage("You can't kill on player" + i);
                }
            }
            if (_voteActivated)
            {
                _voteActivated    = false;
                BtnVote.BackColor = Button.DefaultBackColor;
                try
                {
                    AddChatMessage("You vote on " + players[index].Name);
                    wcmd.Action   = CommandEnum.Vote;
                    wcmd.Payloads = new Dictionary <string, string>()
                    {
                        { "Target", players[index].Id.ToString() }
                    };
                    controller.ActionPerformed(wcmd);
                }
                catch (Exception ex)
                {
                    AddChatMessage("You can't vote on player" + i);
                }
            }
        }
コード例 #27
0
ファイル: Main.cs プロジェクト: bombbae1234/WerewolfClient
        private void btnMM_Click(object sender, EventArgs e)
        {
            _MMTimer = new Timer();

            if (!_isMM)
            {
                WerewolfCommand wcmd = new WerewolfCommand();
                wcmd.Action = WerewolfCommand.CommandEnum.JoinGame;
                controller.ActionPerformed(wcmd);
            }
            else
            {
                WerewolfCommand wcmd = new WerewolfCommand();
                wcmd.Action = WerewolfCommand.CommandEnum.CancelJoin;
                controller.ActionPerformed(wcmd);

                _isMM = false;
                _MMTimer.Dispose();
            }
        }
コード例 #28
0
 /// <summary>
 /// Use of chat on voice chat and it are used in recEngine_SpeechRecognized()
 /// </summary>
 /// <param name="role">role of who you think that</param>
 /// <param name="i">player</param>
 private void IThink_voiceChat(string role, int i)
 {
     if (_voiceChatActivated)
     {
         try
         {
             WerewolfCommand wcmd = new WerewolfCommand();
             wcmd.Action   = CommandEnum.Chat;
             wcmd.Payloads = new Dictionary <string, string>()
             {
                 { "Message", "I think " + players[i].Name + " is " + role }
             };
             controller.ActionPerformed(wcmd);
         }
         catch (Exception ex)
         {
             AddChatMessage("You can't think on player" + i);
         }
     }
 }
コード例 #29
0
        /* private void button4_Click(object sender, EventArgs e)
         * {
         *   Login login = (Login)constuctlogin;
         *   WerewolfCommand wcmd = new WerewolfCommand();
         *   wcmd.Action = CommandEnum.SignOut;
         *   wcmd.Payloads = new Dictionary<string, string>() { { "Server", login.GetServer() } };
         *   controller.ActionPerformed(wcmd);
         *   //player.controls.stop();
         *   login.Show();
         *   this.Hide();
         *   BtnJoin.Show();
         *   panel1.Visible = false;
         *   this.BackColor = Color.Gainsboro;
         *   GBPlayers.ForeColor = Color.Black;
         *   GBChat.ForeColor = Color.Black;
         *   GBAction.ForeColor = Color.Black;
         *   GBStatus.ForeColor = Color.Black;
         *   label3.ForeColor = Color.Black;
         * }*/


        /*private void TbChatBox_TextChanged(object sender, EventArgs e)
         * {
         *  _MouseDown = true;
         *  if (_MouseDown)
         *  {
         *      GBChat.Size = new Size(325, 370);
         *      GBChat.Location = new Point(20, 30);
         *
         *      TbChatBox.Location = new Point(19, 23);
         *      TbChatBox.Size = new Size(284, 299);
         *
         *      TbChatInput.Location = new Point(19, 325);
         *  }
         *  else
         *
         * }*/

        private void button1_Click_1(object sender, EventArgs e)
        {
            Login           login = (Login)constuctlogin;
            WerewolfCommand wcmd  = new WerewolfCommand();

            wcmd.Action   = CommandEnum.SignOut;
            wcmd.Payloads = new Dictionary <string, string>()
            {
                { "Server", login.GetServer() }
            };
            controller.ActionPerformed(wcmd);
            //player.controls.stop();
            login.Show();
            this.Hide();
            BtnJoin.Show();
            panel1.Visible      = false;
            this.BackColor      = Color.Gainsboro;
            GBPlayers.ForeColor = Color.Black;
            GBChat.ForeColor    = Color.Black;
            GBAction.ForeColor  = Color.Black;
            GBStatus.ForeColor  = Color.Black;
            label3.ForeColor    = Color.Black;
        }
コード例 #30
0
ファイル: GameForm.cs プロジェクト: tomta555/WerewolfClient
        public void Notify(Model m)
        {
            if (m is WerewolfModel)
            {
                WerewolfModel wm = (WerewolfModel)m;
                switch (wm.Event)
                {
                case EventEnum.SignOut:
                    foreach (int i in Enumerable.Range(0, 16))
                    {
                        this.Controls["panel1"].Controls["BtnPlayer" + i].Click += new System.EventHandler(this.BtnPlayerX_Click);
                        this.Controls["panel1"].Controls["BtnPlayer" + i].Tag    = i;
                    }

                    this.SystemOutBox.Visible = false;
                    this.TbChatBox.Visible    = false;
                    this.TbChatInput.Visible  = false;
                    this.LBDay.Visible        = false;
                    this.LBPeriod.Visible     = false;
                    this.LBTime.Visible       = false;
                    this.label1.Visible       = false;
                    this.label2.Visible       = false;

                    _updateTimer     = new Timer();
                    _voteActivated   = false;
                    _actionActivated = false;
                    _myRole          = null;
                    _isDead          = false;

                    StartSetup();

                    EnableButton(BtnJoin, true);
                    EnableButton(BtnViewRole, true);
                    EnableButton(BtnAction, false);
                    EnableButton(BtnVote, false);
                    EnableButton(BtnLeave, false);
                    EnableButton(BtnSignOut, false);

                    SystemOutBox.Text = "";

                    this.Visible = false;


                    break;

                case EventEnum.LeaveGame:
                    foreach (int i in Enumerable.Range(0, 16))
                    {
                        this.Controls["panel1"].Controls["BtnPlayer" + i].Click += new System.EventHandler(this.BtnPlayerX_Click);
                        this.Controls["panel1"].Controls["BtnPlayer" + i].Tag    = i;
                    }

                    this.SystemOutBox.Visible = false;
                    this.TbChatBox.Visible    = false;
                    this.TbChatInput.Visible  = false;
                    this.LBDay.Visible        = false;
                    this.LBPeriod.Visible     = false;
                    this.LBTime.Visible       = false;
                    this.label1.Visible       = false;
                    this.label2.Visible       = false;

                    _updateTimer     = new Timer();
                    _voteActivated   = false;
                    _actionActivated = false;
                    _myRole          = null;
                    _isDead          = false;
                    StartSetup();
                    EnableButton(BtnJoin, true);
                    EnableButton(BtnViewRole, true);
                    EnableButton(BtnAction, false);
                    EnableButton(BtnVote, false);
                    EnableButton(BtnLeave, false);
                    EnableButton(BtnSignOut, false);
                    SystemOutBox.Text = "";
                    break;

                case EventEnum.JoinGame:
                    if (wm.EventPayloads["Success"] == WerewolfModel.TRUE)
                    {
                        BtnJoin.Visible = false;
                        //AddChatMessage("You're joining the game #" + wm.EventPayloads["Game.Id"] + ", please wait for game start.");
                        AddSystemMessage("You're joining the game #" + wm.EventPayloads["Game.Id"] + ", please wait for game start.");
                        _updateTimer.Interval = 1000;
                        _updateTimer.Tick    += new EventHandler(OnTimerEvent);
                        _updateTimer.Enabled  = true;

                        foreach (int i in Enumerable.Range(0, 16))
                        {
                            ButtonVisible((Button)Controls["panel1"].Controls["BtnPlayer" + i], true);
                        }

                        this.SystemOutBox.Visible = true;
                        this.TbChatBox.Visible    = true;
                        this.TbChatInput.Visible  = true;
                        this.LBDay.Visible        = true;
                        this.LBPeriod.Visible     = true;
                        this.LBTime.Visible       = true;
                        this.label1.Visible       = true;
                        this.label2.Visible       = true;
                        EnableButton(BtnLeave, true);
                        EnableButton(BtnSignOut, true);
                        EnableButton(BtnViewRole, false);
                    }
                    else
                    {
                        MessageBox.Show("You can't join the game, please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    break;

                case EventEnum.GameStopped:
                    //AddChatMessage("Game is finished, outcome is " + wm.EventPayloads["Game.Outcome"]);
                    AddSystemMessage("Game is finished, outcome is " + wm.EventPayloads["Game.Outcome"]);
                    _updateTimer.Enabled = false;
                    break;

                case EventEnum.GameStarted:
                    players = wm.Players;
                    _myRole = wm.EventPayloads["Player.Role.Name"];
                    //AddChatMessage("Your role is " + _myRole + ".");
                    AddSystemMessage("Your role is " + _myRole + ".");
                    _currentPeriod = Game.PeriodEnum.Night;
                    EnableButton(BtnAction, true);
                    switch (_myRole)
                    {
                    case WerewolfModel.ROLE_PRIEST:
                        BtnAction.Text = WerewolfModel.ACTION_HOLYWATER;
                        break;

                    case WerewolfModel.ROLE_GUNNER:
                        BtnAction.Text = WerewolfModel.ACTION_SHOOT;
                        break;

                    case WerewolfModel.ROLE_JAILER:
                        BtnAction.Text = WerewolfModel.ACTION_JAIL;
                        break;

                    case WerewolfModel.ROLE_WEREWOLF_SHAMAN:
                        BtnAction.Text = WerewolfModel.ACTION_ENCHANT;
                        break;

                    case WerewolfModel.ROLE_BODYGUARD:
                        BtnAction.Text = WerewolfModel.ACTION_GUARD;
                        break;

                    case WerewolfModel.ROLE_DOCTOR:
                        BtnAction.Text = WerewolfModel.ACTION_HEAL;
                        break;

                    case WerewolfModel.ROLE_SERIAL_KILLER:
                        BtnAction.Text = WerewolfModel.ACTION_KILL;
                        break;

                    case WerewolfModel.ROLE_SEER:
                    case WerewolfModel.ROLE_WEREWOLF_SEER:
                        BtnAction.Text = WerewolfModel.ACTION_REVEAL;
                        break;

                    case WerewolfModel.ROLE_AURA_SEER:
                        BtnAction.Text = WerewolfModel.ACTION_AURA;
                        break;

                    case WerewolfModel.ROLE_MEDIUM:
                        BtnAction.Text = WerewolfModel.ACTION_REVIVE;
                        break;

                    default:
                        EnableButton(BtnAction, false);
                        break;
                    }
                    EnableButton(BtnVote, true);
                    EnableButton(BtnJoin, false);
                    EnableButton(BtnViewRole, false);
                    UpdateAvatar(wm);
                    break;

                case EventEnum.SwitchToDayTime:
                    //AddChatMessage("Switch to day time of day #" + wm.EventPayloads["Game.Current.Day"] + ".");
                    AddSystemMessage("Switch to day time of day #" + wm.EventPayloads["Game.Current.Day"] + ".");
                    _currentPeriod = Game.PeriodEnum.Day;
                    LBPeriod.Text  = "Day time";
                    break;

                case EventEnum.SwitchToNightTime:
                    //AddChatMessage("Switch to night time of day #" + wm.EventPayloads["Game.Current.Day"] + ".");
                    AddSystemMessage("Switch to night time of day #" + wm.EventPayloads["Game.Current.Day"] + ".");
                    _currentPeriod = Game.PeriodEnum.Night;
                    LBPeriod.Text  = "Night time";
                    break;

                case EventEnum.UpdateDay:
                    // TODO  catch parse exception here
                    string tempDay = wm.EventPayloads["Game.Current.Day"];
                    _currentDay = int.Parse(tempDay);
                    LBDay.Text  = tempDay;
                    break;

                case EventEnum.UpdateTime:
                    string tempTime = wm.EventPayloads["Game.Current.Time"];
                    _currentTime = int.Parse(tempTime);
                    LBTime.Text  = tempTime;
                    if (_currentPeriod == Game.PeriodEnum.Night)
                    {
                        this.Sun_moon.Left -= 4;
                        this.BackColor      = ColorTranslator.FromHtml(BG_Arr[BG_count]);
                        if (BG_count < 35)
                        {
                            BG_count++;
                        }
                    }
                    else
                    {
                        this.BackColor = ColorTranslator.FromHtml(BG_Arr[BG_count]);
                        BG_count--;
                        this.Sun_moon.Left += 4;
                        if (BG_count == -1)
                        {
                            BG_count++;
                        }
                    }
                    UpdateAvatar(wm);
                    break;

                case EventEnum.Vote:
                    if (wm.EventPayloads["Success"] == WerewolfModel.TRUE)
                    {
                        //AddChatMessage("Your vote is registered.");
                        AddSystemMessage("Your vote is registered.");
                    }
                    else
                    {
                        //AddChatMessage("You can't vote now.");
                        AddSystemMessage("You can't vote now.");
                    }
                    break;

                case EventEnum.Action:
                    if (wm.EventPayloads["Success"] == WerewolfModel.TRUE)
                    {
                        //AddChatMessage("Your action is registered.");
                        AddSystemMessage("Your action is registered.");
                        if (_myRole == WerewolfModel.ROLE_GUNNER)
                        {
                            WerewolfCommand wcmd = new WerewolfCommand();
                            wcmd.Action   = CommandEnum.Chat;
                            wcmd.Payloads = new Dictionary <string, string>()
                            {
                                { "Message", "I am a Gunner" }
                            };
                            controller.ActionPerformed(wcmd);
                            firstshot = true;
                        }
                    }
                    else
                    {
                        //AddChatMessage("You can't perform action now.");
                        AddSystemMessage("You can't perform action now.");
                    }
                    break;

                case EventEnum.YouShotDead:
                    //AddChatMessage("You're shot dead by gunner.");
                    AddSystemMessage("You're shot dead by gunner.");
                    _isDead = true;
                    break;

                case EventEnum.OtherShotDead:
                    //AddChatMessage(wm.EventPayloads["Game.Target.Name"] + " was shot dead by gunner.");
                    AddSystemMessage(wm.EventPayloads["Game.Target.Name"] + " was shot dead by gunner.");
                    break;

                case EventEnum.Alive:
                    //AddChatMessage(wm.EventPayloads["Game.Target.Name"] + " has been revived by medium.");
                    AddSystemMessage(wm.EventPayloads["Game.Target.Name"] + " has been revived by medium.");
                    if (wm.EventPayloads["Game.Target.Id"] == null)
                    {
                        _isDead = false;
                    }
                    break;

                case EventEnum.ChatMessage:
                    if (wm.EventPayloads["Success"] == WerewolfModel.TRUE)
                    {
                        AddChatMessage(wm.EventPayloads["Game.Chatter"] + ":" + wm.EventPayloads["Game.ChatMessage"]);
                    }
                    break;

                case EventEnum.Chat:
                    if (wm.EventPayloads["Success"] == WerewolfModel.FALSE)
                    {
                        switch (wm.EventPayloads["Error"])
                        {
                        case "403":
                            AddSystemMessage("You're not alive, can't talk now.");
                            break;

                        case "404":
                            AddSystemMessage("You're not existed, can't talk now.");
                            break;

                        case "405":
                            AddSystemMessage("You're not in a game, can't talk now.");
                            break;

                        case "406":
                            AddSystemMessage("You're not allow to talk now, go to sleep.");
                            break;
                        }
                    }
                    break;
                }
                // need to reset event
                wm.Event = EventEnum.NOP;
            }
        }