예제 #1
0
 void IBFServerList.RemoveServer(uint ServerID)
 {
     if (storeDict.TryGetValue(ServerID, out var server))
     {
         store.Remove(server);
         storeDict.Remove(ServerID);
         ServerChanged?.Invoke(this, server.ServerID, server, ServerChangeTypes.Remove);
     }
 }
예제 #2
0
 void IBFServerList <T> .AddServer(T server)
 {
     if (!storeDict.ContainsKey(server.ServerID))
     {
         store.Add(server);
         storeDict[server.ServerID] = server;
         ServerChanged?.Invoke(this, server.ServerID, server, ServerChangeTypes.Add);
     }
 }
예제 #3
0
        public void SetRemoteState(RemoteClientWorldState worldState)
        {
            if (_worldState != null)
            {
                _worldState.Disconnected -= ProcessDisconnected;
            }

            _worldState = worldState;
            _worldState.Disconnected += ProcessDisconnected;

            ServerChanged?.Invoke();
        }
예제 #4
0
        private void ServerButton_Click(object sender, RoutedEventArgs e)
        {
            Server selectedServer = ButtonServers[(Button)sender];

            ServerButtonClick?.Invoke(this, new ServerButtonClickArgs(selectedServer));
            if (Inventory.CurrentServer != selectedServer)
            {
                Server previousServer = Inventory.CurrentServer;
                Inventory.SetCurrentServer(selectedServer);
                ServerChanged?.Invoke(this, new ServerChangedArgs(previousServer, selectedServer));
            }
        }
예제 #5
0
        void IBFServerList.UpdateServerPlayers(uint ServerID, byte[] info)
        {
            var serv = Find(ServerID);

            if (serv == null)
            {
                //server doesn't exist,create a new one
                serv = createServer(ServerID);
                AsEditable.AddServer(serv);
            }
            //server exists
            serv.Players.Parse(info);
            ServerChanged?.Invoke(this, ServerID, serv, ServerChangeTypes.Update);
        }
예제 #6
0
        void IBFServerList.UpdateServerInfo(uint ServerID, byte[] info)
        {
            var serv = Find(ServerID);

            if (serv == null)
            {
                //server doesn't exist,create a new one
                var asInterface = (IBFServerList <T>) this;
                serv = createServer(ServerID);
                serv.Parse(info);
                AsEditable.AddServer(serv);
            }
            else
            {
                //server exists
                serv.Parse(info);
                ServerChanged?.Invoke(this, ServerID, serv, ServerChangeTypes.Update);
            }
        }
예제 #7
0
 internal void OnServerChanged(bool weAreTheServer)
 {
     ServerChanged?.Invoke(this, new ServerChangedEventArgs(weAreTheServer));
 }