示例#1
0
        private void OnPacketRequestConnect(DreamConnection connection, PacketRequestConnect pRequestConnect)
        {
            if (!_ckeyToConnection.ContainsKey(pRequestConnect.CKey))
            {
                connection.CKey = pRequestConnect.CKey;

                DreamConnectionRequest.Invoke(connection);
            }
            else
            {
                connection.SendPacket(new PacketConnectionResult(false, "A connection with your ckey already exists"));
            }
        }
示例#2
0
        public void ConnectToServer(string ip, int port, string username)
        {
            if (Connection.Connected)
            {
                throw new InvalidOperationException("Already connected to a server!");
            }
            Connection.Connect(ip, port);

            PacketRequestConnect pRequestConnect = new PacketRequestConnect(username);

            Connection.SendPacket(pRequestConnect);

            Interface       = new DreamInterface();
            SoundEngine     = new NAudioSoundEngine();
            ResourceManager = new DreamResourceManager();
            StateManager    = new DreamStateManager();

            IconAppearances = new List <IconAppearance>();
            ATOMs           = new Dictionary <UInt32, ATOM>();
            ScreenObjects   = new List <ATOM>();

            MainWindow.Hide();
            _updateTimer.Start();
        }