void HandleClient(PLAYER play, String str) { ROOM roomofplay = lstROOM.Find(x => x.room == play.Room); if (str[0] == Cons.Receive_End) { play.End = true; if (roomofplay.player_M.End == true && roomofplay.player_S.End == true) { if (roomofplay.player_S.Mark > roomofplay.player_M.Mark) { roomofplay.player_S.SendResult(1); roomofplay.player_M.SendResult(-1); } if (roomofplay.player_S.Mark < roomofplay.player_M.Mark) { roomofplay.player_S.SendResult(-1); roomofplay.player_M.SendResult(1); } if (roomofplay.player_S.Mark == roomofplay.player_M.Mark) { roomofplay.player_S.SendResult(0); roomofplay.player_M.SendResult(0); } roomofplay.lstGold.Clear(); roomofplay.player_S.SendEnd(); roomofplay.player_M.SendEnd(); roomofplay.player_M.End = false; roomofplay.player_S.End = false; roomofplay.CreatMap(); } return; } if (str[0] == Cons.Receive_Ready) { roomofplay.player_M.SendReady(); Thread.Sleep(15); roomofplay.player_M.SendMap(roomofplay.lstGold); Thread.Sleep(15); // Thread.Sleep(15); roomofplay.player_S.SendMap(roomofplay.lstGold); Thread.Sleep(15); return; } if (str[0] == Cons.Receive_Start) { roomofplay.player_M.SendStart(); roomofplay.player_S.SendStart(); return; } if (str[0] == Cons.Receive_CanCau) { str = str.Substring(1); string[] arrListStr = str.Split(','); Point pt = new Point(Int32.Parse(arrListStr[0]), Int32.Parse(arrListStr[1])); GOLD remove = new GOLD(); // lock (lstGolg) { remove = Collision(pt, roomofplay); if (remove != null) { if (play == roomofplay.player_M) { roomofplay.player_S.SendGold(remove.pos); } else { roomofplay.player_M.SendGold(remove.pos); } roomofplay.Remove_Gold(remove); } } return; } if (str[0] == Cons.Receive_MyMark) { str = str.Substring(1); if (play == roomofplay.player_M) { roomofplay.player_S.SendMark(str); } else { roomofplay.player_M.SendMark(str); } play.Mark = Int32.Parse(str); return; } }
public void Remove_Gold(GOLD a) { lstGold.Remove(a); }