diff --git a/Runtime/Code/SDK/GuruSDK.Analytics.cs b/Runtime/Code/SDK/GuruSDK.Analytics.cs
index 604bef2..4cf7f36 100644
--- a/Runtime/Code/SDK/GuruSDK.Analytics.cs
+++ b/Runtime/Code/SDK/GuruSDK.Analytics.cs
@@ -320,6 +320,352 @@ namespace Guru
});
}
+ #endregion
+
+ #region 经济打点
+
+ // ************************************************************************************************
+ // *
+ // * 经济打点
+ // * 内容详参: https://docs.google.com/spreadsheets/d/1xYSsAjbrwqeJm7panoVzHO0PeGRQVDCR4e2CU9OPEzk/edit#gid=0
+ // *
+ // ************************************************************************************************
+
+ //---------------------------------------- EARN ----------------------------------------
+ ///
+ /// 获取虚拟货币/道具.
+ /// 基础接口, 不推荐项目组直接调用
+ /// 请直接调用其他对应场景的统计接口
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void EarnVirtualCurrency(string currencyName,
+ int value, int balance,
+ string category = "", string itemName = "",
+ string levelName = "", string scene = "")
+ {
+ Analytics.EarnVirtualCurrency(currencyName, value, balance, category, itemName,levelName, scene);
+ }
+
+
+
+ ///
+ /// 赚取组合: 货币+道具
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void EarnVirtualCurrencyAndProps(string currencyName,
+ int value = 0, int balance = 0,
+ string category = "", string itemName = "",
+ string levelName = "", string scene = Consts.ParameterDefaultScene,
+ string[] props = null)
+ {
+ //---- Currency -----
+ if (value > 0)
+ {
+ EarnVirtualCurrency(currencyName, value, balance, category, itemName,levelName, scene);
+ }
+ //---- Props --------
+ if (null != props)
+ {
+ int i = 0;
+ while (i < props.Length)
+ {
+ EarnVirtualCurrency(props[i], 1, 0, category, itemName,levelName, scene);
+ i++;
+ }
+ }
+ }
+
+ ///
+ /// 签到奖励. 获得货币/道具
+ /// 通常类型: Coin 收入
+ /// 特殊类型: Coin + Props (道具列表)
+ /// 特殊类型: Props (道具列表)
+ ///
+ /// 货币名称
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ /// 应用场景
+ /// 获取的道具名称列表
+ public static void EarnVirtualCurrencyBySign(string currencyName,
+ int value = 0, int balance = 0, string levelName = "",
+ string scene = "home", string[] props = null)
+ {
+ string category = Consts.CurrencyCategoryReward;
+ string itemName = "sign";
+
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+
+ ///
+ /// IAP 付费购买. 获得货币/道具
+ /// 通常类型: Coin 收入
+ /// 特殊类型: Coin + Props (道具列表)
+ /// 特殊类型: Props (道具列表)
+ ///
+ /// 货币名称
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ /// 应用场景
+ /// 获取的道具名称列表
+ public static void EarnVirtualCurrencyByIAP(string currencyName,
+ int value = 0, int balance = 0, string levelName = "",
+ string scene = "store", string[] props = null)
+ {
+ string category = Consts.CurrencyCategoryIAP;
+ string itemName = "sku";
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+ ///
+ /// 看广告获取到货币/道具
+ /// 通常类型: Coin 收入
+ /// 特殊类型: Coin + Props (道具列表)
+ /// 特殊类型: Props (道具列表)
+ ///
+ /// 货币名称
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ /// 应用场景
+ /// 获取的道具名称列表
+ public static void EarnVirtualCurrencyByAds(string currencyName,
+ int value = 0, int balance = 0, string levelName = "",
+ string scene = "store", string[] props = null)
+ {
+ string category = Consts.CurrencyCategoryReward;
+ string itemName = "ads";
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+ ///
+ /// 使用了金币半价 + 看广告获取到货币/道具
+ /// 通常类型: Coin 收入
+ /// 特殊类型: Coin + Props (道具列表)
+ /// 特殊类型: Props (道具列表)
+ ///
+ /// 货币名称
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ /// 应用场景
+ /// 获取的道具名称列表
+ public static void EarnVirtualCurrencyByPaidAds(string currencyName,
+ int value = 0, int balance = 0, string levelName = "",
+ string scene = Consts.ParameterDefaultScene, string[] props = null)
+ {
+ string category = Consts.CurrencyCategoryBonus;
+ string itemName = "ads";
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+ ///
+ /// 过关奖励获取到货币/道具
+ /// 通常类型: Coin 收入
+ /// 特殊类型: Coin + Props (道具列表)
+ /// 特殊类型: Props (道具列表)
+ ///
+ /// 货币名称
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ /// 应用场景
+ /// 获取的道具名称列表
+ public static void EarnVirtualCurrencyByLevelComplete(string currencyName,
+ int value = 0, int balance = 0, string levelName = "",
+ string scene = "store", string[] props = null)
+ {
+ string category = Consts.CurrencyCategoryReward;
+ string itemName = "level";
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+
+ ///
+ /// 通过使用 Currency 购买获得 Prop (记录 Prop 增加的打点, 消费游戏内货币)
+ ///
+ /// 货币名称
+ /// 获取的道具名称列表
+ /// 应用场景
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ public static void EarnPropsByVirtualCurrency(string currencyName, string[] props,
+ string scene = Consts.ParameterDefaultScene,
+ int value = 1, int balance = 0, string levelName = "")
+ {
+ string category = Consts.CurrencyCategoryIGC;
+ string itemName = currencyName;
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+ ///
+ /// 通过道具交换/合成或得了其他道具
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void EarnPropsByExchange(string propName, string otherPropName,
+ string scene = Consts.ParameterDefaultScene,
+ int value = 1, int balance = 0, string levelName = "")
+ {
+ string category = Consts.CurrencyCategoryIGB;
+ string itemName = otherPropName;
+ EarnVirtualCurrency(propName, value, balance, category, itemName, levelName, scene);
+ }
+
+
+ ///
+ /// 通过转盘或者抽奖, 获取货币/道具
+ /// 通常类型: Coin 收入
+ /// 特殊类型: Coin + Props (道具列表)
+ /// 特殊类型: Props (道具列表)
+ ///
+ /// 货币名称
+ /// 赚取金额
+ /// 货币总量(累加后)
+ /// 当前关卡名称
+ /// 应用场景
+ /// 获取的道具名称列表
+ public static void EarnVirtualCurrencyByLottery(string currencyName,
+ int value = 0, int balance = 0, string levelName = "",
+ string scene = "store", string[] props = null)
+ {
+ string category = Consts.CurrencyCategoryIGB;
+ string itemName = "lottery";
+ EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props);
+ }
+
+
+ //---------------------------------------- EARN ----------------------------------------
+
+
+ ///
+ /// 花费虚拟货币/道具
+ /// 基础接口, 不推荐项目组直接调用
+ /// 请直接调用其他对应场景的统计接口
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SpendVirtualCurrency(string currencyName,
+ int value, int balance,
+ string category = "", string itemName = "",
+ string levelName = "", string scene = "")
+ {
+ Analytics.SpendVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene);
+ }
+
+
+ ///
+ /// 消耗货币购买道具
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SpendVirtualCurrencyWithProp(string currencyName, string prop,
+ int value, int balance,
+ string levelName = "", string scene = "")
+ {
+ SpendVirtualCurrencyWithProps(currencyName, new string[] {prop}, value, balance, levelName, scene);
+ }
+
+ ///
+ /// 消耗货币购买道具 (含多个)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SpendVirtualCurrencyWithProps(string currencyName, string[] props,
+ int value, int balance,
+ string levelName = "", string scene = "")
+ {
+ string itemName = "";
+ string category = Consts.CurrencyCategoryProp;
+ if (props != null && props.Length > 0)
+ {
+ int i = 0;
+ while (i < props.Length)
+ {
+ itemName = props[i];
+ SpendVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene);
+ i++;
+ }
+ }
+ }
+
+ ///
+ /// 消耗货币购买礼包或组合
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SpendVirtualCurrencyWithBundle(string currencyName, string bundle,
+ int value, int balance,
+ string levelName = "", string scene = "")
+ {
+ SpendVirtualCurrencyWithBundles(currencyName, new string[] {bundle}, value, balance, levelName, scene);
+ }
+
+ ///
+ /// 消耗货币购买礼包或组合 (含多个)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SpendVirtualCurrencyWithBundles(string currencyName, string[] bundles,
+ int value, int balance,
+ string levelName = "", string scene = "")
+ {
+ string itemName = "";
+ string category = Consts.CurrencyCategoryBundle;
+ if (bundles != null && bundles.Length > 0)
+ {
+ int i = 0;
+ while (i < bundles.Length)
+ {
+ itemName = bundles[i];
+ SpendVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene);
+ i++;
+ }
+ }
+ }
+
+
#endregion
#region Crashlytics 接口
diff --git a/Runtime/Code/SDK/GuruSDK.Const.cs b/Runtime/Code/SDK/GuruSDK.Const.cs
index 31ba74a..77e9242 100644
--- a/Runtime/Code/SDK/GuruSDK.Const.cs
+++ b/Runtime/Code/SDK/GuruSDK.Const.cs
@@ -215,8 +215,19 @@ namespace Guru
// 经济相关
public const string ParameterBalance = "balance"; // 用于余额
- public const string ParameterSku = "sku"; // sku
+ public const string ParameterDefaultScene = "ingame"; // 货币消费默认场景
public const string ParameterVirtualCurrencyName = "virtual_currency_name"; // 虚拟货币名称
+
+
+ public const string CurrencyNameProps = "props"; // props
+
+ public const string CurrencyCategoryReward = "reward"; // common, ads
+ public const string CurrencyCategoryIAP = "iap_buy"; // In app purchase
+ public const string CurrencyCategoryBonus = "bonus"; // ads+items, gift box, item group
+ public const string CurrencyCategoryIGC = "igc"; // In game currency
+ public const string CurrencyCategoryIGB = "igb"; // In game barter
+ public const string CurrencyCategoryProp = "prop"; // prop
+ public const string CurrencyCategoryBundle = "bundle"; // prop groups
// SDK
diff --git a/package.json b/package.json
index 8fb1097..60e011c 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "com.guru.unity.sdk",
"displayName": "Guru SDK",
- "version": "1.0.10",
+ "version": "1.0.11",
"description": "Guru SDK for unity project",
"unity": "2020.3",
"author":{