1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using UnityEngine;
- using System;
- using Sfs2X.Entities.Data;
- public class Message
- {
- public const string LABEL_COMMAND = "c";
- public const string LABEL_DATA = "p";
- public const string LABEL_DATA_ARRAY = "a";
- public const string LABEL_SENDER = "sd";
- public const string LABEL_TIMESTAMP = "ts";
- public int sender = -1;
- public string cmd;
- public ISFSObject data;
- public bool isRoomMsg; // only use at cmd is MessageArray to check send to room or zone
- public Message()
- {
-
- }
- public Message (ISFSObject msg)
- {
- this.cmd = msg.GetUtfString (LABEL_COMMAND);
- this.data = msg.GetSFSObject (LABEL_DATA);
- }
- public Message (string cmd, ISFSObject data)
- {
- this.cmd = cmd;
- this.data = data;
- }
- public ISFSObject GetMessagePackage()
- {
- ISFSObject pack = new SFSObject();
- pack.PutUtfString(LABEL_COMMAND, cmd);
- pack.PutSFSObject(LABEL_DATA, data);
- return pack;
- }
- public virtual bool AttempOverride(Message msg)
- {
- return false;
- }
-
- public static void TraceSfsObject(ISFSObject obj)
- {
- Debuger.Log("GetDump : "+obj.GetDump());
- }
- }
|