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.
712 lines
22 KiB
712 lines
22 KiB
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.Analytics;
|
|
using IVDataFormat;
|
|
#if APPSFLYER_ANALYTICS
|
|
using AppsFlyerSDK;
|
|
#endif
|
|
|
|
public class AnalyticsMgr
|
|
{
|
|
#if UNITY_ANDROID
|
|
private const string D_PLATFORM = "Android";
|
|
#elif UNITY_IOS
|
|
private const string D_PLATFORM = "iOS";
|
|
#else
|
|
private const string D_PLATFORM = "-";
|
|
#endif
|
|
private static Dictionary<string, object> dicEventDevice = null;
|
|
private static bool FirebaseInit = false;
|
|
|
|
public static void Init()
|
|
{
|
|
if (dicEventDevice == null)
|
|
{
|
|
dicEventDevice = new Dictionary<string, object>
|
|
{
|
|
{ "platform", D_PLATFORM },
|
|
{ "game_ver", FormatString.AppVersion() },
|
|
{ "os_ver", SystemInfo.operatingSystem },
|
|
{ "device_type", SystemInfo.deviceModel }
|
|
};
|
|
}
|
|
}
|
|
|
|
public static void OnFirebaseInitialized()
|
|
{
|
|
FirebaseInit = true;
|
|
}
|
|
|
|
public static void EventOpenAppFirst()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventOpenAppFirst", dicEventDevice);
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> datas = new Dictionary<string, string>();
|
|
AppsFlyer.sendEvent("af_first_open", datas);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventOpenApp()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventOpenApp", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventCheckGameVer()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventCheckGameVer", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventTryLoginGuest()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventTryLoginGuest", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
public static void EventFinishLoginGuest()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventFinishLoginGuest", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventTryLoginApple()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventTryLoginApple", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventFinishLoginApple()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventFinishLoginApple", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventTryLoginGoogle()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventTryLoginGoogle", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventFinishLoginGoogle()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("EventFinishLoginGoogle", dicEventDevice);
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventCheckUserID(string userid)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.Parameter param_uid = new Firebase.Analytics.Parameter("uid", userid);
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent("CheckUserId", param_uid);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
//Dictionary<string, string> playerid = new Dictionary<string, string>();
|
|
//playerid.Add("userid", userid);
|
|
//AppsFlyer.sendEvent("CheckUserId", playerid);
|
|
AppsFlyer.setCustomerUserId(userid);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventAttend(int iclearcount, int iday)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
if (iclearcount > 0 || iday > 10)
|
|
return;
|
|
string eventname = string.Format("checkin_d{0}", iday);
|
|
Analytics.CustomEvent(eventname);
|
|
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> datas = new Dictionary<string, string>();
|
|
AppsFlyer.sendEvent(eventname, datas);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventFirstClearStage(int iarea, int istage)
|
|
{
|
|
//#if UNITY_EDITOR || VER_DEV || VER_TEST
|
|
// return;
|
|
//#endif
|
|
// if (istage != 10 && istage != 20)
|
|
// return;
|
|
|
|
// string eventname = string.Format("FirstClearStage{0}-{1}", iarea, istage);
|
|
// string eventname2 = null;
|
|
// //int[] areainfo = DataHandler.GetThemeArea(iarea);
|
|
// //switch (areainfo[0])
|
|
// //{
|
|
// // case 1:
|
|
// // eventname2 = string.Format("stage{0:00}_{1:00}", areainfo[1], istage);
|
|
// // break;
|
|
// // case 2:
|
|
// // eventname2 = string.Format("hell{0:00}_{1:00}", areainfo[1], istage);
|
|
// // break;
|
|
// // case 3:
|
|
// // eventname2 = string.Format("purgatory{0:00}_{1:00}", areainfo[1], istage);
|
|
// // break;
|
|
// // default:
|
|
// // eventname2 = string.Format("theme{2:00}_{0:00}_{1:00}", areainfo[1], istage, areainfo[0]);
|
|
// // break;
|
|
// //}
|
|
// //Analytics.CustomEvent(eventname);
|
|
|
|
//#if FIREBASE_ANALYTICS
|
|
// if (FirebaseInit)
|
|
// {
|
|
// Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname, "peerage", DataHandler.PlayData.peerage);
|
|
// Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname2, "peerage", DataHandler.PlayData.peerage);
|
|
// }
|
|
//#endif
|
|
|
|
//#if APPSFLYER_ANALYTICS
|
|
// Dictionary<string, string> datas = new Dictionary<string, string>() { { "area", iarea.ToString() }, { "stage", istage.ToString() } };
|
|
// AppsFlyer.sendEvent(eventname, datas);
|
|
// AppsFlyer.sendEvent(eventname2, datas);
|
|
//#endif
|
|
}
|
|
|
|
|
|
public static void EventClearStage(int iarea, int istage)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
if (istage != 10 && istage != 20)
|
|
return;
|
|
string eventname = string.Format("ClearStage{0}-{1}", iarea, istage);
|
|
Analytics.CustomEvent(eventname);
|
|
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname, "peerage", DataHandler.PlayData.peerage);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(eventname, new Dictionary<string, string>() { { "area", iarea.ToString() }, { "stage", istage.ToString() } });
|
|
#endif
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
public static void EventPeerage(int ipeeragelevel)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
string eventname = string.Format("Peerage{0}", ipeeragelevel);
|
|
Analytics.CustomEvent(eventname);
|
|
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname, "playtime", DataHandler.PlayRecordTotal.playTime);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> levelachieve = new Dictionary<string, string>();
|
|
levelachieve.Add("af_level", ipeeragelevel.ToString());
|
|
levelachieve.Add("playtime", DataHandler.PlayRecordTotal.playTime.ToString());
|
|
AppsFlyer.sendEvent("af_level_achieved", levelachieve);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventSkillUp(int skillid, int iprevlevel, int ilevel)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
string eventname = null;
|
|
//switch (skillid)
|
|
//{
|
|
// case IdPreset.Skill_CharAtk:
|
|
// eventname = "atk_pow_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_CharSpd:
|
|
// eventname = "atk_spd_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill1Rate:
|
|
// eventname = "dragonpunch_rate_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill1Atk:
|
|
// eventname = "dragonpunch_pwr_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill2Rate:
|
|
// eventname = "lightningball_rate_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill2Atk:
|
|
// eventname = "lightningball_pwr_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill3Rate:
|
|
// eventname = "wagon_atk_rate_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill3Atk:
|
|
// eventname = "wagon_atk_pwr_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill4Rate:
|
|
// eventname = "ganadarapa_rate_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill4Atk:
|
|
// eventname = "ganadarapa_pwr_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill5Rate:
|
|
// eventname = "gofinger_rate_{0}";
|
|
// break;
|
|
// case IdPreset.Skill_Skill5Atk:
|
|
// eventname = "gofinger_pwr_{0}";
|
|
// break;
|
|
// default:
|
|
// return;
|
|
//}
|
|
|
|
//Dictionary<string, string> datas = new Dictionary<string, string>();
|
|
//datas.Add("playtime", DataHandler.PlayRecordTotal.playTime.ToString());
|
|
|
|
if (iprevlevel < 100 && ilevel >= 100)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 100));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 100), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 200 && ilevel >= 200)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 200));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 200), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 300 && ilevel >= 300)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 300));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 300), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 400 && ilevel >= 400)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 400));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 400), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 500 && ilevel >= 500)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 500));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 500), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 600 && ilevel >= 600)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 600));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 600), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 700 && ilevel >= 700)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 700));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 700), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 800 && ilevel >= 800)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 800));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 800), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 900 && ilevel >= 900)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 900));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 900), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 1000 && ilevel >= 1000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 1000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 1000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 1500 && ilevel >= 1500)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 1500));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 1500), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 2000 && ilevel >= 2000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 2000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 2000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 2500 && ilevel >= 2500)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 2500));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 2500), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 3000 && ilevel >= 3000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 3000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 3000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 3500 && ilevel >= 3500)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 3500));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 3500), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 4000 && ilevel >= 4000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 4000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 4000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 4500 && ilevel >= 4500)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 4500));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 4500), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 5000 && ilevel >= 5000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 5000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 5000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 6000 && ilevel >= 6000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 6000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 6000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 7000 && ilevel >= 7000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 7000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 7000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 8000 && ilevel >= 8000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 8000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 8000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 9000 && ilevel >= 9000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 9000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 9000), datas);
|
|
#endif
|
|
}
|
|
if (iprevlevel < 10000 && ilevel >= 10000)
|
|
{
|
|
Analytics.CustomEvent(string.Format(eventname, 10000));
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(string.Format(eventname, 10000), datas);
|
|
#endif
|
|
}
|
|
#endif
|
|
}
|
|
|
|
public static void EventCompAds()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_view");
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> datas = new Dictionary<string, string>() { { "af_adrev_ad_type", "Reward" } };
|
|
AppsFlyer.sendEvent("af_ads", datas);
|
|
AppsFlyer.sendEvent("ad_view", datas);
|
|
AppsFlyer.sendEvent("ad_reward", datas);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventCompAdsCount(int icount)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
string eventname = null;
|
|
switch (icount)
|
|
{
|
|
case 5:
|
|
case 10:
|
|
case 15:
|
|
case 20:
|
|
case 30:
|
|
case 50:
|
|
eventname = string.Format("ad_reward{0:00}", icount);
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent(eventname, new Dictionary<string, string>());
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventClickAds()
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_click");
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> datas = new Dictionary<string, string>() { { "af_adrev_ad_type", "Reward" } };
|
|
AppsFlyer.sendEvent("ad_click", datas);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventBuyShop(int shopid)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Analytics.CustomEvent("BuyShop", new Dictionary<string, object>
|
|
{
|
|
{ "use_name", shopid }
|
|
});
|
|
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.Parameter param_name = new Firebase.Analytics.Parameter("use_name", shopid);
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent("BuyShop", param_name);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
AppsFlyer.sendEvent("buy_shop", new Dictionary<string, string>() { { "shop_id", shopid.ToString() } });
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventUseCash(string productId, string strprice, string currency, string signature = null, string purchaseData = null, string transactionId = null)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE || VER_ONESTORE)
|
|
if (string.IsNullOrEmpty(productId))
|
|
return;
|
|
Analytics.CustomEvent("UseCash", new Dictionary<string, object>
|
|
{
|
|
{ "use_name", productId }
|
|
});
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent("UseCash_" + productId);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
#if UNITY_ANDROID
|
|
AppsFlyerAndroid.validateAndSendInAppPurchase(Global.GooglePublicKey, signature, purchaseData, strprice, currency, null, SingleManager.Instance);
|
|
#elif UNITY_IOS
|
|
//AppsFlyeriOS.validateAndSendInAppPurchase(productId, strprice, currency, transactionId, null, SingleManager.Instance);
|
|
Dictionary<string, string> purchaseEvent = new Dictionary<string, string>();
|
|
purchaseEvent.Add(AFInAppEvents.CURRENCY, currency);
|
|
purchaseEvent.Add(AFInAppEvents.REVENUE, strprice);
|
|
purchaseEvent.Add(AFInAppEvents.QUANTITY, "1");
|
|
purchaseEvent.Add(AFInAppEvents.CONTENT_ID, productId);
|
|
purchaseEvent.Add(AFInAppEvents.ORDER_ID, transactionId);
|
|
AppsFlyer.sendEvent(AFInAppEvents.PURCHASE, purchaseEvent);
|
|
#endif
|
|
// 환불.
|
|
//AppsFlyer.sendEvent("cancel_purchase", purchaseEvent);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventUseCashOneStore(string productId, string strprice, string currency, string signature = null, string purchaseData = null)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE || !VER_ONESTORE)
|
|
if (string.IsNullOrEmpty(productId))
|
|
return;
|
|
Analytics.CustomEvent("UseCash", new Dictionary<string, object>
|
|
{
|
|
{ "use_name", productId }
|
|
});
|
|
Analytics.CustomEvent("OneStoreIAP", new Dictionary<string, object>
|
|
{
|
|
{ "use_name", productId }
|
|
});
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent("UseCash_" + productId);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> purchaseEvent = new Dictionary<string, string>();
|
|
purchaseEvent.Add(AFInAppEvents.CURRENCY, currency);
|
|
purchaseEvent.Add(AFInAppEvents.REVENUE, strprice);
|
|
purchaseEvent.Add(AFInAppEvents.QUANTITY, "1");
|
|
//purchaseEvent.Add(AFInAppEvents.CONTENT_TYPE, "category_a");
|
|
purchaseEvent.Add(AFInAppEvents.CONTENT_ID, productId);
|
|
AppsFlyer.sendEvent(AFInAppEvents.PURCHASE, purchaseEvent);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
public static void EventBuyProduct(string productid)
|
|
{
|
|
#if !(UNITY_EDITOR || VER_DEV || VER_TEST || VER_ZOMBIE)
|
|
Logger.LogWarning("Analytics - EventBuyProduct : " + productid);
|
|
string eventname = null;
|
|
|
|
switch (productid)
|
|
{
|
|
case "rf_110002":
|
|
eventname = "shop_dia_11";
|
|
break;
|
|
case "rf_110003":
|
|
eventname = "shop_dia_27";
|
|
break;
|
|
case "rf_110004":
|
|
eventname = "shop_dia_100";
|
|
break;
|
|
case "rf_110005":
|
|
eventname = "shop_dia_170x2";
|
|
break;
|
|
case "rf_110006":
|
|
eventname = "shop_dia_350x2";
|
|
break;
|
|
|
|
case "rf_110012":
|
|
eventname = "pack_ad_free";
|
|
break;
|
|
case "rf_110013":
|
|
eventname = "pack_ beginner";
|
|
break;
|
|
case "rf_110014":
|
|
eventname = "pack_master";
|
|
break;
|
|
case "rf_110015":
|
|
eventname = "pack_grand_master";
|
|
break;
|
|
case "rf_110016":
|
|
eventname = "pack_enhancement_a";
|
|
break;
|
|
case "rf_110017":
|
|
eventname = "pack_enhancement_b";
|
|
break;
|
|
|
|
case "rf_130001":
|
|
eventname = "pass_monster";
|
|
break;
|
|
case "rf_130002":
|
|
eventname = "pass_dungeon";
|
|
break;
|
|
case "rf_130003":
|
|
eventname = "pass_gold";
|
|
break;
|
|
case "rf_130004":
|
|
eventname = "pass_raid";
|
|
break;
|
|
case "rf_130005":
|
|
eventname = "pass_fighter";
|
|
break;
|
|
|
|
default:
|
|
Logger.LogWarning("Analytics - EventBuyProduct RETURN");
|
|
#if APPSFLYER_ANALYTICS
|
|
//if (PreorderMgr.SkuPreRegistration.Equals(productid))
|
|
// AppsFlyer.sendEvent("pre_registration_" + Global.Platform, new Dictionary<string, string>() { { "use_name", productid } });
|
|
//else
|
|
// AppsFlyer.sendEvent("cash_rf_" + productid, new Dictionary<string, string>() { { "use_name", productid } });
|
|
#endif
|
|
return;
|
|
}
|
|
Logger.LogWarning("Analytics - EventBuyProduct NEXT : " + eventname);
|
|
|
|
#if FIREBASE_ANALYTICS
|
|
if (FirebaseInit)
|
|
{
|
|
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventname);
|
|
}
|
|
#endif
|
|
|
|
#if APPSFLYER_ANALYTICS
|
|
Dictionary<string, string> datas = new Dictionary<string, string>();
|
|
datas.Add("product_id", productid);
|
|
AppsFlyer.sendEvent(eventname, datas);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
}
|