public string SetHandler() { if (Data.GetTermType() != TermType.LIST) return "Type of root term is not List"; if (Data.TupleVal.Count <= 0) return "Root term is Empty"; if (Data.TupleVal[0].GetTermType() != TermType.INTEGER) return "ID (First in root) term is not Integer"; Message=GameNetwork.Instance.ReadTable_Find(Data.TupleVal[0].IntVal); if (Message==null) return "Can`t Finde message in table, ID=" + Data.TupleVal[0].IntVal.ToString(); return null; }
public ReceivedMessage(Term aData, MessageToRead msg) { Data = aData; LifeTime = GameNetwork.MaxReciveLifeTime; IsReaded = false; MyNode = null; RawData=null; Message = msg; }
public static int CompareByID(MessageToRead A,MessageToRead B) { if (A.ID>B.ID) return 1; if (A.ID<B.ID) return -1; return 0; }
public ReceivedMessage() { MyNode = null; Data = null; LifeTime = GameNetwork.MaxReciveLifeTime; IsReaded = false; RawData=null; Message = null; }
public MessageToRead RegisterMessageHandler(int msgID, OnMessage Handler) { if (ReadTable_Find(msgID)!=null) return null; MessageToRead msg = new MessageToRead(); msg.ID = msgID; msg.OnReciveMessage = Handler; Sorting.BinaryInsert<MessageToRead>(ref ReadTable,msg,MessageToRead.CompareByID); return msg; }