当前位置: 首页>>代码示例>>C++>>正文


C++ MapPoint::getMapPointVectorForDistance方法代码示例

本文整理汇总了C++中MapPoint::getMapPointVectorForDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ MapPoint::getMapPointVectorForDistance方法的具体用法?C++ MapPoint::getMapPointVectorForDistance怎么用?C++ MapPoint::getMapPointVectorForDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapPoint的用法示例。


在下文中一共展示了MapPoint::getMapPointVectorForDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onTouchEnded

void PropColumnMenu::onTouchEnded(Touch *pTouch, Event *pEvent)
{
    Point point = pTouch->getLocation();
    
    Rect rect = Rect::ZERO;
    rect.origin = m_propColumn->convertToWorldSpace(Point::ZERO);
    rect.size = m_propColumn->getContentSize();
    
    if (rect.containsPoint(point))
    {
        point = m_propColumn->convertToNodeSpace(point);
        int x = (int)point.x / GRID_WIDTH;
        int y = (int)point.y / GRID_HEIGHT;
        y = ROW - y - 1;
        m_propVec[m_editProp->getTag()]->setVisible(true);
        this->swapProp(m_editProp->getTag(), y*COL+x);
    }
    else
    {
        if (m_editProp->getOpacity() == 255)
        {
            GAME_UILAYER->getOperationMenu()->addDrugs(2001);
            ControlButton* btn = GAME_UILAYER->getOperationMenu()->getDrugsBtn();
            btn->stopAllActions();
            ScaleTo* scaleTo = ScaleTo::create(0.1f, 1.0f);
            btn->runAction(scaleTo);
            m_propVec[m_editProp->getTag()]->removeFromParent();
            m_propVec[m_editProp->getTag()] = NULL;
        }
        else
        {
            float r = CCRANDOM_0_1();
            if (r ==1)
                r = 0;
            
            BgMap* bgMap = GAME_SCENE->getCurrBgMap();
            MapPoint playerPosition = MapPoint(Player::sharePlayer()->getPosition());
            
            MapPoint point = MapPointZero;
            std::vector<MapPoint> mapVec;
            M_INT lenght = 1;
            do
            {
                mapVec = playerPosition.getMapPointVectorForDistance(lenght);
                unsigned int index = 0;
                for (; index<mapVec.size(); index++)
                {
                    if (GAME_SCENE->getMapPointForProp(MapPoint(mapVec.at(index))) == NULL)
                    {
                        point = MapPoint(mapVec.at(index));
                    }
                }
                
                CC_BREAK_IF(!point.equals(MapPointZero));
                
                lenght++;
            }
            while (1);

            
            PropIconShow* show = m_propVec[m_editProp->getTag()];
            m_propVec[m_editProp->getTag()] = NULL;
            show->setVisible(true);
            show->retain();
            show->removeFromParent();
            show->setPosition(point.getCCPointValue());
            bgMap->addChild(show, BgMap::getZOrderZero(bgMap));
            show->release();
            show->setScale(0.8f);

            GAME_SCENE->insterMapPointForProp(show, point);
            
            show->setOpacity(0);
            FadeIn* fadeIn = FadeIn::create(0.1f);
            JumpBy* jumpBy = JumpBy::create(0.3f, Point::ZERO, 30, 1);
            Spawn* spawn = Spawn::create(fadeIn, jumpBy, NULL);
            show->runAction(spawn);
            
        }
    }
    m_editProp->removeFromParent();
    m_editProp = NULL;
}
开发者ID:dzwdyc,项目名称:codesssssssss,代码行数:83,代码来源:PropColumn.cpp


注:本文中的MapPoint::getMapPointVectorForDistance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。