You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

113 lines
3.1 KiB

using System.Collections.Generic;
public class DevToDevRealization
{
private static bool m_inited = false;
private static bool m_notSendEvents = false;
//-------------------------------------------------------------------
public static void Init()
{
#if UNITY_EDITOR
m_notSendEvents = true;
#endif
if (m_inited)
return;
if (m_notSendEvents)
return;
m_inited = true;
#if UNITY_ANDROID
DevToDev.Analytics.Initialize("ca2b2f11-7f86-0723-88c8-07e1ff15483d", "Tvno68Q9LDhKVBzGZxWX3FySAu4O0wra");
#elif UNITY_IOS
DevToDev.Analytics.Initialize("c9b4a6f6-73e9-03c0-b7b8-26d512f0cc5f", "YdhTW9euogza803rlZKkM4XRq1DBUHwI");
#endif
//DevToDev.Analytics.SetActiveLog(true);
}
//-------------------------------------------------------------------
public static void SetUserLevel( int linearLevel )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
DevToDev.Analytics.CurrentLevel(linearLevel);
#endif
}
//-------------------------------------------------------------------
public static void LevelUp( int currentLevel )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
User user = GlobalsVar.gUser;
Dictionary<string, int> coinsCount = new Dictionary<string, int>();
coinsCount["coins"] = user.Coins;
coinsCount["energy"] = user.Energy;
DevToDev.Analytics.LevelUp(currentLevel, coinsCount);
#endif
}
//-------------------------------------------------------------------
public static void RealPayment( float inAppPrice, string inAppName, string isoCode, string transactionId )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
DevToDev.Analytics.RealPayment( transactionId, inAppPrice, inAppName, isoCode);
#endif
}
//-------------------------------------------------------------------
public static void InAppPurchase( string purchaseName, int cost )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
DevToDev.Analytics.InAppPurchase(purchaseName, purchaseName, 1, cost, "coins" );
#endif
}
//-------------------------------------------------------------------
public static void CustomEventWithParams(string eventName, string ParamName, string ParamValue )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
DevToDev.CustomEventParams eventParams = new DevToDev.CustomEventParams();
eventParams.AddParam(ParamName, ParamValue);
DevToDev.Analytics.CustomEvent(eventName, eventParams);
#endif
}
//-------------------------------------------------------------------
public static void CustomEvent( string eventName )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
DevToDev.Analytics.CustomEvent(eventName);
#endif
}
//-------------------------------------------------------------------
public static void SetCustomProperty( string propertyName, string propertyVal )
{
if (m_notSendEvents)
return;
#if UNITY_IOS || UNITY_ANDROID
Init();
DevToDev.Analytics.ActiveUser.SetUserData(propertyName, propertyVal);
#endif
}
}