public void SendLetters(string playerIP, GameLetters letters) { string messageText = Serialiser.SerializeToXml<GameLetters>(letters); NetworkMessage message = new NetworkMessage() { RecipientsIP = playerIP, MessagePacket = new NetworkMessagePacket() { Command = eProtocol.SendLetters, MessageText = messageText } }; AddMessageToQueue(message); }
public GameLetters GetLetters(int numberOfLetters) { GameLetters letters = new GameLetters(); numberOfLetters = Math.Min(numberOfLetters, GameSettings.Settings.LetterBag.Count); for (int i = 0; i < numberOfLetters; i++) { letters.Letters.Add(NextRandomLetter()); } letters.LettersRemaining = GameSettings.Settings.LetterBag.Count; return letters; }
public void AddLettersToPanel(GameLetters letters) { GameSettings.Settings.MyDetails.CurrentLetters.Letters.AddRange(letters.Letters); for (int i = 0; i < letters.Letters.Count; i++) { AddTileToPanel(letters.Letters[i], i); } if(LetterRemaining != null) { LetterRemaining(letters.LettersRemaining.ToString() + " letters remaining"); } if(letters.Letters.Count == 0 && m_panelTiles.Count == 0) { // Signal game over. } }
void LocalNetwork_OnLettersReceived(string serverIP, GameLetters letters) { if (m_tileBeingExchanged != null) { m_panelTiles.Remove(m_tileBeingExchanged); m_tileBeingExchanged = null; if(OnChangingALetter != null) { OnChangingALetter(true); } } AddLettersToPanel(letters); }