/// <summary> /// Message copy method /// </summary> /// <returns>Duplicate of MmMessage</returns> public override MmMessage Copy() { MmMessageVector4 newMessage = new MmMessageVector4(this); newMessage.value = value; return(newMessage); }
/// <summary> /// Invoke an MmMethod with parameter: Vector4. /// </summary> /// <param name="mmMethod">MmMethod Identifier - <see cref="MmMethod"/></param> /// <param name="param">MmMethod parameter: Vector4.</param> /// <param name="metadataBlock">Object defining the routing of /// Mmessages through MercuryMessaging Hierarchies. <see cref="MmMetadataBlock"/></param> public virtual void MmInvoke(MmMethod mmMethod, Vector4 param, MmMetadataBlock metadataBlock = null) { MmMessage msg = new MmMessageVector4(param, mmMethod, metadataBlock); MmInvoke(MmMessageType.MmVector4, msg); }
/// <summary> /// Duplicate an MmMessage /// </summary> /// <param name="message">Item to duplicate</param> public MmMessageVector4(MmMessageVector4 message) : base(message) { }
/// <summary> /// Process a message and send it to the associated object. /// </summary> /// <param name="netMsg">UNET network message</param> public virtual void ReceivedMessage(NetworkMessage netMsg) { MmMessageType mmMessageType = (MmMessageType)netMsg.msgType; try { switch (mmMessageType) { case MmMessageType.MmVoid: MmMessage msg = netMsg.ReadMessage <MmMessage>(); MmRelayNodes[msg.NetId].MmInvoke(mmMessageType, msg); break; case MmMessageType.MmInt: MmMessageInt msgInt = netMsg.ReadMessage <MmMessageInt>(); MmRelayNodes[msgInt.NetId].MmInvoke(mmMessageType, msgInt); break; case MmMessageType.MmBool: MmMessageBool msgBool = netMsg.ReadMessage <MmMessageBool>(); MmRelayNodes[msgBool.NetId].MmInvoke(mmMessageType, msgBool); break; case MmMessageType.MmFloat: MmMessageFloat msgFloat = netMsg.ReadMessage <MmMessageFloat>(); MmRelayNodes[msgFloat.NetId].MmInvoke(mmMessageType, msgFloat); break; case MmMessageType.MmVector3: MmMessageVector3 msgVector3 = netMsg.ReadMessage <MmMessageVector3>(); MmRelayNodes[msgVector3.NetId].MmInvoke(mmMessageType, msgVector3); break; case MmMessageType.MmVector4: MmMessageVector4 msgVector4 = netMsg.ReadMessage <MmMessageVector4>(); MmRelayNodes[msgVector4.NetId].MmInvoke(mmMessageType, msgVector4); break; case MmMessageType.MmString: MmMessageString msgString = netMsg.ReadMessage <MmMessageString>(); MmRelayNodes[msgString.NetId].MmInvoke(mmMessageType, msgString); break; case MmMessageType.MmByteArray: MmMessageByteArray msgByteArray = netMsg.ReadMessage <MmMessageByteArray>(); MmRelayNodes[msgByteArray.NetId].MmInvoke(mmMessageType, msgByteArray); break; case MmMessageType.MmTransform: MmMessageTransform msgTransform = netMsg.ReadMessage <MmMessageTransform>(); MmRelayNodes[msgTransform.NetId].MmInvoke(mmMessageType, msgTransform); break; case MmMessageType.MmTransformList: MmMessageTransformList msgTransformList = netMsg.ReadMessage <MmMessageTransformList>(); MmRelayNodes[msgTransformList.NetId].MmInvoke(mmMessageType, msgTransformList); break; case MmMessageType.MmSerializable: MmMessageSerializable msgSerializable = netMsg.ReadMessage <MmMessageSerializable>(); MmRelayNodes[msgSerializable.NetId].MmInvoke(mmMessageType, msgSerializable); break; case MmMessageType.MmGameObject: MmMessageGameObject msgGameObject = netMsg.ReadMessage <MmMessageGameObject>(); MmRelayNodes[msgGameObject.NetId].MmInvoke(mmMessageType, msgGameObject); break; default: throw new ArgumentOutOfRangeException(); } } catch (Exception e) { MmLogger.LogError(e.Message); } }
/// <summary> /// Handle MmMethod: MessageVector4 /// Override this to handle Mercury's Vector4 messages. /// </summary> /// <param name="message"><see cref="MmMessageVector4"/></param> protected virtual void ReceivedMessage(MmMessageVector4 message) { }
/// <summary> /// Process a message and send it to the associated object. /// </summary> /// <param name="photonEvent">Photon RaiseEvent message data</param> public virtual void ReceivedMessage(EventData photonEvent) { short eventCode = (short)photonEvent.Code; if (eventCode != 1) { return; } MmMessageType mmMessageType = (MmMessageType)(eventCode); object[] data = (object[])photonEvent.CustomData; MmMessage msg = new MmMessage(); msg.Deserialize(data); try { switch (msg.MmMessageType) { case MmMessageType.MmVoid: MmRelayNode.MmInvoke(msg); break; case MmMessageType.MmInt: MmMessageInt msgInt = new MmMessageInt(); msgInt.Deserialize(data); MmRelayNode.MmInvoke(msgInt); break; case MmMessageType.MmBool: MmMessageBool msgBool = new MmMessageBool(); msgBool.Deserialize(data); MmRelayNode.MmInvoke(msgBool); break; case MmMessageType.MmFloat: MmMessageFloat msgFloat = new MmMessageFloat(); msgFloat.Deserialize(data); MmRelayNode.MmInvoke(msgFloat); break; case MmMessageType.MmVector3: MmMessageVector3 msgVector3 = new MmMessageVector3(); msgVector3.Deserialize(data); MmRelayNode.MmInvoke(msgVector3); break; case MmMessageType.MmVector4: MmMessageVector4 msgVector4 = new MmMessageVector4(); msgVector4.Deserialize(data); MmRelayNode.MmInvoke(msgVector4); break; case MmMessageType.MmString: MmMessageString msgString = new MmMessageString(); msgString.Deserialize(data); MmRelayNode.MmInvoke(msgString); break; case MmMessageType.MmByteArray: MmMessageByteArray msgByteArray = new MmMessageByteArray(); msgByteArray.Deserialize(data); MmRelayNode.MmInvoke(msgByteArray); break; case MmMessageType.MmTransform: MmMessageTransform msgTransform = new MmMessageTransform(); msgTransform.Deserialize(data); MmRelayNode.MmInvoke(msgTransform); break; case MmMessageType.MmTransformList: MmMessageTransformList msgTransformList = new MmMessageTransformList(); msgTransformList.Deserialize(data); MmRelayNode.MmInvoke(msgTransformList); break; case MmMessageType.MmSerializable: MmMessageSerializable msgSerializable = new MmMessageSerializable(); msgSerializable.Deserialize(data); MmRelayNode.MmInvoke(msgSerializable); break; case MmMessageType.MmGameObject: MmMessageGameObject msgGameObject = new MmMessageGameObject(); msgGameObject.Deserialize(data); MmRelayNode.MmInvoke(msgGameObject); break; default: Debug.Log(eventCode); throw new ArgumentOutOfRangeException(); } } catch (Exception e) { MmLogger.LogError(e.Message); } }