Ejemplo n.º 1
0
 private NetModule(NetworkManager.PType protocolType)
 {
     if (protocolType == NetworkManager.PType.Kcp)
     {
         NetworkManager.SetupKCP();
     }
     NetworkManager.CreateClient(NETWORK_NAME, protocolType);
     NetworkManager.AddClientEventHandler(NETWORK_NAME, this.ProcessClientEvent);
 }
Ejemplo n.º 2
0
        public TCPTest()
        {
            AssemblyName[] assemblies = Assembly.GetEntryAssembly().GetReferencedAssemblies();
            foreach (AssemblyName assembly in assemblies)
            {
                Assembly.Load(assembly);
            }

            Logger.logAction    = Console.WriteLine;
            Logger.infoAction   = Console.WriteLine;
            Logger.netAction    = Console.WriteLine;
            Logger.warnAction   = Console.WriteLine;
            Logger.errorAction  = Console.WriteLine;
            Logger.factalAction = Console.WriteLine;

            NetworkManager.SetupKCP();
            NetworkManager.CreateClient(NETWORK_NAME, NetworkManager.PType.Tcp);
            NetworkManager.AddClientEventHandler(NETWORK_NAME, this.ProcessClientEvent);
            NetworkManager.Connect(NETWORK_NAME, "127.0.0.1", 2551);
        }
Ejemplo n.º 3
0
        public NetworkTest()
        {
            NetworkManager.AddPacketTypes();
            NetworkManager.CreateServer(SERVER_NAME, NetworkManager.PType.Tcp, 10);
            NetworkManager.AddServerEventHandler(SERVER_NAME, this.ProcessServerEvent);
            NetworkManager.StartServer(SERVER_NAME, 2551);

            NetworkManager.CreateClient(CLIENT_NAME, NetworkManager.PType.Tcp);
            NetworkManager.AddClientEventHandler(CLIENT_NAME, this.ProcessClientEvent);
            NetworkManager.Connect(CLIENT_NAME, "127.0.0.1", 2551);

            int i = 300;

            while (i > 0)
            {
                NetworkManager.Update(10);
                Thread.Sleep(10);
                --i;
            }
            NetworkManager.Dispose();
        }
Ejemplo n.º 4
0
 public LocalBattle(NetworkManager.PType protocolType, string ip, int port)
 {
     NetworkManager.CreateClient(NETWORK_NAME, protocolType);
     NetworkManager.AddClientEventHandler(NETWORK_NAME, this.ProcessClientEvent);
     NetworkManager.Connect(NETWORK_NAME, ip, port);
 }