public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case WerewolfModel.EventEnum.SignIn: if (wm.EventPayloads["Success"] == "True") { _mainForm.Visible = true; this.Visible = false; } else { MessageBox.Show("Login or password incorrect, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case WerewolfModel.EventEnum.SignUp: if (wm.EventPayloads["Success"] == "True") { MessageBox.Show("Sign up successfuly, please login", "Success", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { MessageBox.Show("Login or password incorrect, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mMainForm = new MainForm(); mMainForm.Visible = false; Login mLogin = new Login(mMainForm); mMainForm.Addformlogin(mLogin); WerewolfController mControler = WerewolfController.GetInstance(); WerewolfModel mModel = new WerewolfModel(); mModel.Addserver(mLogin); // View -> Controller mMainForm.setController(mControler); mLogin.setController(mControler); // Controler -> Model mControler.AddModel(mModel); // Model -> View mModel.AttachObserver(mLogin); mModel.AttachObserver(mMainForm); Application.Run(mLogin); }
private void DeadPlayer(WerewolfModel wm) { int i = 0; foreach (Player player in wm.Players) { if (player.Status == Player.StatusEnum.Votedead) { Image img = Properties.Resources.RIP2; ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } if (player.Status == Player.StatusEnum.Killdead) { Image img = Properties.Resources.RIP2; ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } if (player.Status == Player.StatusEnum.Holydead) { Image img = Properties.Resources.RIP2; ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } if (player.Status == Player.StatusEnum.Shotdead) { Image img = Properties.Resources.RIP2; ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } } i++; }
private void ShowPlayerInfo(WerewolfModel wm) { //there's should be better detection somewhere, we'll see. if (wm != null && wm.Player != null && wm.Player.Name != null) { tbUID.Text = wm.Player.Id.ToString(); tbUsername.Text = wm.Player.Name.ToString(); } }
public string Dis() { string name = "test"; foreach (Model m in mList) { WerewolfModel wm = (WerewolfModel)m; name = wm.test(); } return(name); }
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; } } } }
public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case WerewolfModel.EventEnum.SignOut: if (wm.EventPayloads["Success"] == "True") { _loginForm.Visible = true; this.Visible = false; } break; case WerewolfModel.EventEnum.JoinGame: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { _MMTimer.Interval = 1000; _MMTimer.Tick += new EventHandler(OnTimerEvent); _MMTimer.Enabled = true; btnMM.Text = "Joining Room #" + wm.EventPayloads["Game.Id"] + "\r\n(Queuing: " + wm.EventPayloads["Game.Count"] + "Players)"; _isMM = true; } break; case WerewolfModel.EventEnum.CancelJoin: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { btnMM.Text = "Auto Matchmaking"; _isMM = false; } break; case WerewolfModel.EventEnum.GameStarted: _gameForm.Visible = true; this.Visible = false; _isMM = false; _MMTimer.Dispose(); break; } ShowPlayerInfo(wm); } }
public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case WerewolfModel.EventEnum.SignIn: if (wm.EventPayloads["Success"] == "True") { this.Visible = false; Menu mMenu = new Menu(_mainForm); if (_mainForm.Visible == false) { mMenu.Show(); } } else { MessageBox.Show("Login or password incorrect, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case WerewolfModel.EventEnum.SignUp: if (wm.EventPayloads["Success"] == "True") { this.Visible = true; frm.Visible = false; } else { MessageBox.Show("Login or password incorrect, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case WerewolfModel.EventEnum.SignOut: this.Visible = true; _mainForm.Visible = false; break; } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Game mGameForm = new Game(); mGameForm.Visible = false; Main mMainForm = new Main(mGameForm); mMainForm.Visible = false; Login mLogin = new Login(mMainForm); //Return to lobby mGameForm.SetMainMenu(mMainForm); //too lazy to figure better solution yet mMainForm.setLoginForm(mLogin); WerewolfController mController = WerewolfController.GetInstance(); WerewolfModel mModel = new WerewolfModel(); // View -> Controller mMainForm.setController(mController); mLogin.setController(mController); mGameForm.setController(mController); // Controler -> Model mController.AddModel(mModel); // Model -> View mModel.AttachObserver(mLogin); mModel.AttachObserver(mMainForm); mModel.AttachObserver(mGameForm); Application.Run(mLogin); //Application.Run(new Main()); }
public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case WerewolfModel.EventEnum.SignIn: if (wm.EventPayloads["Success"] == "True") { _mainForm.Visible = true; this.Visible = false; // WerewolfCommand wcmd = new WerewolfCommand(); // wcmd.Action = CommandEnum.JoinGame; // controller.ActionPerformed(wcmd); } else { MessageBox.Show("Login or password incorrect, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case WerewolfModel.EventEnum.SignUp: if (wm.EventPayloads["Done"] == "True") { //MessageBox.Show("Sign up successfuly, please login", "Success", MessageBoxButtons.OK, MessageBoxIcon.); MessageBox.Show("Sign Up successfully, Please Login", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Please Try Another Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } } }
private void HowManyPeople(WerewolfModel wm) { if (wm.Event == EventEnum.JoinGame) { /* playerIngameCount; * int i = 0; * string[] playerIngame = new string[16]; * foreach(Player player in wm.Players) * { * if(playerIngame.Length == 0) * { * playerIngame[i] = player.Name; * } * else * { * bool checkSame = false; * for(int j = 0; j < i; j++){ * if (playerIngame[j] == player.Name) * { * checkSame = true; * } * if (checkSame) * { * playerIngame[i] = player.Name; * } * else * { * return; * } * } * } * i++; * } * label3.Text = playerIngame.Length.ToString() + "/16";*/ } }
private void UpdateAvatar(WerewolfModel wm) { //Hide all players foreach (var plrBtn in Controls["GBPlayers"].Controls.OfType <Button>()) { EnableButton(plrBtn, !(plrBtn.Name.StartsWith("BtnPlayer"))); } int i = 0; foreach (Player player in wm.Players) { var _cpBtn = Controls["GBPlayers"].Controls["BtnPlayer" + i]; EnableButton((Button)_cpBtn, true); _cpBtn.Text = player.Name; _cpBtn.ForeColor = Color.Black; //Custom for self if (player.Name == wm.Player.Name) { _cpBtn.Text += "\n(You)"; _cpBtn.ForeColor = Color.DarkGreen; } if (player.Name == wm.Player.Name || player.Status != Player.StatusEnum.Alive) { // FIXME, need to optimize this Image img = Properties.Resources.Icon_villager; string role; if (player.Name == wm.Player.Name) { role = _myRole; } else if (player.Role != null) { role = player.Role.Name; } else { continue; } switch (role) { case WerewolfModel.ROLE_SEER: img = Properties.Resources.Icon_seer; break; case WerewolfModel.ROLE_AURA_SEER: img = Properties.Resources.Icon_aura_seer; break; case WerewolfModel.ROLE_PRIEST: img = Properties.Resources.Icon_priest; break; case WerewolfModel.ROLE_DOCTOR: img = Properties.Resources.Icon_doctor; break; case WerewolfModel.ROLE_WEREWOLF: img = Properties.Resources.Icon_werewolf; break; case WerewolfModel.ROLE_WEREWOLF_SEER: img = Properties.Resources.Icon_wolf_seer; break; case WerewolfModel.ROLE_ALPHA_WEREWOLF: img = Properties.Resources.Icon_alpha_werewolf; break; case WerewolfModel.ROLE_WEREWOLF_SHAMAN: img = Properties.Resources.Icon_wolf_shaman; break; case WerewolfModel.ROLE_MEDIUM: img = Properties.Resources.Icon_medium; break; case WerewolfModel.ROLE_BODYGUARD: img = Properties.Resources.Icon_bodyguard; break; case WerewolfModel.ROLE_JAILER: img = Properties.Resources.Icon_jailer; break; case WerewolfModel.ROLE_FOOL: img = Properties.Resources.Icon_fool; break; case WerewolfModel.ROLE_HEAD_HUNTER: img = Properties.Resources.Icon_head_hunter; break; case WerewolfModel.ROLE_SERIAL_KILLER: img = Properties.Resources.Icon_serial_killer; break; case WerewolfModel.ROLE_GUNNER: img = Properties.Resources.Icon_gunner; break; } ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } i++; } }
public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case EventEnum.JoinGame: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { BtnJoin.Visible = false; AddChatMessage("You're joing the game #" + wm.EventPayloads["Game.Id"] + ", please wait for game start."); _updateTimer.Interval = 1000; _updateTimer.Tick += new EventHandler(OnTimerEvent); _updateTimer.Enabled = true; } 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"]); _updateTimer.Enabled = false; break; case EventEnum.GameStarted: players = wm.Players; _myRole = wm.EventPayloads["Player.Role.Name"]; AddChatMessage("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); UpdateAvatar(wm); break; case EventEnum.SwitchToDayTime: AddChatMessage("Switch to day time of day #" + wm.EventPayloads["Game.Current.Day"] + "."); _currentPeriod = Game.PeriodEnum.Day; LBPeriod.Text = "Day time of"; DorN = true; break; case EventEnum.SwitchToNightTime: AddChatMessage("Switch to night time of day #" + wm.EventPayloads["Game.Current.Day"] + "."); _currentPeriod = Game.PeriodEnum.Night; LBPeriod.Text = "Night time of"; DorN = false; 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; UpdateAvatar(wm); if (_isChat) { AddChatMessage(textBox2.ToString()); textBox2.Text = ""; _isChat = false; } if (DorN) { TbChatBox.BackColor = Color.White; TbChatBox.ForeColor = Color.Black; textBox2.BackColor = Color.White; textBox2.ForeColor = Color.Black; this.BackgroundImage = (Image)Properties.Resources.ResourceManager.GetObject("D" + (_currentTime + 1)); } else { TbChatBox.BackColor = Color.Black; TbChatBox.ForeColor = Color.White; textBox2.BackColor = Color.Black; textBox2.ForeColor = Color.White; this.BackgroundImage = (Image)Properties.Resources.ResourceManager.GetObject("N" + (_currentTime + 1)); } break; case EventEnum.Vote: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { AddChatMessage("Your vote is registered."); } else { AddChatMessage("You can't vote now."); } break; case EventEnum.Action: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { AddChatMessage("Your action is registered."); } else { AddChatMessage("You can't perform action now."); } break; case EventEnum.YouShotDead: AddChatMessage("You're shot dead by gunner."); _isDead = true; break; case EventEnum.OtherShotDead: AddChatMessage(wm.EventPayloads["Game.Target.Name"] + " was shot dead by gunner."); break; case EventEnum.Alive: if (_isDead) { AddChatMessage("You've been revived by medium."); _isDead = false; } break; } // need to reset event wm.Event = EventEnum.NOP; } }
private void UpdateAvatar(WerewolfModel wm) { int i = 0; foreach (Player player in wm.Players) { Controls["GBPlayers"].Controls["BtnPlayer" + i].Text = player.Name; if (player.Name == wm.Player.Name || player.Status != Player.StatusEnum.Alive) { // FIXME, need to optimize this Image img = Properties.Resources.Icon_villager; string role; if (player.Name == wm.Player.Name) { role = _myRole; } else if (player.Role != null) { role = player.Role.Name; } else { continue; } switch (role) { case WerewolfModel.ROLE_SEER: img = Properties.Resources.Icon_seer; break; case WerewolfModel.ROLE_AURA_SEER: img = Properties.Resources.Icon_aura_seer; break; case WerewolfModel.ROLE_PRIEST: img = Properties.Resources.Icon_priest; break; case WerewolfModel.ROLE_DOCTOR: img = Properties.Resources.Icon_doctor; break; case WerewolfModel.ROLE_WEREWOLF: img = Properties.Resources.Icon_werewolf; break; case WerewolfModel.ROLE_WEREWOLF_SEER: img = Properties.Resources.Icon_wolf_seer; break; case WerewolfModel.ROLE_ALPHA_WEREWOLF: img = Properties.Resources.Icon_alpha_werewolf; break; case WerewolfModel.ROLE_WEREWOLF_SHAMAN: img = Properties.Resources.Icon_wolf_shaman; break; case WerewolfModel.ROLE_MEDIUM: img = Properties.Resources.Icon_medium; break; case WerewolfModel.ROLE_BODYGUARD: img = Properties.Resources.Icon_bodyguard; break; case WerewolfModel.ROLE_JAILER: img = Properties.Resources.Icon_jailer; break; case WerewolfModel.ROLE_FOOL: img = Properties.Resources.Icon_fool; break; case WerewolfModel.ROLE_HEAD_HUNTER: img = Properties.Resources.Icon_head_hunter; break; case WerewolfModel.ROLE_SERIAL_KILLER: img = Properties.Resources.Icon_serial_killer; break; case WerewolfModel.ROLE_GUNNER: img = Properties.Resources.Icon_gunner; break; } ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } i++; } }
public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case EventEnum.JoinGame: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { BtnJoin.Visible = false; AddChatMessage("You're joing the game #" + wm.EventPayloads["Game.Id"] + ", please wait for game start."); _updateTimer.Interval = 1000; _updateTimer.Tick += new EventHandler(OnTimerEvent); _updateTimer.Enabled = true; } 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"]); _updateTimer.Enabled = false; break; case EventEnum.GameStarted: players = wm.Players; _myRole = wm.EventPayloads["Player.Role.Name"]; AddChatMessage("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); UpdateAvatar(wm); break; case EventEnum.SwitchToDayTime: AddChatMessage("Switch to day time of day #" + wm.EventPayloads["Game.Current.Day"] + "."); _currentPeriod = Game.PeriodEnum.Day; LBPeriod.Text = "Day time of"; break; case EventEnum.SwitchToNightTime: AddChatMessage("Switch to night time of day #" + wm.EventPayloads["Game.Current.Day"] + "."); _currentPeriod = Game.PeriodEnum.Night; LBPeriod.Text = "Night time of"; 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; UpdateAvatar(wm); break; case EventEnum.Vote: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { AddChatMessage("Your vote is registered."); } else { AddChatMessage("You can't vote now."); } break; case EventEnum.Action: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { AddChatMessage("Your action is registered."); } else { AddChatMessage("You can't perform action now."); } break; case EventEnum.YouShotDead: AddChatMessage("You're shot dead by gunner."); _isDead = true; break; case EventEnum.OtherShotDead: AddChatMessage(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."); 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": AddChatMessage("You're not alive, can't talk now."); break; case "404": AddChatMessage("You're not existed, can't talk now."); break; case "405": AddChatMessage("You're not in a game, can't talk now."); break; case "406": AddChatMessage("You're not allow to talk now, go to sleep."); break; } } break; case EventEnum.SignOut: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { this.Visible = false; formlogin.Visible = true; } break; } // need to reset event wm.Event = EventEnum.NOP; } }
public void Notify(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; switch (wm.Event) { case EventEnum.JoinGame: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { BtnJoin.Visible = false; AddChatMessage("You're joing the game #" + wm.EventPayloads["Game.Id"] + ", please wait for game start."); _updateTimer.Interval = 1000; _updateTimer.Tick += new EventHandler(OnTimerEvent); _updateTimer.Enabled = true; } 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"]); _updateTimer.Enabled = false; BtnJoin.Visible = true; EnableButton(BtnJoin, true); break; case EventEnum.GameStarted: players = wm.Players; _myRole = wm.EventPayloads["Player.Role.Name"]; AddChatMessage("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); UpdateAvatar(wm); break; case EventEnum.GameWaiting: if (playerCounter != wm.Players.Count) { foreach (Player player in wm.Players) { AddChatMessage(player.Name + " Join Game !!!"); } playerCounter = wm.Players.Count; } break; case EventEnum.SwitchToDayTime: AddChatMessage("Switch to day time of day #" + wm.EventPayloads["Game.Current.Day"] + "."); _currentPeriod = Game.PeriodEnum.Day; LBPeriod.Text = "Day time of"; this.BackgroundImage = Properties.Resources.Daytime; break; case EventEnum.SwitchToNightTime: AddChatMessage("Switch to night time of day #" + wm.EventPayloads["Game.Current.Day"] + "."); _currentPeriod = Game.PeriodEnum.Night; LBPeriod.Text = "Night time of"; this.BackgroundImage = Properties.Resources.Nighttime; 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; UpdateAvatar(wm); break; case EventEnum.Vote: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { AddChatMessage("Your vote is registered."); } else { AddChatMessage("You can't vote now."); } break; case EventEnum.Action: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { AddChatMessage("Your action is registered."); } else { AddChatMessage("You can't perform action now."); } break; case EventEnum.YouShotDead: AddChatMessage("You're shot dead by gunner."); _isDead = true; break; case EventEnum.OtherShotDead: AddChatMessage(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."); if (wm.EventPayloads["Game.Target.Id"] == null) { _isDead = false; } break; case EventEnum.ChatMessage: if (wm.EventPayloads["Success"] == WerewolfModel.TRUE) { for (int i = 0; i < wm.Players.Count; i++) { if (wm.EventPayloads["Game.Chatter"] == wm.Players[i].Name) { switch (i + 1) { case 1: textBox1.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 2: textBox2.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 3: textBox3.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 4: textBox4.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 5: textBox5.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 6: textBox6.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 7: textBox7.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 8: textBox8.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 9: textBox9.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 10: textBox10.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 11: textBox11.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 12: textBox12.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 13: textBox13.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 14: textBox14.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 15: textBox15.Text = wm.EventPayloads["Game.ChatMessage"]; break; case 16: textBox16.Text = wm.EventPayloads["Game.ChatMessage"]; break; } } } 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": AddChatMessage("You're not alive, can't talk now."); break; case "404": AddChatMessage("You're not existed, can't talk now."); break; case "405": AddChatMessage("You're not in a game, can't talk now."); break; case "406": AddChatMessage("You're not allow to talk now, go to sleep."); break; } } break; case EventEnum.SignOut: this.Visible = false; BtnJoin.Visible = true; EnableButton(BtnJoin, true); TbChatBox.Text = ""; playerCounter = 0; break; case EventEnum.LeaveGame: BtnJoin.Visible = true; EnableButton(BtnJoin, true); TbChatBox.Text = ""; playerCounter = 0; break; case EventEnum.Soundbackground: if (_isSound) { counter = 2; //backGround_sound.settings.volume = 20; //clickSound = !clickSound; _isSound = false; timer_time(); } else { counter = 2; //backGround_sound.settings.volume = 0; clickSound = !clickSound; _isSound = true; timer_time(); } EnableButton(BtnJoin, true); TbChatBox.Text = ""; break; } // need to reset event wm.Event = EventEnum.NOP; } }
private void WinnerName(Model m) { if (m is WerewolfModel) { WerewolfModel wm = (WerewolfModel)m; foreach (Player player in wm.Players) { string role; role = player.Role.Name; if (!_alreadyAdd)//TEST ยังไม่เสร็จ { switch (_gameOut.Outcome) { case Game.OutcomeEnum.Werewolfwin: if (role == WerewolfModel.ROLE_ALPHA_WEREWOLF) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_WEREWOLF) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_WEREWOLF_SEER) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_ALPHA_WEREWOLF) { richTextBox1.Text += player.Name; } break; case Game.OutcomeEnum.Serialkillerwin: if (role == WerewolfModel.ROLE_SERIAL_KILLER) { richTextBox1.Text += player.Name; } break; case Game.OutcomeEnum.Villagerwin: //Villager ไม่มี << เพิ่มแล้ว if (role == WerewolfModel.ROLE_VILLAGER) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_SEER) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_AURA_SEER) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_BODYGUARD) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_DOCTOR) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_GUNNER) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_JAILER) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_MEDIUM) { richTextBox1.Text += player.Name; } if (role == WerewolfModel.ROLE_PRIEST) { richTextBox1.Text += player.Name; } break; case Game.OutcomeEnum.Headhunterwin: if (role == WerewolfModel.ROLE_HEAD_HUNTER) { richTextBox1.Text += player.Name; } break; case Game.OutcomeEnum.Foolwin: if (role == WerewolfModel.ROLE_FOOL) { richTextBox1.Text += player.Name; } break; case Game.OutcomeEnum.Nowin: richTextBox1.Text += "No Winer!!!"; break; } } _alreadyAdd = true; } } }
private void UpdateAvatar(WerewolfModel wm) { int i = 0; foreach (Player player in wm.Players) { Controls["GBPlayers"].Controls["BtnPlayer" + i].Text = player.Name; if (player.Name == wm.Player.Name || player.Status != Player.StatusEnum.Alive) { // FIXME, need to optimize this Image img = Properties.Resources.villager_icon_resize_; string role; if (player.Name == wm.Player.Name) { role = _myRole; } else if (player.Role != null) { role = player.Role.Name; } else { continue; } switch (role) { case WerewolfModel.ROLE_SEER: img = Properties.Resources.seer_icon_resize_; Char_pic.Image = Properties.Resources.Seer_use; Animation.Image = Properties.Resources.Seer2_standby; break; case WerewolfModel.ROLE_AURA_SEER: img = Properties.Resources.auraseer_icon_resize_; Char_pic.Image = Properties.Resources.AuraSeer_use; Animation.Image = Properties.Resources.AuraSeer_standby; break; case WerewolfModel.ROLE_PRIEST: img = Properties.Resources.bible_icon_resize_; Char_pic.Image = Properties.Resources.Priest_use; Animation.Image = Properties.Resources.Priest_standby; break; case WerewolfModel.ROLE_DOCTOR: img = Properties.Resources.doctor_icon_resize_; Char_pic.Image = Properties.Resources.Doctor_use; Animation.Image = Properties.Resources.Doctor_standby; break; case WerewolfModel.ROLE_WEREWOLF: img = Properties.Resources.werewolf_icon_resize_; Char_pic.Image = Properties.Resources.Werewolf_use; Animation.Image = Properties.Resources.Werewolf_standby; break; case WerewolfModel.ROLE_WEREWOLF_SEER: img = Properties.Resources.werewolfseer_icon_resize_; Char_pic.Image = Properties.Resources.WolfSeer_use; Animation.Image = Properties.Resources.WolfSeer2_standby; break; case WerewolfModel.ROLE_ALPHA_WEREWOLF: img = Properties.Resources.alphawerewolf_icon_resize_; Char_pic.Image = Properties.Resources.AlphaWerewolf_use; Animation.Image = Properties.Resources.AlphaWerewolf_standby; break; case WerewolfModel.ROLE_WEREWOLF_SHAMAN: img = Properties.Resources.werewolfshaman_icon_resize_; Char_pic.Image = Properties.Resources.WolfShaman_use; Animation.Image = Properties.Resources.WolfShaman_standby; break; case WerewolfModel.ROLE_MEDIUM: img = Properties.Resources.medium_icon_resize_; Char_pic.Image = Properties.Resources.Medium_use; Animation.Image = Properties.Resources.Medium_standby; break; case WerewolfModel.ROLE_BODYGUARD: img = Properties.Resources.bodyguard_icon_resize_; Char_pic.Image = Properties.Resources.Bodyguard_use; Animation.Image = Properties.Resources.Bodyguard_standby; break; case WerewolfModel.ROLE_JAILER: img = Properties.Resources.jailer_icon_resize_; Char_pic.Image = Properties.Resources.Jailer_use; Animation.Image = Properties.Resources.Jailer_standby; break; case WerewolfModel.ROLE_FOOL: img = Properties.Resources.fool_icon_resize_; Char_pic.Image = Properties.Resources.Fool_use; Animation.Image = Properties.Resources.Fool_standby; break; case WerewolfModel.ROLE_HEAD_HUNTER: img = Properties.Resources.bountyhunter_icon_resize_; Char_pic.Image = Properties.Resources.Headhunter_use; Animation.Image = Properties.Resources.Headhunter_standby; break; case WerewolfModel.ROLE_SERIAL_KILLER: img = Properties.Resources.serialkiller_icon_resize_; Char_pic.Image = Properties.Resources.SerialKiller_use; Animation.Image = Properties.Resources.SerialKiller_standby; break; case WerewolfModel.ROLE_GUNNER: img = Properties.Resources.gunner_icon_resize_; Char_pic.Image = Properties.Resources.Gunner_use; Animation.Image = Properties.Resources.Gunner_standby; break; case null: img = Properties.Resources.Null_resize_; Char_pic.Image = Properties.Resources.Null_resize_; Animation.Image = Properties.Resources.Null_resize_; break; } ((Button)Controls["GBPlayers"].Controls["BtnPlayer" + i]).Image = img; } i++; } }
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; } }
private void UpdateAvatar(WerewolfModel wm) { bool isGunner = false; int i = 0; foreach (Player player in wm.Players) { string role = null; Controls["panel1"].Controls["BtnPlayer" + i].Text = player.Name; if (player.Name == wm.Player.Name || player.Status != Player.StatusEnum.Alive) { // FIXME, need to optimize this Image img = Properties.Resources.char_villager_resize; if (player.Name == wm.Player.Name) { role = _myRole; } else if (player.Role != null) { role = player.Role.Name; } else { goto endloop; } if (i >= 8) { switch (role) { case WerewolfModel.ROLE_SEER: img = Properties.Resources.char_seer_resize2; break; case WerewolfModel.ROLE_AURA_SEER: img = Properties.Resources.char_auraseer_resize2; break; case WerewolfModel.ROLE_PRIEST: img = Properties.Resources.char_priest_resize2; break; case WerewolfModel.ROLE_DOCTOR: img = Properties.Resources.char_doctor_resize2; break; case WerewolfModel.ROLE_WEREWOLF: img = Properties.Resources.char_wolf_resize2; break; case WerewolfModel.ROLE_WEREWOLF_SEER: img = Properties.Resources.char_wolfseer_resize2; break; case WerewolfModel.ROLE_ALPHA_WEREWOLF: img = Properties.Resources.char_alphawolf_resize2; break; case WerewolfModel.ROLE_WEREWOLF_SHAMAN: img = Properties.Resources.char_wolf_shaman_resize2; break; case WerewolfModel.ROLE_MEDIUM: img = Properties.Resources.char_medium_resize2; break; case WerewolfModel.ROLE_BODYGUARD: img = Properties.Resources.char_Bodyguard_resize2; break; case WerewolfModel.ROLE_JAILER: img = Properties.Resources.char_jailer_resize2; break; case WerewolfModel.ROLE_FOOL: img = Properties.Resources.char_fool_resize2; break; case WerewolfModel.ROLE_HEAD_HUNTER: img = Properties.Resources.char_Head_Hunter_resize2; break; case WerewolfModel.ROLE_SERIAL_KILLER: img = Properties.Resources.char_killer_resize2; break; case WerewolfModel.ROLE_GUNNER: img = Properties.Resources.char_gunner_resize2; break; } } else { switch (role) { case WerewolfModel.ROLE_SEER: img = Properties.Resources.char_seer_resize; break; case WerewolfModel.ROLE_AURA_SEER: img = Properties.Resources.char_auraseer_resize; break; case WerewolfModel.ROLE_PRIEST: img = Properties.Resources.char_priest_resize; break; case WerewolfModel.ROLE_DOCTOR: img = Properties.Resources.char_doctor_resize; break; case WerewolfModel.ROLE_WEREWOLF: img = Properties.Resources.char_wolf_resize; break; case WerewolfModel.ROLE_WEREWOLF_SEER: img = Properties.Resources.char_wolfseer_resize; break; case WerewolfModel.ROLE_ALPHA_WEREWOLF: img = Properties.Resources.char_alphawolf_resize; break; case WerewolfModel.ROLE_WEREWOLF_SHAMAN: img = Properties.Resources.char_wolf_shaman_resize; break; case WerewolfModel.ROLE_MEDIUM: img = Properties.Resources.char_medium_resize; break; case WerewolfModel.ROLE_BODYGUARD: img = Properties.Resources.char_Bodyguard_resize; break; case WerewolfModel.ROLE_JAILER: img = Properties.Resources.char_jailer_resize; break; case WerewolfModel.ROLE_FOOL: img = Properties.Resources.char_fool_resize; break; case WerewolfModel.ROLE_HEAD_HUNTER: img = Properties.Resources.char_Head_Hunter_resize; break; case WerewolfModel.ROLE_SERIAL_KILLER: img = Properties.Resources.char_killer_resize; break; case WerewolfModel.ROLE_GUNNER: isGunner = true; img = Properties.Resources.char_gunner_resize; break; } } ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; } else if (player.Name != wm.Player.Name) { Image img = Properties.Resources.char_villager_resize; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; } endloop: if (player.Status == Player.StatusEnum.Shotdead) { Image img = Properties.Resources.RIPstone_resize; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Width = img.Width; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Height = img.Height; } else if (player.Status == Player.StatusEnum.Killdead) { Image img = Properties.Resources.RIPstone_resize; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Width = img.Width; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Height = img.Height; } else if (player.Status == Player.StatusEnum.Holydead) { Image img = Properties.Resources.RIPstone_resize; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Width = img.Width; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Height = img.Height; } else if (player.Status == Player.StatusEnum.Votedead) { Image img = Properties.Resources.RIPstone_resize; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Width = img.Width; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Height = img.Height; } else if (player.Status == Player.StatusEnum.Jaildead) { Image img = Properties.Resources.RIPstone_resize; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Image = img; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Width = img.Width; ((Button)Controls["panel1"].Controls["BtnPlayer" + i]).Height = img.Height; } i++; } }