Exemple #1
0
    CocoWidget* UIInputManager::checkEventWidget(cocos2d::CCPoint &touchPoint)
    {
        if (!this->m_bWidgetBeSorted){
            this->sortWidgets();
        }
        
//        for (int i=0;i<this->m_manageredWidget->count();i++) {
//            CocoWidget* widget = (CocoWidget*)(this->m_manageredWidget->objectAtIndex(i));
//            printf("widget name == [%s] z == [%d]\n",widget->getName().c_str(),widget->getWidgetZOrder());
//        }
        
        for (int i=0;i<this->m_manageredWidget->count();i++){
            CocoWidget* widget = (CocoWidget*)(this->m_manageredWidget->objectAtIndex(i));
            
            if(widget->pointAtSelfBody(touchPoint)){
                if (!widget->checkVisibleDependParent(touchPoint)){
                    continue;
                }
                if (i != this->m_manageredWidget->count()-1){
                    int j = i+1;
                    for (;j < this->m_manageredWidget->count();j++){
                        CocoWidget* widget = (CocoWidget*)(m_manageredWidget->objectAtIndex(j));
                        widget->didNotSelectSelf();
                    }
                }
                return widget;
            }else{
                widget->didNotSelectSelf();
            }
        }
        return NULL;
    }
Exemple #2
0
CocoWidget* UIInputManager::checkEventWidget(cocos2d::CCPoint &touchPoint)
{
    if (!m_bWidgetBeSorted && m_pRootWidget)
    {
        this->sortWidgets(m_pRootWidget);
    }
    int widgetCount = this->m_manageredWidget->count();
    for (int i=0;i<widgetCount;i++)
    {
        CocoWidget* widget = (CocoWidget*)(this->m_manageredWidget->objectAtIndex(i));
        
        if(widget->pointAtSelfBody(touchPoint))
        {
            if (!widget->checkVisibleDependParent(touchPoint))
            {
                continue;
            }
            if (i != this->m_manageredWidget->count()-1){
                int j = i+1;
                for (;j < this->m_manageredWidget->count();j++)
                {
                    CocoWidget* wid = (CocoWidget*)(m_manageredWidget->objectAtIndex(j));
                    wid->didNotSelectSelf();
                }
            }
            return widget;
        }
        else
        {
            widget->didNotSelectSelf();
        }
    }
    return NULL;
}