void touchesEnded(const Connection&, std::vector<Touch>& touches) noexcept { if (!touching_) return; auto it = std::find(std::begin(touches), std::end(touches), touching_id_); if (it == std::end(touches)) return; float u = it->pos.x / (float)ci::app::getWindowWidth(); float v = it->pos.y / (float)ci::app::getWindowHeight(); auto ray = camera_.generateRay(u, 1.0f - v, camera_.getAspectRatio()); bool touch_in = touching_widget_->intersects(ray); if (touch_in || (touch_in != touch_in_)) { touching_widget_->startTween(touch_in ? "tween-touch-end" : "tween-touch-out"); } // signal先で自分自身のsetActiveが呼ばれるので、ここで更新 touching_ = false; if (touch_in) { EventParam params = { { "widget", touching_widget_->getName() }, }; event_.signal(touching_widget_->eventMessage(), params); if (touching_widget_->isTouchSound()) { requestSound(event_, touching_widget_->soundMessage()); } } }
void SelectMenuView::onTouchBeautyCard( CCObject* sender , TouchEventType type ) { UIWidget* widget = static_cast<UIWidget*>(sender); if( type == TOUCH_EVENT_ENDED ) {playEffect(EFFECT_CLICK); int beautyIndex = widget->getTag() - CARD_TAG; if( beautyIndex < REAL_BEAUTY_NUM ) { beautyTouched = beautyIndex; _delegate->gotoBeauty(beautyIndex); } CCLOG("touch %s",widget->getName()); } }
void BattleUILayer::AdjustWidgetForScreen(Layout* pLayout) { if (pLayout) { CCArray* pArray = pLayout->getChildren(); if (pArray) { CCObject* pObject = NULL; CCARRAY_FOREACH(pArray, pObject) { UIWidget* pWidget = dynamic_cast<UIWidget*>(pObject); if (pWidget) { const char* pName = pWidget->getName(); if (strcmp(pName,"PanelHeadIcon") == 0) { UIManager::Get()->AdjustWidgetForScreen(pWidget,UIManager::E_LEFT_DOWN,UIManager::E_LEFT_DOWN); } else if (strcmp(pName,"PanelSkillIcon") == 0) { UIManager::Get()->AdjustWidgetForScreen(pWidget,UIManager::E_RIGHT_DOWN,UIManager::E_RIGHT_DOWN); } else if (strcmp(pName,"PanelSmallMap") == 0) { UIManager::Get()->AdjustWidgetForScreen(pWidget,UIManager::E_MID_UP,UIManager::E_MID_UP); } else if (strcmp(pName,"ListViewPanel") == 0) { UIManager::Get()->AdjustWidgetForScreen(pWidget,UIManager::E_LEFT_UP,UIManager::E_LEFT_UP); } else if (strcmp(pName,"ListViewPanel_0") == 0) { UIManager::Get()->AdjustWidgetForScreen(pWidget,UIManager::E_RIGHT_UP,UIManager::E_RIGHT_UP); } } } } }