示例#1
0
        public static void SetNetworkManager(NetworkManagerBase networkManager)
        {
            if (networkManager != null)
            {
                networkManager.OnRegisterPlayer   -= OnRegisterPlayerMethod;
                networkManager.OnUnregisterPlayer -= OnUnregisterPlayerMethod;
                networkManager.OnRecievePacket    -= OnRecievePacketMethod;
            }
            NetworkManager = networkManager;

            networkManager.OnRegisterPlayer   += OnRegisterPlayerMethod;
            networkManager.OnUnregisterPlayer += OnUnregisterPlayerMethod;
            networkManager.OnRecievePacket    += OnRecievePacketMethod;
        }
        public void SetNetworkManager(NetworkManagerBase networkManager)
        {
            if (networkManager != null)
            {
                networkManager.OnRecievePacket -= Instance.OnRecievePacketMethod;
            }
            NetworkManager = networkManager;

            networkManager.OnRecievePacket += Instance.OnRecievePacketMethod;

            sendTransporterTable    = new Dictionary <int, Transporter> ();
            recieveTransporterTable = new Dictionary <int, Transporter> ();

            CustomPlayerLoopUtility.InsertLoopLast(typeof(UpdateLoop), new PlayerLoopSystem()
            {
                type           = typeof(TransporterManagerUpdate),
                updateDelegate = Instance.Update
            });
        }