public bool HandleTestMessage(UITelegram msg) { string str = msg._extraInfo as string; Debug.Log(str); return(true); }
void Update() { Tick(); if (_queue.Count > 0) { UITelegram msg = _queue.Dequeue(); HandleMessage(msg); } }
public bool HandleMessage(UITelegram msg) { bool ret = false; UIMessageID id = (UIMessageID)msg._msgId; if (_dict.ContainsKey(id)) { ret = _dict[id](msg); } return(ret); }
public void SendMessage(UIMessageID msgId, UIEntity entity, object extraInfo, object extraInfo2) { if (!_dict.ContainsKey(msgId)) { return; } SortedList list = _dict[msgId]; UITelegram msg = new UITelegram((int)msgId, null, -1, extraInfo, extraInfo2); if (entity != null && list.ContainsKey(entity)) { entity.HandleMessage(msg); } else { for (int i = 0; i < list.Count; i++) { UIEntity en = (UIEntity)list.GetKey(i); if (!en.HandleMessage(msg)) { continue; } if (en.BlockType == UIEntity.UIBlockType.BlockAll) { break; } else if (en.BlockType == UIEntity.UIBlockType.BlockLower) { for (int j = i + 1; j < list.Count; j++) { UIEntity ent = (UIEntity)list.GetKey(j); if (en.Priority == ent.Priority) { ent.HandleMessage(msg); } else { return; } } } } } }
public void AddMessage(UITelegram msg) { _queue.Enqueue(msg); }