示例#1
0
bool CIwGameAds::RequestAd(eAdProvider provider, bool reset_mediator)
{
#if defined(_DEBUG)
	CIwGameError::LogError("Info: CIwGameAds::RequestAd()");
#endif	// _DEBUG

#if defined(_DEBUG)
	CIwGameError::LogError("Info: Busy, cant request ad - Elapsed = ", CIwGameString((int)BusyTimer.GetElapsedTime()).c_str());
#endif	// _DEBUG
	// Dont allow request if busy already collecting ad or timeout has not occured
	if (BusyTimer.hasStarted())
	{
		return false;
	}

	// If we have an attached mediator then get details from the mediator
	if (Mediator != NULL)
	{
		// reset the mediator
		if (reset_mediator)
			Mediator->reset();

		// Set up custom ad request from mediator
		CIwGameAdsParty* party = Mediator->getNextAdParty();
		if (party != NULL)
		{
			provider = party-> Provider;
			ApplicationID = party-> ApplicationID;
            IOSAppID = party-> IOSAppID;
            AndroidAppID = party -> AndroidAppID;
            BBAppID = party -> BBAppID;
            WP8AppID = party -> WP8AppID;
            
			OtherID = party->OtherID;
			ExtraInfo = party->ExtraInfo;
		}
        
	}
    
    switch (OperatingSystem)
	{
        case  S3E_OS_ID_OSX:
            if (!IOSAppID.IsEmpty()) {
                ApplicationID = IOSAppID;
            }
            break;
        case  S3E_OS_ID_ANDROID:
            if (!AndroidAppID.IsEmpty()) {
                ApplicationID = AndroidAppID;
            }
            break;
        case  S3E_OS_ID_QNX:
            if (!BBAppID.IsEmpty())
            {
                ApplicationID = BBAppID;
            }
            break;
        case  S3E_OS_ID_WP8:
            if (!WP8AppID.IsEmpty())
            {
            ApplicationID = WP8AppID;
            }
            break;
    }
    
    
	// Reset error
	Error = ErrorNone;
	ErrorString = "";
	AdAvailable = false;
	AdProvider = provider;
	switch (AdProvider)
	{
	case InnerActive:
		RequestAdInnerActive();
		break;
	case AdFonic:
		RequestAdAdFonic();
		break;
	case VServ:
		RequestAdVServ();
		break;
	case Mojiva:
		RequestAdMojiva();
		break;
	case MillennialMedia:
		RequestAdMillennialMedia();
		break;
	case AdModa:
		RequestAdAdModa();
		break;
	case InMobi:
		RequestAdInMobi();
        break;
#if defined(_AD_DO_NOT_USE_)
	case MobClix:
		RequestAdMobClix();
		break;
	case MobFox:
		RequestAdMobFox();
		break;
	case Madvertise:
		RequestAdMadvertise();
		break;
	case KomliMobile:
		RequestAdKomliMobile();
		break;
#endif	// _AD_DO_NOT_USE_
	}

#if defined(_DEBUG)
	CIwGameError::LogError("Info: CIwGameAds::RequestAd() with URL: ", RequestURI.c_str());
#endif	// _DEBUG

	return true;
}
示例#2
0
bool CzAds::RequestAd(eAdProvider provider, bool reset_mediator)
{
#if defined(_DEBUG)
	CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "CzAds::RequestAd()");
#endif	// _DEBUG

#if defined(_DEBUG)
	CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "CzAds::RequestAd: Busy, cant request ad - Elapsed = ", CzString((int)BusyTimer.GetElapsedTime()).c_str());
#endif	// _DEBUG
	// Dont allow request if busy already collecting ad or timeout has not occured
	if (BusyTimer.hasStarted())
	{
		return false;
	}

	// If we have an attached mediator then get details from the mediator
	if (Mediator != NULL)
	{
		// reset the mediator
		if (reset_mediator)
			Mediator->reset();

		// Set up custom ad request from mediator
		CzAdsParty* party = Mediator->getNextAdParty();
		if (party != NULL)
		{
			provider = party->Provider;
			ApplicationID = party->ApplicationID;
			OtherID = party->OtherID;
			ExtraInfo = party->ExtraInfo;
		}
	}

	// Reset error
	Error = ErrorNone;
	ErrorString = "";
	AdAvailable = false;
	AdProvider = provider;
	switch (AdProvider)
	{
	case InnerActive:
		RequestAdInnerActive();
		break;
	case AdFonic:
		RequestAdAdFonic();
		break;
	case VServ:
		RequestAdVServ();
		break;
	case Mojiva:
		RequestAdMojiva();
		break;
	case MillennialMedia:
		RequestAdMillennialMedia();
		break;
	case AdModa:
		RequestAdAdModa();
		break;
#if defined(_AD_DO_NOT_USE_)
	case InMobi:
		RequestAdInMobi();
		break;
	case MobClix:
		RequestAdMobClix();
		break;
	case MobFox:
		RequestAdMobFox();
		break;
	case Madvertise:
		RequestAdMadvertise();
		break;
	case KomliMobile:
		RequestAdKomliMobile();
		break;
#endif	// _AD_DO_NOT_USE_
	}

#if defined(_DEBUG)
	CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "CzAds::RequestAd() with URL: ", RequestURI.c_str());
#endif	// _DEBUG

	return true;
}