protected virtual bool OnMessageReceivedEvent(string msg) { if (msg.StartsWith("chat:")) { gameRoom.BroadcastChat(name, msg.Substring("chat:".Length)); return(true); } else if (msg == "reqbank") { Logger.Log(LogType.Debug, name + " requested bank amount"); SetBank(bank); return(true); } else if (msg == "quit") { Logger.Log(LogType.Debug, name + " is quitting game room"); Quit(); return(true); } else if (msg.StartsWith("sit:")) { int i = 0; if (int.TryParse(msg.Substring("sit:".Length), out i)) { Logger.Log(LogType.Debug, name + " is trying to sit in " + gameRoom.Name); if (gameRoom.SitDown(this, i) == false) { // ok was sent inside gameRoom.SitDown along with all seat info tunnel.SendMessage("fail"); } } else { Logger.Log(LogType.Error, name + " sent sit request with bad integer"); tunnel.SendMessage("sit:fail"); } return(true); } else if (msg == "stand") { Logger.Log(LogType.Debug, name + " stood up in " + gameRoom.Name); DepositBank(wallet); gameRoom.StandUp(this); return(true); } else if (msg.StartsWith("sitin")) { Logger.Log(LogType.Debug, name + " is starting to play in " + gameRoom.Name); gameRoom.SitIn(this); return(true); } else if (msg.StartsWith("sitout")) { Logger.Log(LogType.Debug, name + " is sitting out in " + gameRoom.Name); gameRoom.SitOut(this); return(true); } else if (msg == "refill") { Logger.Log(LogType.Debug, name + " requested a refill"); int chipsInPlay = lobbyEntity.ChipsInPlay; int totalChips = lobbyEntity.Bank + chipsInPlay; if (totalChips < gameRoom.BuyIn) { lobbyEntity.SetBank(gameRoom.BuyIn - chipsInPlay); } return(true); } else if (msg.StartsWith("withdraw:")) { Logger.Log(LogType.Debug, name + " is trying to withdraw"); int i = 0; if (int.TryParse(msg.Substring("withdraw:".Length), out i)) { WithdrawBank(i); } else { SetBank(bank); Logger.Log(LogType.Error, name + " tried to withdraw a non-integer amount"); } return(true); } else if (msg.StartsWith("deposit:")) { Logger.Log(LogType.Debug, name + " is trying to deposit"); int i = 0; if (int.TryParse(msg.Substring("deposit:".Length), out i)) { DepositBank(i); } else { SetBank(bank); Logger.Log(LogType.Error, name + " tried to deposit a non-integer amount"); } return(true); } return(false); }