Пример #1
0
        public void Reconnect(string tabName)
        {
            var page = Tools.FindTabPage(TabPanel, tabName);

            if (page == null)
            {
                return;
            }

            var connection = ServerManager.FindConnection(page);

            if (connection == null)
            {
                return;
            }

            ServerManager.Disconnect(connection);
            TabPanel.TabPages.Remove(page);

            var newInfo = DataFileManager.Data.AllServers.FirstOrDefault(x => x.Name == connection.ServerInfo.Name);

            if (newInfo == null)
            {
                return;
            }

            ServerManager.Connect(newInfo);
        }
Пример #2
0
 public override void OnAllSetup()
 {
     client = new ClientData(UnityEngine.Random.Range(int.MinValue, int.MaxValue));
     server = Manager.Manager.Server.GetComponent <ServerManager>();
     server.Connect(client);
     client.inputs.hotbar = -1;
 }
Пример #3
0
        public void ServerManager_Connect()
        {
            ServerManager sm = new ServerManager(router);

            Assert.IsFalse(sm.IsConnected);
            sm.Connect(ServiceManager.AbstractEP);
            Assert.IsTrue(sm.IsConnected);
            sm.Disconnect();
            Assert.IsFalse(sm.IsConnected);
        }
Пример #4
0
    public void ConnectToServer()
    {
        if (serverManager == null)
        {
            GameObject newObj = new GameObject();
            serverManager = newObj.AddComponent <ServerManager>();
        }

        serverManager.ip   = "206.189.217.194";
        serverManager.port = int.Parse("6534");

        serverManager.Connect(username);
    }
Пример #5
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ServerList.Text))
            {
                MessageBox.Show("You must first add a server before connecting.");
                return;
            }

            var item = DataFileManager.Data.AllServers.FirstOrDefault(x => x.Name == ServerList.Text);

            if (item == null)
            {
                RefreshServerList();
                return;
            }

            ServerManager.Connect(item);
        }