示例#1
0
 public void SendMessageToServer(MessageWrapper wrapper)
 {
     if (wrapper != null)
     {
         lock (Server.Inbox)
         {
             Server.Inbox.Enqueue(wrapper.PrimaryMessage);
         }
     }
 }
示例#2
0
        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>()
                };
            }
        }
示例#3
0
 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;
 }