public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup, bool forwardToWebhook) { var opParameters = new Dictionary <byte, object> { [ParameterCode.Code] = eventCode }; if (customEventContent != null) { opParameters[ParameterCode.Data] = customEventContent; } if (cache != EventCaching.DoNotCache) { opParameters[ParameterCode.Cache] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[ParameterCode.ReceiverGroup] = (byte)receivers; } if (interestGroup != 0) { opParameters[ParameterCode.Group] = interestGroup; } if (targetActors != null) { opParameters[ParameterCode.ActorList] = targetActors; } if (forwardToWebhook) { opParameters[ParameterCode.EventForward] = true; //TURNBASED } return(OpCustom(OperationCode.RaiseEvent, opParameters, sendReliable, channelId, false)); }
public void SendEventData(byte eventCode, object eventData, ReceiverGroup receivers = 0, bool sendImmediate = false) { RaiseEventOptions receiveOptions = new RaiseEventOptions(); receiveOptions.Receivers = receivers; PhotonNetwork.RaiseEvent(eventCode, eventData, receiveOptions, SendOptions.SendUnreliable); }
/// <summary> /// Sends a new network event, as long as the data being sent is inherited from INetworkObject and we check the class here, /// everything else is taken care of. /// </summary> /// <param name="netObject">The net object.</param> public async void SendNewNetworkEvent(INetworkObject netObject, ReceiverGroup receiverGroup, DeliveryMode deliveryMode) { await new WaitForBackgroundThread(); /*----------------------------------------------------------------------------------------------------------------------------*/ byte id = (byte)netObject.NetEvent; var message = netObject.NetData; object[] messageArray = await netObject.ConvertToNetworkObject(); /*----------------------------------------------------------------------------------------------------------------------------*/ var eventOptions = new RaiseEventOptions(); eventOptions.CachingOption = EventCaching.DoNotCache; eventOptions.Receivers = receiverGroup; /*----------------------------------------------------------------------------------------------------------------------------*/ var sendOptions = new SendOptions(); sendOptions.DeliveryMode = deliveryMode; /*----------------------------------------------------------------------------------------------------------------------------*/ if (PhotonNetwork.RaiseEvent(id, messageArray, eventOptions, sendOptions)) { } else { } await new WaitForUpdate(); }
public static void Send(byte eventCode, object[] content, ReceiverGroup receivers) { PhotonNetwork.RaiseEvent(eventCode, content, new RaiseEventOptions { Receivers = receivers }, new SendOptions { Reliability = true }); }
//public static void RaiseEvent(EventCode code, object content) //{ // RaiseEventOptions option = new RaiseEventOptions { Receivers = ReceiverGroup.Others }; // SendOptions sendOptions = new SendOptions { Reliability = true }; // PhotonNetwork.RaiseEvent((byte)code, content, option, sendOptions); //} public static void RaiseEvent(EventCode code, object content, ReceiverGroup receiverGroup) { RaiseEventOptions option = new RaiseEventOptions { Receivers = receiverGroup }; SendOptions sendOptions = new SendOptions { Reliability = true }; PhotonNetwork.RaiseEvent((byte)code, content, option, sendOptions); }
private void RaiseEvent(object content, EventCode evCode, ReceiverGroup recGroup) { RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = recGroup }; SendOptions sendOptions = new SendOptions { Reliability = true }; PhotonNetwork.RaiseEvent((byte)evCode, content, raiseEventOptions, sendOptions); }
public void RaiseNetworkEvent(EventCodes eventCode, object[] ctx, ReceiverGroup recievers = ReceiverGroup.All) { RaiseEventOptions eventOpt = new RaiseEventOptions() { Receivers = recievers }; SendOptions sendOpt = new SendOptions() { Reliability = true }; PhotonNetwork.RaiseEvent((byte)eventCode, ctx, eventOpt, sendOpt); }
public void PublishEvent(NetworkEventString networkEvent, string data, ReceiverGroup receiveGroup) { object[] eventData = new object[1] { data }; PhotonNetwork.RaiseEvent(networkEvent.eventCode, eventData, new RaiseEventOptions() { Receivers = receiveGroup }, (networkEvent.sendOptions == EventSendOptions.SendReliable)?SendOptions.SendReliable:SendOptions.SendUnreliable); }
public override bool OpRaiseEvent(byte eventCode, Hashtable evData, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { if (PhotonNetwork.offlineMode) { return false; } return base.OpRaiseEvent(eventCode, evData, sendReliable, channelId, cache, receivers); }
/// <summary> /// Calls operation RaiseEvent on the server, with full control of event-caching and the target receivers. /// </summary> /// <remarks> /// This method is described in one of its overloads. /// /// The cache parameter defines if and how this event will be cached server-side. Per event-code, your client /// can store events and update them and will send cached events to players joining the same room. /// /// The option EventCaching.DoNotCache matches the default behaviour of RaiseEvent. /// The option EventCaching.MergeCache will merge the costomEventContent into existing one. /// Values in the customEventContent Hashtable can be null to remove existing values. /// /// With the receivers parameter, you can chose who gets this event: Others (default), All (includes you as sender) /// or MasterClient. The MasterClient is the connected player with the lowest ActorNumber in this room. /// This player could get some privileges, if needed. /// /// Read more about Cached Events in the DevNet: http://doc.exitgames.com /// </remarks> /// <param name="eventCode">Identifies this type of event (and the content). Your game's event codes can start with 0.</param> /// <param name="customEventContent">Custom data you want to send along (use null, if none).</param> /// <param name="sendReliable">If this event has to arrive reliably (potentially repeated if it's lost).</param> /// <param name="channelId">Number of channel to use (starting with 0).</param> /// <param name="cache">Events can be cached (merged and removed) for players joining later on.</param> /// <param name="receivers">Controls who should get this event.</param> /// <returns>If operation could be enqueued for sending.</returns> public virtual bool OpRaiseEvent(byte eventCode, Hashtable customEventContent, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { Dictionary<byte, object> opParameters = new Dictionary<byte, object>(); opParameters[(byte)LiteOpKey.Data] = customEventContent; opParameters[(byte)LiteOpKey.Code] = (byte)eventCode; if (cache != EventCaching.DoNotCache) { opParameters[(byte)LiteOpKey.Cache] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[(byte)LiteOpKey.ReceiverGroup] = (byte)receivers; } return this.OpCustom((byte)LiteOpCode.RaiseEvent, opParameters, sendReliable, channelId, false); }
public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>(); customOpParameters[(byte)244] = (object)eventCode; if (customEventContent != null) { customOpParameters[(byte)245] = customEventContent; } if (cache != EventCaching.DoNotCache) { customOpParameters[(byte)247] = (object)cache; } if (receivers != ReceiverGroup.Others) { customOpParameters[(byte)246] = (object)receivers; } if ((int)interestGroup != 0) { customOpParameters[(byte)240] = (object)interestGroup; } if (targetActors != null) { customOpParameters[(byte)252] = (object)targetActors; } return(this.OpCustom((byte)253, customOpParameters, sendReliable, channelId, false)); }
public virtual bool OpRaiseEvent(byte eventCode, Hashtable customEventContent, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>(); customOpParameters[(byte)245] = (object)customEventContent; customOpParameters[(byte)244] = (object)eventCode; if (cache != EventCaching.DoNotCache) { customOpParameters[(byte)247] = (object)cache; } if (receivers != ReceiverGroup.Others) { customOpParameters[(byte)246] = (object)receivers; } return(this.OpCustom((byte)253, customOpParameters, sendReliable, channelId, false)); }
/// <summary> /// Used in a room to raise (send) an event to the other players. /// Multiple overloads expose different parameters to this frequently used operation. /// </summary> /// <param name="eventCode">Code for this "type" of event (use a code per "meaning" or content).</param> /// <param name="evData">Data to send. Hashtable that contains key-values of Photon serializable datatypes.</param> /// <param name="sendReliable">Use false if the event is replaced by a newer rapidly. Reliable events add overhead and add lag when repeated.</param> /// <param name="channelId">The "channel" to which this event should belong. Per channel, the sequence is kept in order.</param> /// <param name="cache">Use EventCaching options to store this event for players who join.</param> /// <param name="receivers">ReceiverGroup defines to which group of players the event is passed on.</param> /// <returns>If the operation could be sent (has to be connected).</returns> public virtual bool OpRaiseEvent(byte eventCode, Hashtable evData, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { if (this.DebugOut >= DebugLevel.INFO) { this.Listener.DebugReturn(DebugLevel.INFO, "OpRaiseEvent()"); } Dictionary <byte, object> opParameters = new Dictionary <byte, object>(); opParameters[ParameterCode.Data] = evData; opParameters[ParameterCode.Code] = (byte)eventCode; if (receivers != ReceiverGroup.Others) { opParameters[ParameterCode.ReceiverGroup] = (byte)receivers; } if (cache != EventCaching.DoNotCache) { opParameters[ParameterCode.Cache] = (byte)cache; } return(this.OpCustom((byte)OperationCode.RaiseEvent, opParameters, sendReliable, channelId)); }
/// <summary> /// Send an event with custom code/type and any content to the other players in the same room. /// </summary> /// <remarks>This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.</remarks> /// <param name="eventCode">Identifies this type of event (and the content). Your game's event codes can start with 0.</param> /// <param name="sendReliable">If this event has to arrive reliably (potentially repeated if it's lost).</param> /// <param name="customEventContent">Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).</param> /// <param name="channelId">Command sequence in which this command belongs. Must be less than value of ChannelCount property. Default: 0.</param> /// <param name="cache">Affects how the server will treat the event caching-wise. Can cache events for players joining later on or remove previously cached events. Default: DoNotCache.</param> /// <param name="targetActors">List of ActorNumbers (in this room) to send the event to. Overrides caching. Default: null.</param> /// <param name="receivers">Defines a target-player group. Default: Others.</param> /// <param name="interestGroup">Defines to which interest group the event is sent. Players can subscribe or unsibscribe to groups. Group 0 is always sent to all. Default: 0.</param> /// <returns>If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.</returns> public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { Dictionary<byte, object> opParameters = new Dictionary<byte, object>(); opParameters[(byte)LiteOpKey.Code] = (byte)eventCode; if (customEventContent != null) { opParameters[(byte)LiteOpKey.Data] = customEventContent; } if (cache != EventCaching.DoNotCache) { opParameters[(byte)LiteOpKey.Cache] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[(byte)LiteOpKey.ReceiverGroup] = (byte)receivers; } if (interestGroup != 0) { opParameters[(byte)LiteOpKey.Group] = (byte)interestGroup; } if (targetActors != null) { opParameters[(byte)LiteOpKey.ActorList] = targetActors; } return this.OpCustom((byte)LiteOpCode.RaiseEvent, opParameters, sendReliable, channelId, false); }
public void RaiseNetworkEvent(EventCodes eventCode, ReceiverGroup recievers = ReceiverGroup.All) { RaiseNetworkEvent(eventCode, new object[] { }, recievers); }
public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { return OpRaiseEvent(eventCode, sendReliable, customEventContent, channelId, cache, targetActors, receivers, interestGroup, false); }
public virtual bool OpRaiseEvent(byte eventCode, Hashtable evData, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { return this.OpRaiseEvent(eventCode, sendReliable, evData, channelId, cache, null, receivers, 0, false); }
public override bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { if (PhotonNetwork.offlineMode) { return false; } return base.OpRaiseEvent(eventCode, sendReliable, customEventContent, channelId, cache, targetActors, receivers, interestGroup); }
///<summary> /// Calls operation RaiseEvent on the server, with full control of event-caching and the target receivers. /// </summary> /// <remarks> /// This method is described in one of its overloads. /// The cache parameter defines if and how this event will be cached server-side. Per event-code, your client /// can store events and update them and will send cached events to players joining the same room. /// The option EventCaching.DoNotCache matches the default behaviour of RaiseEvent. /// The option EventCaching.MergeCache will merge the costomEventContent into existing one. /// Values in the customEventContent Hashtable can be null to remove existing values. /// With the receivers parameter, you can chose who gets this event: Others (default), All (includes you as sender) /// or MasterClient. The MasterClient is the connected player with the lowest ActorNumber in this room. /// This player could get some privileges, if needed. /// Read more about Cached Events in the DevNet: http://doc.exitgames.com /// </remarks> /// <param name="eventCode">Identifies this type of event (and the content). Your game's event codes can start with 0.</param> /// <param name="customEventContent">Custom data you want to send along (use null, if none).</param> /// <param name="sendReliable">If this event has to arrive reliably (potentially repeated if it's lost).</param> /// <param name="channelId">Number of channel to use (starting with 0).</param> /// <param name="cache">Events can be cached (merged and removed) for players joining later on.</param> /// <param name="receivers">Controls who should get this event.</param> /// <returns>If operation could be enqueued for sending.</returns> public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { Dictionary <byte, object> opParameters = new Dictionary <byte, object>(); opParameters[0xf4] = eventCode; if (customEventContent != null) { opParameters[0xf5] = customEventContent; } if (cache != EventCaching.DoNotCache) { opParameters[0xf7] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[0xf6] = (byte)receivers; } if (interestGroup != 0) { opParameters[240] = interestGroup; } if (targetActors != null) { opParameters[0xfc] = targetActors; } return(this.OpCustom(0xfd, opParameters, sendReliable, channelId, false)); }
///<summary> /// Calls operation RaiseEvent on the server, with full control of event-caching and the target receivers. /// </summary> /// <remarks> /// This method is described in one of its overloads. /// The cache parameter defines if and how this event will be cached server-side. Per event-code, your client /// can store events and update them and will send cached events to players joining the same room. /// The option EventCaching.DoNotCache matches the default behaviour of RaiseEvent. /// The option EventCaching.MergeCache will merge the costomEventContent into existing one. /// Values in the customEventContent Hashtable can be null to remove existing values. /// With the receivers parameter, you can chose who gets this event: Others (default), All (includes you as sender) /// or MasterClient. The MasterClient is the connected player with the lowest ActorNumber in this room. /// This player could get some privileges, if needed. /// Read more about Cached Events in the DevNet: http://doc.exitgames.com /// </remarks> /// <param name="eventCode">Identifies this type of event (and the content). Your game's event codes can start with 0.</param> /// <param name="customEventContent">Custom data you want to send along (use null, if none).</param> /// <param name="sendReliable">If this event has to arrive reliably (potentially repeated if it's lost).</param> /// <param name="channelId">Number of channel to use (starting with 0).</param> /// <param name="cache">Events can be cached (merged and removed) for players joining later on.</param> /// <param name="receivers">Controls who should get this event.</param> /// <returns>If operation could be enqueued for sending.</returns> public virtual bool OpRaiseEvent(byte eventCode, Hashtable customEventContent, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { Dictionary <byte, object> opParameters = new Dictionary <byte, object>(); opParameters[0xf5] = customEventContent; opParameters[0xf4] = eventCode; if (cache != EventCaching.DoNotCache) { opParameters[0xf7] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[0xf6] = (byte)receivers; } return(this.OpCustom(0xfd, opParameters, sendReliable, channelId, false)); }
public virtual bool OpRaiseEvent(byte eventCode, Hashtable evData, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { return(OpRaiseEvent(eventCode, sendReliable, evData, channelId, cache, null, receivers, 0, false)); }
/// <summary> /// Send an event with custom code/type and any content to the other players in the same room. /// </summary> /// <remarks>This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.</remarks> /// <param name="eventCode">Identifies this type of event (and the content). Your game's event codes can start with 0.</param> /// <param name="sendReliable">If this event has to arrive reliably (potentially repeated if it's lost).</param> /// <param name="customEventContent">Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).</param> /// <param name="channelId">Command sequence in which this command belongs. Must be less than value of ChannelCount property. Default: 0.</param> /// <param name="cache">Affects how the server will treat the event caching-wise. Can cache events for players joining later on or remove previously cached events. Default: DoNotCache.</param> /// <param name="targetActors">List of ActorNumbers (in this room) to send the event to. Overrides caching. Default: null.</param> /// <param name="receivers">Defines a target-player group. Default: Others.</param> /// <param name="interestGroup">Defines to which interest group the event is sent. Players can subscribe or unsibscribe to groups. Group 0 is always sent to all. Default: 0.</param> /// <returns>If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.</returns> public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { Dictionary <byte, object> opParameters = new Dictionary <byte, object>(); opParameters[(byte)LiteOpKey.Code] = (byte)eventCode; if (customEventContent != null) { opParameters[(byte)LiteOpKey.Data] = customEventContent; } if (cache != EventCaching.DoNotCache) { opParameters[(byte)LiteOpKey.Cache] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[(byte)LiteOpKey.ReceiverGroup] = (byte)receivers; } if (interestGroup != 0) { opParameters[(byte)LiteOpKey.Group] = (byte)interestGroup; } if (targetActors != null) { opParameters[(byte)LiteOpKey.ActorList] = targetActors; } return(this.OpCustom((byte)LiteOpCode.RaiseEvent, opParameters, sendReliable, channelId, false)); }
public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup) { return(OpRaiseEvent(eventCode, sendReliable, customEventContent, channelId, cache, targetActors, receivers, interestGroup, false)); }
/// <summary> /// Used in a room to raise (send) an event to the other players. /// Multiple overloads expose different parameters to this frequently used operation. /// </summary> /// <param name="eventCode">Code for this "type" of event (use a code per "meaning" or content).</param> /// <param name="evData">Data to send. Hashtable that contains key-values of Photon serializable datatypes.</param> /// <param name="sendReliable">Use false if the event is replaced by a newer rapidly. Reliable events add overhead and add lag when repeated.</param> /// <param name="channelId">The "channel" to which this event should belong. Per channel, the sequence is kept in order.</param> /// <param name="cache">Use EventCaching options to store this event for players who join.</param> /// <param name="receivers">ReceiverGroup defines to which group of players the event is passed on.</param> /// <returns>If the operation could be sent (has to be connected).</returns> public virtual bool OpRaiseEvent(byte eventCode, Hashtable evData, bool sendReliable, byte channelId, EventCaching cache, ReceiverGroup receivers) { if (this.DebugOut >= DebugLevel.INFO) { this.Listener.DebugReturn(DebugLevel.INFO, "OpRaiseEvent()"); } Dictionary<byte, object> opParameters = new Dictionary<byte, object>(); opParameters[ParameterCode.Data] = evData; opParameters[ParameterCode.Code] = (byte)eventCode; if (receivers != ReceiverGroup.Others) { opParameters[ParameterCode.ReceiverGroup] = (byte)receivers; } if (cache != EventCaching.DoNotCache) { opParameters[ParameterCode.Cache] = (byte)cache; } return this.OpCustom((byte)OperationCode.RaiseEvent, opParameters, sendReliable, channelId); }
/// <summary> /// Se encapsula el metodo RaiseEvent /// </summary> /// <param name="eventosJuego"></param> /// <param name="param"></param> /// <param name="target"></param> public static void LevantarEventos(CodigoEventosJuego eventosJuego, object param, ReceiverGroup target) { RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = target }; SendOptions sendOptions = new SendOptions { Reliability = true }; PhotonNetwork.RaiseEvent((byte)eventosJuego, param, raiseEventOptions, sendOptions); }
public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent, byte channelId, EventCaching cache, int[] targetActors, ReceiverGroup receivers, byte interestGroup, bool forwardToWebhook) { Dictionary<byte, object> opParameters = new Dictionary<byte, object>(); opParameters[(byte)ParameterCode.Code] = (byte)eventCode; if (customEventContent != null) { opParameters[(byte)ParameterCode.Data] = customEventContent; } if (cache != EventCaching.DoNotCache) { opParameters[(byte)ParameterCode.Cache] = (byte)cache; } if (receivers != ReceiverGroup.Others) { opParameters[(byte)ParameterCode.ReceiverGroup] = (byte)receivers; } if (interestGroup != 0) { opParameters[(byte)ParameterCode.Group] = (byte)interestGroup; } if (targetActors != null) { opParameters[(byte)ParameterCode.ActorList] = targetActors; } if (forwardToWebhook) { opParameters[(byte) ParameterCode.EventForward] = true; //TURNBASED } return this.OpCustom((byte)OperationCode.RaiseEvent, opParameters, sendReliable, channelId, false); }
public void PublishEvent(string eventName, string data, ReceiverGroup receiveGroup) { NetworkEventString e = events.First((x) => x.eventName == eventName); PublishEvent(e, data, receiveGroup); }