| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- /******************************************************************************/
- #include "stdafx.h"
- #define SUPPORT_GAME_ANALYTICS 1
- #undef GameAnalytics
- #include "../../../ThirdPartyLibs/begin.h"
- #if IOS && SUPPORT_GAME_ANALYTICS
- #include "../../../ThirdPartyLibs/GameAnalytics/iOS/GameAnalytics.h"
- ASSERT((Int)::GAResourceFlowTypeSource==EE::_GameAnalytics::GAResourceFlowTypeSource && (Int)::GAResourceFlowTypeSink==EE::_GameAnalytics::GAResourceFlowTypeSink
- && (Int)::GAProgressionStatusStart==EE::_GameAnalytics::GAProgressionStatusStart && (Int)::GAProgressionStatusComplete==EE::_GameAnalytics::GAProgressionStatusComplete && (Int)::GAProgressionStatusFail==EE::_GameAnalytics::GAProgressionStatusFail
- && (Int)::GAErrorSeverityDebug==EE::_GameAnalytics::GAErrorSeverityDebug && (Int)::GAErrorSeverityInfo==EE::_GameAnalytics::GAErrorSeverityInfo && (Int)::GAErrorSeverityWarning==EE::_GameAnalytics::GAErrorSeverityWarning && (Int)::GAErrorSeverityError==EE::_GameAnalytics::GAErrorSeverityError && (Int)::GAErrorSeverityCritical==EE::_GameAnalytics::GAErrorSeverityCritical);
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #include "../../../ThirdPartyLibs/GameAnalytics/Android/GameAnalyticsJNI.h"
- #endif
- #include "../../../ThirdPartyLibs/end.h"
- namespace EE{namespace _GameAnalytics{
- /******************************************************************************/
- void configureAvailableCustomDimensions01(C MemPtr<Str> &customDimensions)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- if(NSMutableArray *array=[NSMutableArray arrayWithCapacity:customDimensions.elms()])
- {
- FREPA(customDimensions)[array addObject:NSStringAuto(customDimensions[i])];
- [GameAnalytics configureAvailableCustomDimensions01:array];
- //[array release]; NSMutableArray from 'arrayWithCapacity' can't be released
- }
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureAvailableCustomDimensions02(C MemPtr<Str> &customDimensions)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- if(NSMutableArray *array=[NSMutableArray arrayWithCapacity:customDimensions.elms()])
- {
- FREPA(customDimensions)[array addObject:NSStringAuto(customDimensions[i])];
- [GameAnalytics configureAvailableCustomDimensions02:array];
- //[array release]; NSMutableArray from 'arrayWithCapacity' can't be released
- }
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureAvailableCustomDimensions03(C MemPtr<Str> &customDimensions)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- if(NSMutableArray *array=[NSMutableArray arrayWithCapacity:customDimensions.elms()])
- {
- FREPA(customDimensions)[array addObject:NSStringAuto(customDimensions[i])];
- [GameAnalytics configureAvailableCustomDimensions03:array];
- //[array release]; NSMutableArray from 'arrayWithCapacity' can't be released
- }
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureAvailableResourceCurrencies(C MemPtr<Str> &resourceCurrencies)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- if(NSMutableArray *array=[NSMutableArray arrayWithCapacity:resourceCurrencies.elms()])
- {
- FREPA(resourceCurrencies)[array addObject:NSStringAuto(resourceCurrencies[i])];
- [GameAnalytics configureAvailableResourceCurrencies:array];
- //[array release]; NSMutableArray from 'arrayWithCapacity' can't be released
- }
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureAvailableResourceItemTypes(C MemPtr<Str> &resourceItemTypes)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- if(NSMutableArray *array=[NSMutableArray arrayWithCapacity:resourceItemTypes.elms()])
- {
- FREPA(resourceItemTypes)[array addObject:NSStringAuto(resourceItemTypes[i])];
- [GameAnalytics configureAvailableResourceItemTypes:array];
- //[array release]; NSMutableArray from 'arrayWithCapacity' can't be released
- }
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureBuild(C Str &build)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics configureBuild:NSStringAuto(build)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureUserId(C Str &userId)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics configureUserId:NSStringAuto(userId)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void configureEngineVersion(C Str &engineVersion)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics configureEngineVersion:NSStringAuto(engineVersion)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void initialize(C Str &gameKey, C Str &gameSecret)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics initializeWithGameKey:NSStringAuto(gameKey) gameSecret:NSStringAuto(gameSecret)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addBusinessEventWithCurrency(C Str ¤cy, Int amount, C Str &itemType, C Str &itemId, C Str &cartType, C Str &receipt)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addBusinessEventWithCurrency:NSStringAuto(currency) amount:amount itemType:NSStringAuto(itemType) itemId:NSStringAuto(itemId) cartType:NSStringAuto(cartType) receipt:NSStringAuto(receipt)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addBusinessEventWithCurrency(C Str ¤cy, Int amount, C Str &itemType, C Str &itemId, C Str &cartType, Bool autoFetchReceipt)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addBusinessEventWithCurrency:NSStringAuto(currency) amount:amount itemType:NSStringAuto(itemType) itemId:NSStringAuto(itemId) cartType:NSStringAuto(cartType) autoFetchReceipt:autoFetchReceipt];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addResourceEventWithFlowType(GAResourceFlowType flowType, C Str ¤cy, Dbl amount, C Str &itemType, C Str &itemId)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addResourceEventWithFlowType:(::GAResourceFlowType)flowType currency:NSStringAuto(currency) amount:[NSNumber numberWithDouble:amount] itemType:NSStringAuto(itemType) itemId:NSStringAuto(itemId)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addProgressionEventWithProgressionStatus(GAProgressionStatus progressionStatus, C Str &progression01, C Str &progression02, C Str &progression03)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addProgressionEventWithProgressionStatus:(::GAProgressionStatus)progressionStatus progression01:NSStringAuto(progression01) progression02:NSStringAuto(progression02) progression03:NSStringAuto(progression03)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addProgressionEventWithProgressionStatus(GAProgressionStatus progressionStatus, C Str &progression01, C Str &progression02, C Str &progression03, Int score)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addProgressionEventWithProgressionStatus:(::GAProgressionStatus)progressionStatus progression01:NSStringAuto(progression01) progression02:NSStringAuto(progression02) progression03:NSStringAuto(progression03) score:score];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addDesignEventWithEventId(C Str &eventId)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addDesignEventWithEventId:NSStringAuto(eventId)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addDesignEventWithEventId(C Str &eventId, Dbl value)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addDesignEventWithEventId:NSStringAuto(eventId) value:[NSNumber numberWithDouble:value]];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void addErrorEventWithSeverity(GAErrorSeverity severity, C Str &message)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics addErrorEventWithSeverity:(::GAErrorSeverity)severity message:NSStringAuto(message)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- Str getCommandCenterValueAsString(C Str &key)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- return [GameAnalytics getCommandCenterValueAsString:NSStringAuto(key)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- return S;
- }
- Str getCommandCenterValueAsString(C Str &key, C Str &defaultValue)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- return [GameAnalytics getCommandCenterValueAsString:NSStringAuto(key) defaultValue:NSStringAuto(defaultValue)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- return S;
- }
- Str getCommandCenterConfigurations()
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- return [GameAnalytics getCommandCenterConfigurations];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- return S;
- }
- /*void setCommandCenterDelegate(id newDelegate)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }*/
- Bool isCommandCenterReady()
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- return [GameAnalytics isCommandCenterReady];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- return false;
- }
- void setEnabledInfoLog(Bool flag)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setEnabledInfoLog:flag];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setEnabledVerboseLog(Bool flag)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setEnabledVerboseLog:flag];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setEnabledManualSessionHandling(Bool flag)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setEnabledManualSessionHandling:flag];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void startSession()
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics startSession];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void endSession()
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics endSession];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setCustomDimension01(C Str &dimension01)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setCustomDimension01:NSStringAuto(dimension01)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setCustomDimension02(C Str &dimension02)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setCustomDimension02:NSStringAuto(dimension02)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setCustomDimension03(C Str &dimension03)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setCustomDimension03:NSStringAuto(dimension03)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setFacebookId(C Str &facebookId)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setFacebookId:NSStringAuto(facebookId)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setGender(C Str &gender)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setGender:NSStringAuto(gender)];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- void setBirthYear(Int birthYear)
- {
- #if IOS && SUPPORT_GAME_ANALYTICS
- [GameAnalytics setBirthYear:birthYear];
- #elif ANDROID && SUPPORT_GAME_ANALYTICS
- #endif
- }
- /******************************************************************************/
- }}
- /******************************************************************************/
|