public void AddPlayerChips(int id, double betAmount) { BetMessageToServer msg = new BetMessageToServer(); msg.nickname = ServiceLocator.Get<LoginViewModel>().Nickname; msg.betAmount = betAmount; msg.playerId = id; gameReceiver.SendToServiceAsync(msg); }
public void PlayerBet(BetMessageToServer msg) { rwl.AcquireWriterLock(10000); string filename = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"/Table1.xml"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filename); XmlNode root = xmlDoc.DocumentElement; XmlNode chips = xmlDoc.SelectSingleNode("/Table/Players/Player[@PlayerId='" + msg.playerId + "']/Hands/Hand/Chips"); XmlElement chip = xmlDoc.CreateElement("Chip"); chip.SetAttribute("ChipAmount", msg.betAmount.ToString()); chips.AppendChild(chip); xmlDoc.Save(filename); rwl.ReleaseWriterLock(); }