140 lines
4.6 KiB
C#
140 lines
4.6 KiB
C#
|
using UnityEngine;
|
|||
|
using System;
|
|||
|
|
|||
|
#if RND_GAME_ANALYTICS
|
|||
|
using GameAnalyticsSDK;
|
|||
|
#endif
|
|||
|
|
|||
|
namespace RND.SDK.ProductSDK
|
|||
|
{
|
|||
|
public class GameAnalyticsSDK : IProductSDK
|
|||
|
{
|
|||
|
public void Init()
|
|||
|
{
|
|||
|
#if RND_GAME_ANALYTICS
|
|||
|
GameAnalytics.SetBuildAllPlatforms(Application.version);
|
|||
|
GameAnalytics.Initialize();
|
|||
|
GameAnalyticsILRD.SubscribeMoPubImpressions();
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
public void AddProgressionEvent(EnumProductProgressStatus status, string progression)
|
|||
|
{
|
|||
|
#if RND_GAME_ANALYTICS
|
|||
|
GAProgressionStatus gaStatus = default;
|
|||
|
|
|||
|
switch(status)
|
|||
|
{
|
|||
|
case EnumProductProgressStatus.FAIL:
|
|||
|
gaStatus = GAProgressionStatus.Fail;
|
|||
|
break;
|
|||
|
case EnumProductProgressStatus.START:
|
|||
|
gaStatus = GAProgressionStatus.Start;
|
|||
|
break;
|
|||
|
case EnumProductProgressStatus.COMPLETE:
|
|||
|
gaStatus = GAProgressionStatus.Complete;
|
|||
|
break;
|
|||
|
case EnumProductProgressStatus.UNDEFINED:
|
|||
|
gaStatus = GAProgressionStatus.Undefined;
|
|||
|
break;
|
|||
|
default:
|
|||
|
throw new ArgumentException();
|
|||
|
}
|
|||
|
|
|||
|
GameAnalytics.NewProgressionEvent(gaStatus, progression);
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
public void AddResourcesEvent(EnumProductResourcesFlow flow, string currency, float amount, string itemType,
|
|||
|
string itemId)
|
|||
|
{
|
|||
|
#if RND_GAME_ANALYTICS
|
|||
|
GAResourceFlowType gaFlow = default;
|
|||
|
|
|||
|
switch(flow)
|
|||
|
{
|
|||
|
case EnumProductResourcesFlow.SINK:
|
|||
|
gaFlow = GAResourceFlowType.Sink;
|
|||
|
break;
|
|||
|
case EnumProductResourcesFlow.SOURCES:
|
|||
|
gaFlow = GAResourceFlowType.Source;
|
|||
|
break;
|
|||
|
case EnumProductResourcesFlow.UNDEFINED:
|
|||
|
gaFlow = GAResourceFlowType.Undefined;
|
|||
|
break;
|
|||
|
default:
|
|||
|
throw new ArgumentException();
|
|||
|
}
|
|||
|
|
|||
|
GameAnalytics.NewResourceEvent(gaFlow, currency, amount, itemType, itemId);
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
public void AddAdEvent(EnumProductAdAction adAction, EnumProductAdType adType, string adSdkName,
|
|||
|
string adPlacement)
|
|||
|
{
|
|||
|
#if RND_GAME_ANALYTICS
|
|||
|
GAAdAction gaAdAction = default;
|
|||
|
|
|||
|
switch(adAction)
|
|||
|
{
|
|||
|
case EnumProductAdAction.SHOW:
|
|||
|
gaAdAction = GAAdAction.Show;
|
|||
|
break;
|
|||
|
case EnumProductAdAction.CLICKED:
|
|||
|
gaAdAction = GAAdAction.Clicked;
|
|||
|
break;
|
|||
|
case EnumProductAdAction.LOADED:
|
|||
|
gaAdAction = GAAdAction.Loaded;
|
|||
|
break;
|
|||
|
case EnumProductAdAction.UNDEFINED:
|
|||
|
gaAdAction = GAAdAction.Undefined;
|
|||
|
break;
|
|||
|
case EnumProductAdAction.REQUEST:
|
|||
|
gaAdAction = GAAdAction.Request;
|
|||
|
break;
|
|||
|
case EnumProductAdAction.FAILED_SHOW:
|
|||
|
gaAdAction = GAAdAction.FailedShow;
|
|||
|
break;
|
|||
|
case EnumProductAdAction.REWARD_RECEIVED:
|
|||
|
gaAdAction = GAAdAction.RewardReceived;
|
|||
|
break;
|
|||
|
default:
|
|||
|
throw new ArgumentException();
|
|||
|
}
|
|||
|
|
|||
|
GAAdType gaAdType = default;
|
|||
|
|
|||
|
switch(adType)
|
|||
|
{
|
|||
|
case EnumProductAdType.VIDEO:
|
|||
|
gaAdType = GAAdType.Video;
|
|||
|
break;
|
|||
|
case EnumProductAdType.BANNER:
|
|||
|
gaAdType = GAAdType.Banner;
|
|||
|
break;
|
|||
|
case EnumProductAdType.PLAYABLE:
|
|||
|
gaAdType = GAAdType.Playable;
|
|||
|
break;
|
|||
|
case EnumProductAdType.OFFER_WALL:
|
|||
|
gaAdType = GAAdType.OfferWall;
|
|||
|
break;
|
|||
|
case EnumProductAdType.UNDEFINED:
|
|||
|
gaAdType = GAAdType.Undefined;
|
|||
|
break;
|
|||
|
case EnumProductAdType.INTERSTITIAL:
|
|||
|
gaAdType = GAAdType.Interstitial;
|
|||
|
break;
|
|||
|
case EnumProductAdType.REWARDED_VIDEO:
|
|||
|
gaAdType = GAAdType.RewardedVideo;
|
|||
|
break;
|
|||
|
default:
|
|||
|
throw new ArgumentException();
|
|||
|
}
|
|||
|
|
|||
|
GameAnalytics.NewAdEvent(gaAdAction, gaAdType, adSdkName, adPlacement);
|
|||
|
#endif
|
|||
|
}
|
|||
|
}
|
|||
|
}
|