コード例 #1
0
ファイル: OpenDream.cs プロジェクト: ike709/OpenDream
        public void DisconnectFromServer()
        {
            if (!Connection.Connected)
            {
                return;
            }

            _updateTimer.Stop();
            SoundEngine.StopAllChannels();
            Connection.Close();

            Interface       = null;
            SoundEngine     = null;
            ResourceManager = null;
            StateManager    = null;

            Map             = null;
            ATOMs           = null;
            ScreenObjects   = null;
            IconAppearances = null;

            MainWindow.Show();
        }
コード例 #2
0
ファイル: OpenDream.cs プロジェクト: ike709/OpenDream
        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 DreamSoundEngine();
            ResourceManager = new DreamResourceManager();
            StateManager    = new DreamStateManager();

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

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