public void SendMessageToServer(MessageWrapper wrapper) { if (wrapper != null) { lock (Server.Inbox) { Server.Inbox.Enqueue(wrapper.PrimaryMessage); } } }
public MessageWrapper GetMessageFromServer() { try { var tw = new MessageWrapper { PrimaryMessage = AutoFollow.ServerMessage, OtherMessages = AutoFollow.ClientMessages.Values.ToList() }; return tw; } catch (Exception ex) { Log.Info("Exception in GetUpdate() {0}", ex); return new MessageWrapper { PrimaryMessage = Player.CurrentMessage, OtherMessages = new List<Message>() }; } }
private static void UpdateDataAsClient(MessageWrapper messageWrapper) { AutoFollow.CurrentParty = new List<Message>(messageWrapper.OtherMessages) {messageWrapper.PrimaryMessage}; AutoFollow.CurrentFollowers = AutoFollow.CurrentParty.Where(o => o.IsFollower).ToList(); var leader = AutoFollow.CurrentParty.FirstOrDefault(o => o.IsLeader); AutoFollow.CurrentLeader = leader ?? new Message(); AutoFollow.NumberOfConnectedBots = Service.GetSmoothedConnectedBotCount(AutoFollow.CurrentParty); AutoFollow.ServerMessage = messageWrapper.PrimaryMessage; EventManager.Add(AutoFollow.ServerMessage.Events); //AutoFollow.SelectBehavior(); LastClientUpdate = DateTime.UtcNow; }