/// <summary> /// Send a message to all clients using Photon /// </summary> /// <param name="msgType">Type of message. This specifies /// the type of the payload. This is important in /// networked scenarios, when proper deseriaization into /// the correct type requires knowing what was /// used to serialize the object originally. /// </param> /// <param name="msg">The message to send.</param> public override void MmSendMessageToClient(MmMessage msg) { byte eventCode = (byte)(1); object[] data = msg.Serialize(); RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent(eventCode, data, raiseEventOptions, SendOptions.SendReliable); }
/// <summary> /// Send a message to a specific client over chosen Photon. /// </summary> /// <param name="channelId">Client connection ID</param> /// <param name="msgType">Type of message. This specifies /// the type of the payload. This is important in /// networked scenarios, when proper deseriaization into /// the correct type requires knowing what was /// used to serialize the object originally. /// </param> /// <param name="msg">The message to send.</param> public override void MmSendMessageToClient(int channelId, MmMessage msg) { byte eventCode = (byte)(1); object[] data = msg.Serialize(); RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = ReceiverGroup.All }; SendOptions sendOptions = new SendOptions { Reliability = true, Channel = (byte)channelId }; PhotonNetwork.RaiseEvent(eventCode, data, raiseEventOptions, sendOptions); }