예제 #1
0
        public void Rpc_OnClientDisconnected(ENetworkID networkID)
        {
            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if (mirrorBEventDispatcher)
            {
                mirrorBEventDispatcher.OnClientDisconnected(networkID);
            }
        }
예제 #2
0
 private void OnDestroy()
 {
     if (BEventManager.IsInstanceSet)
     {
         MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;
         if (mirrorBEventDispatcher)
         {
             mirrorBEventDispatcher.OnMirrorPlayerLeft(this, NetworkID);
         }
     }
 }
예제 #3
0
        private void Rpc_OnBroadcastEvent(string serializedBEHandle, ENetworkID callingNetworkID)
        {
            //Debug.Log("Rpc_OnBroadcastEvent : " + callingNetworkID);

            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if ((mirrorBEventDispatcher) &&
                (mirrorBEventDispatcher.LocalNetworkID != callingNetworkID))
            {
                BEventManager.Instance.OnBEventReplicated(serializedBEHandle);
            }
        }
예제 #4
0
        private void Server_RequestServerNetworkID()
        {
            //Debug.Log("Server_RequestServerNetworkID");

            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if (mirrorBEventDispatcher)
            {
                Debug.Log("Assigned Network ID : " + NetworkID);
                /*networkID = */
                mirrorBEventDispatcher.Server_OnHostStarted(this);
                //mirrorBEventDispatcher.LocalNetworkID = NetworkID;
            }
        }
예제 #5
0
        private void Rpc_OnRefreshAssignedNetworkID(ENetworkID assignedNetworkID)
        {
            //Debug.Log("Rpc_OnRefreshAssignedNetworkID : " + assignedNetworkID);

            networkID = assignedNetworkID;

            // Connect network if not connected yet
            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if (mirrorBEventDispatcher)
            {
                mirrorBEventDispatcher.OnRefreshConnectedNetworkIDs(assignedNetworkID);
            }
        }
예제 #6
0
        private void Target_OnAssignedNetworkID(NetworkConnection networkConnection, ENetworkID assignedNetworkID)
        {
            //Debug.Log("Target_OnAssignedNetworkID : " + assignedNetworkID);

            networkID = assignedNetworkID;

            // Set up MirrorBEventDispatcher
            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if (mirrorBEventDispatcher)
            {
                //mirrorBEventDispatcher.LocalNetworkID = NetworkID;
                //mirrorBEventDispatcher.LocalMirrorPlayerBEventListener = this;
                mirrorBEventDispatcher.Target_OnConnectedToHost(networkID, this);
            }
        }
예제 #7
0
        private void Cmd_OnRequestNetworkID(NetworkIdentity networkIdentity)
        {
            //Debug.Log("Cmd_OnRequestNetworkID : " + networkIdentity.connectionToClient.ToString());

            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if (mirrorBEventDispatcher)
            {
                ENetworkID newNetworkID = mirrorBEventDispatcher.Server_OnNewMirrorPlayerJoined(this);
                if (newNetworkID != ENetworkID.NONE)
                {
                    Debug.Log("Assigned network ID : " + newNetworkID);
                    Target_OnAssignedNetworkID(networkIdentity.connectionToClient, newNetworkID);
                }
            }
        }
예제 #8
0
        private void Target_OnBroadcastEvent(NetworkConnection networkConnection, string serializedBEHandle, ENetworkID callingNetworkID, ENetworkID targetNetworkID)
        {
            //Debug.Log("Target_OnBroadcastEvent : " + callingNetworkID);

            MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;

            if ((mirrorBEventDispatcher) &&
                (mirrorBEventDispatcher.LocalNetworkID != callingNetworkID))
            {
                if (targetNetworkID != BEventManager.Instance.LocalNetworkID)
                {
                    Debug.LogError("Recieved a target rpc but the local networkID is not the same. Target : " + targetNetworkID + " - Local : " + BEventManager.Instance.LocalNetworkID);
                }

                BEventManager.Instance.OnBEventReplicated(serializedBEHandle);
            }
        }
예제 #9
0
        private void Server_OnBroadcastEvent(string serializedBEHandle, BEventReplicationType eventInvocationType, ENetworkID callingNetworkID, ENetworkID targetNetworkID)
        {
            //Debug.Log("Server_OnBroadcastEvent : " + callingNetworkID + " - " + eventInvocationType);

            if (eventInvocationType == BEventReplicationType.TO_TARGET)
            {
                MirrorBEventDispatcher mirrorBEventDispatcher = (MirrorBEventDispatcher)BEventManager.Instance.BEventDispatcher;
                if (mirrorBEventDispatcher)
                {
                    NetworkIdentity targetNetworkIdentity = mirrorBEventDispatcher.GetNetworkIdentity(targetNetworkID);
                    Target_OnBroadcastEvent(targetNetworkIdentity.connectionToClient, serializedBEHandle, callingNetworkID, targetNetworkID);
                }
            }
            else // ALL or ALL_OTHERS
            {
                Rpc_OnBroadcastEvent(serializedBEHandle, callingNetworkID);
            }
        }