public void SendMessage(HoloNetMessage message, DestinationGroup group, bool isReliable) { SendInternal(message, isReliable, new RaiseEventOptions { Receivers = ConvertDestinationToPhotonReceiverEnum(group) } ); }
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); }
public void SendMessage(HoloNetMessage message, HoloNetPlayer player, bool isReliable) { var photonPlayer = (PhotonHoloNetPlayer)player; SendInternal(message, isReliable, new RaiseEventOptions { TargetActors = new[] { photonPlayer.photonPlayer.ActorNumber } } ); }
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); } }
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); } }
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); }
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; } }
public void Invoke(HoloNetMessage content) { methodInfo.Invoke(component, new[] { content }); }