コード例 #1
0
 public void SendMessage(HoloNetMessage message, DestinationGroup group, bool isReliable)
 {
     SendInternal(message, isReliable,
                  new RaiseEventOptions {
         Receivers = ConvertDestinationToPhotonReceiverEnum(group)
     }
                  );
 }
コード例 #2
0
 private void SendInternal(HoloNetMessage message, bool isReliable, RaiseEventOptions raiseEventOptions)
 {
     raiseEventOptions.CachingOption = EventCaching.DoNotCache;
     raiseEventOptions.Flags         = WebFlags.Default;
     PhotonNetwork.RaiseEvent(
         (byte)message.messageType,
         HoloNetAppModule.instance.serializer.Serialize(message),
         raiseEventOptions,
         isReliable ? SendOptions.SendReliable : SendOptions.SendUnreliable);
 }
コード例 #3
0
        public void SendMessage(HoloNetMessage message, HoloNetPlayer player, bool isReliable)
        {
            var photonPlayer = (PhotonHoloNetPlayer)player;

            SendInternal(message, isReliable,
                         new RaiseEventOptions {
                TargetActors = new[] { photonPlayer.photonPlayer.ActorNumber }
            }
                         );
        }
コード例 #4
0
 public void OnMessageReceived(HoloNetMessage newMessage)
 {
     if (_isPaused && !overrideMuteMessageTypes.Contains(newMessage.GetType()))
     {
         Debug.Log($"[HOLONET] Messaging - Message received and put to queue: {newMessage.GetType().Name}");
         _objectMessageQueue.Add(newMessage);
     }
     else
     {
         Debug.Log($"[HOLONET] Messaging - Message received: {newMessage.GetType().Name}");
         ApplyMessage(newMessage);
     }
 }
コード例 #5
0
 public void SendMessage(HoloNetMessage message, HoloNetPlayer player, bool isReliable)
 {
     Debug.Log($"[HOLONET] Messaging - Sending message {message.GetType().Name}");
     message.sendTime = HoloNetAppModule.instance.provider.GetServerTime();
     if (player.isLocal)
     {
         ApplyMessage(message);
     }
     else
     {
         HoloNetAppModule.instance.provider.SendMessage(message, player, isReliable);
         HoloNetAppModule.instance.objectPool.Push(message);
     }
 }
コード例 #6
0
        public void SendMessage(HoloNetMessage message, DestinationGroup group, bool isReliable)
        {
            Debug.Log($"[HOLONET] Messaging - Sending message {message.GetType().Name}");
            message.sendTime = HoloNetAppModule.instance.provider.GetServerTime();
            if (group == DestinationGroup.All)
            {
                HoloNetAppModule.instance.provider.SendMessage(message, DestinationGroup.Others, isReliable);
                ApplyMessage(message);
            }
            else if (group == DestinationGroup.Self || (group == DestinationGroup.Server && HoloNetPlayer.Local.isServer))
            {
                ApplyMessage(message);
            }
            else
            {
                HoloNetAppModule.instance.provider.SendMessage(message, group, isReliable);
            }

            HoloNetAppModule.instance.objectPool.Push(message);
        }
コード例 #7
0
        private void ApplyMessage(HoloNetMessage newMessage)
        {
//      Debug.Log($"[HOLONET] Messaging - Applying message {newMessage.GetType().Name}");
            switch (newMessage.messageType)
            {
            case HoloNetMessageType.GLOBAL:
                Publish(newMessage);
                break;

            case HoloNetMessageType.OBJECT:
                var objectMessage = (HoloNetObjectMessage)newMessage;
                var receiver      = HoloNetAppModule.instance.objectsManager.GetObject(objectMessage.receiverId);
                if (receiver == null)
                {
                    break;
                }
                receiver.PublishMessage(objectMessage);
                break;
            }
        }
コード例 #8
0
 public void Invoke(HoloNetMessage content)
 {
     methodInfo.Invoke(component, new[] { content });
 }