示例#1
0
    void OnDestroy()
    {
        VNetDispatch.UnregisterListenerInst <VNetMessageTransformControl>(this.OnTransformControlMessage);
        VNetDispatch.UnregisterListenerInst <VNetMessageNetTransformData>(this.OnTransformDataMessage);
        VNetDispatch.UnregisterListenerInst <VNetMessageSpawnPrefab>(this.OnSpawnPrefabMessage);
        VNetDispatch.UnregisterListenerInst <VNetMessageRunCoroutine>(this.OnRunCoroutineMessage);

        VNetSession.Inst.ClientAddedCallback   -= OnNewClient;
        VNetSession.Inst.ClientRemovedCallback -= OnRemoveClient;

        Inst = null;
    }
示例#2
0
    public void Awake()
    {
        Inst = this;
        m_networkTransforms = new Dictionary <ulong, VNetTransform>();
        m_spawnPrefabs      = new Dictionary <ulong, VNetSpawnPrefab>();
        VNetDispatch.RegisterListenerInst <VNetMessageTransformControl>(this.OnTransformControlMessage);
        VNetDispatch.RegisterListenerInst <VNetMessageNetTransformData>(this.OnTransformDataMessage);
        VNetDispatch.RegisterListenerInst <VNetMessageSpawnPrefab>(this.OnSpawnPrefabMessage);
        VNetDispatch.RegisterListenerInst <VNetMessageRunCoroutine>(this.OnRunCoroutineMessage);

        VNetSession.Inst.ClientAddedCallback   += OnNewClient;
        VNetSession.Inst.ClientRemovedCallback += OnRemoveClient;
    }