Exemple #1
0
void BasicLoadable::unload(){
	lock();

	if (!this -> mIsloaded) {
		unlock();
		return;
	}
	onUnload();
	this -> mIsloaded = false;
	unlock();
}
Exemple #2
0
void Content::unload()
{
	if (!_loaded) return;

	if (_loading)
	{
		NIT_THROW_FMT(EX_INVALID_STATE, "'%s': can't unload while loading", getSourceUrl().c_str());
		// It would be headache when async process try to dispose..
		// TODO: just cancel it or resource manager should treat them by a list
	}

	onUnload();

	_loaded = false;
}
Exemple #3
0
bool Mob::useOn(Item* _ip, Entity* _ep){
	int oldHP = HitPoints;
	if (gp->lvl->isPlayer(_ep)){
		_ip->getAtt() > HitPoints ? HitPoints = 0 : HitPoints-=_ip->getAtt();
		iprintf("Hit A Foe! %i-%i=%i\n", oldHP, oldHP-HitPoints, HitPoints);
		gp->som.playSFX(5, 1024);
		if (HitPoints<=0){
			onUnload();
			gp->lvl->getBlock(GridX, GridY)->HasEntity = false;
			gp->som.playSFX(0, 1024);
			delete this;
		}
		return true;
	}
	return false;
}
Exemple #4
0
bool JsAgent::invoke(NPIdentifier name, const NPVariant* args, unsigned argCount, NPVariant* result) {
	//	NPUTF8* strName = NPN_UTF8FromIdentifier(name);
	Debug::println("JsAgent::invoke: %s", debugName(name));

	if(name == methods.onLoad) {
		return onLoad(args, argCount);
	}
	else if(name == methods.onUnload) {
		return onUnload();
	}
	else if(name == methods.toString) {
		std::string str("[DotWeb Plugin]");
		Variant var;
		var.set(str);
		*result = var.take();
		return true;
	}

	return false;
}
APIMod::~APIMod(){
    onUnload();
}