Terraria.Netplay.ClientLoopSetup C# (CSharp) Method

ClientLoopSetup() private static method

private static ClientLoopSetup ( RemoteAddress address ) : void
address Terraria.Net.RemoteAddress
return void
        private static void ClientLoopSetup(RemoteAddress address)
        {
            Netplay.ResetNetDiag();
            Main.ServerSideCharacter = false;
            if (Main.rand == null)
                Main.rand = new Random((int)DateTime.Now.Ticks);
            if (WorldGen.genRand == null)
                WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
            Main.player[Main.myPlayer].hostile = false;
            Main.clientPlayer = (Player)Main.player[Main.myPlayer].clientClone();
            for (int index = 0; index < (int)byte.MaxValue; ++index)
            {
                if (index != Main.myPlayer)
                    Main.player[index] = new Player();
            }
            Main.netMode = 1;
            Main.menuMode = 14;
            if (!Main.autoPass)
                Main.statusText = "Connecting to " + address.GetFriendlyName();
            Netplay.disconnect = false;
            Netplay.Connection = new RemoteServer();
            Netplay.Connection.ReadBuffer = new byte[1024];
        }

Usage Example

Exemplo n.º 1
0
        public static void TcpClientLoop(object threadContext)
        {
            Netplay.ClientLoopSetup((RemoteAddress) new TcpAddress(Netplay.ServerIP, Netplay.ListenPort));
            Main.menuMode = 14;
            bool flag = true;

            while (flag)
            {
                flag = false;
                try
                {
                    Netplay.Connection.Socket.Connect((RemoteAddress) new TcpAddress(Netplay.ServerIP, Netplay.ListenPort));
                    flag = false;
                }
                catch
                {
                    if (!Netplay.disconnect)
                    {
                        if (Main.gameMenu)
                        {
                            flag = true;
                        }
                    }
                }
            }
            Netplay.InnerClientLoop();
        }
All Usage Examples Of Terraria.Netplay::ClientLoopSetup