Exemplo n.º 1
0
    public bool HandleTestMessage(UITelegram msg)
    {
        string str = msg._extraInfo as string;

        Debug.Log(str);

        return(true);
    }
Exemplo n.º 2
0
 void Update()
 {
     Tick();
     if (_queue.Count > 0)
     {
         UITelegram msg = _queue.Dequeue();
         HandleMessage(msg);
     }
 }
Exemplo n.º 3
0
    public bool HandleMessage(UITelegram msg)
    {
        bool        ret = false;
        UIMessageID id  = (UIMessageID)msg._msgId;

        if (_dict.ContainsKey(id))
        {
            ret = _dict[id](msg);
        }

        return(ret);
    }
Exemplo n.º 4
0
    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;
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
 public void AddMessage(UITelegram msg)
 {
     _queue.Enqueue(msg);
 }