Exemple #1
0
        /// <summary>
        /// 处理消息:当某个mono发送了消息后,消息会被发送到对应的Manager,
        /// 调用ProcessEvent方法将该消息转发给相应的监听者
        /// </summary>
        /// <param name="tmpMsg"></param>
        public override void ProcessMessage(MessageBase tmpMsg)
        {
            if (!m_eventTree.ContainsKey(tmpMsg.m_msgId))
            {
                Debug.LogError("Msg id does not exit in event tree : " + tmpMsg.m_msgId +
                               " Manager id is : " + m_managerId.ToString());
            }
            else
            {
                List <MessageNode> list = new List <MessageNode>();
                m_eventTree.TryGetValue(tmpMsg.m_msgId, out list);

                foreach (MessageNode node in list)
                {
                    if (node.data == this) // 如果是manager自己的消息 则自己处理
                    {
                        ((ManagerBase)(node.data)).ProcessSelfMessage(tmpMsg);
                    }
                    else // manager管辖内 其他mono注册的消息,则分发给相应的Mono处理
                    {
                        node.data.ProcessMessage(tmpMsg);
                    }
                }
            }
        }
Exemple #2
0
 public override string ToString()
 {
     return(new StringBuilder()
            .Append("Manager ID: ")
            .AppendLine(ManagerId.ToString())
            .Append("Name: ")
            .AppendLine(Name)
            .Append("Department: ")
            .AppendLine(Department.ToString())
            .ToString());
 }