예제 #1
0
        public static void Init(int port)
        {
            m_port = port;

            LiteNetLibTransport transport = new LiteNetLibTransport();

            transport.SetDiscoveryServer(true, port);
            LiteNetLibSerializer serializer = new LiteNetLibSerializer();

            netManager = new NetworkClientManager(transport, serializer);

            controllerManager.Init(netManager);

            if (OnInit != null)
            {
                OnInit();
            }
        }
        ////public NetControllerManager(NetworkClientManager netManager)
        ////{
        ////    this.netManager = netManager;
        ////}
        public void Init(NetworkClientManager netManager)
        {
            this.netManager = netManager;

            allService.Clear();

            Type[] childTypes = ReflectionTool.GetChildTypes(typeof(ClientControllerBase));

            foreach (var item in childTypes)
            {
                if (item.IsAbstract)
                {
                    continue;
                }
                Add(item);
            }

            foreach (var item in allService)
            {
                item.Value.OnInit();
            }
        }
예제 #3
0
 public void SetNetworkClientManager(NetworkClientManager netManager)
 {
     this.netManager = netManager;
 }