示例#1
0
GraphicsLayer::~GraphicsLayer()
{
    ASSERT(!s_inPaintContents);
    removeAllChildren();
    removeFromParent();
}
示例#2
0
void MakeItemUI::UpdateUI()
{
    auto layout_Template = m_RootWidget->getChildByName<Layout*>("Layout_Template");
    
    //有新建筑可建或有建筑可建
    auto layout_Item_Template = layout_Template->getChildByName<Layout*>("Layout_Item");
    
    auto layout_Center = m_RootWidget->getChildByName<Layout*>("Layout_Center");
    
    auto lView_List = layout_Center->getChildByName<ListView*>("LView_List");
    
    vector<pair<int, Value>> viv;
    //每次清空 子控件
    lView_List->removeAllChildren();

    vector<pair<int, Value>> viv_MakeItem;
    ValueMap* vm_MakeItem =  &(UserData::getInstance()->GetUserData(UserDataEnum::MakeItem)->asValueMap());
    UserData::getInstance()->VMSKToVIV_Sort(vm_MakeItem, &viv_MakeItem);
    
    for (auto iter = viv_MakeItem.begin(); iter != viv_MakeItem.end(); iter++)
    {
        auto cfgId = iter->first;
        if(UserData::getInstance()->Check_VI_Fun(UserDataEnum::OnlyItemList, Value(cfgId)))
        {
            continue;
        }
        
        auto layout_Item = layout_Item_Template->clone();
        layout_Item->setVisible(true);
        lView_List->addChild(layout_Item);
        CfgDataRow dataRow(cfgId);
        
        auto langId = dataRow.GetValue(CfgField::Name)->asInt();
        auto langText = MultiLanguage::getInstance()->GetText(langId);
        
        auto btn_Name = layout_Item->getChildByName<Button*>("Btn_Name");
        btn_Name->setTitleText(langText.c_str());
        btn_Name->getChildByName<ImageView*>("Sprite_New")->setVisible(iter->second.asBool());
        UIUtils::getInstance()->addMakeBatches(btn_Name, this, cfgId);
        btn_Name->addClickEventListener([this, cfgId, btn_Name](Ref* sender)
        {
            if (btn_Name->getTag() == BTN_IS_LONGBTN) {
                btn_Name->setTag(BTN_NOT_LONGBTN);
                return;
            }
            
            CfgDataRow dataRow(cfgId);
            auto vmi_Price = dataRow.GetValue(CfgField::MaterialID_M)->asIntMultiKeyMap();
            
            vector<pair<int, int> > lackData;
            bool delResutl = UserData::getInstance()->DeleteStorehouseData(&vmi_Price, &lackData);
            if (delResutl)
            {
                makeItemEvent(cfgId);
                MsgListNode::getInstance()->NewMsg(cfgId, 1, CfgField::Schedule);
                UpdateUI();
            }else
            {
                int totalNum = UIUtils::getInstance()->getLackCostDiamond(&lackData);
                string showText = StringUtils::format(MultiLanguage::getInstance()->GetText((int)LanguageIdEnum::Diamond_ToGet).c_str(), totalNum) + MultiLanguage::getInstance()->GetText(dataRow.GetValue(CfgField::Name)->asInt());
                UIUtils::getInstance()->addLeadBuyLayer(this, showText, totalNum,
                                                        [=]()
                                                        {
                                                            UIUtils::getInstance()->costUpgNeededItem(&vmi_Price, &lackData);
                                                            makeItemEvent(cfgId);
                                                            MsgListNode::getInstance()->NewMsg(cfgId, 1, CfgField::Schedule);
                                                            UpdateUI();
                                                        });
                
                MoveText::getInstance()->LackResText(m_RootWidget, &lackData);
            }
            
        });
        
        auto level = dataRow.GetValue(CfgField::Level)->asInt();
        auto layout_Start = layout_Item->getChildByName<Layout*>("Start");
        if (layout_Start != nullptr)
        {
            for (auto i = 1; i <= level; i++)
            {
                auto startName = StringUtils::format("Start_%d", i - 1);
                auto imgStart = layout_Start->getChildByName<ImageView*>(startName);
                if (imgStart != nullptr) imgStart->setVisible(true);
            }
        }

        viv.clear();
        auto vmim = dataRow.GetValue(CfgField::MaterialID_M)->asIntMultiKeyMap();
        CfgData::getInstance()->VMIMKToVIV_Sort(&vmim, &viv);
        for (auto i = 0; i < (viv.size() > 3 ? 3 : viv.size()); i++)
        {
            auto textName = StringUtils::format("Text_NameNum%d",i);
            auto text_NameNum = layout_Item->getChildByName<Text*>(textName);
            langId = CfgData::getInstance()->GetValue(viv[i].first, CfgField::Name)->asInt();
            langText = MultiLanguage::getInstance()->GetText(langId);
            
            text_NameNum->setString(StringUtils::format("%s x%d", langText.c_str(), viv[i].second.asInt()));
            if(!UIUtils::getInstance()->isStuffEnough(viv[i].first, viv[i].second.asInt()))
            {
                // 数量不足,置灰
                text_NameNum->setColor(Color3B(128, 128, 128));
            }
        }
        
        auto btn_Explain = layout_Item->getChildByName<Button*>("Btn_Explain");
        btn_Explain->addClickEventListener([=](Ref* sender)
           {
               CfgDataRow dataRow(cfgId);
               auto langId = dataRow.GetValue(CfgField::Details)->asInt();
               auto langText = MultiLanguage::getInstance()->GetText(langId);
               TextExplainNode::getInstance()->UpdateText(m_RootWidget, &langText);
           });
    }
    lView_List->refreshView();
}
示例#3
0
AlertWindow::~AlertWindow()
{
    removeAllChildren();
}
示例#4
0
void ListView::removeAllItems()
{
    removeAllChildren();
}
示例#5
0
GameFrame::~GameFrame()
{
    EventManager::Shared()->UnRegisterCmdEvent(this);
    EventManager::Shared()->UnRegisterGameEvent(this);
    removeAllChildren();
}
void ListView::removeAllItems()
{
    _items->removeAllObjects();
    removeAllChildren();
}
void SoColorShape::compute() {
   enableNotify(false);
   // alles schoen auf nichts zurücksetzen
   if (_vertexPropArray) { delete[] _vertexPropArray; _vertexPropArray = 0; }
   if (_sizeCoordinate3) { delete[] _sizeCoordinate3; _sizeCoordinate3 = 0; }

   if (_vertexSet)   {
      for (int index = 0; index < (_extentX * _extentY * _extentZ); index++) 
         _vertexSet[index].clear();
      delete[] _vertexSet;     
      _vertexSet = 0; 
   }
   if (_triangleSet) { 
      for (int index = 0; index < (_extentX * _extentY * _extentZ); index++) 
         _triangleSet[index].clear(); 
      delete[] _triangleSet; 
      _triangleSet = 0; 
   }
   if (_edgeSet)     { 
      for (int index = 0; index < (_extentX * _extentY * _extentZ); index++) 
         _edgeSet[index].clear();     
      delete[] _edgeSet;     
      _edgeSet = 0; 
   }
   removeAllChildren();

   if (input.getValue() != 0) {
      // Bounding Box bestimmen
      SoComputeBoundingBox* bbact = new SoComputeBoundingBox;
      SoTranslation *min = new SoTranslation, *max = new SoTranslation;
      min->ref(); max->ref();
      bbact->ref();
      bbact->node = input.getValue();
      min->translation.connectFrom(&bbact->min);
      max->translation.connectFrom(&bbact->max);
      SbBox3f bBox(min->translation.getValue(), max->translation.getValue());

      min->unref(), max->unref();
      bbact->unref();

      // Eingang hat sich geändert
      if (!bBox.isEmpty()) {
         // Array fuer _edgeSet und _triangleSet set-Instanzen initialisieren
         float xSize, ySize, zSize;
         bBox.getSize(xSize, ySize, zSize);
         _offSet = bBox.getMin();

         _extentX = xSize / (float) HASH_PARTITION + 1; 
         _extentY = ySize / (float) HASH_PARTITION + 1; 
         _extentZ = zSize / (float) HASH_PARTITION + 1;

         _vertexSet =   new std::set<Vertex*, ltVertex>[_extentX * _extentY * _extentZ];
         _edgeSet =     new std::set<Edge*,   ltEdge  >[_extentX * _extentY * _extentZ];
         _triangleSet = new std::set<Triangle*        >[_extentX * _extentY * _extentZ];

         _vertexPropArray = new SoVertexProperty*[_extentX * _extentY * _extentZ];
         int index = 0;
         for (index = 0; index < (_extentX * _extentY * _extentZ); index++)
            _vertexPropArray[index] = 0;

         _sizeCoordinate3 = new int[_extentX * _extentY * _extentZ];
         for (index = 0; index < (_extentX * _extentY * _extentZ); index++)
            _sizeCoordinate3[index] = -1;

         // Dreiecke aufsammeln
         _myAction->apply(input.getValue());

         // SoIndexedTriangleStripSet erstellen
         generateITSS();
      }
   }
   enableNotify(true);
   touch();
}
示例#8
0
void Box2dContainer::onExit() {
    cocos2d::Node::onExit();
    removeAllChildren();
};
示例#9
0
SbBool
SoUnknownNode::readInstance(SoInput *in, unsigned short flags)

//
////////////////////////////////////////////////////////////////////////
{
    int i;

    // This is mostly the normal SoGroup reading code, but we look for
    // an alternateRep field after reading and move our public
    // children onto the hidden children list:

    hasChildren = (!in->isBinary() || (flags & IS_GROUP));
    SbBool result;
    if (hasChildren) {
	result = SoGroup::readInstance(in, flags);

	// If read ASCII AND didn't read any children, set hasChildren
	// to FALSE:
	if (!in->isBinary() && getNumChildren() == 0) hasChildren = FALSE;

	// Add all kids to hiddenChildren, then remove them all from the
	// regular (SoGroup) list
	for (i = 0; i < getNumChildren(); i++) {
	    hiddenChildren.append(getChild(i));
	}
	removeAllChildren();
    }
    else {
	result = SoNode::readInstance(in, flags);
    }

    // Check to see if an alternate representation was read and
    // store a pointer to it if one is found.
    int num = instanceFieldData->getNumFields();
    SbBool haveAlternateRep = FALSE;
    for (i=0; i<num; i++) {
        if (instanceFieldData->getFieldName(i) == SbName("alternateRep")) {
	    SoField *f = instanceFieldData->getField(this, i);
	    if (f->isOfType(SoSFNode::getClassTypeId())) {
		haveAlternateRep = TRUE;
		SoSFNode *alternateRepField = (SoSFNode *)f;
		SoNode *n = alternateRepField->getValue();
		if (n != NULL)
		    addChild(n);
	    }
            break;
        }
    }

    // If no alternateRep was specified, look for a field named "isA"
    // of type MFString and try to automatically create an
    // alternateRep:
    if (!haveAlternateRep) for (i=0; i<num; i++) {
        if (instanceFieldData->getFieldName(i) == SbName("isA")) {
	    SoField *f = instanceFieldData->getField(this, i);
	    if (f->isOfType(SoMFString::getClassTypeId())) {
		createFromIsA((SoMFString *)f);
	    }
	}
    }

    return result;
}
示例#10
0
HUDLayer::~HUDLayer(){
	CCLOG("HUD Layer destruct");
	mm->Detach(this);
	mm = nullptr;
	removeAllChildren();
}
void CustomSpritePage::unloadUI()
{
    removeAllChildren();
}
示例#12
0
BaseNode::~BaseNode(){
//	DebugLog("delete a node");
	removeAllComponement();
	removeAllChildren();
	_count--;
}
示例#13
0
CCGSpell::~CCGSpell(void)
{
	removeAllChildren();
	dettachLuaScript();
}
示例#14
0
MechListBoxItem::~MechListBoxItem()
{
	removeAllChildren( false );
}
示例#15
0
HCtrl::~HCtrl()
{
	delete m_pImglist;
	
	removeAllChildren();
}
示例#16
0
void PageView::removeAllPages()
{
    removeAllChildren();
}
void ActionDiceStateSelected::changeState(Dice* dice) {
  auto sprite = dice->getSprite();
  sprite->removeAllChildren();
  
  dice->setState(ActionDiceStateNormal::create());
}
示例#18
0
ACTPlayer::~ACTPlayer(void)
{
	removeAllChildren();
}
示例#19
0
FTGPlayer::~FTGPlayer(void)
{
	removeAllChildren();
}
示例#20
0
void wyNode::removeAllChildrenLocked(bool cleanup) {
    pthread_mutex_lock(&gMutex);
    removeAllChildren(cleanup);
    pthread_mutex_unlock(&gMutex);
}
示例#21
0
ccHObject::~ccHObject()
{
	removeAllChildren();
}
示例#22
0
	void ScoreText::collect(float)
	{
		removeAllChildren();
		removeFromParent();
	}
GraphicsLayer::~GraphicsLayer()
{
    removeAllChildren();
    removeFromParent();
}
示例#24
0
void WallSingleScene::onExit(){
	CCLayer::onExit();
	CCLog("WallSingleScene::onExit");
	removeAllChildren();
	hanzis.clear();
}
示例#25
0
void LoadingScene::onExit()
{
	Layer::onExit();
	removeAllChildren();
}
示例#26
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
Transform::~Transform()
{
    removeAllChildren();
}
示例#27
0
bool CCArmature::init(const char *name)
{
    bool bRet = false;
    do
    {
        removeAllChildren();

        CC_SAFE_DELETE(m_pAnimation);
        m_pAnimation = new CCArmatureAnimation();
        m_pAnimation->init(this);

        CC_SAFE_DELETE(m_pBoneDic);
        m_pBoneDic	= new CCDictionary();

        CC_SAFE_DELETE(m_pTopBoneList);
        m_pTopBoneList = new CCArray();
        m_pTopBoneList->init();

        CC_SAFE_DELETE(m_pTextureAtlasDic);
        m_pTextureAtlasDic = new CCDictionary();

        m_sBlendFunc.src = CC_BLEND_SRC;
        m_sBlendFunc.dst = CC_BLEND_DST;


        m_strName = name == NULL ? "" : name;

        CCArmatureDataManager *armatureDataManager = CCArmatureDataManager::sharedArmatureDataManager();

        if(m_strName.length() != 0)
        {
            m_strName = name;

            CCAnimationData *animationData = armatureDataManager->getAnimationData(name);
            CCAssert(animationData, "CCAnimationData not exist! ");

            m_pAnimation->setAnimationData(animationData);


            CCArmatureData *armatureData = armatureDataManager->getArmatureData(name);
            CCAssert(armatureData, "");

            m_pArmatureData = armatureData;


            CCDictElement *_element = NULL;
            CCDictionary *boneDataDic = &armatureData->boneDataDic;
            CCDICT_FOREACH(boneDataDic, _element)
            {
                CCBone *bone = createBone(_element->getStrKey());

                //! init bone's  CCTween to 1st movement's 1st frame
                do
                {

                    CCMovementData *movData = animationData->getMovement(animationData->movementNames.at(0).c_str());
                    CC_BREAK_IF(!movData);

                    CCMovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
                    CC_BREAK_IF(!movBoneData || movBoneData->frameList.count() <= 0);

                    CCFrameData *frameData = movBoneData->getFrameData(0);
                    CC_BREAK_IF(!frameData);

                    bone->getTweenData()->copy(frameData);
                    bone->changeDisplayWithIndex(frameData->displayIndex, false);
                }
                while (0);
            }

            update(0);
            updateOffsetPoint();
        }
EditorMenuManager::~EditorMenuManager()
{
    removeAllChildren();
}
示例#29
0
void ListView::removeAllItems()
{
    _items.clear();
    removeAllChildren();
}
LogisticsPilotListBoxItem::~LogisticsPilotListBoxItem()
{
	removeAllChildren(0);
}