示例#1
0
        //复合鼠标控制器用来建构一个消息处理链
        //消息在消息链中被各个控制器处理
        public override HandleResult handleMouseEvent(MouseInputEvent e)
        {
            HandleResult result = HandleResult.Pending;

            if (m_current_sub != null)//当前和默认子控制器都可以为null,即没有消息链
            {
                result = m_current_sub.handleMouseEvent(e); //先使用当前子控制器处理消息
                if (result == HandleResult.Leave)
                    m_current_sub = m_default_sub; //当前子控制器退出之后设置为默认子控制器
                else if (result == HandleResult.Done)
                    return result;
            }

            result = base.handleMouseEvent(e);

            return result;
        }
示例#2
0
        public override HandleResult handleKeyboardEvent(KeyboardInputEvent e)
        {
            HandleResult result = HandleResult.Pending;

            if (m_current_sub != null)
            {
                result = m_current_sub.handleKeyboardEvent(e);
                if (result == HandleResult.Leave)
                    m_current_sub = m_default_sub;
                else if (result == HandleResult.Done)
                    return result;
            }

            result = base.handleKeyboardEvent(e);;

            return result;
        }