Esempio n. 1
0
        public override void OnBEventInvoked <H>(BEvent <H> bEvent, H bEHandle, BEventReplicationType eventInvocationType, ENetworkID targetNetworkID)
        {
            // Broadcast locally if still not connected
            if (LocalNetworkID == ENetworkID.LOCAL)
            {
                bEvent.OnProceedInvokation(bEHandle);
                return;
            }

            switch (eventInvocationType)
            {
            case BEventReplicationType.TO_ALL:
                //Broadcast locally
                bEvent.OnProceedInvokation(bEHandle);

                // Publish to all other clients on the network
                foreach (ENetworkID networkID in connectedNetworkIDs.Keys)
                {
                    if (networkID != LocalNetworkID)
                    {
                        Publish_TOPIC_BROADCAST_BEVENT(bEHandle, networkID);
                    }
                }
                break;

            case BEventReplicationType.TO_ALL_OTHERS:
                // Publish to all other clients on the network
                foreach (ENetworkID networkID in connectedNetworkIDs.Keys)
                {
                    if (networkID != LocalNetworkID)
                    {
                        Publish_TOPIC_BROADCAST_BEVENT(bEHandle, networkID);
                    }
                }
                break;

            case BEventReplicationType.LOCAL:
                // Broadcast locally
                bEvent.OnProceedInvokation(bEHandle);
                break;

            case BEventReplicationType.TO_TARGET:
                if (LocalNetworkID == targetNetworkID)
                {
                    // Broadcast locally
                    bEvent.OnProceedInvokation(bEHandle);
                }
                else if (IS_NOT_NONE(targetNetworkID))
                {
                    Publish_TOPIC_BROADCAST_BEVENT(bEHandle, targetNetworkID);
                }
                break;
            }
        }
Esempio n. 2
0
        public override void OnBEventInvoked <H>(BEvent <H> bEvent, H bEHandle, BEventReplicationType eventInvocationType, ENetworkID targetNetworkID)
        {
            // Broadcast locally if still not connected
            if (LocalNetworkID == ENetworkID.LOCAL)
            {
                bEvent.OnProceedInvokation(bEHandle);
                return;
            }

            switch (eventInvocationType)
            {
            case BEventReplicationType.TO_ALL:
                //Broadcast locally
                bEvent.OnProceedInvokation(bEHandle);

                // Server
                if (LocalNetworkID == ENetworkID.HOST)
                {
                    if (IS_NOT_NULL(LocalMirrorPlayerBEventListener))
                    {
                        // Broadcast it to everyone in connectedNetworkControllers
                        LocalMirrorPlayerBEventListener.Server_RequestBroadcastEvent(bEHandle, eventInvocationType, LocalNetworkID, targetNetworkID);
                    }
                }
                else     // Client
                {
                    if (IS_NOT_NULL(LocalMirrorPlayerBEventListener))
                    {
                        // Send to server, which then broadcasts it to everyone in connectedNetworkControllers
                        LocalMirrorPlayerBEventListener.Client_RequestBroadcastEvent(bEHandle, eventInvocationType, LocalNetworkID, targetNetworkID);
                    }
                }
                break;

            case BEventReplicationType.TO_ALL_OTHERS:
                // Server
                if (LocalNetworkID == ENetworkID.HOST)
                {
                    if (IS_NOT_NULL(LocalMirrorPlayerBEventListener))
                    {
                        // Broadcast it to everyone in connectedNetworkControllers
                        LocalMirrorPlayerBEventListener.Server_RequestBroadcastEvent(bEHandle, eventInvocationType, LocalNetworkID, targetNetworkID);
                    }
                }
                else     // Client
                {
                    if (IS_NOT_NULL(LocalMirrorPlayerBEventListener))
                    {
                        // Send to server, which then broadcasts it to everyone in connectedNetworkControllers
                        LocalMirrorPlayerBEventListener.Client_RequestBroadcastEvent(bEHandle, eventInvocationType, LocalNetworkID, targetNetworkID);
                    }
                }
                break;

            case BEventReplicationType.LOCAL:
                // Broadcast locally
                bEvent.OnProceedInvokation(bEHandle);
                break;

            case BEventReplicationType.TO_TARGET:
                // Server
                if (LocalNetworkID == ENetworkID.HOST)
                {
                    if (IS_NOT_NULL(LocalMirrorPlayerBEventListener))
                    {
                        // Broadcast it to target in connectedNetworkControllers
                        LocalMirrorPlayerBEventListener.Server_RequestBroadcastEvent(bEHandle, eventInvocationType, LocalNetworkID, targetNetworkID);
                    }
                }
                else     // Client
                {
                    if (IS_NOT_NULL(LocalMirrorPlayerBEventListener))
                    {
                        // Send to server, which then broadcasts it to target in connectedNetworkControllers
                        LocalMirrorPlayerBEventListener.Client_RequestBroadcastEvent(bEHandle, eventInvocationType, LocalNetworkID, targetNetworkID);
                    }
                }
                break;
            }
        }
Esempio n. 3
0
        public override void OnBEventInvoked <H>(BEvent <H> bEvent, H bEHandle, BEventReplicationType eventInvocationType, ENetworkID targetNetworkID)
        {
            //LogConsole(bEvent.BEventName + " : " + bEHandle.GetDebugMessage());

            bEvent.OnProceedInvokation(bEHandle);
        }