Beispiel #1
0
// Collect all leaked elements, passing them to the specified leak dialog.
//
void JSHook::showLeaks(MSHTML::IHTMLWindow2Ptr wnd, CLeakDlg* dlg) {
	// Ensure that all garbage collection is completed so that elements will
	//   be released.
	//
	wnd->execScript(L"window.CollectGarbage()", L"javascript");

	for (std::map<IUnknown*,Elem>::const_iterator it = m_elements.begin(); it != m_elements.end(); ++it) {
		IUnknown *unk = it->first;
		Elem const& elem = it->second;

		// For each element, AddRef() and Release() it.  The latter method will return
		//   the current ref count.
		//
		unk->AddRef();
		int refCount = unk->Release();

		// If any references (other than the one that we hold) are outstanding, then
		//   the element has been leaked.
		//
		if (refCount > 1)
			dlg->addElement(unk, elem.url, refCount - 1);
	}

	// When finished, clear the element list.
	//
	clearElements();
}
Beispiel #2
0
Node &Node::operator=(const Node &node) {
	if(*this != node) {
		clearElements();
		copyElements(node.children);	
	}

	return *this;
};
Beispiel #3
0
Senario::~Senario()
{
    Senario::SP = NULL;
    
    clearElements();
    
    slidesList->removeAllObjects();
    CC_SAFE_RELEASE(slidesList);
}
//------------------------------------------------------------------------------
OpenSoundBundle::~OpenSoundBundle()
{
    clearElements();

    if(dataBuffer)
    {
        delete [] dataBuffer;
        dataBuffer = 0;
    }
}
void plClothingItem::read(hsStream* S, plResManager* mgr) {
    hsKeyedObject::read(S, mgr);

    fItemName = S->readSafeStr();
    fGroup = S->readByte();
    fType = S->readByte();
    fTileset = S->readByte();
    fSortOrder = S->readByte();
    fDescription = S->readSafeStr();
    fCustomText = S->readSafeStr();

    if (S->readBool())
        fIcon = mgr->readKey(S);

    clearElements();
    fElementNames.resize(S->readInt());
    fTextures.resize(fElementNames.size());
    for (size_t i=0; i<fElementNames.size(); i++) {
        fElementNames[i] = S->readSafeStr();
        fTextures[i] = new plKey[kLayerMax];
        size_t count = S->readByte();
        for (size_t j=0; j<count; j++) {
            size_t idx = S->readByte();
            plKey k = mgr->readKey(S);
            if (idx < kLayerMax)
                fTextures[i][idx] = k;
            else
                plDebug::Warning("Throwing away key {}", k.toString());
        }
    }

    for (size_t i=0; i<kNumLODLevels; i++) {
        if (S->readBool())
            fMeshes[i] = mgr->readKey(S);
    }

    fAccessory = mgr->readKey(S);

    for (size_t i=0; i<3; i++) {
        fDefaultTint1[i] = S->readByte();
        fDefaultTint2[i] = S->readByte();
    }
}
Beispiel #6
0
void Senario::clearScenario()
{
    active = false;
    inOption = false;
    notJump = false;
    
    curSlide = 0;
    
    GlobalHelper::clearCache();
    
    clearElements();
    
    slidesList->removeAllObjects();
    CC_SAFE_RELEASE(slidesList);
    
    slidesList = CCArray::create();
    slidesList->retain();
    
    skipSlide = false;
    cumulativeTime = 0;
}
ItemLibrarySortedModel<T>::~ItemLibrarySortedModel()
{
    clearElements();
}
void plClothingItem::IPrcParse(const pfPrcTag* tag, plResManager* mgr) {
    if (tag->getName() == "ClothingName") {
        fItemName = tag->getParam("value", "");
    } else if (tag->getName() == "ClosetOptions") {
        fGroup = tag->getParam("Group", "0").to_uint();
        fType = tag->getParam("Type", "0").to_uint();
        fTileset = tag->getParam("Tileset", "0").to_uint();
        fSortOrder = tag->getParam("SortOrder", "0").to_uint();
    } else if (tag->getName() == "Description") {
        fDescription = "";
        std::list<ST::string> descTokens = tag->getContents();
        for (auto tok = descTokens.begin(); tok != descTokens.end(); ++tok)
            fDescription += *tok + " ";
    } else if (tag->getName() == "CustomText") {
        fCustomText = tag->getParam("value", "");
    } else if (tag->getName() == "Icon") {
        if (tag->hasChildren())
            fIcon = mgr->prcParseKey(tag->getFirstChild());
    } else if (tag->getName() == "Elements") {
        clearElements();
        fElementNames.resize(tag->countChildren());
        fTextures.resize(fElementNames.size());
        const pfPrcTag* child = tag->getFirstChild();
        for (size_t i=0; i<fElementNames.size(); i++) {
            if (child->getName() != "Element")
                throw pfPrcTagException(__FILE__, __LINE__, child->getName());
            fElementNames[i] = child->getParam("Name", "");
            fTextures[i] = new plKey[10];
            size_t nSubChildren = child->countChildren();
            const pfPrcTag* subChild = child->getFirstChild();
            for (size_t j=0; j<nSubChildren; j++) {
                plKey k = mgr->prcParseKey(subChild);
                if (j < kLayerMax)
                    fTextures[i][j] = k;
                else
                    plDebug::Warning("Throwing away key {}", k.toString());
                subChild = subChild->getNextSibling();
            }
            child = child->getNextSibling();
        }
    } else if (tag->getName() == "Meshes") {
        size_t nMeshes = tag->countChildren();
        if (nMeshes != kNumLODLevels)
            throw hsBadParamException(__FILE__, __LINE__);
        const pfPrcTag* child = tag->getFirstChild();
        for (size_t i=0; i<kNumLODLevels; i++) {
            fMeshes[i] = mgr->prcParseKey(child);
            child = child->getNextSibling();
        }
    } else if (tag->getName() == "Accessory") {
        if (tag->hasChildren())
            fAccessory = mgr->prcParseKey(tag->getFirstChild());
    } else if (tag->getName() == "DefaultTints") {
        const pfPrcTag* child = tag->getFirstChild();
        while (child != NULL) {
            if (child->getName() == "Tint1") {
                fDefaultTint1[0] = child->getParam("red", "0").to_uint();
                fDefaultTint1[1] = child->getParam("green", "0").to_uint();
                fDefaultTint1[2] = child->getParam("blue", "0").to_uint();
            } else if (child->getName() == "Tint2") {
                fDefaultTint2[0] = child->getParam("red", "0").to_uint();
                fDefaultTint2[1] = child->getParam("green", "0").to_uint();
                fDefaultTint2[2] = child->getParam("blue", "0").to_uint();
            } else {
                throw pfPrcTagException(__FILE__, __LINE__, child->getName());
            }
            child = child->getNextSibling();
        }
    } else {
        hsKeyedObject::IPrcParse(tag, mgr);
    }
}
Beispiel #9
0
JSHook::~JSHook() {
	// When the hook is destroyed, make sure all elements are released.
	//
	clearElements();
}
Beispiel #10
0
bool Senario::constructSenarioStage(bool skip)
{
    CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
    ccColor3B colorBlack = ccc3(0, 0, 0);
   // ccColor3B colorYellow = ccc3(225, 219, 108);
    ccColor3B colorBlue = ccc3(0, 0, 255);
    clearElements();
    
    if(slidesList->count() <= curSlide)
    {
        return false;
    }
    
    Slide* slide = (Slide*)slidesList->objectAtIndex(curSlide);
    
    CCArray* elementArray = slide->elementList;
    
    if(slide->isScene)
    {
        
        CCTextureCache::sharedTextureCache()->removeAllTextures();
        CCTextureCache::sharedTextureCache()->purgeSharedTextureCache();
        CCAnimationCache::sharedAnimationCache()->purgeSharedAnimationCache();
        CCDirector::sharedDirector()->purgeCachedData();
        
        backgroundImage = slide->scene_src;
    }
    
    CCSprite* blackScreen = CCSprite::create(backgroundImage.c_str());
    blackScreen->setScale(screenSize.width / blackScreen->boundingBox().size.width);
    blackScreen->setAnchorPoint(ccp(0.5, 0.5));
    blackScreen->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
    this->addChild(blackScreen, 1);
    spriteList.push_back(blackScreen);
    
    skipButton = CCSprite::create("skip_button.png");
    skipButton->retain();
    skipButton->setScale(1.0f);
    skipButton->setAnchorPoint(ccp(1, 1));
    skipButton->setPosition(ccp(screenSize.width, screenSize.height));
    this->addChild(skipButton, 2);
    spriteList.push_back(skipButton);
    
    if(slide->hasVideo)
    {
        //Config *c = Config::getConfig();
        if(slide->video_clip.compare("") != 0)
        {
            WrapperClass::getShared()->playVideo(slide->video_clip.c_str());
        }
    }
    
    if(slide->playBGM)
    {
        if(slide->bgm_clip.compare("") != 0)
        {
            SoundtrackManager::PlayBGM(slide->bgm_clip);
        }
    }
    
    if(slide->playSFX)
    {
        if(slide->sfx_clip.compare("") != 0)
        {
            SoundtrackManager::PlaySFX(slide->sfx_clip);
        }
    }
    
    if(GameScene::getThis()->systemConfig->hideSkipButton)
    {
        skipButton->setAnchorPoint(ccp(0, 1));
        skipButton->setPosition(ccp(screenSize.width, screenSize.height));
    }
    
    bool isChoosingOption = false;
    for(int i = 0; i < elementArray->count(); i++)
    {
        Element* ele = (Element*)elementArray->objectAtIndex(i);
        
        /*
         * In the senario stage, there are two types of elements -> sprite and dialogue, treat these two types of elements differently in order to make this display them correctly!
         */
        
        if(ele->type == Element::sprite)
        {
            /*
             * Sprite: only has a picture of the sprite shown on the screen
             * Future: may include animation of the sprite shown on the screen (probably a gif?)
             */
            
            AnimatedSprite* as = AnimatedSprite::create(ele->src.c_str(), ele->fadeIn, ele->fadeOut, true);
            stringstream ss;
            CCSprite* cha = as->getSprite();
            CCSize spriteSize = cha->getContentSize();
            cha->setScale(screenSize.width / spriteSize.width * ele->width / 100.0f);
            cha->setFlipX(true);
            
            cha->setAnchorPoint(ccp(0, 1));
            cha->setPosition(ccp(screenSize.width * (ele->left / 100.0f), screenSize.height * (ele->top / 100.0f)));
            this->addChild(cha, 2);
            spriteList.push_back(cha);
            
            animatedSpriteList->addObject(as);
        }
        else if(ele->type == Element::dialogue)
        {
            /*
             * Dialogue: contains a picture of the background of that dialogue, a name label, a dialogue text and a proceed button
             * Future: may include dialogue functionalities like save, load, auto proceed, text jumper, etc....
             */
            
            AnimatedDialogue* ad = AnimatedDialogue::create(ele->src.c_str(), ele->fadeIn, ele->fadeOut);
            CCSprite* chbox = ad->getSprite();
            CCSize boxSize = chbox->getContentSize();
            chbox->setScale(screenSize.width / boxSize.width * ele->width / 100.0f);
            chbox->setAnchorPoint(ccp(0, 1));
            chbox->setPosition(ccp(screenSize.width * (ele->left / 100.0f), screenSize.height * (ele->top / 100.0f)));
            
            if(ele->isBackground)
            {
                this->addChild(chbox, 3);
                spriteList.push_back(chbox);
                animatedDialogueList->addObject(ad);
                continue;
            }
            
            float heightOff = 80.0f - ele->textOffY;
            float widthOff = 80.0f;
            
            displayTexts(ele->text, screenSize.width * (ele->left / 100.0f) + widthOff, screenSize.height * (ele->top / 100.0f) - heightOff, ele->font.c_str(), (float)ele->fontSize, colorBlack, ele->limitX);
            
            std::stringstream ss;
            ss << ele->text;
            
            heightOff = 40.0f;
            widthOff = 80.0f;
            
            ss.str(std::string());
            ss << ele->name;
            CCLabelTTF* chboxName = CCLabelTTF::create(ss.str().c_str(), ele->font.c_str(), ele->fontSize, CCSizeMake(ss.str().length() * 20.0f, 5.0f), kCCTextAlignmentLeft);
            chboxName->setColor(colorBlue);
            chboxName->setAnchorPoint(ccp(0, 1));
            chboxName->setPosition(ccp(screenSize.width * (ele->left / 100.0f) + widthOff, screenSize.height * (ele->top / 100.0f) - heightOff));
            
            this->addChild(chbox, 3);
            this->addChild(chboxName, 4);
            spriteList.push_back(chbox);
            labelList.push_back(chboxName);
            animatedDialogueList->addObject(ad);
        }
        else if(ele->type == Element::option)
        {
            isChoosingOption = true;
            inOption = true;
            notJump = true;
            
            CCMenuItemImage* selectButton = CCMenuItemImage::create(ele->src.c_str(), ele->srcp.c_str(), this, menu_selector(Senario::selectButtonPressed));
            selectButton->setTag(i);
            selectButton->setAnchorPoint(ccp(0, 1));
            selectButton->setScale(0.6f);
            
            CCMenu* menu = CCMenu::create(selectButton, NULL);
            menu->setPosition(ccp(screenSize.width * (ele->left / 100.0f), screenSize.height * (ele->top / 100.0f)));
            this->addChild(menu, 4);
            menuList.push_back(menu);
        }
    }
    
    if(!isChoosingOption && skip)
    {
        return false;
    }
    
    this->schedule(schedule_selector(Senario::update), 1.0f/60.0f);
    
    return true;
}
Beispiel #11
0
void D3D11Canvas2D::release()
{
	clearElements();
}
Beispiel #12
0
	void quit()
	{
		clearElements();
		if (mainStyle != 0) delete mainStyle;
		if (mainHandler != 0) delete mainHandler;
	}