sdk
This commit is contained in:
parent
03cb55a053
commit
1db0ebb9e3
@ -70,6 +70,10 @@ namespace BF
|
||||
}
|
||||
}
|
||||
#endif
|
||||
public bool GetIsHashCollision()
|
||||
{
|
||||
return spriteNameList.Count != spriteDict.Count;
|
||||
}
|
||||
|
||||
public Sprite GetSprite(uint spriteName)
|
||||
{
|
||||
@ -86,7 +90,7 @@ namespace BF
|
||||
int count = spriteNameList.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
spriteDict.Add(spriteNameList[i], spriteList[i]);
|
||||
spriteDict.TryAdd(spriteNameList[i], spriteList[i]);
|
||||
}
|
||||
#if !UNITY_EDITOR
|
||||
spriteNameList.Clear();
|
||||
|
||||
@ -10,10 +10,8 @@ namespace BF
|
||||
public class BFMain : MonoSingleton<BFMain>
|
||||
{
|
||||
List<ManagerBase> managerList;
|
||||
|
||||
// 客户端c#代码版本号,每次发布新包后加1,lua层存在一套代码兼容多版本c#代码
|
||||
public const int CLIENT_VERSION = 2;
|
||||
|
||||
public const int CLIENT_VERSION = 4;
|
||||
// 是否是单机版
|
||||
public static bool IsStandAlone = false;
|
||||
public static bool IsShenhe = false;
|
||||
@ -23,6 +21,60 @@ namespace BF
|
||||
public const string FILE_HEAD_BASE64 = "Zm9yX2ZpbGVfaGVhZ";
|
||||
public static long ServerTime = 0;
|
||||
public static long DifferenceTime = 0;
|
||||
public static string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return "b13";
|
||||
#else
|
||||
if (BFPlatform.Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||
{
|
||||
return "b13-ru";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "b13";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
public static string ProjectEnv
|
||||
{
|
||||
get
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
// 编辑器
|
||||
return "release";
|
||||
#else
|
||||
// 如果走深度链接启动且有参数,则走深度链接地址
|
||||
if (!string.IsNullOrEmpty(DPEnv))
|
||||
{
|
||||
return DPEnv;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "release";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
public static bool ForceEnv
|
||||
{
|
||||
get
|
||||
{
|
||||
return DPForceEnv;
|
||||
}
|
||||
}
|
||||
|
||||
// 深度链接参数
|
||||
public static string DPEntrance = string.Empty; // 内外网
|
||||
public static bool DPIsLan = false; // 是否为内网
|
||||
public static string DPEnv = string.Empty; // env
|
||||
public static bool DPSupportGM = false; // 正式环境下是否开启GM
|
||||
public static bool DPSupportLog = false; // 正式环境下是否打印日志
|
||||
public static string DPPackageName = string.Empty; // 模拟包名
|
||||
public static bool DPForceEnv = false; // 是否强制设置env
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
@ -320,6 +372,53 @@ namespace BF
|
||||
}
|
||||
}
|
||||
|
||||
// BattleManager battleMgr;
|
||||
// public BattleManager BattleMgr
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (battleMgr == null)
|
||||
// {
|
||||
// battleMgr = BattleManager.Create();
|
||||
// battleMgr.SetMono(this);
|
||||
// battleMgr.Init();
|
||||
// managerList.Add(battleMgr);
|
||||
// }
|
||||
// return battleMgr;
|
||||
// }
|
||||
// }
|
||||
|
||||
BFParseClientManager parseClientMgr;
|
||||
public BFParseClientManager ParseClientMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parseClientMgr == null)
|
||||
{
|
||||
parseClientMgr = BFParseClientManager.Create();
|
||||
parseClientMgr.SetMono(this);
|
||||
parseClientMgr.Init();
|
||||
managerList.Add(parseClientMgr);
|
||||
}
|
||||
return parseClientMgr;
|
||||
}
|
||||
}
|
||||
|
||||
URPManager urpMgr;
|
||||
public URPManager URPMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (urpMgr == null)
|
||||
{
|
||||
urpMgr = URPManager.Create();
|
||||
urpMgr.Init();
|
||||
managerList.Add(urpMgr);
|
||||
}
|
||||
return urpMgr;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetServerTime(long serverTime)
|
||||
{
|
||||
ServerTime = serverTime;
|
||||
|
||||
@ -105,5 +105,16 @@ namespace BF
|
||||
httpRequest.RawData = Encoding.UTF8.GetBytes(data);
|
||||
httpRequest.Send();
|
||||
}
|
||||
|
||||
public void SendRequest(string url, string data, Action<HTTPRequest, HTTPResponse> callback)
|
||||
{
|
||||
var httpRequest = new HTTPRequest(new Uri(url), HTTPMethods.Get, (req, httpResponse) =>
|
||||
{
|
||||
callback?.Invoke(req, httpResponse);
|
||||
});
|
||||
httpRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
httpRequest.RawData = Encoding.UTF8.GetBytes(data);
|
||||
httpRequest.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Scripts/Common/DeepLink.meta
Normal file
8
Assets/Scripts/Common/DeepLink.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 150be05a54bb5274885ce7c5a6bdcedc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
254
Assets/Scripts/Common/DeepLink/DeepLinkManager.cs
Normal file
254
Assets/Scripts/Common/DeepLink/DeepLinkManager.cs
Normal file
@ -0,0 +1,254 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class DeepLinkManager : MonoBehaviour
|
||||
{
|
||||
// 深度链接参数
|
||||
public static string ENTRANCE = "entrance"; // Lan/Wan 内外网
|
||||
public const string ENTRANCE_LAN = "lan";
|
||||
public static string ENV = "env"; // 正式环境/白名单等
|
||||
public static string GM = "gm"; // gm
|
||||
public static string LOG = "log"; // 日志
|
||||
public static string PACKAGE = "package"; // 包名
|
||||
public const string TRUE_FLAG = "true";
|
||||
public const string FALSE_FLAG = "false";
|
||||
private const string SIGN_FLAG = "sign"; // 签名
|
||||
|
||||
// 缓存上一次的地址 与 解析后的参数
|
||||
private string DeepLinkURL = string.Empty;
|
||||
private Dictionary<string, string> DeepLinkParams = new Dictionary<string, string>();
|
||||
|
||||
// 因事件触发的callback,冷启动会在login中处理
|
||||
public Action<string, string> luaDeepLinkActiveCallback;
|
||||
private static char[] NOTHING_CHAR_RESULT = new char[32];
|
||||
private static char[] NOTHING_CHAR = new char[32] {
|
||||
(char)('y' ^ (0x37 - 0)),
|
||||
(char)('r' ^ (0x37 - 1)),
|
||||
(char)('u' ^ (0x37 - 2)),
|
||||
(char)('8' ^ (0x37 - 3)),
|
||||
(char)('c' ^ (0x37 - 4)),
|
||||
(char)('z' ^ (0x37 - 5)),
|
||||
(char)('P' ^ (0x37 - 6)),
|
||||
(char)('i' ^ (0x37 - 7)),
|
||||
(char)('s' ^ (0x37 - 8)),
|
||||
(char)('o' ^ (0x37 - 9)),
|
||||
(char)('O' ^ (0x37 - 10)),
|
||||
(char)('0' ^ (0x37 - 11)),
|
||||
(char)('x' ^ (0x37 - 12)),
|
||||
(char)('W' ^ (0x37 - 13)),
|
||||
(char)('L' ^ (0x37 - 14)),
|
||||
(char)('e' ^ (0x37 - 15)),
|
||||
(char)('k' ^ (0x37 - 16)),
|
||||
(char)('B' ^ (0x37 - 17)),
|
||||
(char)('q' ^ (0x37 - 18)),
|
||||
(char)('2' ^ (0x37 - 19)),
|
||||
(char)('H' ^ (0x37 - 20)),
|
||||
(char)('f' ^ (0x37 - 21)),
|
||||
(char)('Y' ^ (0x37 - 22)),
|
||||
(char)('n' ^ (0x37 - 23)),
|
||||
(char)('X' ^ (0x37 - 24)),
|
||||
(char)('4' ^ (0x37 - 25)),
|
||||
(char)('A' ^ (0x37 - 26)),
|
||||
(char)('9' ^ (0x37 - 27)),
|
||||
(char)('N' ^ (0x37 - 28)),
|
||||
(char)('a' ^ (0x37 - 29)),
|
||||
(char)('U' ^ (0x37 - 30)),
|
||||
(char)('G' ^ (0x37 - 31)),
|
||||
};
|
||||
private static bool NothingFlag = false;
|
||||
private static char[] GetNothingChar()
|
||||
{
|
||||
if (!NothingFlag)
|
||||
{
|
||||
NothingFlag = true;
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
NOTHING_CHAR_RESULT[i] = (char)(NOTHING_CHAR[i] ^ (0x37 - i));
|
||||
}
|
||||
}
|
||||
return NOTHING_CHAR_RESULT;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
// 注册监听
|
||||
Application.deepLinkActivated += OnDeepLinkActivated;
|
||||
if (!string.IsNullOrEmpty(Application.absoluteURL))
|
||||
{
|
||||
// 冷启动而且 Application.absoluteURL 不为 null,因此处理深层链接。
|
||||
OnDeepLinkActivated(Application.absoluteURL);
|
||||
}
|
||||
// 初始化 DeepLink Manager 全局变量。
|
||||
else
|
||||
{
|
||||
DeepLinkURL = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDeepLinkActivated(string url)
|
||||
{
|
||||
DeepLinkURL = url;
|
||||
UpdateMapData(DeepLinkURL);
|
||||
|
||||
// 不考虑中途打开 仅处理冷启动
|
||||
// if (luaDeepLinkActiveCallback != null)
|
||||
// {
|
||||
// // 延迟的回调
|
||||
// luaDeepLinkActiveCallback(DeepLinkURL, GetDeepLinkParamsJson());
|
||||
// }
|
||||
HandleLaunchLinkParams();
|
||||
}
|
||||
|
||||
private void HandleLaunchLinkParams()
|
||||
{
|
||||
if (!DeepLinkParams.ContainsKey(SIGN_FLAG))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string serverSign = DeepLinkParams[SIGN_FLAG];
|
||||
if (string.IsNullOrEmpty(serverSign))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string signStr = string.Empty;
|
||||
foreach (var kvp in DeepLinkParams.OrderBy(kv => kv.Key, StringComparer.Ordinal))
|
||||
{
|
||||
if (!kvp.Key.Equals(SIGN_FLAG))
|
||||
{
|
||||
if (string.IsNullOrEmpty(signStr))
|
||||
{
|
||||
signStr += kvp.Key + "=" + kvp.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
signStr += "&" + kvp.Key + "=" + kvp.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
signStr += string.Concat(GetNothingChar());
|
||||
if (!Md5Encrypt.VerifyMd5Hash(signStr, serverSign))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// 冷启动 更新参数
|
||||
if (DeepLinkParams.ContainsKey(ENTRANCE))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DeepLinkParams[ENTRANCE]))
|
||||
{
|
||||
BFMain.DPEntrance = DeepLinkParams[ENTRANCE];
|
||||
if (BFMain.DPEntrance == ENTRANCE_LAN)
|
||||
{
|
||||
BFMain.DPIsLan = true;
|
||||
}
|
||||
|
||||
Debug.Log("深度链接 更新 ENTRANCE:" + BFMain.DPEntrance + " 内网:" + BFMain.DPIsLan); // 测试日志 TODOJ
|
||||
}
|
||||
}
|
||||
if (DeepLinkParams.ContainsKey(ENV))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DeepLinkParams[ENV]))
|
||||
{
|
||||
BFMain.DPEnv = DeepLinkParams[ENV];
|
||||
BFMain.DPForceEnv = true;
|
||||
Debug.Log("深度链接 更新 ENV:" + BFMain.DPEnv); // 测试日志 TODOJ
|
||||
}
|
||||
}
|
||||
if (DeepLinkParams.ContainsKey(GM))
|
||||
{
|
||||
var support = DeepLinkParams[GM] == TRUE_FLAG;
|
||||
BFMain.DPSupportGM = support;
|
||||
|
||||
Debug.Log("深度链接 更新 GM:" + BFMain.DPSupportGM); // 测试日志 TODOJ
|
||||
}
|
||||
if (DeepLinkParams.ContainsKey(LOG))
|
||||
{
|
||||
var support = DeepLinkParams[LOG] == TRUE_FLAG;
|
||||
BFMain.DPSupportLog = support;
|
||||
|
||||
Debug.Log("深度链接 更新 LOG:" + BFMain.DPSupportLog); // 测试日志 TODOJ
|
||||
}
|
||||
if (DeepLinkParams.ContainsKey(PACKAGE))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DeepLinkParams[PACKAGE]))
|
||||
{
|
||||
BFMain.DPPackageName = DeepLinkParams[PACKAGE];
|
||||
|
||||
Debug.Log("深度链接 更新 ENV:" + BFMain.DPPackageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateMapData(string url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var splitUrl = url.Split('?', 2);
|
||||
if (splitUrl.Length < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var parsedUrl = splitUrl[1];
|
||||
if (string.IsNullOrWhiteSpace(parsedUrl))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var strs = parsedUrl.Split('&');
|
||||
foreach (var str in strs)
|
||||
{
|
||||
var keyValueStr = str.Split('=', 2);
|
||||
if (keyValueStr.Length == 2)
|
||||
{
|
||||
var key = keyValueStr[0];
|
||||
var value = keyValueStr[1];
|
||||
|
||||
// 更新
|
||||
DeepLinkParams[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取缓存的深度链接
|
||||
public string GetDeepLinkURL()
|
||||
{
|
||||
return DeepLinkURL;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetDeepLinkParamsDic()
|
||||
{
|
||||
return DeepLinkParams;
|
||||
}
|
||||
|
||||
public string GetDeepLinkParamsJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(DeepLinkParams);
|
||||
}
|
||||
|
||||
public string GetDeepLinkValueByKey(string key)
|
||||
{
|
||||
if (DeepLinkParams.ContainsKey(key))
|
||||
{
|
||||
return DeepLinkParams[key];
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// 设置回调
|
||||
public void SetLuaDeepLinkActiveCallback(Action<string, string> callback)
|
||||
{
|
||||
luaDeepLinkActiveCallback = callback;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ede466cf9e884fcb90bfec949dc6f04
|
||||
guid: ade1fea119719f145b768283e38c6a43
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@ -15,6 +15,7 @@ namespace BF
|
||||
public LaunchRequester LaunchRequester { get; private set; }
|
||||
public int LaunchTimes { get; private set; }
|
||||
public bool LoadedFirstAb = false;
|
||||
private bool isShowAtt = false;
|
||||
|
||||
GameLaunchProcessorBase currentProcessor;
|
||||
|
||||
@ -52,14 +53,23 @@ namespace BF
|
||||
{
|
||||
}
|
||||
|
||||
public void ShowIOSATTrack()
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
// ATT的回调里面会初始化广告SDK,所以这里处理一下如果多次调用,只会生效一次
|
||||
if (!isShowAtt)
|
||||
{
|
||||
isShowAtt = true;
|
||||
IOS_ATTrack();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 游戏启动入口
|
||||
/// </summary>
|
||||
public void LaunchGame()
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
IOS_ATTrack();
|
||||
#endif
|
||||
LaunchTimes++;
|
||||
#if USE_AB
|
||||
GameLaunchProcessorBase processor = new LaunchSuccProcessor();
|
||||
|
||||
@ -26,6 +26,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "CalculateDiffProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
this.lr = lr;
|
||||
|
||||
@ -48,6 +52,10 @@ namespace BF
|
||||
}
|
||||
else
|
||||
{
|
||||
var clientProcessorOptParams1 = new Dictionary<string, object>();
|
||||
clientProcessorOptParams1.TryAdd("opt_type", "CalculateDiffProcessorOverWithoutUpdate");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams1);
|
||||
|
||||
// 既没有热更新也没有自动修复
|
||||
lr.deleteList = lr.preCheckOverList;
|
||||
lr.curVersionTempDir = Path.Combine(TempUpdateDirPath, lr.persistentAbcc.version);
|
||||
@ -62,6 +70,10 @@ namespace BF
|
||||
EnsureFilesInUpdate();
|
||||
GetDeleteList();
|
||||
|
||||
var clientProcessorOptParams2 = new Dictionary<string, object>();
|
||||
clientProcessorOptParams2.TryAdd("opt_type", "CalculateDiffProcessorOverWithUpdate");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams2);
|
||||
|
||||
totalCount = abConfigList.Count;
|
||||
alreadyCount = 0;
|
||||
frameAlreadyCount = 0;
|
||||
|
||||
@ -32,6 +32,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "DownloadUpdateProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
|
||||
this.lr = lr;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
@ -18,6 +19,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "FirstABProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
this.lr = lr;
|
||||
|
||||
|
||||
@ -19,6 +19,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "FixUpProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
|
||||
this.lr = lr;
|
||||
|
||||
@ -18,6 +18,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "OnGetVersionProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
|
||||
this.lr = lr;
|
||||
@ -121,6 +125,11 @@ namespace BF
|
||||
{
|
||||
if(string.IsNullOrEmpty(lr.versionInfo.cdn_url))
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "OnGetVersionProcessorChooseCdnFail");
|
||||
clientProcessorOptParams.TryAdd("err_info", "server return cdn list is empty");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
BFLog.LogError("获取不到cdn列表 服务器返回的cdn列表为空");
|
||||
return;
|
||||
}
|
||||
@ -181,6 +190,10 @@ namespace BF
|
||||
/// </summary>
|
||||
void DownloadABConfig()
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "OnGetVersionProcessorDownloadABConfig");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
var address = Path.Combine(lr.firstChoiceCDN, lr.versionInfo.version, "ab_config.bytes");
|
||||
var timeout = 60;
|
||||
BFMain.Instance.WebRequestMgr.Get(address, OnDownloadABConfig, timeout);
|
||||
|
||||
@ -22,6 +22,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "PreCheckProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
|
||||
this.lr = lr;
|
||||
@ -109,6 +113,10 @@ namespace BF
|
||||
|
||||
BFMain.Instance.LoomMgr.QueueOnMainThread(() =>
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "PreCheckProcessorCheckMissFile");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
checkMissFileEnd = true;
|
||||
PreCheckEnd();
|
||||
});
|
||||
@ -129,6 +137,10 @@ namespace BF
|
||||
|
||||
BFMain.Instance.LoomMgr.QueueOnMainThread(() =>
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "PreCheckProcessorCheckOverFile");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
checkOverFileEnd = true;
|
||||
PreCheckEnd();
|
||||
});
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
@ -19,13 +20,25 @@ namespace BF
|
||||
base.Process(lr);
|
||||
|
||||
this.lr = lr;
|
||||
|
||||
// 这里延迟一帧处理是因为数数在当前帧未初始化完成会报错,所以这里处理为延迟一帧,等初始化完成
|
||||
BFMain.Instance.OneShotManager.AddOneShot(()=>{
|
||||
PrepareABConfig();
|
||||
});
|
||||
}
|
||||
|
||||
void PrepareABConfig()
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "PrepareProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
GetBytesAsync(StreamingAbccPath, (byte[] data) =>
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "PrepareProcessorOver");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
var json = AssetBundleConfigCollection.Decompress(data);
|
||||
lr.streamingAbcc = AssetBundleConfigCollection.Create(json);
|
||||
var needCopyABConfig = false;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BF
|
||||
@ -13,6 +14,10 @@ namespace BF
|
||||
|
||||
public override void Process(LaunchRequester lr)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "RequestVersionProcessorStart");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
base.Process(lr);
|
||||
|
||||
this.lr = lr;
|
||||
@ -28,6 +33,10 @@ namespace BF
|
||||
|
||||
void OnServerRespond(string json)
|
||||
{
|
||||
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||
clientProcessorOptParams.TryAdd("opt_type", "RequestVersionProcessorOver");
|
||||
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||
|
||||
BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "green", "版本信息: " + json);
|
||||
if (!BFMain.IsStandAlone) // 如果是单机就直接下一步
|
||||
{
|
||||
|
||||
@ -16,6 +16,8 @@ namespace BF
|
||||
|
||||
public const string MAIN_SOCKET_NAME = "0";
|
||||
public const string CHAT_SOCKET_NAME = "1";
|
||||
public const int MAIN_SOCKET_NAME_INT = 0;
|
||||
public const int CHAT_SOCKET_NAME_INT = 1;
|
||||
static NetManager instance;
|
||||
private NetClient netClient;
|
||||
private List<ClientInfo> clients = new List<ClientInfo>();
|
||||
@ -31,8 +33,11 @@ namespace BF
|
||||
public byte [] authReqData = null;
|
||||
public byte [] ChatAuthReqData = null;
|
||||
public string decodePbStr = null;
|
||||
public string decodeChatPbStr = null;
|
||||
public uint rspGroup = 0;
|
||||
public uint rspChatGroup = 0;
|
||||
public bool decodeFinish = false;
|
||||
public bool decodeChatFinish = false;
|
||||
public static NetManager Create()
|
||||
{
|
||||
BFLog.LogAssert(instance == null, "This method only allows BFMain to call once");
|
||||
@ -198,8 +203,15 @@ namespace BF
|
||||
}
|
||||
|
||||
public void HandleDecodePbChange(int clientId, uint group, uint seq, byte[] data)
|
||||
{
|
||||
if (clientId == MAIN_SOCKET_NAME_INT)
|
||||
{
|
||||
decodeFinish = false;
|
||||
}
|
||||
else if (clientId == CHAT_SOCKET_NAME_INT)
|
||||
{
|
||||
decodeChatFinish = false;
|
||||
}
|
||||
OnDecodePbCallback?.Invoke(clientId, group, seq, data);
|
||||
}
|
||||
|
||||
@ -317,7 +329,7 @@ namespace BF
|
||||
public void ConnectWithConfiguration(int clientId, NetConnectConfiguration configuration, string domainName, int port)
|
||||
{
|
||||
ClientInfo clientInfo = new ClientInfo();
|
||||
clientInfo.Name = configuration.UniqueIdentifier;
|
||||
clientInfo.Name = clientId.ToString();
|
||||
clientInfo.LastConnectStatus = NetConnectStatus.InvalidConnect;
|
||||
clients[clientId] = clientInfo;
|
||||
netClient.Connect(configuration, domainName, port);
|
||||
@ -370,16 +382,31 @@ namespace BF
|
||||
return decodeFinish;
|
||||
}
|
||||
|
||||
public bool GetDecodeChatStataus()
|
||||
{
|
||||
return decodeChatFinish;
|
||||
}
|
||||
|
||||
public string GetDecodePbStr()
|
||||
{
|
||||
return decodePbStr;
|
||||
}
|
||||
|
||||
public string GetDecodeChatPbStr()
|
||||
{
|
||||
return decodeChatPbStr;
|
||||
}
|
||||
|
||||
public uint GetDecodeGroup()
|
||||
{
|
||||
return rspGroup;
|
||||
}
|
||||
|
||||
public uint GetDecodeChatGroup()
|
||||
{
|
||||
return rspChatGroup;
|
||||
}
|
||||
|
||||
public void AddLuaOnReceiveMessage(Action<int, uint, uint, byte[]> luaFunc)
|
||||
{
|
||||
OnReceiveMsgLuaCallback = luaFunc;
|
||||
|
||||
@ -104,7 +104,15 @@ namespace BF
|
||||
/// <returns></returns>
|
||||
private bool DeserializeAuthRsp(out long status)
|
||||
{
|
||||
string pbData = BF.BFMain.Instance.NetMgr.GetDecodePbStr();
|
||||
string pbData;
|
||||
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||
{
|
||||
pbData = BFMain.Instance.NetMgr.GetDecodePbStr();
|
||||
}
|
||||
else
|
||||
{
|
||||
pbData = BFMain.Instance.NetMgr.GetDecodeChatPbStr();
|
||||
}
|
||||
Dictionary<string, object> dict = Json.Deserialize(pbData) as Dictionary<string, object>;
|
||||
|
||||
status = (long)dict["status"];
|
||||
|
||||
@ -214,7 +214,14 @@ namespace BF
|
||||
// ResetOldSessionRc4Key();
|
||||
|
||||
ForceSendHeartBeatImmediately();
|
||||
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||
{
|
||||
BF.BFMain.Instance.NetMgr.decodeFinish = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BF.BFMain.Instance.NetMgr.decodeChatFinish = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -310,7 +317,16 @@ namespace BF
|
||||
private bool DeserializeReconnectRsp(out long status, out long seqCs)
|
||||
{
|
||||
// BFLog.Log("==================================== DeserializeReconnectRsp");
|
||||
string pbData = BF.BFMain.Instance.NetMgr.GetDecodePbStr();
|
||||
string pbData;
|
||||
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||
|
||||
{
|
||||
pbData = BF.BFMain.Instance.NetMgr.GetDecodePbStr();
|
||||
}
|
||||
else
|
||||
{
|
||||
pbData = BF.BFMain.Instance.NetMgr.GetDecodeChatPbStr();
|
||||
}
|
||||
Dictionary<string, object> dict = Json.Deserialize(pbData) as Dictionary<string, object>;
|
||||
// BFLog.Log("==================================== DeserializeReconnectRsp pbData = " + pbData);
|
||||
// BFLog.Log("==================================== DeserializeReconnectRsp status = " + (long)dict["status"]);
|
||||
|
||||
@ -72,12 +72,14 @@ namespace BF
|
||||
|
||||
// BFLog.Log("visibleStatus = " + visibleStatus);
|
||||
if (visibleStatus == NetConnectStatus.Decoding && !decoding)
|
||||
{
|
||||
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||
{
|
||||
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeStataus();
|
||||
if (decodeFinish)
|
||||
{
|
||||
uint group = BF.BFMain.Instance.NetMgr.GetDecodeGroup();
|
||||
if (group == Auth_Rsp_Group || group == Chat_Auth_Rsp_Group)
|
||||
if (group == Auth_Rsp_Group)
|
||||
{
|
||||
decoding = true;
|
||||
FilterAuthIncomingMessage2();
|
||||
@ -85,8 +87,25 @@ namespace BF
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeChatStataus();
|
||||
if (decodeFinish)
|
||||
{
|
||||
uint group = BF.BFMain.Instance.NetMgr.GetDecodeChatGroup();
|
||||
if (group == Chat_Auth_Rsp_Group)
|
||||
{
|
||||
decoding = true;
|
||||
FilterAuthIncomingMessage2();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// BFLog.Log("visibleStatus = " + visibleStatus + "decoding = " + decoding);
|
||||
if (visibleStatus == NetConnectStatus.Decoding2 && !decoding)
|
||||
{
|
||||
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||
{
|
||||
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeStataus();
|
||||
if (decodeFinish)
|
||||
@ -100,6 +119,21 @@ namespace BF
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeChatStataus();
|
||||
if (decodeFinish)
|
||||
{
|
||||
uint group = BF.BFMain.Instance.NetMgr.GetDecodeChatGroup();
|
||||
if (group == Reconnect_Rsp_Group)
|
||||
{
|
||||
decoding = true;
|
||||
FilterReconnectIncomingMessage2();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -23,19 +23,21 @@ namespace AudienceNetwork
|
||||
public partial class AdManager : BF.MonoSingleton<AdManager>
|
||||
{
|
||||
private const string Tag = "AdManager:";
|
||||
// private const string Key = "9uHgeBwag3NXva9MC23ToO3q11Ve59bF1uwg4qGltdGmCQ7OSByFZ_3b1ZF7krMlkHQo5gXzIokVDsvg1rwbr-";
|
||||
private const string Key = "9uHgeBwag3NXva9MC23ToO3q11Ve59bF1uwg4qGltdGmCQ7OSByFZ_3b1ZF7krMlkHQo5gXzIokVDsvg1rwbr-11";
|
||||
private const string Key = "9uHgeBwag3NXva9MC23ToO3q11Ve59bF1uwg4qGltdGmCQ7OSByFZ_3b1ZF7krMlkHQo5gXzIokVDsvg1rwbr-";
|
||||
string bannerAdUnitId = "YOUR_BANNER_AD_UNIT_ID"; // Retrieve the ID from your account
|
||||
string adInterstitialUnitId = "YOUR_AD_UNIT_ID";
|
||||
string adRewardUnitId = "e54f27e345da90df";
|
||||
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
string adRewardUnitId = "1043ecded04c561b";
|
||||
#else
|
||||
string adRewardUnitId = "3fdcc8a796773aa2";
|
||||
#endif
|
||||
public Action<string> luaAdRevenuePaidEventCallback;
|
||||
// Start is called before the first frame update
|
||||
public void Init(string init = "")
|
||||
{
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) =>
|
||||
{
|
||||
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
if (MaxSdkUtils.CompareVersions(UnityEngine.iOS.Device.systemVersion, "14.5") != MaxSdkUtils.VersionComparisonResult.Lesser)
|
||||
{
|
||||
// Note that App transparency tracking authorization can be checked via `sdkConfiguration.AppTrackingStatus` for Unity Editor and iOS targets
|
||||
@ -45,6 +47,7 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
||||
else
|
||||
AudienceNetwork.AdSettings.SetAdvertiserTrackingEnabled(false);
|
||||
}
|
||||
#endif
|
||||
// Show Mediation Debugger
|
||||
// MaxSdk.ShowMediationDebugger();
|
||||
// MaxSdk.SetVerboseLogging(true);
|
||||
@ -56,7 +59,7 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
||||
MaxSdk.SetUserId(SystemInfo.deviceUniqueIdentifier);
|
||||
// MaxSdk.SetVerboseLogging(true);
|
||||
MaxSdk.InitializeSdk();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
private void LoadAds()
|
||||
@ -66,6 +69,11 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
||||
// InitializeInterstitialAds();
|
||||
}
|
||||
|
||||
public void SetAdRevenuePaidEventCallback(Action<string> callback)
|
||||
{
|
||||
luaAdRevenuePaidEventCallback = callback;
|
||||
}
|
||||
|
||||
public bool IsRewardedAdReady()
|
||||
{
|
||||
return MaxSdk.IsRewardedAdReady(adRewardUnitId);
|
||||
@ -93,10 +101,11 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
||||
return MaxSdk.IsInterstitialReady(adInterstitialUnitId);
|
||||
}
|
||||
|
||||
public void ShowInterstitial()
|
||||
public void ShowInterstitial(Action<int> callback = null)
|
||||
{
|
||||
if (MaxSdk.IsInterstitialReady(adInterstitialUnitId))
|
||||
{
|
||||
_interstitialAdCallback = callback;
|
||||
MaxSdk.ShowInterstitial(adInterstitialUnitId);
|
||||
}
|
||||
}
|
||||
@ -105,10 +114,48 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
||||
public void ShowBanner()
|
||||
{
|
||||
MaxSdk.ShowBanner(bannerAdUnitId);
|
||||
MaxSdk.StartBannerAutoRefresh(bannerAdUnitId);
|
||||
}
|
||||
|
||||
public void HideBanner()
|
||||
{
|
||||
MaxSdk.StopBannerAutoRefresh(bannerAdUnitId);
|
||||
MaxSdk.HideBanner(bannerAdUnitId);
|
||||
}
|
||||
|
||||
public void DestroyBanner()
|
||||
{
|
||||
MaxSdk.DestroyBanner(bannerAdUnitId);
|
||||
}
|
||||
|
||||
public bool IsPrivacyOptionsRequired()
|
||||
{
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
return BF.BFUMPManager.IsPrivacyOptionsRequired();
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
return BF.BFMain.Instance.SDKMgr.BFNativeSDKMgr.IsPrivacyOptionsRequired();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ShowPrivacyOptionsForm()
|
||||
{
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
BF.BFUMPManager.ShowPrivacyOptionsForm();
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
BF.BFMain.Instance.SDKMgr.BFNativeSDKMgr.ShowPrivacyOptionsForm();
|
||||
#endif
|
||||
}
|
||||
|
||||
public bool CheckCanRequestAds()
|
||||
{
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
return BF.BFUMPManager.IsPrivacyOptionsRequired();
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
return BF.BFMain.Instance.SDKMgr.BFNativeSDKMgr.IsPrivacyOptionsRequired();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public partial class AdManager
|
||||
{
|
||||
public void InitializeBannerAds()
|
||||
{
|
||||
// Banners are automatically sized to 320×50 on phones and 728×90 on tablets
|
||||
// You may call the utility method MaxSdkUtils.isTablet() to help with view sizing adjustments
|
||||
MaxSdk.CreateBanner(bannerAdUnitId, MaxSdkBase.BannerPosition.BottomCenter);
|
||||
|
||||
// Set background or background color for banners to be fully functional
|
||||
MaxSdk.SetBannerBackgroundColor(bannerAdUnitId, Color.white);
|
||||
|
||||
MaxSdkCallbacks.Banner.OnAdLoadedEvent += OnBannerAdLoadedEvent;
|
||||
MaxSdkCallbacks.Banner.OnAdLoadFailedEvent += OnBannerAdLoadFailedEvent;
|
||||
MaxSdkCallbacks.Banner.OnAdClickedEvent += OnBannerAdClickedEvent;
|
||||
@ -27,7 +22,34 @@ public partial class AdManager
|
||||
|
||||
private void OnBannerAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||
|
||||
private void OnBannerAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||
private void OnBannerAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
if (luaAdRevenuePaidEventCallback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
double revenue = adInfo.Revenue;
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
string networkPlacement = adInfo.NetworkPlacement; // The placement ID from the network that showed the ad
|
||||
string adFormat = adInfo.AdFormat;
|
||||
|
||||
var dict = new Dictionary<string, System.Object>();
|
||||
dict.Add("revenue", revenue);
|
||||
dict.Add("country_code", countryCode);
|
||||
dict.Add("network_name", networkName);
|
||||
dict.Add("ad_unit_Id", adUnitId);
|
||||
dict.Add("ad_unit_identifier", adUnitIdentifier);
|
||||
dict.Add("placement", placement);
|
||||
dict.Add("network_placement", networkPlacement);
|
||||
dict.Add("ad_format", adFormat);
|
||||
dict.Add("ad_type", "banner");
|
||||
var result = JsonConvert.SerializeObject(dict);
|
||||
luaAdRevenuePaidEventCallback(result);
|
||||
}
|
||||
|
||||
private void OnBannerAdExpandedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public partial class AdManager
|
||||
{
|
||||
int retryAttemptInterstitial;
|
||||
private Action<int> _interstitialAdCallback;
|
||||
|
||||
public void InitializeInterstitialAds()
|
||||
{
|
||||
@ -14,6 +15,7 @@ public partial class AdManager
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent += OnInterstitialLoadFailedEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayedEvent += OnInterstitialDisplayedEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdClickedEvent += OnInterstitialClickedEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnInterstitialAdRevenuePaidEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialHiddenEvent;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += OnInterstitialAdFailedToDisplayEvent;
|
||||
|
||||
@ -45,12 +47,16 @@ public partial class AdManager
|
||||
Invoke("LoadInterstitial", (float)retryDelay);
|
||||
}
|
||||
|
||||
private void OnInterstitialDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||
private void OnInterstitialDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
_interstitialAdCallback?.Invoke(0);
|
||||
}
|
||||
|
||||
private void OnInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Interstitial ad failed to display. AppLovin recommends that you load the next ad.
|
||||
LoadInterstitial();
|
||||
_interstitialAdCallback?.Invoke(1);
|
||||
}
|
||||
|
||||
private void OnInterstitialClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||
@ -59,5 +65,35 @@ public partial class AdManager
|
||||
{
|
||||
// Interstitial ad is hidden. Pre-load the next ad.
|
||||
LoadInterstitial();
|
||||
_interstitialAdCallback?.Invoke(1);
|
||||
}
|
||||
|
||||
private void OnInterstitialAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
if (luaAdRevenuePaidEventCallback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
double revenue = adInfo.Revenue;
|
||||
// Miscellaneous data
|
||||
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||
string networkPlacement = adInfo.NetworkPlacement; // The placement ID from the network that showed the ad
|
||||
string adFormat = adInfo.AdFormat;
|
||||
|
||||
var dict = new Dictionary<string, System.Object>();
|
||||
dict.Add("revenue", revenue);
|
||||
dict.Add("country_code", countryCode);
|
||||
dict.Add("network_name", networkName);
|
||||
dict.Add("ad_unit_Id", adUnitId);
|
||||
dict.Add("ad_unit_identifier", adUnitIdentifier);
|
||||
dict.Add("placement", placement);
|
||||
dict.Add("network_placement", networkPlacement);
|
||||
dict.Add("ad_format", adFormat);
|
||||
dict.Add("ad_type", "interstitial");
|
||||
var result = JsonConvert.SerializeObject(dict);
|
||||
luaAdRevenuePaidEventCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ public partial class AdManager
|
||||
|
||||
private Action<int> _rewardCallback;
|
||||
private bool _rewardOK = false;
|
||||
public Action<string> luaAdRevenuePaidEventCallback;
|
||||
|
||||
public void InitializeRewardedAds()
|
||||
{
|
||||
@ -28,11 +27,6 @@ public partial class AdManager
|
||||
LoadRewardedAd();
|
||||
}
|
||||
|
||||
public void SetAdRevenuePaidEventCallback(Action<string> callback)
|
||||
{
|
||||
luaAdRevenuePaidEventCallback = callback;
|
||||
}
|
||||
|
||||
private void LoadRewardedAd()
|
||||
{
|
||||
MaxSdk.LoadRewardedAd(adRewardUnitId);
|
||||
@ -43,7 +37,7 @@ public partial class AdManager
|
||||
// Rewarded ad is ready for you to show. MaxSdk.IsRewardedAdReady(adUnitId) now returns 'true'.
|
||||
|
||||
// Reset retry attempt
|
||||
retryAttemptInterstitial = 0;
|
||||
retryAttemptReward = 0;
|
||||
}
|
||||
|
||||
private void OnRewardedAdLoadFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
@ -51,8 +45,8 @@ public partial class AdManager
|
||||
// Rewarded ad failed to load
|
||||
// AppLovin recommends that you retry with exponentially higher delays, up to a maximum delay (in this case 64 seconds).
|
||||
|
||||
retryAttemptInterstitial++;
|
||||
double retryDelay = Math.Pow(2, Math.Min(6, retryAttemptInterstitial));
|
||||
retryAttemptReward++;
|
||||
double retryDelay = Math.Pow(2, Math.Min(6, retryAttemptReward));
|
||||
|
||||
Invoke("LoadRewardedAd", (float)retryDelay);
|
||||
}
|
||||
@ -63,8 +57,6 @@ public partial class AdManager
|
||||
{
|
||||
// Rewarded ad failed to display. AppLovin recommends that you load the next ad.
|
||||
LoadRewardedAd();
|
||||
|
||||
Debug.Log(Tag + "==================== OnRewardedAdFailedToDisplayEvent");
|
||||
_rewardCallback?.Invoke(1);
|
||||
}
|
||||
|
||||
@ -83,17 +75,11 @@ public partial class AdManager
|
||||
}
|
||||
_rewardOK = false;
|
||||
_rewardCallback = null;
|
||||
Debug.Log(Tag + "==================== OnRewardedAdHiddenEvent");
|
||||
}
|
||||
|
||||
private void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// The rewarded ad displayed and the user should receive the reward.
|
||||
|
||||
Debug.Log(Tag + "Rewarded user: " + reward.Amount + " " + reward.Label);
|
||||
_rewardOK = true;
|
||||
// _rewardCallback?.Invoke(0);
|
||||
// _rewardCallback = null;
|
||||
}
|
||||
|
||||
private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
@ -120,6 +106,7 @@ public partial class AdManager
|
||||
dict.Add("placement", placement);
|
||||
dict.Add("network_placement", networkPlacement);
|
||||
dict.Add("ad_format", adFormat);
|
||||
dict.Add("ad_type", "reward");
|
||||
var result = JsonConvert.SerializeObject(dict);
|
||||
luaAdRevenuePaidEventCallback(result);
|
||||
}
|
||||
|
||||
87
Assets/Scripts/Common/SDK/BFHWAdSDKManager.cs
Normal file
87
Assets/Scripts/Common/SDK/BFHWAdSDKManager.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class BFHWAdSDKManager : MonoBehaviour
|
||||
{
|
||||
public Action<int> luaShowCallback;
|
||||
public Action<int> luaLoadedCallback;
|
||||
public Action<int, string> luaEarnedRewardCallback;
|
||||
public bool AdLoaded = false;
|
||||
public bool AdInitialized = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
// google
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.InitHWAdRewardedVideo();
|
||||
}
|
||||
|
||||
public void ShowFullScreenAds()
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.ShowHWFullScreenAds();
|
||||
}
|
||||
|
||||
public void TryLoadRewardedAd()
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.TryLoadHWRewardedAd();
|
||||
}
|
||||
|
||||
// public void SetAdPlacement(string placement)
|
||||
// {
|
||||
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.SetAdPlacement(placement);
|
||||
// }
|
||||
|
||||
public void SetAdShowCallback(Action<int> callback)
|
||||
{
|
||||
luaShowCallback = callback;
|
||||
}
|
||||
|
||||
// 设置广告加载回调
|
||||
public void SetAdLoadedCallback(Action<int> callback)
|
||||
{
|
||||
luaLoadedCallback = callback;
|
||||
}
|
||||
|
||||
// 设置广告看完回调
|
||||
public void SetAdEarnedRewardCallback(Action<int, string> callback)
|
||||
{
|
||||
luaEarnedRewardCallback = callback;
|
||||
}
|
||||
public void ShowFullScreenAdFinish(int code)
|
||||
{
|
||||
if (luaShowCallback != null)
|
||||
{
|
||||
luaShowCallback(code);
|
||||
// luaShowCallback = null;
|
||||
}
|
||||
}
|
||||
public void AdLoadedFinish(int code)
|
||||
{
|
||||
if (code == 0)
|
||||
{
|
||||
AdLoaded = true;
|
||||
}
|
||||
|
||||
if (luaLoadedCallback != null)
|
||||
{
|
||||
luaLoadedCallback(code);
|
||||
}
|
||||
}
|
||||
public void EarnedRewardFinish(int code, string result)
|
||||
{
|
||||
if (luaEarnedRewardCallback != null)
|
||||
{
|
||||
luaEarnedRewardCallback(code, result);
|
||||
// luaEarnedRewardCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88d315c7e2aba4d4d89a104b0c746e3f
|
||||
guid: 51a8bc27467e6434d847a1a53555d90b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
123
Assets/Scripts/Common/SDK/BFHWPaySDKManager.cs
Normal file
123
Assets/Scripts/Common/SDK/BFHWPaySDKManager.cs
Normal file
@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class BFHWPaySDKManager : MonoBehaviour
|
||||
{
|
||||
public Action<int, string> luaPayCallback;
|
||||
public Action<int, string> luaQueryProductCallback;
|
||||
public Action<int, string> luaQueryUncompleteOrderCallback;
|
||||
public Action<int> luaConsumeCallback;
|
||||
public bool StoreValid { get; private set; }
|
||||
private string ProductJson;
|
||||
|
||||
void Start()
|
||||
{
|
||||
// 俄罗斯华为渠道专用支付
|
||||
if (!BFPlatform.IsSupportHWPay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Init();
|
||||
CheckStoreValid();
|
||||
}
|
||||
|
||||
// 初始化
|
||||
public void Init()
|
||||
{
|
||||
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuInit();
|
||||
}
|
||||
|
||||
// 检测支付可用性
|
||||
public void CheckStoreValid()
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWCheckValid();
|
||||
}
|
||||
|
||||
public void CheckStoreValidComplete(bool success)
|
||||
{
|
||||
StoreValid = success;
|
||||
}
|
||||
|
||||
// 请求全部商品信息
|
||||
public void QueryProductInfo(string productJson, Action<int, string> callback)
|
||||
{
|
||||
luaQueryProductCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWGetProducts(productJson, callback);
|
||||
}
|
||||
|
||||
public void QueryProductComplete(bool succ, string result)
|
||||
{
|
||||
Debug.Log("C# call QueryProductComplete");
|
||||
int code = succ?0:1;
|
||||
if(luaQueryProductCallback != null)
|
||||
{
|
||||
Debug.Log("C# call QueryProductComplete result = " + result + " code = " + code);
|
||||
Action<int, string> tempLuaQueryProductCallback = luaQueryProductCallback;
|
||||
luaQueryProductCallback = null;
|
||||
tempLuaQueryProductCallback(code, result);
|
||||
ProductJson = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// 支付
|
||||
public void Pay(string payType, string productId, string customMsg, Action<int, string> callback)
|
||||
{
|
||||
luaPayCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWPurchase(productId, customMsg);
|
||||
}
|
||||
|
||||
public void PayComplete(int code, string result)
|
||||
{
|
||||
Debug.Log("C# call PayComplete");
|
||||
// 优先当前支付的回调
|
||||
if(luaPayCallback != null)
|
||||
{
|
||||
Debug.Log("C# call PayComplete result = " + result + " code = " + code);
|
||||
luaPayCallback(code, result);
|
||||
luaPayCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 消耗
|
||||
public void ConsumePurchase(string token, Action<int> callback)
|
||||
{
|
||||
luaConsumeCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWConsume(token);
|
||||
}
|
||||
|
||||
public void ConsumeComplete(int code)
|
||||
{
|
||||
Debug.Log("C# call ConsumeComplete");
|
||||
if (luaConsumeCallback != null)
|
||||
{
|
||||
Debug.Log("C# call ConsumeComplete code = " + code);
|
||||
luaConsumeCallback(code);
|
||||
luaConsumeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 查询未完成订单
|
||||
public void QueryUncompleteOrder(Action<int, string> callback)
|
||||
{
|
||||
luaQueryUncompleteOrderCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWGetPurchase();
|
||||
}
|
||||
|
||||
public void QueryUncompleteOrderFinish(string result)
|
||||
{
|
||||
Debug.Log("C# call QueryUncompleteOrderFinish");
|
||||
if(luaQueryUncompleteOrderCallback != null)
|
||||
{
|
||||
Debug.Log("C# call QueryUncompleteOrderFinish result = " + result);
|
||||
Action<int, string> tempLuaQueryUncompleteOrderCallback = luaQueryUncompleteOrderCallback;
|
||||
luaQueryUncompleteOrderCallback = null;
|
||||
tempLuaQueryUncompleteOrderCallback(0, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 597a8e5b837f64353b0aa9af2fe9aa84
|
||||
guid: 23ba21f8bd9926047b7b057e98ddf72f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@ -1,318 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using com.adjust.sdk;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
// Example for IronSource Unity.
|
||||
public class BFIronSourceSDKManager : MonoBehaviour
|
||||
{
|
||||
public Action<int> luaShowCallback;
|
||||
public Action<int> luaLoadedCallback;
|
||||
public Action<int, string> luaEarnedRewardCallback;
|
||||
public Action<string> luaAdRevenuePaidEventCallback;
|
||||
public bool AdLoaded = false;
|
||||
public bool AdInitialized = false;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID
|
||||
// string appKey = "85460dcd";
|
||||
string appKey = "1a6aacc25";
|
||||
|
||||
BFLog.Log("unity-script: IronSource.Agent.validateIntegration");
|
||||
IronSource.Agent.validateIntegration();
|
||||
|
||||
BFLog.Log("unity-script: unity version" + IronSource.unityVersion());
|
||||
|
||||
// SDK init
|
||||
BFLog.Log("unity-script: IronSource.Agent.init");
|
||||
// IronSource.Agent.setMetaData("is_test_suite", "enable");
|
||||
IronSource.Agent.init(appKey);
|
||||
IronSource.Agent.setManualLoadRewardedVideo(true);
|
||||
|
||||
// 初始化之前先设置一下用户id
|
||||
// ISAdQualityConfig adQualityConfig = new ISAdQualityConfig();
|
||||
// adQualityConfig.UserId = SystemInfo.deviceUniqueIdentifier;
|
||||
// // adQualityConfig.TestMode = true;
|
||||
// // adQualityConfig.LogLevel = ISAdQualityLogLevel.INFO;
|
||||
// IronSourceAdQuality.Initialize(appKey, adQualityConfig);
|
||||
#elif UNITY_IPHONE
|
||||
// string appKey = "8545d445";
|
||||
// 初始化之前先设置一下用户id
|
||||
// ISAdQualityConfig adQualityConfig = new ISAdQualityConfig();
|
||||
// adQualityConfig.UserId = SystemInfo.deviceUniqueIdentifier;
|
||||
// IronSourceAdQuality.Initialize(appKey, adQualityConfig);
|
||||
#else
|
||||
// string appKey = "unexpected_platform";
|
||||
#endif
|
||||
// BFLog.Log("unity-script: IronSource.Agent.validateIntegration");
|
||||
// IronSource.Agent.validateIntegration();
|
||||
|
||||
// BFLog.Log("unity-script: unity version" + IronSource.unityVersion());
|
||||
|
||||
// // SDK init
|
||||
// BFLog.Log("unity-script: IronSource.Agent.init");
|
||||
// IronSource.Agent.init(appKey);
|
||||
// IronSource.Agent.setManualLoadRewardedVideo(true);
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
|
||||
//Add Init Event
|
||||
IronSourceEvents.onSdkInitializationCompletedEvent += SdkInitializationCompletedEvent;
|
||||
|
||||
//Add Rewarded Video Events
|
||||
// IronSourceEvents.onRewardedVideoAdOpenedEvent += RewardedVideoAdOpenedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAdClosedEvent += RewardedVideoAdClosedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAvailabilityChangedEvent += RewardedVideoAvailabilityChangedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAdStartedEvent += RewardedVideoAdStartedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAdEndedEvent += RewardedVideoAdEndedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAdRewardedEvent += RewardedVideoAdRewardedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAdShowFailedEvent += RewardedVideoAdShowFailedEvent;
|
||||
// IronSourceEvents.onRewardedVideoAdClickedEvent += RewardedVideoAdClickedEvent;
|
||||
|
||||
//Add ImpressionSuccess Event
|
||||
IronSourceEvents.onImpressionSuccessEvent += ImpressionSuccessEvent;
|
||||
IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
|
||||
|
||||
|
||||
//Add AdInfo Rewarded Video Events
|
||||
IronSourceRewardedVideoEvents.onAdOpenedEvent += ReardedVideoOnAdOpenedEvent;
|
||||
IronSourceRewardedVideoEvents.onAdClosedEvent += ReardedVideoOnAdClosedEvent;
|
||||
IronSourceRewardedVideoEvents.onAdAvailableEvent += ReardedVideoOnAdAvailable;
|
||||
IronSourceRewardedVideoEvents.onAdUnavailableEvent += ReardedVideoOnAdUnavailable;
|
||||
IronSourceRewardedVideoEvents.onAdShowFailedEvent += ReardedVideoOnAdShowFailedEvent;
|
||||
IronSourceRewardedVideoEvents.onAdRewardedEvent += ReardedVideoOnAdRewardedEvent;
|
||||
IronSourceRewardedVideoEvents.onAdClickedEvent += ReardedVideoOnAdClickedEvent;
|
||||
}
|
||||
|
||||
public void SetAdRevenuePaidEventCallback(Action<string> callback)
|
||||
{
|
||||
luaAdRevenuePaidEventCallback = callback;
|
||||
}
|
||||
|
||||
void OnApplicationPause(bool isPaused)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
BFLog.Log("unity-script: OnApplicationPause = " + isPaused);
|
||||
IronSource.Agent.onApplicationPause(isPaused);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ShowFullScreenAds()
|
||||
{
|
||||
if(IronSource.Agent.isRewardedVideoAvailable())
|
||||
{
|
||||
IronSource.Agent.showRewardedVideo();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TryLoadRewardedAd();
|
||||
BFLog.Log("unity-script: IronSource.Agent.isRewardedVideoAvailable - False");
|
||||
}
|
||||
}
|
||||
|
||||
public void TryLoadRewardedAd()
|
||||
{
|
||||
IronSource.Agent.loadRewardedVideo();
|
||||
}
|
||||
|
||||
public void SetAdPlacement(string placement)
|
||||
{
|
||||
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.SetAdPlacement(placement);
|
||||
}
|
||||
|
||||
public void SetAdShowCallback(Action<int> callback)
|
||||
{
|
||||
luaShowCallback = callback;
|
||||
}
|
||||
|
||||
// 设置广告加载回调
|
||||
public void SetAdLoadedCallback(Action<int> callback)
|
||||
{
|
||||
luaLoadedCallback = callback;
|
||||
}
|
||||
|
||||
// 设置广告看完回调
|
||||
public void SetAdEarnedRewardCallback(Action<int, string> callback)
|
||||
{
|
||||
luaEarnedRewardCallback = callback;
|
||||
}
|
||||
public void ShowFullScreenAdFinish(int code)
|
||||
{
|
||||
if (luaShowCallback != null)
|
||||
{
|
||||
luaShowCallback(code);
|
||||
}
|
||||
}
|
||||
#region Init callback handlers
|
||||
|
||||
void SdkInitializationCompletedEvent()
|
||||
{
|
||||
BFLog.Log("unity-script: I got SdkInitializationCompletedEvent");
|
||||
//Launch test suite
|
||||
// IronSource.Agent.launchTestSuite();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AdInfo Rewarded Video
|
||||
void ReardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo) {
|
||||
BFLog.Log("unity-script: I got ReardedVideoOnAdOpenedEvent With AdInfo " + adInfo.ToString());
|
||||
ShowFullScreenAdFinish(0);
|
||||
}
|
||||
void ReardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo)
|
||||
{
|
||||
BFLog.Log("unity-script: I got ReardedVideoOnAdClosedEvent With AdInfo " + adInfo.ToString());
|
||||
}
|
||||
void ReardedVideoOnAdAvailable(IronSourceAdInfo adInfo)
|
||||
{
|
||||
BFLog.Log("unity-script: I got ReardedVideoOnAdAvailable With AdInfo " + adInfo.ToString());
|
||||
AdLoaded = true;
|
||||
|
||||
if (luaLoadedCallback != null)
|
||||
{
|
||||
luaLoadedCallback(0);
|
||||
}
|
||||
}
|
||||
void ReardedVideoOnAdUnavailable()
|
||||
{
|
||||
BFLog.Log("unity-script: I got ReardedVideoOnAdUnavailable");
|
||||
AdLoaded = false;
|
||||
|
||||
if (luaLoadedCallback != null)
|
||||
{
|
||||
luaLoadedCallback(1);
|
||||
}
|
||||
}
|
||||
void ReardedVideoOnAdShowFailedEvent(IronSourceError ironSourceError,IronSourceAdInfo adInfo)
|
||||
{
|
||||
BFLog.Log("unity-script: I got RewardedVideoAdOpenedEvent With Error"+ironSourceError.ToString() + "And AdInfo " + adInfo.ToString());
|
||||
ShowFullScreenAdFinish(1);
|
||||
}
|
||||
void ReardedVideoOnAdRewardedEvent(IronSourcePlacement ironSourcePlacement,IronSourceAdInfo adInfo)
|
||||
{
|
||||
BFLog.Log("unity-script: I got ReardedVideoOnAdRewardedEvent With Placement" + ironSourcePlacement.ToString()+ "And AdInfo " + adInfo.ToString());
|
||||
if (luaEarnedRewardCallback != null)
|
||||
{
|
||||
luaEarnedRewardCallback(0, "");
|
||||
}
|
||||
}
|
||||
void ReardedVideoOnAdClickedEvent(IronSourcePlacement ironSourcePlacement, IronSourceAdInfo adInfo)
|
||||
{
|
||||
BFLog.Log("unity-script: I got ReardedVideoOnAdClickedEvent With Placement" + ironSourcePlacement.ToString() + "And AdInfo " + adInfo.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// #region RewardedAd callback handlers
|
||||
|
||||
// void RewardedVideoAvailabilityChangedEvent(bool canShowAd)
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAvailabilityChangedEvent, value = " + canShowAd);
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdOpenedEvent()
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdOpenedEvent");
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdRewardedEvent(IronSourcePlacement ssp)
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdRewardedEvent, amount = " + ssp.getRewardAmount() + " name = " + ssp.getRewardName());
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdClosedEvent()
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdClosedEvent");
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdStartedEvent()
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdStartedEvent");
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdEndedEvent()
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdEndedEvent");
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdShowFailedEvent(IronSourceError error)
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdShowFailedEvent, code : " + error.getCode() + ", description : " + error.getDescription());
|
||||
// }
|
||||
|
||||
// void RewardedVideoAdClickedEvent(IronSourcePlacement ssp)
|
||||
// {
|
||||
// BFLog.Log("unity-script: I got RewardedVideoAdClickedEvent, name = " + ssp.getRewardName());
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
#region ImpressionSuccess callback handler
|
||||
|
||||
void ImpressionSuccessEvent(IronSourceImpressionData impressionData)
|
||||
{
|
||||
// BFLog.Log("unity - script: I got ImpressionSuccessEvent ToString(): " + impressionData.ToString());
|
||||
// BFLog.Log("unity - script: I got ImpressionSuccessEvent allData: " + impressionData.allData);
|
||||
}
|
||||
|
||||
void ImpressionDataReadyEvent(IronSourceImpressionData impressionData)
|
||||
{
|
||||
if (impressionData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ReferenceEquals(impressionData.revenue, null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
double revenue = (double)impressionData.revenue;
|
||||
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourceIronSource);
|
||||
adjustAdRevenue.setRevenue(revenue, "USD");
|
||||
// optional fields
|
||||
adjustAdRevenue.setAdRevenueNetwork(impressionData.adNetwork);
|
||||
adjustAdRevenue.setAdRevenueUnit(impressionData.adUnit);
|
||||
adjustAdRevenue.setAdRevenuePlacement(impressionData.placement);
|
||||
// track Adjust ad revenue
|
||||
Adjust.trackAdRevenue(adjustAdRevenue);
|
||||
|
||||
if (luaAdRevenuePaidEventCallback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var dict = new Dictionary<string, System.Object>();
|
||||
dict.Add("revenue", revenue);
|
||||
dict.Add("auction_id", impressionData.auctionId);
|
||||
dict.Add("country_code", impressionData.country);
|
||||
dict.Add("network_name", impressionData.adNetwork);
|
||||
dict.Add("ad_unit_Id", impressionData.adUnit);
|
||||
dict.Add("placement", impressionData.placement);
|
||||
dict.Add("ad_format_name", impressionData.instanceName);
|
||||
dict.Add("ad_format_id", impressionData.instanceId);
|
||||
if (!string.IsNullOrEmpty(impressionData.segmentName))
|
||||
{
|
||||
dict.Add("segment_name", impressionData.segmentName);
|
||||
}
|
||||
if (!ReferenceEquals(impressionData.lifetimeRevenue, null))
|
||||
{
|
||||
dict.Add("lifetime_revenue", impressionData.lifetimeRevenue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(impressionData.encryptedCPM))
|
||||
{
|
||||
dict.Add("encrypted_cpm", impressionData.encryptedCPM);
|
||||
}
|
||||
dict.Add("currency", "USD");
|
||||
dict.Add("precision", impressionData.precision);
|
||||
var result = JsonConvert.SerializeObject(dict);
|
||||
luaAdRevenuePaidEventCallback(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -65,20 +65,31 @@ namespace BF
|
||||
void Awake()
|
||||
{
|
||||
// facebook
|
||||
if (BFPlatform.IsSupportFB())
|
||||
{
|
||||
BFLog.Log("FBSdk.Init");
|
||||
FBSdk.Init();
|
||||
FBSdk.SetULoginListener(this);
|
||||
}
|
||||
|
||||
// appid 登陆
|
||||
#if UNITY_IOS
|
||||
signInWithApple = gameObject.AddComponent<SignInWithApple>();
|
||||
#endif
|
||||
|
||||
if (BFPlatform.IsSupportVK())
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.VKIDInit("52913931");
|
||||
}
|
||||
}
|
||||
|
||||
void OnApplicationPause(bool pauseStatus)
|
||||
{
|
||||
if (BFPlatform.IsSupportFB())
|
||||
{
|
||||
FBSdk.OnApplicationPause(pauseStatus);
|
||||
}
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
@ -152,6 +163,10 @@ namespace BF
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(type == LoginType.VKID)
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.VKIDLogin();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -167,6 +182,10 @@ namespace BF
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.GoogleLogout();
|
||||
}
|
||||
else if(type == LoginType.VKID)
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.VKIDLogout();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -266,6 +285,7 @@ namespace BF
|
||||
|
||||
BFLog.Log(string.Format("json = {0}", json));
|
||||
luaLoginCallback((int)result, json);
|
||||
luaLoginCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,5 +509,28 @@ namespace BF
|
||||
}
|
||||
}
|
||||
#endif
|
||||
public void VKIDLoginComplete(bool succ, string msg)
|
||||
{
|
||||
if (succ)
|
||||
{
|
||||
LoginComplete(LoginType.VKID, ULoginResult.Success, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginComplete(LoginType.VKID, ULoginResult.Failed, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public void VKIDLogoutComplete(bool succ)
|
||||
{
|
||||
if(succ)
|
||||
{
|
||||
LogoutComplete(LoginType.VKID, ULoginResult.Success, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogoutComplete(LoginType.VKID, ULoginResult.Failed, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,51 @@ namespace BF
|
||||
public const int ADMOB_LOADED_FAILED = 21;
|
||||
public const int ADMOB_EARNED_REWARD = 22;
|
||||
public const int ADMOB_INITIALIZED = 23;
|
||||
|
||||
public const int UMP_REQUEST_CONSENT_ERROR = 30;
|
||||
public const int UMP_LOAD_AND_PRESENT_ERROR = 31;
|
||||
public const int UMP_SUCCESS_CALLBACK = 32;
|
||||
public const int UMP_PARALLEL_CALLBACK = 33;
|
||||
|
||||
// 俄罗斯支付
|
||||
public const int RU_CHECK_VALID_SUCCESS = 40;
|
||||
public const int RU_CHECK_VALID_FAILED = 41;
|
||||
public const int RU_GET_PRODUCTS_SUCCESS = 42;
|
||||
public const int RU_GET_PRODUCTS_FAILED = 43;
|
||||
public const int RU_GET_PURCHASE_SUCCESS = 44;
|
||||
public const int RU_GET_PURCHASE_FAILED = 45;
|
||||
public const int RU_PURCHASE_SUCCESS = 46;
|
||||
public const int RU_PURCHASE_FAILED = 47;
|
||||
public const int RU_PURCHASE_CANCEL = 48;
|
||||
public const int RU_CONSUME_SUCCESS = 49;
|
||||
public const int RU_CONSUME_FAILED = 50;
|
||||
// 俄罗斯商店好评
|
||||
public const int RU_STORE_REVIEW_REQUEST_SUCCESS = 51;
|
||||
public const int RU_STORE_REVIEW_REQUEST_FAILED = 52;
|
||||
public const int RU_STORE_REVIEW_LAUNCH_SUCCESS = 53;
|
||||
public const int RU_STORE_REVIEW_LAUNCH_FAILED = 54;
|
||||
public const int RU_VKID_LOGIN_SUCCESS = 55;
|
||||
public const int RU_VKID_LOGIN_FAILED = 56;
|
||||
public const int RU_VKID_LOGOUT_SUCCESS = 57;
|
||||
public const int RU_VKID_LOGOUT_FAILED = 58;
|
||||
// 华为支付
|
||||
public const int HW_CHECK_VALID_SUCCESS = 59;
|
||||
public const int HW_CHECK_VALID_FAILED = 60;
|
||||
public const int HW_GET_PRODUCTS_SUCCESS = 61;
|
||||
public const int HW_GET_PRODUCTS_FAILED = 62;
|
||||
public const int HW_GET_PURCHASE_SUCCESS = 63;
|
||||
public const int HW_GET_PURCHASE_FAILED = 64;
|
||||
public const int HW_PURCHASE_SUCCESS = 65;
|
||||
public const int HW_PURCHASE_FAILED = 66;
|
||||
public const int HW_PURCHASE_CANCEL = 67;
|
||||
public const int HW_CONSUME_SUCCESS = 68;
|
||||
public const int HW_CONSUME_FAILED = 69;
|
||||
// 华为广告
|
||||
public const int HW_SHOWED_FULLSCREEN = 70;
|
||||
public const int HW_FAILEDTO_SHOW_FULLSCREEN = 71;
|
||||
public const int HW_LOADED = 72;
|
||||
public const int HW_LOADED_FAILED = 73;
|
||||
public const int HW_EARNED_REWARD = 74;
|
||||
}
|
||||
|
||||
public class BFNativeSDKManager : MonoBehaviour
|
||||
@ -57,7 +102,17 @@ namespace BF
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void FIRGetToken(IntPtr callback);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
private static extern void _OpenURL(string url);
|
||||
|
||||
// [DllImport("__Internal")]
|
||||
// private static extern void VKInit(string appId);
|
||||
|
||||
// [DllImport("__Internal")]
|
||||
// private static extern void VKLogin();
|
||||
#endif
|
||||
|
||||
[Serializable]
|
||||
public class NativeResultMsg
|
||||
{
|
||||
@ -86,6 +141,13 @@ namespace BF
|
||||
#endif
|
||||
}
|
||||
|
||||
public void InitGDPR()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("initGDPR");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void GooglePay(string payType, string productId, string customMsg)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
@ -214,12 +276,314 @@ namespace BF
|
||||
#endif
|
||||
}
|
||||
|
||||
public bool IsPrivacyOptionsRequired()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
return androidJavaClass.CallStatic<bool>("isPrivacyOptionsRequired");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ShowPrivacyOptionsForm()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("showPrivacyOptionsForm");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ResetGDPR()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("resetGDPR");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OnUMPFinish(string stateStr)
|
||||
{
|
||||
int state = 0;
|
||||
int.TryParse(stateStr, out state);
|
||||
// 审核模式下,只有正常返回 触发ATT
|
||||
if (BFMain.IsShenhe)
|
||||
{
|
||||
if (state == BFNativeSDKMessage.UMP_REQUEST_CONSENT_ERROR || state == BFNativeSDKMessage.UMP_LOAD_AND_PRESENT_ERROR || state == BFNativeSDKMessage.UMP_SUCCESS_CALLBACK)
|
||||
{
|
||||
BFMain.Instance.GameLaunchMgr.ShowIOSATTrack();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BFMain.Instance.GameLaunchMgr.ShowIOSATTrack();
|
||||
}
|
||||
BFUMPManager.OnUMPFinish(state);
|
||||
}
|
||||
|
||||
public string GetAppSignMD5()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
return androidJavaClass.CallStatic<string>("getSign", "MD5");
|
||||
#endif
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetAppSignSHA1()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
return androidJavaClass.CallStatic<string>("getSign", "SHA1");
|
||||
#endif
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetAppSignSHA256()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
return androidJavaClass.CallStatic<string>("getSign", "SHA256");
|
||||
#endif
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void RequestStoreReview()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("requestStoreReview");
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
UnityEngine.iOS.Device.RequestStoreReview();
|
||||
#endif
|
||||
}
|
||||
|
||||
#region 俄罗斯支付
|
||||
public void RuInit()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruInit");
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RUInit");
|
||||
}
|
||||
|
||||
public void RuCheckValid()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruCheckValid");
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RuCheckValid");
|
||||
}
|
||||
|
||||
public void RuGetProducts(string productJson, Action<int, string> callback)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruGetProducts", productJson);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RUGetProducts");
|
||||
}
|
||||
|
||||
public void RuGetPurchase()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruGetPurchase");
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RUGetPurchase");
|
||||
}
|
||||
|
||||
public void RuPurchase(string productId, string customMsg)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruPurchase", productId, customMsg);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RUPurchase:" + productId);
|
||||
}
|
||||
|
||||
public void RuConsume(string purchaseId)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruConsume", purchaseId);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RUConsume:" + purchaseId);
|
||||
}
|
||||
|
||||
public void RuDelete(string purchaseId)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("ruDelete", purchaseId);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RUDelete:" + purchaseId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public bool IsAndroidPkgInstalled(string pkgName)
|
||||
{
|
||||
bool isInstalled = false;
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
isInstalled = androidJavaClass.CallStatic<bool>("checkInstalled", pkgName);
|
||||
#endif
|
||||
return isInstalled;
|
||||
|
||||
Debug.Log("C# call RUDelete:" + pkgName + " isInstalled:" + isInstalled);
|
||||
}
|
||||
|
||||
#region 俄罗斯商店好评
|
||||
public void RuRequestStoreReview()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("requestAndLaunchStoreReviewFlow");
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call RuRequestStoreReview");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region vk登录登出
|
||||
public void VKIDInit(string id)
|
||||
{
|
||||
if (BFPlatform.IsSupportVK())
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
// VKInit(id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void VKIDLogout()
|
||||
{
|
||||
if (BFPlatform.IsSupportVK())
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("vkidLogout");
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLogoutComplete(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void VKIDLogin()
|
||||
{
|
||||
if (BFPlatform.IsSupportVK())
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("vkidLogin");
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
// VKLogin();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void IOSVKLoginCallBack(string code)
|
||||
{
|
||||
if (code.Equals("1"))
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(false, code);
|
||||
}
|
||||
else
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(true, code);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void PayDukPay(string url)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("payDukPay", url);
|
||||
#endif
|
||||
}
|
||||
|
||||
#region 华为支付
|
||||
public void HWCheckValid()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("hwCheckValid");
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call hwCheckValid");
|
||||
}
|
||||
|
||||
public void HWGetProducts(string productJson, Action<int, string> callback)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("hwGetProducts", productJson);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call HWGetProducts");
|
||||
}
|
||||
|
||||
public void HWGetPurchase()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("hwGetPurchase");
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call HWGetPurchase");
|
||||
}
|
||||
|
||||
public void HWPurchase(string productId, string customMsg)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("hwPurchase", productId, customMsg);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call HWPurchase:" + productId);
|
||||
}
|
||||
|
||||
public void HWConsume(string productJson)
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("hwConsume", productJson);
|
||||
#endif
|
||||
|
||||
Debug.Log("C# call HWConsume:" + productJson);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 华为广告
|
||||
public void InitHWAdRewardedVideo()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("initHWAdRewardedVideo");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ShowHWFullScreenAds()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("showHWFullScreenAds");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void TryLoadHWRewardedAd()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
androidJavaClass.CallStatic("tryLoadHWRewardedAd");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OpenUrl(string url)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_OpenURL(url);
|
||||
#else
|
||||
Application.OpenURL(url);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
public void MsgFromAndroidOrIOS(string content)
|
||||
{
|
||||
var msgResult = JsonUtility.FromJson<NativeResultMsg>(content);
|
||||
BFLog.Log(msgResult.body);
|
||||
int head = msgResult.head;
|
||||
switch (head){
|
||||
switch (head)
|
||||
{
|
||||
case BFNativeSDKMessage.GOOGLE_LOGIN_SUCCESS:
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.GoogleLoginComplete(true, msgResult.body);
|
||||
break;
|
||||
@ -289,6 +653,137 @@ namespace BF
|
||||
case BFNativeSDKMessage.ADMOB_INITIALIZED:
|
||||
// BFMain.Instance.SDKMgr.BFAdmobSDKMgr.AdInitialized = true;
|
||||
break;
|
||||
|
||||
// 俄罗斯支付
|
||||
case BFNativeSDKMessage.RU_CHECK_VALID_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.CheckStoreValidComplete(true);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_CHECK_VALID_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.CheckStoreValidComplete(false);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_GET_PRODUCTS_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryProductComplete(true, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_GET_PRODUCTS_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryProductComplete(false, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_GET_PURCHASE_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_GET_PURCHASE_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_PURCHASE_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.PayComplete(0, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_PURCHASE_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.PayComplete(1, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_PURCHASE_CANCEL:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.PayComplete(2, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_CONSUME_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.ConsumeComplete(0);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_CONSUME_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.ConsumeComplete(1);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_STORE_REVIEW_REQUEST_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_STORE_REVIEW_REQUEST_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_STORE_REVIEW_LAUNCH_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_STORE_REVIEW_LAUNCH_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_VKID_LOGIN_SUCCESS:
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(true, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_VKID_LOGIN_FAILED:
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(false, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_VKID_LOGOUT_SUCCESS:
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLogoutComplete(true);
|
||||
break;
|
||||
case BFNativeSDKMessage.RU_VKID_LOGOUT_FAILED:
|
||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLogoutComplete(false);
|
||||
break;
|
||||
// 华为支付
|
||||
case BFNativeSDKMessage.HW_CHECK_VALID_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.CheckStoreValidComplete(true);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_CHECK_VALID_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.CheckStoreValidComplete(false);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_GET_PRODUCTS_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryProductComplete(true, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_GET_PRODUCTS_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryProductComplete(false, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_GET_PURCHASE_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_GET_PURCHASE_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_PURCHASE_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.PayComplete(0, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_PURCHASE_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.PayComplete(1, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_PURCHASE_CANCEL:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.PayComplete(2, msgResult.body);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_CONSUME_SUCCESS:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.ConsumeComplete(0);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_CONSUME_FAILED:
|
||||
// Debug.Log(msgResult.body);
|
||||
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.ConsumeComplete(1);
|
||||
break;
|
||||
// 华为广告
|
||||
case BFNativeSDKMessage.HW_SHOWED_FULLSCREEN:
|
||||
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.ShowFullScreenAdFinish(0);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_FAILEDTO_SHOW_FULLSCREEN:
|
||||
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.ShowFullScreenAdFinish(1);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_LOADED:
|
||||
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.AdLoadedFinish(0);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_LOADED_FAILED:
|
||||
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.AdLoadedFinish(1);
|
||||
break;
|
||||
case BFNativeSDKMessage.HW_EARNED_REWARD:
|
||||
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.EarnedRewardFinish(0, msgResult.body);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -20,6 +20,12 @@ namespace BF
|
||||
|
||||
void Start()
|
||||
{
|
||||
// 俄罗斯渠道不使用google
|
||||
if (BFPlatform.IsSupportRuPay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
121
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs
Normal file
121
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs
Normal file
@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class BFRuPaySDKManager : MonoBehaviour
|
||||
{
|
||||
public Action<int, string> luaPayCallback;
|
||||
public Action<int, string> luaQueryProductCallback;
|
||||
public Action<int, string> luaQueryUncompleteOrderCallback;
|
||||
public Action<int> luaConsumeCallback;
|
||||
public bool StoreValid { get; private set; }
|
||||
private string ProductJson;
|
||||
|
||||
void Start()
|
||||
{
|
||||
// 俄罗斯渠道专用支付
|
||||
if (!BFPlatform.IsSupportRuPay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 临时屏蔽俄罗斯支付
|
||||
if (BFPlatform.Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Init();
|
||||
CheckStoreValid();
|
||||
}
|
||||
|
||||
// 初始化
|
||||
public void Init()
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuInit();
|
||||
}
|
||||
|
||||
// 检测支付可用性
|
||||
public void CheckStoreValid()
|
||||
{
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuCheckValid();
|
||||
}
|
||||
|
||||
public void CheckStoreValidComplete(bool success)
|
||||
{
|
||||
StoreValid = success;
|
||||
}
|
||||
|
||||
// 请求全部商品信息
|
||||
public void QueryProductInfo(string productJson, Action<int, string> callback)
|
||||
{
|
||||
luaQueryProductCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuGetProducts(productJson, callback);
|
||||
}
|
||||
|
||||
public void QueryProductComplete(bool succ, string result)
|
||||
{
|
||||
int code = succ?0:1;
|
||||
if(luaQueryProductCallback != null)
|
||||
{
|
||||
Action<int, string> tempLuaQueryProductCallback = luaQueryProductCallback;
|
||||
luaQueryProductCallback = null;
|
||||
tempLuaQueryProductCallback(code, result);
|
||||
ProductJson = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// 支付
|
||||
public void Pay(string payType, string productId, string customMsg, Action<int, string> callback)
|
||||
{
|
||||
luaPayCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuPurchase(productId, customMsg);
|
||||
}
|
||||
|
||||
public void PayComplete(int code, string result)
|
||||
{
|
||||
// 优先当前支付的回调
|
||||
if(luaPayCallback != null)
|
||||
{
|
||||
luaPayCallback(code, result);
|
||||
luaPayCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 消耗
|
||||
public void ConsumePurchase(string token, Action<int> callback)
|
||||
{
|
||||
luaConsumeCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuConsume(token);
|
||||
}
|
||||
|
||||
public void ConsumeComplete(int code)
|
||||
{
|
||||
if (luaConsumeCallback != null)
|
||||
{
|
||||
luaConsumeCallback(code);
|
||||
luaConsumeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 查询未完成订单
|
||||
public void QueryUncompleteOrder(Action<int, string> callback)
|
||||
{
|
||||
luaQueryUncompleteOrderCallback = callback;
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuGetPurchase();
|
||||
}
|
||||
|
||||
public void QueryUncompleteOrderFinish(string result)
|
||||
{
|
||||
if(luaQueryUncompleteOrderCallback != null)
|
||||
{
|
||||
Action<int, string> tempLuaQueryUncompleteOrderCallback = luaQueryUncompleteOrderCallback;
|
||||
luaQueryUncompleteOrderCallback = null;
|
||||
tempLuaQueryUncompleteOrderCallback(0, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a060c3107f223a84ba065e7134d0aff8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -2,17 +2,14 @@
|
||||
using UnityEngine;
|
||||
using BF.NativeCore.ThirdPlatform;
|
||||
using Newtonsoft.Json;
|
||||
using com.adjust.sdk;
|
||||
using AppsFlyerSDK;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class BFThirdReportSDKManager : MonoBehaviour
|
||||
{
|
||||
// private ThinkingAnalyticsSdk TASdk = new ThinkingAnalyticsSdk();
|
||||
// private AppsFlyerSdk AFSdk = new AppsFlyerSdk();
|
||||
// private bool isInitAFAdRevenue = false;
|
||||
|
||||
private ThinkingAnalyticsSdk TASdk = new ThinkingAnalyticsSdk();
|
||||
private AppsFlyerSdk AFSdk = new AppsFlyerSdk();
|
||||
void Start()
|
||||
{
|
||||
Init();
|
||||
@ -21,147 +18,123 @@ namespace BF
|
||||
public void Init()
|
||||
{
|
||||
BFLog.Log("TASdk.Init");
|
||||
// TASdk.Init();
|
||||
// AFSdk.Init();
|
||||
TASdk.Init();
|
||||
AFSdk.Init();
|
||||
}
|
||||
|
||||
// 设置账户id
|
||||
public void SetThinkingAnalyticsAccountId(string id)
|
||||
{
|
||||
// TASdk.SetAccountId(id);
|
||||
// AFSdk.SetTaAccountId(id);
|
||||
TASdk.SetAccountId(id);
|
||||
AFSdk.SetTaAccountId(id);
|
||||
}
|
||||
|
||||
public void InitAppsFlyerAdRevenue()
|
||||
public void CalibrateTime(long timestamp)
|
||||
{
|
||||
// if (isInitAFAdRevenue)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// isInitAFAdRevenue = true;
|
||||
// AppsFlyerAdRevenue.start();
|
||||
TASdk.CalibrateTime(timestamp);
|
||||
}
|
||||
|
||||
// 清除账户id
|
||||
public void ClearThinkingAnalyticsAccountId()
|
||||
{
|
||||
// TASdk.ClearAccountId();
|
||||
TASdk.ClearAccountId();
|
||||
}
|
||||
|
||||
public string GetAFConversionData()
|
||||
{
|
||||
return AppsFlyerObjectScript.AFConversionData;
|
||||
}
|
||||
|
||||
public bool IsGetConversionDataOver()
|
||||
{
|
||||
return AppsFlyerObjectScript.IsGetConversionDataOver;
|
||||
}
|
||||
|
||||
public string GetAFAttributionData()
|
||||
{
|
||||
return AppsFlyerObjectScript.AFAttributionData;
|
||||
}
|
||||
|
||||
public bool IsGetAppOpenAttributionOver()
|
||||
{
|
||||
return AppsFlyerObjectScript.IsGetAppOpenAttributionOver;
|
||||
}
|
||||
|
||||
public bool IsGetAFOnRequestResponse()
|
||||
{
|
||||
return AppsFlyerObjectScript.IsGetAFOnRequestResponse;
|
||||
}
|
||||
|
||||
public int GetAFOnRequestResponseStatusCode()
|
||||
{
|
||||
return AppsFlyerObjectScript.AFOnRequestResponseStatusCode;
|
||||
}
|
||||
|
||||
public string GetAFOnRequestResponseErrorDescription()
|
||||
{
|
||||
return AppsFlyerObjectScript.AFOnRequestResponseErrorDescription;
|
||||
}
|
||||
|
||||
// 数数科技上报
|
||||
// lua端使用
|
||||
public void PostThinkingAnalyticsEvent(string eventName, string data = "")
|
||||
{
|
||||
// if (string.IsNullOrEmpty(data))
|
||||
// {
|
||||
// TASdk.Track(eventName, null);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var properties = JsonConvert.DeserializeObject<Dictionary<string, object>>(data);
|
||||
// TASdk.Track(eventName, properties);
|
||||
// }
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
TASdk.Track(eventName, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var properties = JsonConvert.DeserializeObject<Dictionary<string, object>>(data);
|
||||
TASdk.Track(eventName, properties);
|
||||
}
|
||||
}
|
||||
|
||||
// 数数科技上报
|
||||
// c#端使用,只上报事件名
|
||||
public void PostThinkingAnalyticsEventName(string eventName)
|
||||
{
|
||||
// TASdk.Track(eventName, null);
|
||||
TASdk.Track(eventName, null);
|
||||
}
|
||||
|
||||
// 数数科技上报
|
||||
// c#端使用,上报事件名和参数
|
||||
public void PostThinkingAnalyticsEventProperties(string eventName, Dictionary<string, object> properties)
|
||||
{
|
||||
// TASdk.Track(eventName, properties);
|
||||
TASdk.Track(eventName, properties);
|
||||
}
|
||||
|
||||
public void PostAppsflyerEvent(string eventName, string data = "")
|
||||
{
|
||||
// if (string.IsNullOrEmpty(data))
|
||||
// {
|
||||
// AFSdk.SendEvent(eventName, null);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
// AFSdk.SendEvent(eventName, properties);
|
||||
// }
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
AFSdk.SendEvent(eventName, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
AFSdk.SendEvent(eventName, properties);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostFireBaseEvent(string eventName, string data = "")
|
||||
{
|
||||
// if (string.IsNullOrEmpty(data))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.LogEvent(eventName, data);
|
||||
// }
|
||||
}
|
||||
|
||||
// 设置账户id
|
||||
public void PostAdjustSimpleTrackEvent(string key)
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
// AdjustEvent adjustEvent = new AdjustEvent(key);
|
||||
// // BFLog.Log("PostAdjustSimpleTrackEvent");
|
||||
// Adjust.trackEvent(adjustEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
public void PostAdjustRevenueTrackEvent(string key, double currency, string currencyCode)
|
||||
else
|
||||
{
|
||||
// AdjustEvent adjustEvent = new AdjustEvent(key);
|
||||
// adjustEvent.setRevenue(currency, currencyCode);
|
||||
// // BFLog.Log("PostAdjustRevenueTrackEvent");
|
||||
// Adjust.trackEvent(adjustEvent);
|
||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.LogEvent(eventName, data);
|
||||
}
|
||||
|
||||
public void PostAdjustCallbackTrackEvent(string key, string data = "")
|
||||
{
|
||||
// var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
// AdjustEvent adjustEvent = new AdjustEvent(key);
|
||||
// foreach (var item in properties)
|
||||
// {
|
||||
// adjustEvent.addCallbackParameter(item.Key, item.Value);
|
||||
// }
|
||||
// // BFLog.Log("PostAdjustCallbackTrackEvent");
|
||||
// Adjust.trackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
public void PostAdjustPartnerTrackEvent(string key, string data = "")
|
||||
{
|
||||
// var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
// AdjustEvent adjustEvent = new AdjustEvent(key);
|
||||
// foreach (var item in properties)
|
||||
// {
|
||||
// adjustEvent.addPartnerParameter(item.Key, item.Value);
|
||||
// }
|
||||
// // BFLog.Log("PostAdjustPartnerTrackEvent");
|
||||
// Adjust.trackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
public void PostAdjustAdRevenueAppLovinMAX(double revenue, string networkName, string adUnitIdentifier, string placement)
|
||||
{
|
||||
// var adRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourceAppLovinMAX);
|
||||
// adRevenue.setRevenue(revenue, "USD");
|
||||
// adRevenue.setAdRevenueNetwork(networkName);
|
||||
// adRevenue.setAdRevenueUnit(adUnitIdentifier);
|
||||
// adRevenue.setAdRevenuePlacement(placement);
|
||||
// Adjust.trackAdRevenue(adRevenue);
|
||||
}
|
||||
|
||||
public void AdjustSetDeviceToken(string token)
|
||||
{
|
||||
// Adjust.setDeviceToken(token);
|
||||
}
|
||||
|
||||
public void LogAppsFlyerAdRevenue(int mediationNetwork, string monetizationNetwork, double eventRevenue, string data)
|
||||
{
|
||||
// var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
// var mediationNetworkType = (AppsFlyerAdRevenueMediationNetworkType)mediationNetwork;
|
||||
// AppsFlyerAdRevenue.logAdRevenue(monetizationNetwork, mediationNetworkType, eventRevenue, "USD", properties);
|
||||
var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
var mediationNetworkType = (AppsFlyerSDK.MediationNetwork)mediationNetwork;
|
||||
var adRevenueData = new AFAdRevenueData(monetizationNetwork, mediationNetworkType, "USD", eventRevenue);
|
||||
AFSdk.LogAdRevenue(adRevenueData, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
83
Assets/Scripts/Common/SDK/BFUMPManager.cs
Normal file
83
Assets/Scripts/Common/SDK/BFUMPManager.cs
Normal file
@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace BF
|
||||
{
|
||||
public class BFUMPManager
|
||||
{
|
||||
#if UNITY_IOS
|
||||
#region GDPR
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _MaxInitGDPR();
|
||||
|
||||
public static void InitGDPR()
|
||||
{
|
||||
_MaxInitGDPR();
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern bool _MaxCheckIsGDPR();
|
||||
|
||||
public static bool IsPrivacyOptionsRequired()
|
||||
{
|
||||
return _MaxCheckIsGDPR();
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _MaxShowGDRP();
|
||||
|
||||
public static void ShowPrivacyOptionsForm()
|
||||
{
|
||||
_MaxShowGDRP();
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern bool _MaxCheckCanRequestAds();
|
||||
|
||||
public static bool CheckCanRequestAds()
|
||||
{
|
||||
return _MaxCheckCanRequestAds();
|
||||
}
|
||||
#endregion
|
||||
#endif
|
||||
public static Action luaCallback;
|
||||
public static bool IsUMPFinish = false;
|
||||
public static int UMPState = 0;
|
||||
public static void OnUMPFinish(int state)
|
||||
{
|
||||
UMPState = state;
|
||||
// 审核模式下,只有正常返回,lua 回调
|
||||
if (BFMain.IsShenhe)
|
||||
{
|
||||
if (state == BFNativeSDKMessage.UMP_REQUEST_CONSENT_ERROR || state == BFNativeSDKMessage.UMP_LOAD_AND_PRESENT_ERROR || state == BFNativeSDKMessage.UMP_SUCCESS_CALLBACK)
|
||||
{
|
||||
IsUMPFinish = true;
|
||||
if (luaCallback != null)
|
||||
{
|
||||
luaCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IsUMPFinish = true;
|
||||
if (luaCallback != null)
|
||||
{
|
||||
luaCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddLuaCallback(Action callback)
|
||||
{
|
||||
luaCallback = callback;
|
||||
}
|
||||
|
||||
public static void RemoveLuaCallback()
|
||||
{
|
||||
luaCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Common/SDK/BFUMPManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/BFUMPManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcd13bfb23f7be948a1b084f3581e493
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ced1766fcb78b314db1ae240a0e27a9f
|
||||
guid: 69c854ae7d148be429e876656d170acd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@ -99,6 +99,7 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
||||
IAPDebug($"ID:{productId}.Not found or is not available for purchase");
|
||||
return false;
|
||||
}
|
||||
|
||||
_storeC.InitiatePurchase(productId, payload);
|
||||
return true;
|
||||
}
|
||||
@ -117,17 +118,17 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
||||
|
||||
//购买成功
|
||||
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e) {
|
||||
#if UNITY_EDITOR
|
||||
bool isValid = true;
|
||||
#else
|
||||
_localChecking (e.purchasedProduct, out bool isValid);
|
||||
#endif
|
||||
if (!isValid) buyCallback?.Invoke(false, e.purchasedProduct, "本地验证失败");
|
||||
else {
|
||||
_appsFlyerChecking(e.purchasedProduct);
|
||||
// #if UNITY_EDITOR
|
||||
// bool isValid = true;
|
||||
// #else
|
||||
// _localChecking (e.purchasedProduct, out bool isValid);
|
||||
// #endif
|
||||
// if (!isValid) buyCallback?.Invoke(false, e.purchasedProduct, "本地验证失败");
|
||||
// else {
|
||||
// _appsFlyerChecking(e.purchasedProduct);
|
||||
IAPDebug($"ID:{e.purchasedProduct.definition.id}. purchase success");
|
||||
buyCallback?.Invoke(true, e.purchasedProduct, string.Empty);
|
||||
}
|
||||
// }
|
||||
return PurchaseProcessingResult.Pending;
|
||||
}
|
||||
|
||||
@ -206,6 +207,7 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
||||
private void _appsFlyerChecking(Product product) {
|
||||
|
||||
IAPDebug($"CURRENCY:{product.metadata.isoCurrencyCode} REVENUE:{product.metadata.localizedPrice.ToString()} CONTENT_TYPE:{product.transactionID} CONTENT_ID:{product.definition.id}");
|
||||
|
||||
// Dictionary<string, string> da = new Dictionary<string, string> {
|
||||
// { AFInAppEventParameterName.CURRENCY, product.metadata.isoCurrencyCode },
|
||||
// { AFInAppEventParameterName.REVENUE, product.metadata.localizedPrice.ToString() },
|
||||
@ -219,6 +221,7 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region ================================================== 订阅 ==================================================
|
||||
|
||||
/// <summary>
|
||||
@ -321,6 +324,20 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
||||
// return "";
|
||||
}
|
||||
|
||||
//IOS专用 传入uuid类型的透传参数 用于校验订单
|
||||
public void SetApplicationUsername(string applicationUsername)
|
||||
{
|
||||
#if UNITY_IOS
|
||||
if (!IsInitialized()) {
|
||||
IAPDebug("SetApplicationUsername FAIL. Not init.");
|
||||
return;
|
||||
}
|
||||
|
||||
IAppleExtensions apple = _storeE.GetExtension<IAppleExtensions>();
|
||||
apple.SetApplicationUsername(applicationUsername);
|
||||
#endif
|
||||
}
|
||||
|
||||
#region ================================================== 原价 ==================================================
|
||||
|
||||
/// <summary>
|
||||
@ -379,6 +396,29 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
||||
return product.metadata.localizedPriceString;
|
||||
}
|
||||
|
||||
public string GetLocalizedIsoCurrencyCode(string productId)
|
||||
{
|
||||
if (!IsInitialized()) {
|
||||
IAPDebug($"ID:{productId}. Not init.");
|
||||
return "USD";
|
||||
};
|
||||
Product product = _storeC.products.WithID (productId);
|
||||
return product.metadata.isoCurrencyCode;
|
||||
}
|
||||
|
||||
public double GetLocalizedPriceAmount(string productId)
|
||||
{
|
||||
if (!IsInitialized())
|
||||
{
|
||||
IAPDebug($"ID:{productId}. Not init.");
|
||||
return 0.0;
|
||||
}
|
||||
;
|
||||
Product product = _storeC.products.WithID(productId);
|
||||
double price = Decimal.ToDouble(product.metadata.localizedPrice);
|
||||
return price;
|
||||
}
|
||||
|
||||
private void IAPDebug(string mes) {
|
||||
UnityEngine.Debug.Log($"IAPManager {mes}");
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
|
||||
@ -106,9 +107,15 @@ namespace BF
|
||||
};
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern IntPtr GetAllPossibleTimeZoneIdentifiers();
|
||||
|
||||
public static string GetTimeZone()
|
||||
{
|
||||
return "Asia/Shanghai";
|
||||
// return "Asia/Shanghai";
|
||||
IntPtr ptr = GetAllPossibleTimeZoneIdentifiers();
|
||||
string msg = Marshal.PtrToStringUTF8(ptr);
|
||||
return msg;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
|
||||
@ -21,6 +21,11 @@ namespace BF.NativeCore.ThirdPlatform
|
||||
AppsFlyer.sendEvent(eventName, properties);
|
||||
}
|
||||
|
||||
public void LogAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||
{
|
||||
AppsFlyer.logAdRevenue(adRevenueData, additionalParameters);
|
||||
}
|
||||
|
||||
public void SetTaAccountId(string accountId)
|
||||
{
|
||||
var customData = new Dictionary<string, string>();
|
||||
|
||||
@ -45,5 +45,10 @@ namespace BF.NativeCore.ThirdPlatform
|
||||
{
|
||||
return ThinkingAnalyticsAPI.GetDistinctId();
|
||||
}
|
||||
|
||||
public void CalibrateTime(long timestamp)
|
||||
{
|
||||
ThinkingAnalyticsAPI.CalibrateTime(timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,5 +11,6 @@ namespace BF.NativeCore
|
||||
// QQ,
|
||||
// WeChat,
|
||||
Apple,
|
||||
VKID,
|
||||
}
|
||||
}
|
||||
168
Assets/Scripts/Common/SDK/NotificationSDKManager.cs
Normal file
168
Assets/Scripts/Common/SDK/NotificationSDKManager.cs
Normal file
@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if UNITY_ANDROID
|
||||
using Unity.Notifications.Android;
|
||||
#elif UNITY_IOS
|
||||
using Unity.Notifications.iOS;
|
||||
#endif
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class NotificationInfo
|
||||
{
|
||||
public string title;
|
||||
public string text;
|
||||
public int day;
|
||||
public int hour;
|
||||
public int minute;
|
||||
public int second;
|
||||
public bool repeat;
|
||||
}
|
||||
|
||||
public class NotificationSDKManager : MonoBehaviour
|
||||
{
|
||||
private int NotificationId = 1;
|
||||
private string NotificationTitle = "Daily surprise";
|
||||
private string NotificationContent = "Let your fingers dance with the music";
|
||||
private bool isOpenAppFromNotification = false;
|
||||
void Start()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
// 检查一下app是从推送点开还是正常打开的
|
||||
#if UNITY_ANDROID
|
||||
var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent();
|
||||
if (notificationIntentData != null)
|
||||
{
|
||||
isOpenAppFromNotification = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isOpenAppFromNotification = false;
|
||||
}
|
||||
#elif UNITY_IOS
|
||||
var notification = iOSNotificationCenter.GetLastRespondedNotification();
|
||||
if (notification != null)
|
||||
{
|
||||
isOpenAppFromNotification = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isOpenAppFromNotification = false;
|
||||
}
|
||||
#else
|
||||
isOpenAppFromNotification = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void InitPuchContent(string title, string content)
|
||||
{
|
||||
NotificationTitle = title;
|
||||
NotificationContent = content;
|
||||
}
|
||||
|
||||
//重置推送
|
||||
public void ResetNotificationChannel()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
NotificationId = 1;
|
||||
AndroidNotificationCenter.CancelAllNotifications();//清除上次注册的通知
|
||||
var channel = new AndroidNotificationChannel()
|
||||
{
|
||||
Id = "channel_id",
|
||||
Name = "Default Channel",
|
||||
Importance = Importance.High,
|
||||
Description = "Generic notifications",
|
||||
CanShowBadge = false,
|
||||
EnableLights = true,
|
||||
LockScreenVisibility = LockScreenVisibility.Public
|
||||
};
|
||||
|
||||
AndroidNotificationCenter.RegisterNotificationChannel(channel);
|
||||
#elif UNITY_IOS
|
||||
NotificationId = 1;
|
||||
iOSNotificationCenter.ApplicationBadge = 0;
|
||||
iOSNotificationCenter.RemoveAllDeliveredNotifications();
|
||||
iOSNotificationCenter.RemoveAllScheduledNotifications();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册通知
|
||||
/// </summary>
|
||||
public void RegisterAndSendNotification(string title, string text, int day, int hour, int minute, int second, bool repeat)
|
||||
{
|
||||
var notificationInfo = new NotificationInfo()
|
||||
{
|
||||
title = title,
|
||||
text = text,
|
||||
day = day,
|
||||
hour = hour,
|
||||
minute = minute,
|
||||
second = second,
|
||||
repeat = repeat
|
||||
};
|
||||
SendNotification(notificationInfo);
|
||||
}
|
||||
|
||||
private void SendNotification(NotificationInfo notificationInfo)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
var time = GetNotificationTime(notificationInfo);
|
||||
var notification = new AndroidNotification()
|
||||
{
|
||||
Title = notificationInfo.title,
|
||||
Text = notificationInfo.text,
|
||||
FireTime = time,
|
||||
};
|
||||
AndroidNotificationCenter.SendNotification(notification, "channel_id");
|
||||
#elif UNITY_IOS
|
||||
var time = GetNotificationTime(notificationInfo);
|
||||
var daySpan = new TimeSpan(notificationInfo.day, notificationInfo.hour, notificationInfo.minute, notificationInfo.second);
|
||||
var timeTrigger = new iOSNotificationTimeIntervalTrigger()
|
||||
{
|
||||
TimeInterval = daySpan,
|
||||
Repeats = notificationInfo.repeat
|
||||
};
|
||||
|
||||
var notification = new iOSNotification()
|
||||
{
|
||||
Identifier = "_notification_"+ NotificationId,
|
||||
Title = notificationInfo.title,
|
||||
Body = notificationInfo.text,
|
||||
Badge = 0,
|
||||
ShowInForeground = true,
|
||||
ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
|
||||
CategoryIdentifier = "category_a",
|
||||
ThreadIdentifier = "thread1",
|
||||
Trigger = timeTrigger,
|
||||
};
|
||||
NotificationId++;
|
||||
iOSNotificationCenter.ScheduleNotification(notification);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到注册通知的时间
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime GetNotificationTime(NotificationInfo notificationInfo)
|
||||
{
|
||||
var daySpan = new TimeSpan(notificationInfo.day, notificationInfo.hour, notificationInfo.minute, notificationInfo.second);
|
||||
var dateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
|
||||
dateTime += daySpan;
|
||||
// Debug.Log("GetNotificationTime 发出通知时间 : " + dateTime);
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public bool GetIsOpenAppFromNotification()
|
||||
{
|
||||
return isOpenAppFromNotification;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Common/SDK/NotificationSDKManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/NotificationSDKManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fc2af03d1d06764db81724e32bcb026
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -33,22 +33,24 @@ namespace BF
|
||||
HttpManager.Instance.SetServerUrl("http://game.juzugame.com:1337/parse/");
|
||||
HttpManager.Instance.SetParseRevocableSession("1");
|
||||
HttpManager.Instance.SetParseApplicationId("1");
|
||||
HttpManager.Instance.SetParseClientKey("1kYT4UrExyQ0gaFh");
|
||||
HttpManager.Instance.SetParseClientKey("iQ8NRClxjSAVOc4p");
|
||||
#else
|
||||
// HttpManager.Instance.SetServerUrl("http://34.233.204.253:1337/parse/");
|
||||
// HttpManager.Instance.SetParseRevocableSession("1");
|
||||
// HttpManager.Instance.SetParseApplicationId("1");
|
||||
// HttpManager.Instance.SetParseClientKey("1kYT4UrExyQ0gaFh");
|
||||
HttpManager.Instance.SetServerUrl("https://b2.bigfoot-studio.link/parse/");
|
||||
HttpManager.Instance.SetServerUrl("https://b9.bigfoot-studio.link/parse/");
|
||||
HttpManager.Instance.SetParseRevocableSession("1");
|
||||
HttpManager.Instance.SetParseApplicationId("101");
|
||||
HttpManager.Instance.SetParseClientKey("Xxl3j5TBIn4ArY1m");
|
||||
HttpManager.Instance.SetParseApplicationId("1");
|
||||
HttpManager.Instance.SetParseClientKey("iQ8NRClxjSAVOc4p");
|
||||
// HttpManager.Instance.SetServerUrl("https://b9.bigfoot-studio.link/parse/");
|
||||
// HttpManager.Instance.SetParseRevocableSession("1");
|
||||
// HttpManager.Instance.SetParseApplicationId("101");
|
||||
// HttpManager.Instance.SetParseClientKey("Xxl3j5TBIn4ArY1m");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SetServerUrl(string url, string psarseRevocableSession = "1", string parseApplicationId = "1", string parseClientKey = "1kYT4UrExyQ0gaFh")
|
||||
public void SetServerUrl(string url, string parseClientPlatform, string parseClientVersion, string psarseRevocableSession = "1", string parseApplicationId = "1", string parseClientKey = "iQ8NRClxjSAVOc4p")
|
||||
{
|
||||
HttpManager.Instance.SetServerUrl(url);
|
||||
HttpManager.Instance.SetParseClientPlatform(parseClientPlatform);
|
||||
HttpManager.Instance.SetParseClientVersion(parseClientVersion);
|
||||
HttpManager.Instance.SetParseRevocableSession(psarseRevocableSession);
|
||||
HttpManager.Instance.SetParseApplicationId(parseApplicationId);
|
||||
HttpManager.Instance.SetParseClientKey(parseClientKey);
|
||||
|
||||
@ -33,6 +33,8 @@ namespace Http
|
||||
internal string _parseRevocableSession = string.Empty;
|
||||
private string _parseApplicationId = string.Empty;
|
||||
private string _parseClientKey = string.Empty;
|
||||
private string _parseClientPlatform = string.Empty;
|
||||
private string _parseClientVersion = string.Empty;
|
||||
|
||||
#region set get
|
||||
|
||||
@ -41,6 +43,8 @@ namespace Http
|
||||
public void SetParseRevocableSession(string key) => _parseRevocableSession = key;
|
||||
public void SetParseApplicationId(string appId) => _parseApplicationId = appId;
|
||||
public void SetParseClientKey(string key) => _parseClientKey = key;
|
||||
public void SetParseClientPlatform(string key) => _parseClientPlatform = key;
|
||||
public void SetParseClientVersion(string key) => _parseClientVersion = key;
|
||||
|
||||
public SingleHttp Get(string id) => !_requests.TryGetValue(id, out var httpInfo) ? null : httpInfo.Http;
|
||||
|
||||
@ -57,8 +61,10 @@ namespace Http
|
||||
Complete = complete,
|
||||
});
|
||||
|
||||
http.AddHeader("X-Parse-Application-Id", _parseApplicationId)
|
||||
.AddHeader("X-Parse-Client-Key", _parseClientKey);
|
||||
http.AddHeader("X-Parse-Application-id", _parseApplicationId)
|
||||
.AddHeader("X-Parse-Client-Key", _parseClientKey)
|
||||
.AddHeader("platform", _parseClientPlatform)
|
||||
.AddHeader("version", _parseClientVersion);
|
||||
return http;
|
||||
}
|
||||
|
||||
@ -123,8 +129,11 @@ namespace Http
|
||||
}
|
||||
|
||||
public static void AddRevocableSession(this SingleHttp self)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(HttpManager.Instance._parseRevocableSession))
|
||||
{
|
||||
self.AddHeader("X-Parse-Revocable-Session", HttpManager.Instance._parseRevocableSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,7 @@ namespace Http
|
||||
{
|
||||
Success,
|
||||
Aborted,
|
||||
Fail,
|
||||
ConnectionTimedOut,
|
||||
TimedOut
|
||||
Fail
|
||||
}
|
||||
|
||||
public class ResultInfo
|
||||
@ -48,7 +46,7 @@ namespace Http
|
||||
Type = HTTPMethods.Get;
|
||||
CustomTimeout = 100f;
|
||||
|
||||
_isKeepAlive = true;
|
||||
_isKeepAlive = false;
|
||||
_disableCache = true;
|
||||
_timeout = 60d;
|
||||
_connectTimeout = 20d;
|
||||
@ -206,12 +204,10 @@ namespace Http
|
||||
break;
|
||||
// 连接到服务器超时
|
||||
case HTTPRequestStates.ConnectionTimedOut:
|
||||
state = RequestState.ConnectionTimedOut;
|
||||
HttpDebug.LogError("Connection Timed Out!");
|
||||
break;
|
||||
// 请求没有在给定时间内完成
|
||||
case HTTPRequestStates.TimedOut:
|
||||
state = RequestState.TimedOut;
|
||||
HttpDebug.LogError("Processing the request Timed Out!");
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -60,11 +60,16 @@ namespace BF
|
||||
//新版本登陆,支付,第三方辅助SDK
|
||||
public BFLoginSDKManager BFLoginSDKMgr { get; private set; }
|
||||
public BFPaySDKManager BFPaySDKMgr { get; private set; }
|
||||
public BFRuPaySDKManager BFRuPaySDKMgr { get; private set; }
|
||||
public BFHWPaySDKManager BFHWPaySDKMgr { get; private set; }
|
||||
public IAPManager IosPaySDKMgr { get; private set; }
|
||||
// public BFAdmobSDKManager BFAdmobSDKMgr { get; private set; }
|
||||
// public BFIronSourceSDKManager BFIronSourceSDKMgr { get; private set; }
|
||||
// public BFHWAdSDKManager BFHWAdSDKMgr { get; private set; }
|
||||
public BFNativeSDKManager BFNativeSDKMgr { get; private set; }
|
||||
public BFThirdReportSDKManager BFThirdReportSDKMgr { get; private set; }
|
||||
public NotificationSDKManager NotificationSDKMgr { get; private set; }
|
||||
public DeepLinkManager DeepLinkMgr { get; private set; }
|
||||
|
||||
static SDKManager instance;
|
||||
public static SDKManager Create()
|
||||
@ -85,20 +90,46 @@ namespace BF
|
||||
{
|
||||
sdkGo = new GameObject("SDKManager");
|
||||
}
|
||||
// Deeplink
|
||||
DeepLinkMgr = sdkGo.AddComponent<DeepLinkManager>();
|
||||
// native交互管理,需要最先初始化,其他地方可能要调用此类里面的方法
|
||||
BFNativeSDKMgr = sdkGo.AddComponent<BFNativeSDKManager>();
|
||||
// 登陆
|
||||
BFLoginSDKMgr = sdkGo.AddComponent<BFLoginSDKManager>();
|
||||
// 支付
|
||||
BFPaySDKMgr = sdkGo.AddComponent<BFPaySDKManager>();
|
||||
BFRuPaySDKMgr = sdkGo.AddComponent<BFRuPaySDKManager>();
|
||||
BFHWPaySDKMgr = sdkGo.AddComponent<BFHWPaySDKManager>();
|
||||
// 广告
|
||||
// BFAdmobSDKMgr = sdkGo.AddComponent<BFAdmobSDKManager>();
|
||||
// BFIronSourceSDKMgr = sdkGo.AddComponent<BFIronSourceSDKManager>();
|
||||
// // 三方上报
|
||||
// 三方上报
|
||||
BFThirdReportSDKMgr = sdkGo.AddComponent<BFThirdReportSDKManager>();
|
||||
// native交互管理
|
||||
BFNativeSDKMgr = sdkGo.AddComponent<BFNativeSDKManager>();
|
||||
// IosPaySDKMgr = IAPManager.Instance;
|
||||
|
||||
IosPaySDKMgr = IAPManager.Instance;
|
||||
// MAX SDK安卓在这里主动初始化,IOS版会在ATT弹窗后初始化
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
AdManager.Instance.Init();
|
||||
#endif
|
||||
// 华为广告
|
||||
// BFHWAdSDKMgr = sdkGo.AddComponent<BFHWAdSDKManager>();
|
||||
// 本地推送
|
||||
// NotificationSDKMgr = sdkGo.AddComponent<NotificationSDKManager>();
|
||||
GameObject.DontDestroyOnLoad(sdkGo);
|
||||
|
||||
#if UNITY_IOS || UNITY_IPHONE
|
||||
// BFUMPManager.InitGDPR();
|
||||
// 这里不显示GDPR就直接显示ATT,如果GDPR要显示,则这里不要同时显示ATT,ATT会在GDPR显示后处理
|
||||
// 这里延迟一帧处理是因为启动后会同时显示多个权限弹窗,包括,网络,推送,还有ATT,这种情况下ATT可能会不显示,到下一次启动才显示,这种情况下也可能会导致苹果拒审
|
||||
BFMain.Instance.OneShotManager.AddOneShot(()=>{
|
||||
BFMain.Instance.GameLaunchMgr.ShowIOSATTrack();
|
||||
});
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
// if (BFPlatform.IsSupportGDPR())
|
||||
// {
|
||||
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.InitGDPR();
|
||||
// }
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
|
||||
8
Assets/Scripts/Common/URP.meta
Normal file
8
Assets/Scripts/Common/URP.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6f25d3b88a875d46b7f988da3389135
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
49
Assets/Scripts/Common/URP/URPManager.cs
Normal file
49
Assets/Scripts/Common/URP/URPManager.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class URPManager : ManagerBase
|
||||
{
|
||||
static URPManager instance;
|
||||
public static URPManager Create()
|
||||
{
|
||||
BFLog.LogAssert(instance == null, "This method only allows BFMain to call once");
|
||||
instance = new URPManager();
|
||||
return instance;
|
||||
}
|
||||
URPManager() { }
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
// URP新增叠加相机
|
||||
public void URPAddAdditionalCamera(Camera mainCamera, Camera additionalCamera)
|
||||
{
|
||||
var cameraData = mainCamera.GetUniversalAdditionalCameraData();
|
||||
cameraData.cameraStack.Add(additionalCamera);
|
||||
}
|
||||
|
||||
// URP移除叠加相机
|
||||
public void URPRemoveAdditionalCamera(Camera mainCamera, Camera additionalCamera)
|
||||
{
|
||||
var cameraData = mainCamera.GetUniversalAdditionalCameraData();
|
||||
cameraData.cameraStack.Remove(additionalCamera);
|
||||
}
|
||||
|
||||
// URP清空叠加相机
|
||||
public void URPClearAdditionalCamera(Camera mainCamera)
|
||||
{
|
||||
var cameraData = mainCamera.GetUniversalAdditionalCameraData();
|
||||
cameraData.cameraStack.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Common/URP/URPManager.cs.meta
Normal file
11
Assets/Scripts/Common/URP/URPManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d61530ea6b2712f48b8130c89cee839b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
113
Assets/Scripts/Component/Effects/DrawBezierLine.cs
Normal file
113
Assets/Scripts/Component/Effects/DrawBezierLine.cs
Normal file
@ -0,0 +1,113 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class DrawBezierLine : MonoBehaviour
|
||||
{
|
||||
public LineRenderer lineRender;
|
||||
private Vector3 _startPoint = Vector3.zero;
|
||||
private Vector3 _endPoint = Vector3.zero;
|
||||
private Vector3 _controlPoint1 = Vector3.zero;
|
||||
private Vector3 _controlPoint2 = Vector3.zero;
|
||||
// 曲线上的路径点数量,值越大,取得的路径点越多,曲线越平滑
|
||||
private int drawPointCount = 30;
|
||||
private bool isDraw = false;
|
||||
private bool useCubicBezier = true;
|
||||
public void SetStartPoint(float x, float y, float z)
|
||||
{
|
||||
_startPoint = new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public void SetEndPoint(float x, float y, float z)
|
||||
{
|
||||
_endPoint = new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public void SetControlPoint1(float x, float y, float z)
|
||||
{
|
||||
_controlPoint1 = new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public void SetControlPoint2(float x, float y, float z)
|
||||
{
|
||||
_controlPoint2 = new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public void SetDrawPointCount(int count)
|
||||
{
|
||||
drawPointCount = count;
|
||||
}
|
||||
|
||||
public void DrawLine()
|
||||
{
|
||||
isDraw = true;
|
||||
}
|
||||
|
||||
public void ClearLine()
|
||||
{
|
||||
isDraw = false;
|
||||
lineRender.positionCount = 0;
|
||||
}
|
||||
|
||||
public Vector3[] GetPathList()
|
||||
{
|
||||
Vector3[] positions = new Vector3[lineRender.positionCount];
|
||||
lineRender.GetPositions(positions);
|
||||
return positions;
|
||||
}
|
||||
|
||||
public void SetUseCubicBezier(bool use)
|
||||
{
|
||||
useCubicBezier = use;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!isDraw)
|
||||
{
|
||||
return;
|
||||
}
|
||||
isDraw = false;
|
||||
if (drawPointCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lineRender.positionCount = drawPointCount;
|
||||
lineRender.SetPosition(0, _startPoint);
|
||||
for (int i = 1; i < drawPointCount; i++)
|
||||
{
|
||||
var t = (i + 1) / (float)drawPointCount;
|
||||
if (useCubicBezier)
|
||||
{
|
||||
var pathPoint = GetPointInCubicBezierCurve(t, _startPoint, _controlPoint1, _controlPoint2, _endPoint);//使用贝塞尔曲线的公式取得t时的路径点
|
||||
lineRender.SetPosition(i, pathPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pathPoint = GetBezierPoint(t, _startPoint, _controlPoint1, _endPoint);//使用贝塞尔曲线的公式取得t时的路径点
|
||||
lineRender.SetPosition(i, pathPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <param name="t">0到1的值,0获取曲线的起点,1获得曲线的终点</param>
|
||||
/// <param name="start">曲线的起始位置</param>
|
||||
/// <param name="center">决定曲线形状的控制点</param>
|
||||
/// <param name="end">曲线的终点</param>
|
||||
public static Vector3 GetBezierPoint(float t, Vector3 start, Vector3 controlPoint, Vector3 end)
|
||||
{
|
||||
return (1 - t) * (1 - t) * start + 2 * t * (1 - t) * controlPoint + t * t * end;
|
||||
}
|
||||
|
||||
public Vector3 GetPointInCubicBezierCurve(float t, Vector3 startPoint, Vector3 controlPoint1, Vector3 controlPoint2, Vector3 endPoint)
|
||||
{
|
||||
var A = startPoint * (Mathf.Pow(-t, 3) + 3 * Mathf.Pow(t, 2) - 3 * t + 1);
|
||||
var B = controlPoint1 * (3 * Mathf.Pow(t, 3) - 6 * Mathf.Pow(t, 2) + 3 * t);
|
||||
var C = controlPoint2 * (-3 * Mathf.Pow(t, 3) + 3 * Mathf.Pow(t, 2));
|
||||
var D = endPoint * (Mathf.Pow(t, 3));
|
||||
return A + B + C + D;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Component/Effects/DrawBezierLine.cs.meta
Normal file
11
Assets/Scripts/Component/Effects/DrawBezierLine.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f27b020f0d68e14788bcde278e4add4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/Scripts/Component/Helper/DreamlandInstancingHelper.cs
Normal file
82
Assets/Scripts/Component/Helper/DreamlandInstancingHelper.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public class DreamlandInstancingHelper : MonoBehaviour
|
||||
{
|
||||
Action luaUpdateAction;
|
||||
MaterialPropertyBlock block;
|
||||
MeshFilter meshFilter;
|
||||
List<Matrix4x4> materixList = new List<Matrix4x4>();
|
||||
List<Vector4> lightmapOffsetList = new List<Vector4>();
|
||||
|
||||
void Awake()
|
||||
{
|
||||
block = new MaterialPropertyBlock();
|
||||
}
|
||||
|
||||
public void SetLuaUpdateAction(Action updateAction)
|
||||
{
|
||||
luaUpdateAction = updateAction;
|
||||
}
|
||||
|
||||
public void ClearLuaUpdateAction()
|
||||
{
|
||||
luaUpdateAction = null;
|
||||
}
|
||||
|
||||
public MaterialPropertyBlock GetMaterialPorpertyBlock()
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
public MeshFilter GetMeshFilter()
|
||||
{
|
||||
meshFilter = GetComponentInChildren<MeshFilter>();
|
||||
return meshFilter;
|
||||
}
|
||||
|
||||
public Vector4[] CollectLightmapOffsetArray()
|
||||
{
|
||||
lightmapOffsetList.Clear();
|
||||
var meshRenderers = GetComponentsInChildren<MeshRenderer>();
|
||||
foreach (var mr in meshRenderers)
|
||||
{
|
||||
lightmapOffsetList.Add(mr.lightmapScaleOffset);
|
||||
}
|
||||
return lightmapOffsetList.ToArray();
|
||||
}
|
||||
|
||||
public List<Matrix4x4> CollectMaterixList()
|
||||
{
|
||||
materixList.Clear();
|
||||
var meshRenderers = GetComponentsInChildren<MeshRenderer>();
|
||||
foreach (var mr in meshRenderers)
|
||||
{
|
||||
materixList.Add(mr.localToWorldMatrix);
|
||||
}
|
||||
return materixList;
|
||||
}
|
||||
|
||||
public void HideChild()
|
||||
{
|
||||
for (var i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
transform.GetChild(i).gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
luaUpdateAction?.Invoke();
|
||||
}
|
||||
|
||||
public static bool GetSupportInstancing()
|
||||
{
|
||||
return SystemInfo.supportsInstancing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95f27acf2ce774f32b4d9c7ca29c2b70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/Component/Helper/GlobalHelper.cs
Normal file
46
Assets/Scripts/Component/Helper/GlobalHelper.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct GlobalInfo
|
||||
{
|
||||
public TextMeshProUGUI tx;
|
||||
public string key;
|
||||
}
|
||||
[ExecuteInEditMode]
|
||||
[DisallowMultipleComponent]
|
||||
public class GlobalHelper : MonoBehaviour
|
||||
{
|
||||
public List<GlobalInfo> globalInfoList = new List<GlobalInfo>();
|
||||
public int GetListCount()
|
||||
{
|
||||
return globalInfoList.Count;
|
||||
}
|
||||
public string GetGlobalByIndex(int index)
|
||||
{
|
||||
if (index >= 0 && index < globalInfoList.Count)
|
||||
{
|
||||
return globalInfoList[index].key;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public void SetText(int index, string v)
|
||||
{
|
||||
if (index >= 0 && index < globalInfoList.Count)
|
||||
{
|
||||
globalInfoList[index].tx.text = v;
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
globalInfoList.Clear();
|
||||
globalInfoList = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Component/Helper/GlobalHelper.cs.meta
Normal file
11
Assets/Scripts/Component/Helper/GlobalHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9961f2693c0ea344aa81949924f05b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -103,6 +103,45 @@ namespace BF
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPositionX(int index, float x)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
{
|
||||
var childTransform = prefabList[index].gameObject.transform;
|
||||
childTransform.position = new Vector3(x, childTransform.position.y, childTransform.position.z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.position = new Vector3(x, this.transform.position.y, this.transform.position.z);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPositionY(int index, float y)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
{
|
||||
var childTransform = prefabList[index].gameObject.transform;
|
||||
childTransform.position = new Vector3(childTransform.position.x, y, childTransform.position.z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.position = new Vector3(this.transform.position.x, y, this.transform.position.z);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPositionZ(int index, float z)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
{
|
||||
var childTransform = prefabList[index].gameObject.transform;
|
||||
childTransform.position = new Vector3(childTransform.position.x, childTransform.position.y, z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void CacheLocalEulerAngles(int index)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
@ -132,6 +171,33 @@ namespace BF
|
||||
}
|
||||
}
|
||||
|
||||
public float GetLocalEulerAnglesZ(int index)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
{
|
||||
var localEulerAngles = prefabList[index].gameObject.transform.localEulerAngles;
|
||||
return localEulerAngles.z;
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
return this.transform.localEulerAngles.z;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public void SetLocalEulerAnglesZ(int index, float z)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
{
|
||||
var localEulerAngles = prefabList[index].gameObject.transform.localEulerAngles;
|
||||
prefabList[index].gameObject.transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.localEulerAngles = new Vector3(this.transform.localEulerAngles.x, this.transform.localEulerAngles.y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLocalScale(int index, float x, float y, float z)
|
||||
{
|
||||
if (index >= 0 && index < prefabList.Count)
|
||||
|
||||
@ -28,6 +28,8 @@ namespace BF
|
||||
[DisallowMultipleComponent]
|
||||
public class PrefabHelper : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public List<UnityEngine.GameObject> lis_AddObject = new List<UnityEngine.GameObject>();
|
||||
public List<GameObjectInfo> prefabList = new List<GameObjectInfo>();
|
||||
public float PositionX { get; private set; }
|
||||
public float PositionY { get; private set; }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9473cad853ffbc4284abb0e064c52d6
|
||||
guid: cbd97f50181e3ba4aa76780bbbce0d79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
176
Assets/Scripts/Component/Helper/WeaponHelper.cs
Normal file
176
Assets/Scripts/Component/Helper/WeaponHelper.cs
Normal file
@ -0,0 +1,176 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[DisallowMultipleComponent]
|
||||
public class WeaponHelper : MonoBehaviour
|
||||
{
|
||||
public GameObject modelObject;
|
||||
public List<CharacterObjectInfo> objectList = new List<CharacterObjectInfo>();
|
||||
public List<CharacterAnimationInfo> animationList = new List<CharacterAnimationInfo>();
|
||||
|
||||
public float PositionX { get; private set; }
|
||||
public float PositionY { get; private set; }
|
||||
public float PositionZ { get; private set; }
|
||||
|
||||
public GameObject GetModelObject()
|
||||
{
|
||||
return modelObject;
|
||||
}
|
||||
|
||||
public int GetModelHashCode()
|
||||
{
|
||||
return gameObject.GetHashCode();
|
||||
}
|
||||
|
||||
public int GetListCount()
|
||||
{
|
||||
return objectList.Count;
|
||||
}
|
||||
|
||||
public GameObject GetGameObjectByIndex(int index)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
return objectList[index].gameObject;
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
return this.gameObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public uint GetHashNameByIndex(int index)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
return objectList[index].hashName;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Lua层可以使用PositionX,PositionY,PositionZ,减少直接传递localPosition的开销
|
||||
public void CacheLocalPosition(int index)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
var localPosition = objectList[index].gameObject.transform.localPosition;
|
||||
PositionX = localPosition.x;
|
||||
PositionY = localPosition.y;
|
||||
PositionZ = localPosition.z;
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
PositionX = this.transform.localPosition.x;
|
||||
PositionY = this.transform.localPosition.y;
|
||||
PositionZ = this.transform.localPosition.z;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLocalPosition(int index, float x, float y, float z)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
objectList[index].gameObject.transform.localPosition = new Vector3(x, y, z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.localPosition = new Vector3(x, y, z);
|
||||
}
|
||||
}
|
||||
// Lua层可以使用PositionX,PositionY,PositionZ,减少直接传递position的开销
|
||||
public void CachePosition(int index)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
var position = objectList[index].gameObject.transform.position;
|
||||
PositionX = position.x;
|
||||
PositionY = position.y;
|
||||
PositionZ = position.z;
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
PositionX = this.transform.position.x;
|
||||
PositionY = this.transform.position.y;
|
||||
PositionZ = this.transform.position.z;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPosition(int index, float x, float y, float z)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
objectList[index].gameObject.transform.position = new Vector3(x, y, z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.position = new Vector3(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLocalEulerAngles(int index, float x, float y, float z)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
objectList[index].gameObject.transform.localEulerAngles = new Vector3(x, y, z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.localEulerAngles = new Vector3(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLocalScale(int index, float x, float y, float z)
|
||||
{
|
||||
if (index >= 0 && index < objectList.Count)
|
||||
{
|
||||
objectList[index].gameObject.transform.localScale = new Vector3(x, y, z);
|
||||
}
|
||||
else if (index < 0)
|
||||
{
|
||||
this.transform.localScale = new Vector3(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMainModelLocalPosition(float x, float y, float z)
|
||||
{
|
||||
modelObject.transform.localPosition = new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public float GetStateTime(uint index)
|
||||
{
|
||||
int count = animationList.Count;
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
if(animationList[i].hashName == index)
|
||||
{
|
||||
return animationList[i].animationTime;
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public uint GetStateKeyFrame(uint hashName, int index)
|
||||
{
|
||||
int count = animationList.Count;
|
||||
CharacterAnimationInfo characterAnimationInfo;
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
characterAnimationInfo = animationList[i];
|
||||
if(characterAnimationInfo.hashName == hashName)
|
||||
{
|
||||
if(characterAnimationInfo.keyFrame != null && characterAnimationInfo.keyFrame.Count > index)
|
||||
{
|
||||
return characterAnimationInfo.keyFrame[index];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Component/Helper/WeaponHelper.cs.meta
Normal file
11
Assets/Scripts/Component/Helper/WeaponHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20f2cf41ce575154699359cdd2465af7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -138,7 +138,7 @@ namespace BF
|
||||
{
|
||||
if (size > 0)
|
||||
{
|
||||
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, - pos - size / 2);
|
||||
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, - pos - size / 2 * rect.localScale.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -12,6 +12,7 @@ namespace BF
|
||||
public int downRecoveryOffset;
|
||||
public BFUIDirection direction;
|
||||
public bool reverse = false;
|
||||
public bool centerWhenNotFull = false; // 新增参数,控制是否在不满一行时居中
|
||||
|
||||
Stack<BFCell> cellPool = new Stack<BFCell>();
|
||||
List<BFCell> activeCells = new List<BFCell>();
|
||||
@ -129,7 +130,6 @@ namespace BF
|
||||
float maxHeight = Mathf.Max(UnityScrollRect.viewport.rect.height, maxLine*cellHeight + topRecoveryOffset + downRecoveryOffset);
|
||||
ContentTrans.sizeDelta = new Vector2(ContentTrans.sizeDelta.x, maxHeight);
|
||||
// cellWidth = (int)UnityScrollRect.viewport.rect.width;
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
float posY = UnityScrollRect.content.anchoredPosition.y;
|
||||
@ -179,6 +179,7 @@ namespace BF
|
||||
// maxIdx = Mathf.Min(this.totalCount, maxIdx);
|
||||
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", " ContentTrans.sizeDelta.x = " + ContentTrans.sizeDelta.x);
|
||||
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", " ContentTrans.sizeDelta.y = " + ContentTrans.sizeDelta.y);
|
||||
UpdateAllCellPosition();
|
||||
}
|
||||
|
||||
public override void RefreshAll()
|
||||
@ -388,6 +389,15 @@ namespace BF
|
||||
{
|
||||
float posX = 0.0f;
|
||||
if (direction == BFUIDirection.Vertical)
|
||||
{
|
||||
if (centerWhenNotFull && totalCount < perLineNum)
|
||||
{
|
||||
float totalWidth = totalCount * cellWidth;
|
||||
float startPos = (UnityScrollRect.viewport.rect.width - totalWidth) / 2;
|
||||
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||
posX = startPos + (idx - 0.5f) * cellWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (reverse)
|
||||
{
|
||||
@ -401,7 +411,7 @@ namespace BF
|
||||
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||
posX = (idx - 0.5f) * cellWidth1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -436,6 +446,39 @@ namespace BF
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (centerWhenNotFull && totalCount < perLineNum)
|
||||
{
|
||||
// 在ContentTrans高度范围内居中
|
||||
float totalHeight = totalCount * cellHeight;
|
||||
float contentOffset = (ContentTrans.rect.height - totalHeight) / 2;
|
||||
|
||||
// 元素在ContentTrans内垂直居中
|
||||
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||
if (reverse)
|
||||
{
|
||||
posY = -(contentOffset + (idx - 0.5f) * cellHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
posY = contentOffset + (idx - 0.5f) * cellHeight;
|
||||
}
|
||||
|
||||
// 如果ContentTrans比viewport矮,调整全局居中
|
||||
if (ContentTrans.rect.height < UnityScrollRect.viewport.rect.height)
|
||||
{
|
||||
float viewportOffset = (UnityScrollRect.viewport.rect.height - ContentTrans.rect.height) / 2;
|
||||
if (reverse)
|
||||
{
|
||||
posY -= viewportOffset; // 抵消视口偏移
|
||||
}
|
||||
else
|
||||
{
|
||||
posY += viewportOffset; // 抵消视口偏移
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (reverse)
|
||||
{
|
||||
@ -453,6 +496,7 @@ namespace BF
|
||||
posY = offset - (idx - 1.0f) * cellHeight1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return posY;
|
||||
}
|
||||
@ -599,7 +643,7 @@ namespace BF
|
||||
{
|
||||
UnityScrollRect.StopMovement();
|
||||
}
|
||||
|
||||
[ContextMenu("UpdateAllCellPosition")]
|
||||
public void UpdateAllCellPosition()
|
||||
{
|
||||
for (int i = 0; i < activeCells.Count; i++)
|
||||
|
||||
@ -10,7 +10,7 @@ using XLua.Cast;
|
||||
public class UIOutlineEffect : BaseMeshEffect
|
||||
{
|
||||
[SerializeField]
|
||||
private Color outlineColor = Color.white;
|
||||
private Color outlineColor = Color.black;
|
||||
|
||||
public Color OutlineColor
|
||||
{
|
||||
@ -27,11 +27,6 @@ public class UIOutlineEffect : BaseMeshEffect
|
||||
base.Awake();
|
||||
if (base.graphic)
|
||||
{
|
||||
if (base.graphic.material == null || base.graphic.material.shader.name != "BF/UI/TEXT_OUTLINE")
|
||||
{
|
||||
BF.BFLog.Log("uitext没有设置对应描边材质");
|
||||
}
|
||||
|
||||
if (base.graphic.canvas)
|
||||
{
|
||||
var shaderChannelOrigin = base.graphic.canvas.additionalShaderChannels;
|
||||
@ -67,18 +62,6 @@ public class UIOutlineEffect : BaseMeshEffect
|
||||
base.graphic.SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate();
|
||||
if (base.graphic.material.shader.name != "BF/UI/TEXT_OUTLINE")
|
||||
{
|
||||
base.graphic.material =
|
||||
AssetDatabase.LoadAssetAtPath<Material>("assets/arts/materials/ui/ui_text_outline.mat");
|
||||
}
|
||||
base.graphic.SetVerticesDirty();
|
||||
}
|
||||
#endif
|
||||
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
@ -129,7 +112,6 @@ public class UIOutlineEffect : BaseMeshEffect
|
||||
//uv框
|
||||
var uvOriginMin = Min(v1.uv0, v2.uv0, v3.uv0);
|
||||
var uvOriginMax = Max(v1.uv0, v2.uv0, v3.uv0);
|
||||
|
||||
var color_rg = new Vector2(outlineColor.r, outlineColor.g);
|
||||
var color_ba = new Vector4(0 ,0 , outlineColor.b, outlineColor.a);
|
||||
var normal = new Vector3(0, 0, OutlineWidth);
|
||||
@ -198,5 +180,4 @@ public class UIOutlineEffect : BaseMeshEffect
|
||||
{
|
||||
return new Vector2(Max(a.x, b.x, c.x), Max(a.y, b.y, c.y));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
11
Assets/Scripts/Const/BFPlatform.Const.cs
Normal file
11
Assets/Scripts/Const/BFPlatform.Const.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace BF
|
||||
{
|
||||
public partial class BFPlatform
|
||||
{
|
||||
public const string ANDROID_GP_PACKAGE_NAME = "com.gearpaw.defenders.td.game";
|
||||
public const string ANDROID_GP_PACKAGE_NAME_GLOBAL = "com.fortune.td.game.global";
|
||||
public const string ANDROID_GP_PACKAGE_NAME_RU = "com.gearpaw.defenders.td.game.ru";
|
||||
public const string ANDROID_GP_PACKAGE_NAME_RUSTORE = "com.fortune.td.game.rustore";
|
||||
public const string ANDROID_GP_PACKAGE_NAME_RU_HW = "com.fortune.td.game.ru.hw";
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Const/BFPlatform.Const.cs.meta
Normal file
11
Assets/Scripts/Const/BFPlatform.Const.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94aec8a10f4fce041a3f1a94ab8079db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -64,22 +64,9 @@ namespace BF
|
||||
|
||||
public partial class BFPlatform
|
||||
{
|
||||
const String LoginCenterURL = "https://entrance.wdd817.link";
|
||||
static Dictionary<string, string> BFLoginCenterURLDict = new Dictionary<string, string>()
|
||||
{
|
||||
// dev
|
||||
{"com.juzu.b6.dev", "https://entrance.wdd817.link"},
|
||||
{"com.juzu.b6.dev.android", "https://entrance.wdd817.link"},
|
||||
{"com.juzu.b6.dev.ios", "http://game.juzugame.com:3000"},
|
||||
|
||||
// release
|
||||
{"com.juzu.b6.release.android", "http://game.juzugame.com:3000"},
|
||||
{"com.juzu.b6.release.ios", "http://game.juzugame.com:3000"},
|
||||
|
||||
// gp
|
||||
{"com.combo.heroes.puzzle.rpg", "https://entrance.wdd817.link"},
|
||||
};
|
||||
|
||||
const String LoginCenterURLDev = "http://game.juzugame.com:3000";
|
||||
const String LoginCenterURL = "https://entrance.bigfoot-studio.link";
|
||||
const String LoginCenterURLRU = "https://entrance-ru.bigfoot-studio.link";
|
||||
//combine url解析的数据
|
||||
static ClusterType clusterType;
|
||||
|
||||
@ -112,109 +99,6 @@ namespace BF
|
||||
//登陆中心返回的信息齐全且格式正常
|
||||
static bool isLoginCenterConfigValid;//请求的域名信息是否正确
|
||||
|
||||
/// <summary>
|
||||
/// 解析json数据 获取cluter,gate,chat,vsn,pay的地址
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
public static void InitUrlsFromLoginCenter(string json)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
{
|
||||
CombineURL urls = JsonUtility.FromJson<CombineURL>(json);
|
||||
|
||||
BFLog.Log("C#解析后的urls:" + urls.ToString());
|
||||
|
||||
clusterType = (ClusterType)urls.cluster_type;
|
||||
string tmpGateUrl = urls.ugate_addr;
|
||||
string tmpChatUrl = urls.uchat_addr;
|
||||
string tmpVsnUrl = urls.vsn_addr;
|
||||
string tmpPayUrl = urls.upay_addr;
|
||||
string tmpCommunityWebUrl = urls.community_web_addr;
|
||||
string tmpCommunitySrvUrl = urls.community_srv_addr;
|
||||
string tmpAicsHttpUrl = urls.aics_http_addr;
|
||||
string tmpAicsWebSocketUrl = urls.aics_ws_addr;
|
||||
|
||||
bool clusterValid = clusterType != ClusterType.None;
|
||||
bool gateValid = !string.IsNullOrEmpty(tmpGateUrl);
|
||||
bool chatValid = !string.IsNullOrEmpty(tmpChatUrl);
|
||||
bool vsnValid = !string.IsNullOrEmpty(tmpVsnUrl);
|
||||
bool payValid = !string.IsNullOrEmpty(tmpPayUrl);
|
||||
bool communityWebValid = !string.IsNullOrEmpty(tmpCommunityWebUrl);
|
||||
bool communitySrvValid = !string.IsNullOrEmpty(tmpCommunitySrvUrl);
|
||||
bool aicsHttpValid = !string.IsNullOrEmpty(tmpAicsHttpUrl);
|
||||
bool aicsWebSocketValid = !string.IsNullOrEmpty(tmpAicsWebSocketUrl);
|
||||
|
||||
BFLog.Log(string.Format("check valid clusterValid:{0} gateValid:{1} chatValid:{2} vsnValid:{3} payValid:{4} communityWebValid:{5} communitySrvValid:{6} aicsHttpValid:{7} aicsWebSocketValid:{8}", clusterValid, gateValid, chatValid, vsnValid, payValid, communityWebValid, communitySrvValid, aicsHttpValid, aicsWebSocketValid));
|
||||
|
||||
//判断参数是否正常
|
||||
if (clusterValid && gateValid && chatValid && vsnValid && payValid)
|
||||
{
|
||||
if (IsPublishChannel()) // 正式渠道不验证社区与客服地址
|
||||
{
|
||||
SetLoginCenterConfigValid(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (communityWebValid && communitySrvValid && aicsHttpValid && aicsWebSocketValid)
|
||||
{
|
||||
SetLoginCenterConfigValid(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLoginCenterConfigValid(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLoginCenterConfigValid(false);
|
||||
}
|
||||
|
||||
//拆分域名url与port
|
||||
int gatePortIndex = tmpGateUrl.LastIndexOf(':');
|
||||
int chatPortIndex = tmpChatUrl.LastIndexOf(':');
|
||||
int vsnPortIndex = tmpVsnUrl.LastIndexOf(':');
|
||||
|
||||
string gatePortStr = tmpGateUrl.Substring(gatePortIndex + 1, tmpGateUrl.Length - gatePortIndex - 1);
|
||||
string chatPortStr = tmpChatUrl.Substring(chatPortIndex + 1, tmpChatUrl.Length - chatPortIndex - 1);
|
||||
string vsnPortStr = tmpVsnUrl.Substring(vsnPortIndex + 1, tmpVsnUrl.Length - vsnPortIndex - 1);
|
||||
|
||||
int gatePort = 0;
|
||||
int chatPort = 0;
|
||||
int vsnPort = 0;
|
||||
int.TryParse(gatePortStr, out gatePort);
|
||||
int.TryParse(chatPortStr, out chatPort);
|
||||
int.TryParse(vsnPortStr, out vsnPort);
|
||||
|
||||
string tmpGateUrlWithoutPort = tmpGateUrl.Substring(0, gatePortIndex);
|
||||
string tmpChatUrlWithoutPort = tmpChatUrl.Substring(0, chatPortIndex);
|
||||
string tmpVsnUrlWithoutPort = tmpVsnUrl.Substring(0, vsnPortIndex);
|
||||
|
||||
mainGateUrl = tmpGateUrlWithoutPort;
|
||||
mainGatePort = gatePort;
|
||||
chatGateUrl = tmpChatUrlWithoutPort;
|
||||
chatGatePort = chatPort;
|
||||
vsnHttpUrl = tmpVsnUrlWithoutPort;
|
||||
vsnHttpPort = vsnPort;
|
||||
|
||||
//暂时保留原格式
|
||||
_channelGate = new BFGateInfo(mainGateUrl, mainGatePort, chatGateUrl, chatGatePort);
|
||||
_vsnUrl = new BFHttpsInfo(vsnHttpUrl, vsnHttpPort);
|
||||
|
||||
payUrl = tmpPayUrl;
|
||||
communityWebUrl = tmpCommunityWebUrl;
|
||||
communitySrvUrl = tmpCommunitySrvUrl;
|
||||
aicsHttpUrl = tmpAicsHttpUrl;
|
||||
aicsWebSocketUrl = tmpAicsWebSocketUrl;
|
||||
|
||||
BFLog.Log("解析后的地址 gate:{0} gatePort:{1} chat:{2} chatPort:{3} vsn:{4} vsnPort:{5} payUrl:{6} communityWebUrl:{7} communitySrvUrl:{8} aicsHttpUrl:{9} aicsWebSocketUrl:{10}", mainGateUrl, gatePort, chatGateUrl, chatPort, vsnHttpUrl, vsnPort, payUrl, communityWebUrl, communitySrvUrl, aicsHttpUrl, aicsWebSocketUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
BFLog.LogError("GetUrlsFromLoginCenter Error,JSON is null or empty");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得集群类型 (1-普通,2-审核,3-测试)
|
||||
/// </summary>
|
||||
@ -255,31 +139,117 @@ namespace BF
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否是内网渠道
|
||||
/// </summary>
|
||||
public static bool IsDevChannel()
|
||||
{
|
||||
return Identifier == "com.juzu.b6.dev" ||
|
||||
Identifier == "com.juzu.b6.dev.android" ||
|
||||
Identifier == "com.juzu.b6.dev.ios";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否是外网测试渠道
|
||||
/// </summary>
|
||||
public static bool IsReleaseChannel()
|
||||
{
|
||||
return Identifier == "com.juzu.b6.release.android" ||
|
||||
Identifier == "com.juzu.b6.release.ios";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否是正式发布渠道
|
||||
/// </summary>
|
||||
public static bool IsPublishChannel()
|
||||
{
|
||||
return !IsDevChannel() && !IsReleaseChannel();
|
||||
#if UNITY_EDITOR || BF_APP_DEV || BF_APP_TEST
|
||||
return false;
|
||||
#else
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME ||
|
||||
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_GLOBAL ||
|
||||
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE ||
|
||||
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW ||
|
||||
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||
{
|
||||
// 深度链接可以强制改为内网环境
|
||||
if (BFMain.DPIsLan)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool IsRuPackage()
|
||||
{
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用ru支付
|
||||
/// </summary>
|
||||
public static bool IsSupportRuPay()
|
||||
{
|
||||
#if BF_APP_DEV || BF_APP_TEST
|
||||
return false;
|
||||
#else
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用ru商店好评
|
||||
/// </summary>
|
||||
public static bool IsSupportRuStoreReview()
|
||||
{
|
||||
#if BF_APP_DEV || BF_APP_TEST
|
||||
return false;
|
||||
#else
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// 这是Facebook SDK
|
||||
public static bool IsSupportFB()
|
||||
{
|
||||
#if BF_APP_DEV || BF_APP_TEST
|
||||
return true;
|
||||
#else
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool IsSupportGDPR()
|
||||
{
|
||||
#if BF_APP_DEV || BF_APP_TEST
|
||||
return true;
|
||||
#else
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
// 这是Facebook广告SDK
|
||||
|
||||
public static bool IsSupportFBAD()
|
||||
{
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsSupportVK()
|
||||
{
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -345,11 +315,19 @@ namespace BF
|
||||
|
||||
public static string GetLoginCenterURL()
|
||||
{
|
||||
if (BFLoginCenterURLDict.TryGetValue(Identifier, out string url))
|
||||
#if BF_APP_DEV || UNITY_EDITOR
|
||||
return LoginCenterURLDev;
|
||||
#else
|
||||
if (BFMain.DPIsLan)
|
||||
{
|
||||
return url;
|
||||
return LoginCenterURLDev;
|
||||
}
|
||||
if (IsRuPackage())
|
||||
{
|
||||
return LoginCenterURLRU;
|
||||
}
|
||||
return LoginCenterURL;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static string GetPayCenterURL()
|
||||
@ -383,5 +361,22 @@ namespace BF
|
||||
{
|
||||
return aicsWebSocketUrl;
|
||||
}
|
||||
//region 华为支付
|
||||
/// <summary>
|
||||
/// 是否使用hw支付
|
||||
/// </summary>
|
||||
public static bool IsSupportHWPay()
|
||||
{
|
||||
#if BF_APP_DEV || BF_APP_TEST
|
||||
return false;
|
||||
#else
|
||||
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
//regionend
|
||||
}
|
||||
}
|
||||
@ -42,14 +42,14 @@ namespace BF
|
||||
// 渠道对应的语言配置
|
||||
public static Dictionary<string, BFLanguageInfo> languageInfos = new Dictionary<string, BFLanguageInfo>()
|
||||
{
|
||||
{"com.juzu.b6.dev", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.juzu.b6.dev.android", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.juzu.b6.dev.ios", new BFLanguageInfo(new List<string>{"en", "cn"})},
|
||||
{"com.juzu.b6.release.android", new BFLanguageInfo(new List<string>{"en"})},
|
||||
{"com.juzu.b6.release.ios", new BFLanguageInfo(new List<string>{"en"})},
|
||||
// 这个是gp渠道
|
||||
{"com.combo.heroes.puzzle.rpg", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.juzu.b6.ios", new BFLanguageInfo(new List<string>{"en"})},
|
||||
{"com.juzu.b13.dev", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.juzu.b13.dev.android", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.juzu.b13.dev.ios", new BFLanguageInfo(new List<string>{"en", "cn"})},
|
||||
{"com.juzu.b13.release.android", new BFLanguageInfo(new List<string>{"en"})},
|
||||
{"com.juzu.b13.release.ios", new BFLanguageInfo(new List<string>{"en"})},
|
||||
{"com.gearpaw.defenders.td.game", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.gearpaw.defenders.td.game.ru", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||
{"com.juzu.b13.ios", new BFLanguageInfo(new List<string>{"en"})},
|
||||
};
|
||||
|
||||
public static BFLanguageInfo GetLanguageInfo(string identifier)
|
||||
|
||||
28
Assets/Scripts/Utils/TimeHelper.cs
Normal file
28
Assets/Scripts/Utils/TimeHelper.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace BF
|
||||
{
|
||||
public static class TimeHelper
|
||||
{
|
||||
public static long GetDayBeginTimestamp(long timestamp, int timeZoneOffset)
|
||||
{
|
||||
// 将时间戳转换为UTC时间
|
||||
DateTime utcTime = DateTimeOffset.FromUnixTimeSeconds(timestamp).UtcDateTime;
|
||||
// 应用时区偏移(不考虑夏令时)
|
||||
if (timeZoneOffset != 0)
|
||||
{
|
||||
utcTime = utcTime.AddHours(timeZoneOffset);
|
||||
}
|
||||
// 构造当天0点的UTC时间
|
||||
DateTime utcDayBegin = new DateTime(utcTime.Year, utcTime.Month, utcTime.Day, 0, 0, 0, DateTimeKind.Utc);
|
||||
// 减去时区偏移量恢复UTC时间
|
||||
if (timeZoneOffset != 0)
|
||||
{
|
||||
utcDayBegin = utcDayBegin.AddHours(-timeZoneOffset);
|
||||
}
|
||||
// 转换为时间戳并减去时区偏移
|
||||
long utcDayBeginTimestamp = new DateTimeOffset(utcDayBegin).ToUnixTimeSeconds();
|
||||
return utcDayBeginTimestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Utils/TimeHelper.cs.meta
Normal file
11
Assets/Scripts/Utils/TimeHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c322159b684af9d4eb38fbfe9b9ed89a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -22,6 +22,8 @@ namespace BF
|
||||
|
||||
private static bool c_free_flag = false;
|
||||
private static bool c_config_flag = false;
|
||||
private static string DefaultSpecialPatternStr = "[【】\\[\\]\\^*×―%@@##$…&¥=<>《》::•`·~;;\\\\/\'\"{}‘’“”]";
|
||||
public static string CustomSpecialPatternStr = "[【】\\[\\]\\^*×―%@@##$…&¥=<>《》::•`·~;;\\\\/\'\"{}‘’“”]";
|
||||
|
||||
public static char[] GetFreeChar()
|
||||
{
|
||||
@ -98,6 +100,15 @@ namespace BF
|
||||
return lp;
|
||||
}
|
||||
|
||||
public static Vector3 LocalPointInRectangleToWorld(RectTransform rt, float planeZ, Camera uiCam, Camera main)
|
||||
{
|
||||
var screenPoint = uiCam.WorldToScreenPoint(rt.transform.position);
|
||||
Vector3 position = new Vector3(screenPoint.x, screenPoint.y, 0);
|
||||
Vector3 result = main.ScreenToWorldPoint(position);
|
||||
result.z = planeZ;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool RectangleContainsScreenPoint(RectTransform rt, float x, float y, Camera cam)
|
||||
{
|
||||
return RectTransformUtility.RectangleContainsScreenPoint(rt, new Vector2(x, y), cam);
|
||||
@ -271,5 +282,22 @@ namespace BF
|
||||
};
|
||||
return Convert.ToBase64String(sha1);
|
||||
}
|
||||
|
||||
public static bool IsSpecialChar(string str, bool useDefaultPattern)
|
||||
{
|
||||
Regex regExp;
|
||||
if (useDefaultPattern)
|
||||
{
|
||||
regExp = new Regex(DefaultSpecialPatternStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
regExp = new Regex(CustomSpecialPatternStr);
|
||||
}
|
||||
if(regExp.IsMatch(str)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
71
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs
vendored
Normal file
71
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
public enum MediationNetwork : ulong
|
||||
{
|
||||
GoogleAdMob = 1,
|
||||
IronSource = 2,
|
||||
ApplovinMax = 3,
|
||||
Fyber = 4,
|
||||
Appodeal = 5,
|
||||
Admost = 6,
|
||||
Topon = 7,
|
||||
Tradplus = 8,
|
||||
Yandex = 9,
|
||||
ChartBoost = 10,
|
||||
Unity = 11,
|
||||
ToponPte = 12,
|
||||
Custom = 13,
|
||||
DirectMonetization = 14
|
||||
}
|
||||
|
||||
public static class AdRevenueScheme
|
||||
{
|
||||
/**
|
||||
* code ISO 3166-1 format
|
||||
*/
|
||||
public const string COUNTRY = "country";
|
||||
|
||||
/**
|
||||
* ID of the ad unit for the impression
|
||||
*/
|
||||
public const string AD_UNIT = "ad_unit";
|
||||
|
||||
/**
|
||||
* Format of the ad
|
||||
*/
|
||||
public const string AD_TYPE = "ad_type";
|
||||
|
||||
/**
|
||||
* ID of the ad placement for the impression
|
||||
*/
|
||||
public const string PLACEMENT = "placement";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
// Data class representing ad revenue information.
|
||||
//
|
||||
// @property monetizationNetwork The name of the network that monetized the ad.
|
||||
// @property mediationNetwork An instance of MediationNetwork representing the mediation service used.
|
||||
// @property currencyIso4217Code The ISO 4217 currency code describing the currency of the revenue.
|
||||
// @property eventRevenue The amount of revenue generated by the ad.
|
||||
/// </summary>
|
||||
public class AFAdRevenueData
|
||||
{
|
||||
public string monetizationNetwork { get; private set; }
|
||||
public MediationNetwork mediationNetwork { get; private set; }
|
||||
public string currencyIso4217Code { get; private set; }
|
||||
public double eventRevenue { get; private set; }
|
||||
|
||||
public AFAdRevenueData(string monetization, MediationNetwork mediation, string currency, double revenue)
|
||||
{
|
||||
monetizationNetwork = monetization;
|
||||
mediationNetwork = mediation;
|
||||
currencyIso4217Code = currency;
|
||||
eventRevenue = revenue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49e1906ae949e4bfea400bd1da9f7e39
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/ThirdParty/AppsFlyer/AFAdRevenueEvent.cs
vendored
34
Assets/ThirdParty/AppsFlyer/AFAdRevenueEvent.cs
vendored
@ -1,34 +0,0 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class AFAdRevenueEvent {
|
||||
|
||||
/**
|
||||
*Pre-defined keys for non-mandatory dictionary
|
||||
*Code ISO 3166-1 format
|
||||
**/
|
||||
public const string COUNTRY = "country";
|
||||
|
||||
/**
|
||||
*ID of the ad unit for the impression
|
||||
**/
|
||||
public const string AD_UNIT = "ad_unit";
|
||||
|
||||
/**
|
||||
*Format of the ad
|
||||
**/
|
||||
public const string AD_TYPE = "ad_type";
|
||||
|
||||
/**
|
||||
*ID of the ad placement for the impression
|
||||
**/
|
||||
public const string PLACEMENT = "placement";
|
||||
|
||||
/**
|
||||
*Provided by Facebook Audience Network only, and will be reported to publishers
|
||||
*approved by Facebook Audience Network within the closed beta
|
||||
**/
|
||||
public const string ECPM_PAYLOAD = "ecpm_payload";
|
||||
|
||||
|
||||
}
|
||||
35
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs
vendored
Normal file
35
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
public enum AFPurchaseType
|
||||
{
|
||||
Subscription = 0,
|
||||
OneTimePurchase = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
//
|
||||
/// </summary>
|
||||
public class AFPurchaseDetailsAndroid
|
||||
|
||||
{
|
||||
public AFPurchaseType purchaseType { get; private set; }
|
||||
public string purchaseToken { get; private set; }
|
||||
public string productId { get; private set; }
|
||||
public string price { get; private set; }
|
||||
public string currency { get; private set; }
|
||||
|
||||
public AFPurchaseDetailsAndroid(AFPurchaseType type, String purchaseToken, String productId, String price, String currency)
|
||||
{
|
||||
this.purchaseType = type;
|
||||
this.purchaseToken = purchaseToken;
|
||||
this.productId = productId;
|
||||
this.price = price;
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d71b3864006f94ac08938b2ebdc940bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs
vendored
Normal file
30
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
/// <summary>
|
||||
//
|
||||
/// </summary>
|
||||
public class AFSDKPurchaseDetailsIOS
|
||||
{
|
||||
public string productId { get; private set; }
|
||||
public string price { get; private set; }
|
||||
public string currency { get; private set; }
|
||||
public string transactionId { get; private set; }
|
||||
|
||||
private AFSDKPurchaseDetailsIOS(string productId, string price, string currency, string transactionId)
|
||||
{
|
||||
this.productId = productId;
|
||||
this.price = price;
|
||||
this.currency = currency;
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public static AFSDKPurchaseDetailsIOS Init(string productId, string price, string currency, string transactionId)
|
||||
{
|
||||
return new AFSDKPurchaseDetailsIOS(productId, price, currency, transactionId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44bb6c4472701416080eb050732075ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
Assets/ThirdParty/AppsFlyer/AFSDKValidateAndLogResult.cs
vendored
Normal file
38
Assets/ThirdParty/AppsFlyer/AFSDKValidateAndLogResult.cs
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
public enum AFSDKValidateAndLogStatus
|
||||
{
|
||||
AFSDKValidateAndLogStatusSuccess,
|
||||
AFSDKValidateAndLogStatusFailure,
|
||||
AFSDKValidateAndLogStatusError
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
//
|
||||
/// </summary>
|
||||
public class AFSDKValidateAndLogResult
|
||||
{
|
||||
public AFSDKValidateAndLogStatus status { get; private set; }
|
||||
public Dictionary<string, object> result { get; private set; }
|
||||
public Dictionary<string, object> errorData { get; private set; }
|
||||
public string error { get; private set; }
|
||||
|
||||
private AFSDKValidateAndLogResult(AFSDKValidateAndLogStatus status, Dictionary<string, object> result, Dictionary<string, object> errorData, string error)
|
||||
{
|
||||
this.status = status;
|
||||
this.result = result;
|
||||
this.errorData = errorData;
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public static AFSDKValidateAndLogResult Init(AFSDKValidateAndLogStatus status, Dictionary<string, object> result, Dictionary<string, object> errorData, string error)
|
||||
{
|
||||
return new AFSDKValidateAndLogResult(status, result, errorData, error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/AFSDKValidateAndLogResult.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFSDKValidateAndLogResult.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2df1c6f1eab2e4849bf2762a8d78933f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
783
Assets/ThirdParty/AppsFlyer/AppsFlyer.cs
vendored
783
Assets/ThirdParty/AppsFlyer/AppsFlyer.cs
vendored
File diff suppressed because it is too large
Load Diff
173
Assets/ThirdParty/AppsFlyer/AppsFlyerAdRevenue.cs
vendored
173
Assets/ThirdParty/AppsFlyer/AppsFlyerAdRevenue.cs
vendored
@ -1,173 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
public class AppsFlyerAdRevenue : MonoBehaviour
|
||||
{
|
||||
|
||||
public static readonly string kAppsFlyerAdRevenueVersion = "6.5.4";
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
private static AndroidJavaClass appsFlyerAndroid = new AndroidJavaClass("com.appsflyer.unity.afunityadrevenuegenericplugin.AdRevenueUnityWrapper");
|
||||
#endif
|
||||
|
||||
public static void start()
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
|
||||
_start();
|
||||
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
|
||||
using(AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
|
||||
|
||||
using(AndroidJavaObject cls_Activity = cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity")) {
|
||||
|
||||
AndroidJavaObject cls_Application = cls_Activity.Call<AndroidJavaObject>("getApplication");
|
||||
|
||||
appsFlyerAndroid.CallStatic("start", cls_Application);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public static void setIsDebug(bool isDebug)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_setIsDebugAdrevenue(isDebug);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void logAdRevenue(string monetizationNetwork,
|
||||
AppsFlyerAdRevenueMediationNetworkType mediationNetwork,
|
||||
double eventRevenue,
|
||||
string revenueCurrency,
|
||||
Dictionary<string, string> additionalParameters)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
|
||||
_logAdRevenue(monetizationNetwork, mediationNetwork, eventRevenue, revenueCurrency, AFMiniJSON.Json.Serialize(additionalParameters));
|
||||
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
|
||||
int mediationNetworkAndroid = setMediationNetworkTypeAndroid(mediationNetwork);
|
||||
if (mediationNetworkAndroid == -1)
|
||||
{
|
||||
Debug.Log("Please choose a valid mediationNetwork");
|
||||
} else
|
||||
{
|
||||
appsFlyerAndroid.CallStatic("logAdRevenue",
|
||||
monetizationNetwork,
|
||||
mediationNetworkAndroid,
|
||||
revenueCurrency,
|
||||
eventRevenue,
|
||||
convertDictionaryToJavaMap(additionalParameters));
|
||||
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _start();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _setIsDebugAdrevenue(bool isDebug);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _logAdRevenue(string monetizationNetwork,
|
||||
AppsFlyerAdRevenueMediationNetworkType mediationNetwork,
|
||||
double eventRevenue,
|
||||
string revenueCurrency,
|
||||
string additionalParameters);
|
||||
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
private static int setMediationNetworkTypeAndroid(AppsFlyerAdRevenueMediationNetworkType mediationNetwork)
|
||||
{
|
||||
switch (mediationNetwork)
|
||||
{
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeIronSource:
|
||||
return 0;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeApplovinMax:
|
||||
return 1;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob:
|
||||
return 2;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeFyber:
|
||||
return 3;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeAppodeal:
|
||||
return 4;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeAdmost:
|
||||
return 5;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeTopon:
|
||||
return 6;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeTradplus:
|
||||
return 7;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeYandex:
|
||||
return 8;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeChartBoost:
|
||||
return 9;
|
||||
case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeUnity:
|
||||
return 10;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
private static AndroidJavaObject convertDictionaryToJavaMap(Dictionary<string, string> dictionary)
|
||||
{
|
||||
AndroidJavaObject map = new AndroidJavaObject("java.util.HashMap");
|
||||
IntPtr putMethod = AndroidJNIHelper.GetMethodID(map.GetRawClass(), "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
||||
jvalue[] val;
|
||||
if (dictionary != null)
|
||||
{
|
||||
foreach (var entry in dictionary)
|
||||
{
|
||||
val = AndroidJNIHelper.CreateJNIArgArray(new object[] { entry.Key, entry.Value });
|
||||
AndroidJNI.CallObjectMethod(map.GetRawObject(), putMethod, val);
|
||||
AndroidJNI.DeleteLocalRef(val[0].l);
|
||||
AndroidJNI.DeleteLocalRef(val[1].l);
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum AppsFlyerAdRevenueMediationNetworkType
|
||||
{
|
||||
AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob = 1,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeIronSource = 2,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeApplovinMax = 3,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeFyber = 4,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeAppodeal = 5,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeAdmost = 6,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeTopon = 7,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeTradplus = 8,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeYandex = 9,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeChartBoost = 10,
|
||||
AppsFlyerAdRevenueMediationNetworkTypeUnity = 11
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
262
Assets/ThirdParty/AppsFlyer/AppsFlyerAndroid.cs
vendored
262
Assets/ThirdParty/AppsFlyer/AppsFlyerAndroid.cs
vendored
@ -6,11 +6,13 @@ namespace AppsFlyerSDK
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID
|
||||
public class AppsFlyerAndroid
|
||||
public class AppsFlyerAndroid : IAppsFlyerAndroidBridge
|
||||
{
|
||||
public bool isInit { get; set; }
|
||||
|
||||
private static AndroidJavaClass appsFlyerAndroid = new AndroidJavaClass("com.appsflyer.unity.AppsFlyerAndroidWrapper");
|
||||
|
||||
public AppsFlyerAndroid() { }
|
||||
|
||||
/// <summary>
|
||||
/// Use this method to init the sdk for the application.
|
||||
@ -18,7 +20,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="devkey"> AppsFlyer's Dev-Key, which is accessible from your AppsFlyer account under 'App Settings' in the dashboard.</param>
|
||||
/// <param name="gameObject">The current game object. This is used to get the conversion data callbacks. Pass null if you do not need the callbacks.</param>
|
||||
public static void initSDK(string devkey, MonoBehaviour gameObject)
|
||||
public void initSDK(string devkey, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("initSDK", devkey, gameObject ? gameObject.name : null);
|
||||
@ -30,15 +32,10 @@ namespace AppsFlyerSDK
|
||||
/// The AppsFlyer's Dev-Key must be provided.
|
||||
/// </summary>
|
||||
/// <param name="devkey"> AppsFlyer's Dev-Key, which is accessible from your AppsFlyer account under 'App Settings' in the dashboard.</param>
|
||||
public static void startSDK()
|
||||
{
|
||||
startSDK(false, AppsFlyer.CallBackObjectName);
|
||||
}
|
||||
|
||||
public static void startSDK(bool shouldCallback, string callBackObjectName)
|
||||
public void startSDK(bool onRequestResponse, string CallBackObjectName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("startTracking", shouldCallback, callBackObjectName);
|
||||
appsFlyerAndroid.CallStatic("startTracking", onRequestResponse, CallBackObjectName);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -48,7 +45,7 @@ namespace AppsFlyerSDK
|
||||
/// This can be achieved with the stopSDK API.
|
||||
/// </summary>
|
||||
/// <param name="isSDKStopped">boolean should SDK be stopped.</param>
|
||||
public static void stopSDK(bool isSDKStopped)
|
||||
public void stopSDK(bool isSDKStopped)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("stopTracking", isSDKStopped);
|
||||
@ -59,7 +56,7 @@ namespace AppsFlyerSDK
|
||||
/// Get the AppsFlyer SDK version used in app.
|
||||
/// </summary>
|
||||
/// <returns>AppsFlyer SDK version.</returns>
|
||||
public static string getSdkVersion()
|
||||
public string getSdkVersion()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<string>("getSdkVersion");
|
||||
@ -72,7 +69,7 @@ namespace AppsFlyerSDK
|
||||
/// Manually pass the Firebase / GCM Device Token for Uninstall measurement.
|
||||
/// </summary>
|
||||
/// <param name="token">Firebase Device Token.</param>
|
||||
public static void updateServerUninstallToken(string token)
|
||||
public void updateServerUninstallToken(string token)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("updateServerUninstallToken", token);
|
||||
@ -84,7 +81,7 @@ namespace AppsFlyerSDK
|
||||
/// Should only be set to true in development / debug.
|
||||
/// </summary>
|
||||
/// <param name="shouldEnable">shouldEnable boolean.</param>
|
||||
public static void setIsDebug(bool shouldEnable)
|
||||
public void setIsDebug(bool shouldEnable)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setIsDebug", shouldEnable);
|
||||
@ -97,7 +94,7 @@ namespace AppsFlyerSDK
|
||||
/// Use this API to explicitly send IMEI to AppsFlyer.
|
||||
/// </summary>
|
||||
/// <param name="aImei">device's IMEI.</param>
|
||||
public static void setImeiData(string aImei)
|
||||
public void setImeiData(string aImei)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setImeiData", aImei);
|
||||
@ -110,7 +107,7 @@ namespace AppsFlyerSDK
|
||||
/// Use this API to explicitly send Android ID to AppsFlyer.
|
||||
/// </summary>
|
||||
/// <param name="aAndroidId">device's Android ID.</param>
|
||||
public static void setAndroidIdData(string aAndroidId)
|
||||
public void setAndroidIdData(string aAndroidId)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setAndroidIdData", aAndroidId);
|
||||
@ -122,7 +119,7 @@ namespace AppsFlyerSDK
|
||||
/// This ID is available in AppsFlyer CSV reports along with Postback APIs for cross-referencing with your internal IDs.
|
||||
/// </summary>
|
||||
/// <param name="id">Customer ID for client.</param>
|
||||
public static void setCustomerUserId(string id)
|
||||
public void setCustomerUserId(string id)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setCustomerUserId", id);
|
||||
@ -135,7 +132,7 @@ namespace AppsFlyerSDK
|
||||
/// If this API is used, all in-app events and any other SDK API calls are discarded, until the customerUserID is provided.
|
||||
/// </summary>
|
||||
/// <param name="wait">wait boolean.</param>
|
||||
public static void waitForCustomerUserId(bool wait)
|
||||
public void waitForCustomerUserId(bool wait)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("waitForCustomerUserId", wait);
|
||||
@ -146,7 +143,7 @@ namespace AppsFlyerSDK
|
||||
/// Use this API to provide the SDK with the relevant customer user id and trigger the SDK to begin its normal activity.
|
||||
/// </summary>
|
||||
/// <param name="id">Customer ID for client.</param>
|
||||
public static void setCustomerIdAndStartSDK(string id)
|
||||
public void setCustomerIdAndStartSDK(string id)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setCustomerIdAndTrack", id);
|
||||
@ -157,7 +154,7 @@ namespace AppsFlyerSDK
|
||||
/// Get the current AF_STORE value.
|
||||
/// </summary>
|
||||
/// <returns>AF_Store value.</returns>
|
||||
public static string getOutOfStore()
|
||||
public string getOutOfStore()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<string>("getOutOfStore");
|
||||
@ -170,7 +167,7 @@ namespace AppsFlyerSDK
|
||||
/// Manually set the AF_STORE value.
|
||||
/// </summary>
|
||||
/// <param name="sourceName">value to be set.</param>
|
||||
public static void setOutOfStore(string sourceName)
|
||||
public void setOutOfStore(string sourceName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setOutOfStore", sourceName);
|
||||
@ -182,7 +179,7 @@ namespace AppsFlyerSDK
|
||||
/// The link that is generated for the user invite will use this OneLink as the base link.
|
||||
/// </summary>
|
||||
/// <param name="oneLinkId">OneLink ID obtained from the AppsFlyer Dashboard.</param>
|
||||
public static void setAppInviteOneLinkID(string oneLinkId)
|
||||
public void setAppInviteOneLinkID(string oneLinkId)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setAppInviteOneLinkID", oneLinkId);
|
||||
@ -193,21 +190,32 @@ namespace AppsFlyerSDK
|
||||
/// Set additional data to be sent to AppsFlyer.
|
||||
/// </summary>
|
||||
/// <param name="customData">additional data Dictionary.</param>
|
||||
public static void setAdditionalData(Dictionary<string, string> customData)
|
||||
public void setAdditionalData(Dictionary<string, string> customData)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setAdditionalData", convertDictionaryToJavaMap(customData));
|
||||
#endif
|
||||
}
|
||||
|
||||
//// <summary>
|
||||
/// Set the deepLink timeout value that should be used for DDL.
|
||||
/// </summary>
|
||||
/// <param name="deepLinkTimeout">deepLink timeout in milliseconds.</param>
|
||||
public void setDeepLinkTimeout(long deepLinkTimeout)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setDeepLinkTimeout", deepLinkTimeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the user emails.
|
||||
/// </summary>
|
||||
/// <param name="emails">User emails.</param>
|
||||
public static void setUserEmails(params string[] emails)
|
||||
public void setUserEmails(params string[] userEmails)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setUserEmails", (object)emails);
|
||||
appsFlyerAndroid.CallStatic("setUserEmails", (object)userEmails);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -216,7 +224,7 @@ namespace AppsFlyerSDK
|
||||
/// Set the user phone number.
|
||||
/// </summary>
|
||||
/// <param name="phoneNumber">User phoneNumber.</param>
|
||||
public static void setPhoneNumber(string phoneNumber){
|
||||
public void setPhoneNumber(string phoneNumber){
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setPhoneNumber", phoneNumber);
|
||||
#endif
|
||||
@ -232,7 +240,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="cryptMethod">Encryption method.</param>
|
||||
/// <param name="emails">User emails.</param>
|
||||
public static void setUserEmails(EmailCryptType cryptMethod, params string[] emails)
|
||||
public void setUserEmails(EmailCryptType cryptMethod, params string[] emails)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setUserEmails", getEmailType(cryptMethod), (object)emails);
|
||||
@ -245,7 +253,7 @@ namespace AppsFlyerSDK
|
||||
/// However, apps with Google play services should avoid Android ID collection as this is in violation of the Google Play policy.
|
||||
/// </summary>
|
||||
/// <param name="isCollect">boolean, false to opt-out.</param>
|
||||
public static void setCollectAndroidID(bool isCollect)
|
||||
public void setCollectAndroidID(bool isCollect)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setCollectAndroidID", isCollect);
|
||||
@ -258,7 +266,7 @@ namespace AppsFlyerSDK
|
||||
/// However, apps with Google play services should avoid IMEI collection as this is in violation of the Google Play policy.
|
||||
/// </summary>
|
||||
/// <param name="isCollect">boolean, false to opt-out.</param>
|
||||
public static void setCollectIMEI(bool isCollect)
|
||||
public void setCollectIMEI(bool isCollect)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setCollectIMEI", isCollect);
|
||||
@ -270,7 +278,7 @@ namespace AppsFlyerSDK
|
||||
/// This Universal Link will invoke the app but any deep linking data will not propagate to AppsFlyer.
|
||||
/// </summary>
|
||||
/// <param name="urls">Array of urls.</param>
|
||||
public static void setResolveDeepLinkURLs(params string[] urls)
|
||||
public void setResolveDeepLinkURLs(params string[] urls)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setResolveDeepLinkURLs", (object)urls);
|
||||
@ -282,7 +290,7 @@ namespace AppsFlyerSDK
|
||||
/// Advertisers can use this method to set vanity onelink domains.
|
||||
/// </summary>
|
||||
/// <param name="domains">Array of domains.</param>
|
||||
public static void setOneLinkCustomDomain(params string[] domains)
|
||||
public void setOneLinkCustomDomain(params string[] domains)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setOneLinkCustomDomain", (object)domains);
|
||||
@ -293,7 +301,7 @@ namespace AppsFlyerSDK
|
||||
/// Manually set that the application was updated.
|
||||
/// </summary>
|
||||
/// <param name="isUpdate">isUpdate boolean value.</param>
|
||||
public static void setIsUpdate(bool isUpdate)
|
||||
public void setIsUpdate(bool isUpdate)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setIsUpdate", isUpdate);
|
||||
@ -306,7 +314,7 @@ namespace AppsFlyerSDK
|
||||
/// You can set the currency code for all events by calling the following method.
|
||||
/// </summary>
|
||||
/// <param name="currencyCode">3 character ISO 4217 code.</param>
|
||||
public static void setCurrencyCode(string currencyCode)
|
||||
public void setCurrencyCode(string currencyCode)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setCurrencyCode", currencyCode);
|
||||
@ -318,7 +326,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="latitude">latitude as double.</param>
|
||||
/// <param name="longitude">longitude as double.</param>
|
||||
public static void recordLocation(double latitude, double longitude)
|
||||
public void recordLocation(double latitude, double longitude)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("trackLocation", latitude, longitude);
|
||||
@ -331,12 +339,12 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="eventName">Event Name as String.</param>
|
||||
/// <param name="eventValues">Event Values as Dictionary.</param>
|
||||
public static void sendEvent(string eventName, Dictionary<string, string> eventValues)
|
||||
public void sendEvent(string eventName, Dictionary<string, string> eventValues)
|
||||
{
|
||||
sendEvent(eventName, eventValues, false, AppsFlyer.CallBackObjectName);
|
||||
}
|
||||
|
||||
public static void sendEvent(string eventName, Dictionary<string, string> eventValues, bool shouldCallback, string callBackObjectName)
|
||||
public void sendEvent(string eventName, Dictionary<string, string> eventValues, bool shouldCallback, string callBackObjectName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("trackEvent", eventName, convertDictionaryToJavaMap(eventValues), shouldCallback, callBackObjectName);
|
||||
@ -349,26 +357,66 @@ namespace AppsFlyerSDK
|
||||
/// Default is false.
|
||||
/// </summary>
|
||||
/// <param name="isDisabled">isDisabled boolean.</param>
|
||||
public static void anonymizeUser(bool isDisabled)
|
||||
public void anonymizeUser(bool isDisabled)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setDeviceTrackingDisabled", isDisabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calling enableTCFDataCollection(true) will enable collecting and sending any TCF related data.
|
||||
/// Calling enableTCFDataCollection(false) will disable the collection of TCF related data and from sending it.
|
||||
/// </summary>
|
||||
/// <param name = "shouldCollectTcfData" >should start TCF Data collection boolean.</param>
|
||||
public void enableTCFDataCollection(bool shouldCollectTcfData)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("enableTCFDataCollection", shouldCollectTcfData);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable the collection of Facebook Deferred AppLinks.
|
||||
/// Requires Facebook SDK and Facebook app on target/client device.
|
||||
/// This API must be invoked prior to initializing the AppsFlyer SDK in order to function properly.
|
||||
/// </summary>
|
||||
/// <param name="isEnabled">should Facebook's deferred app links be processed by the AppsFlyer SDK.</param>
|
||||
public static void enableFacebookDeferredApplinks(bool isEnabled)
|
||||
public void enableFacebookDeferredApplinks(bool isEnabled)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("enableFacebookDeferredApplinks", isEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets or updates the user consent data related to GDPR and DMA regulations for advertising and data usage purposes within the application.
|
||||
/// call this method when GDPR user is true
|
||||
/// </summary>
|
||||
/// <param name = "hasConsentForDataUsage" >hasConsentForDataUsage boolean.</param>
|
||||
/// <param name = "hasConsentForAdsPersonalization" >hasConsentForAdsPersonalization boolean.</param>
|
||||
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
string isUserSubjectToGDPR = appsFlyerConsent.isUserSubjectToGDPR?.ToString().ToLower() ?? "null";
|
||||
string hasConsentForDataUsage = appsFlyerConsent.hasConsentForDataUsage?.ToString().ToLower() ?? "null";
|
||||
string hasConsentForAdsPersonalization = appsFlyerConsent.hasConsentForAdsPersonalization?.ToString().ToLower() ?? "null";
|
||||
string hasConsentForAdStorage = appsFlyerConsent.hasConsentForAdStorage?.ToString().ToLower() ?? "null";
|
||||
|
||||
appsFlyerAndroid.CallStatic("setConsentData", isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization, hasConsentForAdStorage);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs ad revenue data along with additional parameters if provided.
|
||||
/// <param name = "adRevenueData" >instance of AFAdRevenueData containing ad revenue information.</param>
|
||||
/// <param name = "additionalParameters" >An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters.</param>
|
||||
public void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("logAdRevenue", adRevenueData.monetizationNetwork, getMediationNetwork(adRevenueData.mediationNetwork), adRevenueData.currencyIso4217Code, adRevenueData.eventRevenue, convertDictionaryToJavaMap(additionalParameters));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restrict reengagement via deep-link to once per each unique deep-link.
|
||||
@ -376,7 +424,7 @@ namespace AppsFlyerSDK
|
||||
/// The default value is false.
|
||||
/// </summary>
|
||||
/// <param name="doConsume">doConsume boolean.</param>
|
||||
public static void setConsumeAFDeepLinks(bool doConsume)
|
||||
public void setConsumeAFDeepLinks(bool doConsume)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setConsumeAFDeepLinks", doConsume);
|
||||
@ -389,7 +437,7 @@ namespace AppsFlyerSDK
|
||||
/// <param name="mediaSource">Manufacturer or media source name for preinstall attribution.</param>
|
||||
/// <param name="campaign">Campaign name for preinstall attribution.</param>
|
||||
/// <param name="siteId">Site ID for preinstall attribution.</param>
|
||||
public static void setPreinstallAttribution(string mediaSource, string campaign, string siteId)
|
||||
public void setPreinstallAttribution(string mediaSource, string campaign, string siteId)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setPreinstallAttribution", mediaSource, campaign, siteId);
|
||||
@ -400,7 +448,7 @@ namespace AppsFlyerSDK
|
||||
/// Boolean indicator for preinstall by Manufacturer.
|
||||
/// </summary>
|
||||
/// <returns>boolean isPreInstalledApp.</returns>
|
||||
public static bool isPreInstalledApp()
|
||||
public bool isPreInstalledApp()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<bool>("isPreInstalledApp");
|
||||
@ -413,7 +461,7 @@ namespace AppsFlyerSDK
|
||||
/// Get the Facebook attribution ID, if one exists.
|
||||
/// </summary>
|
||||
/// <returns>string Facebook attribution ID.</returns>
|
||||
public static string getAttributionId()
|
||||
public string getAttributionId()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<string>("getAttributionId");
|
||||
@ -426,7 +474,7 @@ namespace AppsFlyerSDK
|
||||
/// Get AppsFlyer's unique device ID is created for every new install of an app.
|
||||
/// </summary>
|
||||
/// <returns>AppsFlyer's unique device ID.</returns>
|
||||
public static string getAppsFlyerId()
|
||||
public string getAppsFlyerId()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<string>("getAppsFlyerId");
|
||||
@ -445,18 +493,31 @@ namespace AppsFlyerSDK
|
||||
/// <param name="price">Purchase price, should be derived from <code>skuDetails.getStringArrayList("DETAILS_LIST")</code></param>
|
||||
/// <param name="currency">Purchase currency, should be derived from <code>skuDetails.getStringArrayList("DETAILS_LIST")</code></param>
|
||||
/// <param name="additionalParameters">additionalParameters Freehand parameters to be sent with the purchase (if validated).</param>
|
||||
public static void validateAndSendInAppPurchase(string publicKey, string signature, string purchaseData, string price, string currency, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
||||
public void validateAndSendInAppPurchase(string publicKey, string signature, string purchaseData, string price, string currency, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("validateAndTrackInAppPurchase", publicKey, signature, purchaseData, price, currency, convertDictionaryToJavaMap(additionalParameters), gameObject ? gameObject.name : null);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// API for server verification of in-app purchases.
|
||||
/// An af_purchase event with the relevant values will be automatically sent if the validation is successful.
|
||||
/// </summary>
|
||||
/// <param name="details">AFPurchaseDetailsAndroid instance.</param>
|
||||
/// <param name="additionalParameters">additionalParameters Freehand parameters to be sent with the purchase (if validated).</param>
|
||||
public void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("validateAndTrackInAppPurchaseV2", (int)details.purchaseType, details.purchaseToken, details.productId, details.price, details.currency, convertDictionaryToJavaMap(additionalParameters), gameObject ? gameObject.name : null);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Was the stopSDK(boolean) API set to true.
|
||||
/// </summary>
|
||||
/// <returns>boolean isSDKStopped.</returns>
|
||||
public static bool isSDKStopped()
|
||||
public bool isSDKStopped()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<bool>("isTrackingStopped");
|
||||
@ -470,7 +531,7 @@ namespace AppsFlyerSDK
|
||||
/// By default, at least 5 seconds must lapse between 2 app launches to count as separate 2 sessions.
|
||||
/// </summary>
|
||||
/// <param name="seconds">minimum time between 2 separate sessions in seconds.</param>
|
||||
public static void setMinTimeBetweenSessions(int seconds)
|
||||
public void setMinTimeBetweenSessions(int seconds)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setMinTimeBetweenSessions", seconds);
|
||||
@ -482,7 +543,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="hostPrefixName">Host prefix.</param>
|
||||
/// <param name="hostName">Host name.</param>
|
||||
public static void setHost(string hostPrefixName, string hostName)
|
||||
public void setHost(string hostPrefixName, string hostName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setHost", hostPrefixName, hostName);
|
||||
@ -494,7 +555,7 @@ namespace AppsFlyerSDK
|
||||
/// Default value is "appsflyer.com".
|
||||
/// </summary>
|
||||
/// <returns>Host name.</returns>
|
||||
public static string getHostName()
|
||||
public string getHostName()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<string>("getHostName");
|
||||
@ -507,7 +568,7 @@ namespace AppsFlyerSDK
|
||||
/// Get the custom host prefix.
|
||||
/// </summary>
|
||||
/// <returns>Host prefix.</returns>
|
||||
public static string getHostPrefix()
|
||||
public string getHostPrefix()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return appsFlyerAndroid.CallStatic<string>("getHostPrefix");
|
||||
@ -519,7 +580,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// Used by advertisers to exclude all networks/integrated partners from getting data.
|
||||
/// </summary>
|
||||
public static void setSharingFilterForAllPartners()
|
||||
public void setSharingFilterForAllPartners()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setSharingFilterForAllPartners");
|
||||
@ -530,7 +591,7 @@ namespace AppsFlyerSDK
|
||||
/// Used by advertisers to set some (one or more) networks/integrated partners to exclude from getting data.
|
||||
/// </summary>
|
||||
/// <param name="partners">partners to exclude from getting data</param>
|
||||
public static void setSharingFilter(params string[] partners)
|
||||
public void setSharingFilter(params string[] partners)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setSharingFilter", (object)partners);
|
||||
@ -554,7 +615,7 @@ namespace AppsFlyerSDK
|
||||
/// By doing this you can serve users with personalized content or send them to specific activities within the app,
|
||||
/// which can greatly enhance their engagement with your app.
|
||||
/// </summary>
|
||||
public static void getConversionData(string objectName)
|
||||
public void getConversionData(string objectName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("getConversionData", objectName);
|
||||
@ -564,7 +625,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// Register a validation listener for the validateAndSendInAppPurchase API.
|
||||
/// </summary>
|
||||
public static void initInAppPurchaseValidatorListener(MonoBehaviour gameObject)
|
||||
public void initInAppPurchaseValidatorListener(MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("initInAppPurchaseValidatorListener", gameObject ? gameObject.name : null);
|
||||
@ -576,7 +637,7 @@ namespace AppsFlyerSDK
|
||||
/// You must include the appsflyer oaid library for this api to work.
|
||||
/// </summary>
|
||||
/// <param name="isCollect">isCollect oaid - set fasle to opt out</param>
|
||||
public static void setCollectOaid(bool isCollect)
|
||||
public void setCollectOaid(bool isCollect)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setCollectOaid", isCollect);
|
||||
@ -589,7 +650,7 @@ namespace AppsFlyerSDK
|
||||
/// <param name="promoted_app_id">promoted App ID</param>
|
||||
/// <param name="campaign">cross promotion campaign</param>
|
||||
/// <param name="userParams">additional user params</param>
|
||||
public static void attributeAndOpenStore(string promoted_app_id, string campaign, Dictionary<string, string> userParams)
|
||||
public void attributeAndOpenStore(string promoted_app_id, string campaign, Dictionary<string, string> userParams, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("attributeAndOpenStore", promoted_app_id, campaign, convertDictionaryToJavaMap(userParams));
|
||||
@ -603,7 +664,7 @@ namespace AppsFlyerSDK
|
||||
/// <param name="appID">promoted App ID.</param>
|
||||
/// <param name="campaign">cross promotion campaign.</param>
|
||||
/// <param name="parameters">parameters Dictionary.</param>
|
||||
public static void recordCrossPromoteImpression(string appID, string campaign, Dictionary<string, string> parameters)
|
||||
public void recordCrossPromoteImpression(string appID, string campaign, Dictionary<string, string> parameters)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("recordCrossPromoteImpression", appID, campaign, convertDictionaryToJavaMap(parameters));
|
||||
@ -615,7 +676,7 @@ namespace AppsFlyerSDK
|
||||
/// See - https://support.appsflyer.com/hc/en-us/articles/115004480866-User-invite-attribution-
|
||||
/// </summary>
|
||||
/// <param name="parameters">parameters Dictionary.</param>
|
||||
public static void generateUserInviteLink(Dictionary<string, string> parameters, MonoBehaviour gameObject)
|
||||
public void generateUserInviteLink(Dictionary<string, string> parameters, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("createOneLinkInviteListener", convertDictionaryToJavaMap(parameters), gameObject ? gameObject.name : null);
|
||||
@ -625,7 +686,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// To measure push notifications as part of a retargeting campaign.
|
||||
/// </summary>
|
||||
public static void handlePushNotifications(){
|
||||
public void handlePushNotifications(){
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("handlePushNotifications");
|
||||
#endif
|
||||
@ -637,7 +698,7 @@ namespace AppsFlyerSDK
|
||||
/// See docs for more info.
|
||||
/// </summary>
|
||||
/// <param name="paths">array of nested json path</param>
|
||||
public static void addPushNotificationDeepLinkPath(params string[] paths)
|
||||
public void addPushNotificationDeepLinkPath(params string[] paths)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("addPushNotificationDeepLinkPath", (object)paths);
|
||||
@ -647,7 +708,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// subscribe to unified deep link callbacks
|
||||
/// </summary>
|
||||
public static void subscribeForDeepLink(string objectName){
|
||||
public void subscribeForDeepLink(string objectName){
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("subscribeForDeepLink", objectName);
|
||||
#endif
|
||||
@ -657,13 +718,32 @@ namespace AppsFlyerSDK
|
||||
/// Disables collection of various Advertising IDs by the SDK. This includes Google Advertising ID (GAID), OAID and Amazon Advertising ID (AAID)
|
||||
/// </summary>
|
||||
/// <param name="disable">disable boolean.</param>
|
||||
public static void setDisableAdvertisingIdentifiers(bool disable)
|
||||
public void setDisableAdvertisingIdentifiers(bool disable)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setDisableAdvertisingIdentifiers", disable);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows sending custom data for partner integration purposes.
|
||||
/// </summary>
|
||||
public void setPartnerData(string partnerId, Dictionary<string, string> partnerInfo)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setPartnerData", partnerId, convertDictionaryToJavaMap(partnerInfo));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use to opt-out of collecting the network operator name (carrier) and sim operator name from the device.
|
||||
/// </summary>
|
||||
public void setDisableNetworkData(bool disable) {
|
||||
#if !UNITY_EDITOR
|
||||
appsFlyerAndroid.CallStatic("setDisableNetworkData", disable);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Internal Helper Method.
|
||||
/// </summary>
|
||||
@ -685,6 +765,65 @@ namespace AppsFlyerSDK
|
||||
return emailsCryptType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Internal Helper Method.
|
||||
/// </summary>
|
||||
private static AndroidJavaObject getMediationNetwork(MediationNetwork mediationNetwork)
|
||||
{
|
||||
AndroidJavaClass mediationNetworkEnumClass = new AndroidJavaClass("com.appsflyer.MediationNetwork");
|
||||
AndroidJavaObject mediationNetworkObject;
|
||||
|
||||
switch (mediationNetwork)
|
||||
{
|
||||
case MediationNetwork.IronSource:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("IRONSOURCE");
|
||||
break;
|
||||
case MediationNetwork.ApplovinMax:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("APPLOVIN_MAX");
|
||||
break;
|
||||
case MediationNetwork.GoogleAdMob:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("GOOGLE_ADMOB");
|
||||
break;
|
||||
case MediationNetwork.Fyber:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("FYBER");
|
||||
break;
|
||||
case MediationNetwork.Appodeal:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("APPODEAL");
|
||||
break;
|
||||
case MediationNetwork.Admost:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("ADMOST");
|
||||
break;
|
||||
case MediationNetwork.Topon:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("TOPON");
|
||||
break;
|
||||
case MediationNetwork.Tradplus:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("TRADPLUS");
|
||||
break;
|
||||
case MediationNetwork.Yandex:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("YANDEX");
|
||||
break;
|
||||
case MediationNetwork.ChartBoost:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("CHARTBOOST");
|
||||
break;
|
||||
case MediationNetwork.Unity:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("UNITY");
|
||||
break;
|
||||
case MediationNetwork.ToponPte:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("TOPON_PTE");
|
||||
break;
|
||||
case MediationNetwork.Custom:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("CUSTOM_MEDIATION");
|
||||
break;
|
||||
case MediationNetwork.DirectMonetization:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("DIRECT_MONETIZATION_NETWORK");
|
||||
break;
|
||||
default:
|
||||
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("NONE");
|
||||
break;
|
||||
}
|
||||
return mediationNetworkObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Internal Helper Method.
|
||||
/// </summary>
|
||||
@ -707,9 +846,6 @@ namespace AppsFlyerSDK
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
71
Assets/ThirdParty/AppsFlyer/AppsFlyerConsent.cs
vendored
Normal file
71
Assets/ThirdParty/AppsFlyer/AppsFlyerConsent.cs
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
/// <summary>
|
||||
// Data class representing a user's consent for data processing in accordance with GDPR and DMA
|
||||
// (Digital Markets Act) compliance, specifically regarding advertising preferences.
|
||||
|
||||
// This class should be used to notify and record the user's applicability
|
||||
// under GDPR, their general consent to data usage, and their consent to personalized
|
||||
// advertisements based on user data.
|
||||
|
||||
/// ## Properties:
|
||||
/// - `isUserSubjectToGDPR` (optional) - Indicates whether GDPR regulations apply to the user.
|
||||
/// This may also serve as a general compliance flag for other regional regulations.
|
||||
/// - `hasConsentForDataUsage` (optional) - Indicates whether the user consents to the processing
|
||||
/// of their data for advertising purposes.
|
||||
/// - `hasConsentForAdsPersonalization` (optional) - Indicates whether the user consents to the
|
||||
/// use of their data for personalized advertising.
|
||||
/// - `hasConsentForAdStorage` (optional) - Indicates whether the user consents to ad-related storage access.
|
||||
///
|
||||
/// **Usage Example:**
|
||||
/// ```csharp
|
||||
/// var consent = new AppsFlyerConsent(
|
||||
/// isUserSubjectToGDPR: true,
|
||||
/// hasConsentForDataUsage: true,
|
||||
/// hasConsentForAdsPersonalization: false,
|
||||
/// hasConsentForAdStorage: true
|
||||
/// );
|
||||
/// **Deprecated APIs:**
|
||||
/// - `ForGDPRUser(...)` and `ForNonGDPRUser(...)` should no longer be used.
|
||||
/// - Use `new AppsFlyerConsent(...)` instead with relevant consent fields.
|
||||
///
|
||||
/// </summary>
|
||||
public class AppsFlyerConsent
|
||||
{
|
||||
public bool? isUserSubjectToGDPR { get; private set; }
|
||||
public bool? hasConsentForDataUsage { get; private set; }
|
||||
public bool? hasConsentForAdsPersonalization { get; private set; }
|
||||
public bool? hasConsentForAdStorage { get; private set; }
|
||||
|
||||
public AppsFlyerConsent( bool? isUserSubjectToGDPR = null, bool? hasConsentForDataUsage = null, bool? hasConsentForAdsPersonalization = null, bool? hasConsentForAdStorage = null)
|
||||
{
|
||||
this.isUserSubjectToGDPR = isUserSubjectToGDPR;
|
||||
this.hasConsentForDataUsage = hasConsentForDataUsage;
|
||||
this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization;
|
||||
this.hasConsentForAdStorage = hasConsentForAdStorage;
|
||||
}
|
||||
|
||||
[Obsolete("Use the new constructor with optional booleans instead.")]
|
||||
private AppsFlyerConsent(bool isGDPR, bool hasForDataUsage, bool hasForAdsPersonalization)
|
||||
{
|
||||
isUserSubjectToGDPR = isGDPR;
|
||||
hasConsentForDataUsage = hasForDataUsage;
|
||||
hasConsentForAdsPersonalization = hasForAdsPersonalization;
|
||||
}
|
||||
|
||||
[Obsolete("Use new AppsFlyerConsent(...) instead.")]
|
||||
public static AppsFlyerConsent ForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization)
|
||||
{
|
||||
return new AppsFlyerConsent(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);
|
||||
}
|
||||
|
||||
[Obsolete("Use new AppsFlyerConsent(...) instead.")]
|
||||
public static AppsFlyerConsent ForNonGDPRUser()
|
||||
{
|
||||
return new AppsFlyerConsent(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/AppsFlyerConsent.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AppsFlyerConsent.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a97c986fe4ee0461badf7042e08db3f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -123,7 +123,6 @@ namespace AppsFlyerSDK
|
||||
AppsFlyer.AFLog("DeepLinkEventsArgs.isDeferred", String.Format("{0} Exception caught.", e));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -156,6 +155,10 @@ namespace AppsFlyerSDK
|
||||
{
|
||||
this.deepLink = AppsFlyer.CallbackStringToDictionary(dictionary["deepLink"].ToString());
|
||||
}
|
||||
if (dictionary.ContainsKey("is_deferred"))
|
||||
{
|
||||
this.deepLink["is_deferred"] = dictionary["is_deferred"];
|
||||
}
|
||||
|
||||
switch (status)
|
||||
{
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -14,22 +15,31 @@ public class AppsFlyerObjectScript : MonoBehaviour , IAppsFlyerConversionData
|
||||
public string iosDevKey;
|
||||
public string appID;
|
||||
public string UWPAppID;
|
||||
public string macOSAppID;
|
||||
public bool isDebug;
|
||||
public bool getConversionData;
|
||||
//******************************//
|
||||
public static string AFConversionData = "";
|
||||
public static bool IsGetConversionDataOver = false;
|
||||
public static string AFAttributionData = "";
|
||||
public static bool IsGetAppOpenAttributionOver = false;
|
||||
public static bool IsGetAFOnRequestResponse = false;
|
||||
public static int AFOnRequestResponseStatusCode = 0;
|
||||
public static string AFOnRequestResponseErrorDescription = string.Empty;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
// These fields are set from the editor so do not modify!
|
||||
//******************************//
|
||||
AppsFlyer.waitForCustomerUserId(true);
|
||||
AppsFlyer.setIsDebug(isDebug);
|
||||
AppsFlyer.OnRequestResponse += AppsFlyerOnRequestResponse;
|
||||
#if UNITY_WSA_10_0 && !UNITY_EDITOR
|
||||
AppsFlyer.initSDK(devKey, UWPAppID, getConversionData ? this : null);
|
||||
#elif UNITY_STANDALONE_OSX && !UNITY_EDITOR
|
||||
AppsFlyer.initSDK(devKey, macOSAppID, getConversionData ? this : null);
|
||||
#elif UNITY_IOS && !UNITY_EDITOR
|
||||
// Notice: After 6.6.0 use the follow code: https://github.com/AppsFlyerSDK/appsflyer-unity-plugin
|
||||
AppsFlyeriOS.waitForATTUserAuthorizationWithTimeoutInterval(60);
|
||||
AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(60);
|
||||
AppsFlyer.initSDK(iosDevKey, appID, getConversionData ? this : null);
|
||||
#else
|
||||
AppsFlyer.initSDK(devKey, appID, getConversionData ? this : null);
|
||||
@ -49,25 +59,39 @@ public class AppsFlyerObjectScript : MonoBehaviour , IAppsFlyerConversionData
|
||||
public void onConversionDataSuccess(string conversionData)
|
||||
{
|
||||
AppsFlyer.AFLog("didReceiveConversionData", conversionData);
|
||||
Dictionary<string, object> conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
|
||||
// Dictionary<string, object> conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
|
||||
// add deferred deeplink logic here
|
||||
AFConversionData = conversionData;
|
||||
IsGetConversionDataOver = true;
|
||||
}
|
||||
|
||||
public void onConversionDataFail(string error)
|
||||
{
|
||||
AppsFlyer.AFLog("didReceiveConversionDataWithError", error);
|
||||
IsGetConversionDataOver = true;
|
||||
}
|
||||
|
||||
public void onAppOpenAttribution(string attributionData)
|
||||
{
|
||||
AppsFlyer.AFLog("onAppOpenAttribution", attributionData);
|
||||
Dictionary<string, object> attributionDataDictionary = AppsFlyer.CallbackStringToDictionary(attributionData);
|
||||
// Dictionary<string, object> attributionDataDictionary = AppsFlyer.CallbackStringToDictionary(attributionData);
|
||||
// add direct deeplink logic here
|
||||
AFAttributionData = attributionData;
|
||||
IsGetAppOpenAttributionOver = true;
|
||||
}
|
||||
|
||||
public void onAppOpenAttributionFailure(string error)
|
||||
{
|
||||
AppsFlyer.AFLog("onAppOpenAttributionFailure", error);
|
||||
IsGetAppOpenAttributionOver = true;
|
||||
}
|
||||
|
||||
void AppsFlyerOnRequestResponse(object sender, EventArgs e)
|
||||
{
|
||||
var args = e as AppsFlyerRequestEventArgs;
|
||||
AFOnRequestResponseStatusCode = args.statusCode;
|
||||
AFOnRequestResponseErrorDescription = args.errorDescription;
|
||||
IsGetAFOnRequestResponse = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
426
Assets/ThirdParty/AppsFlyer/AppsFlyerPurchaseConnector.cs
vendored
Normal file
426
Assets/ThirdParty/AppsFlyer/AppsFlyerPurchaseConnector.cs
vendored
Normal file
@ -0,0 +1,426 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
|
||||
public interface IAppsFlyerPurchaseRevenueDataSource
|
||||
{
|
||||
Dictionary<string, object> PurchaseRevenueAdditionalParametersForProducts(HashSet<object> products, HashSet<object> transactions);
|
||||
}
|
||||
|
||||
public interface IAppsFlyerPurchaseRevenueDataSourceStoreKit2
|
||||
{
|
||||
Dictionary<string, object> PurchaseRevenueAdditionalParametersStoreKit2ForProducts(HashSet<object> products, HashSet<object> transactions);
|
||||
}
|
||||
|
||||
public class AppsFlyerPurchaseRevenueBridge : MonoBehaviour
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
[DllImport("__Internal")]
|
||||
private static extern void RegisterUnityPurchaseRevenueParamsCallback(Func<string, string, string> callback);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void RegisterUnityPurchaseRevenueParamsCallbackSK2(Func<string, string, string> callback);
|
||||
#endif
|
||||
|
||||
private static IAppsFlyerPurchaseRevenueDataSource _dataSource;
|
||||
private static IAppsFlyerPurchaseRevenueDataSourceStoreKit2 _dataSourceSK2;
|
||||
|
||||
public static void RegisterDataSource(IAppsFlyerPurchaseRevenueDataSource dataSource)
|
||||
{
|
||||
_dataSource = dataSource;
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
RegisterUnityPurchaseRevenueParamsCallback(GetAdditionalParameters);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
using (AndroidJavaClass jc = new AndroidJavaClass("com.appsflyer.unity.PurchaseRevenueBridge"))
|
||||
{
|
||||
jc.CallStatic("setUnityBridge", new UnityPurchaseRevenueBridgeProxy());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void RegisterDataSourceStoreKit2(IAppsFlyerPurchaseRevenueDataSourceStoreKit2 dataSource)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_dataSourceSK2 = dataSource;
|
||||
RegisterUnityPurchaseRevenueParamsCallbackSK2(GetAdditionalParametersSK2);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GetAdditionalParametersForAndroid(HashSet<object> products, HashSet<object> transactions)
|
||||
{
|
||||
return _dataSource?.PurchaseRevenueAdditionalParametersForProducts(products, transactions)
|
||||
?? new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
[AOT.MonoPInvokeCallback(typeof(Func<string, string, string>))]
|
||||
public static string GetAdditionalParameters(string productsJson, string transactionsJson)
|
||||
{
|
||||
try
|
||||
{
|
||||
HashSet<object> products = new HashSet<object>();
|
||||
HashSet<object> transactions = new HashSet<object>();
|
||||
|
||||
if (!string.IsNullOrEmpty(productsJson))
|
||||
{
|
||||
var dict = AFMiniJSON.Json.Deserialize(productsJson) as Dictionary<string, object>;
|
||||
if (dict != null)
|
||||
{
|
||||
if (dict.TryGetValue("products", out var productsObj) && productsObj is List<object> productList)
|
||||
products = new HashSet<object>(productList);
|
||||
|
||||
if (dict.TryGetValue("transactions", out var transactionsObj) && transactionsObj is List<object> transactionList)
|
||||
transactions = new HashSet<object>(transactionList);
|
||||
}
|
||||
}
|
||||
|
||||
var parameters = _dataSource?.PurchaseRevenueAdditionalParametersForProducts(products, transactions)
|
||||
?? new Dictionary<string, object>();
|
||||
return AFMiniJSON.Json.Serialize(parameters);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"[AppsFlyer] Exception in GetAdditionalParameters: {e}");
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
[AOT.MonoPInvokeCallback(typeof(Func<string, string, string>))]
|
||||
public static string GetAdditionalParametersSK2(string productsJson, string transactionsJson)
|
||||
{
|
||||
try
|
||||
{
|
||||
HashSet<object> products = new HashSet<object>();
|
||||
HashSet<object> transactions = new HashSet<object>();
|
||||
|
||||
if (!string.IsNullOrEmpty(productsJson))
|
||||
{
|
||||
var dict = AFMiniJSON.Json.Deserialize(productsJson) as Dictionary<string, object>;
|
||||
if (dict != null && dict.TryGetValue("products", out var productsObj) && productsObj is List<object> productList)
|
||||
products = new HashSet<object>(productList);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(transactionsJson))
|
||||
{
|
||||
var dict = AFMiniJSON.Json.Deserialize(transactionsJson) as Dictionary<string, object>;
|
||||
if (dict != null && dict.TryGetValue("transactions", out var transactionsObj) && transactionsObj is List<object> transactionList)
|
||||
transactions = new HashSet<object>(transactionList);
|
||||
}
|
||||
|
||||
var parameters = _dataSourceSK2?.PurchaseRevenueAdditionalParametersStoreKit2ForProducts(products, transactions)
|
||||
?? new Dictionary<string, object>();
|
||||
return AFMiniJSON.Json.Serialize(parameters);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"[AppsFlyer] Exception in GetAdditionalParametersSK2: {e}");
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public class UnityPurchaseRevenueBridgeProxy : AndroidJavaProxy
|
||||
{
|
||||
public UnityPurchaseRevenueBridgeProxy() : base("com.appsflyer.unity.PurchaseRevenueBridge$UnityPurchaseRevenueBridge") { }
|
||||
|
||||
public string getAdditionalParameters(string productsJson, string transactionsJson)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create empty sets if JSON is null or empty
|
||||
HashSet<object> products = new HashSet<object>();
|
||||
HashSet<object> transactions = new HashSet<object>();
|
||||
|
||||
// Only try to parse if we have valid JSON
|
||||
if (!string.IsNullOrEmpty(productsJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
// First try to parse as a simple array
|
||||
var parsedProducts = AFMiniJSON.Json.Deserialize(productsJson);
|
||||
if (parsedProducts is List<object> productList)
|
||||
{
|
||||
products = new HashSet<object>(productList);
|
||||
}
|
||||
else if (parsedProducts is Dictionary<string, object> dict)
|
||||
{
|
||||
if (dict.ContainsKey("events") && dict["events"] is List<object> eventsList)
|
||||
{
|
||||
products = new HashSet<object>(eventsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it's a dictionary but doesn't have events, add the whole dict
|
||||
products.Add(dict);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"Error parsing products JSON: {e.Message}\nJSON: {productsJson}");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(transactionsJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
// First try to parse as a simple array
|
||||
var parsedTransactions = AFMiniJSON.Json.Deserialize(transactionsJson);
|
||||
if (parsedTransactions is List<object> transactionList)
|
||||
{
|
||||
transactions = new HashSet<object>(transactionList);
|
||||
}
|
||||
else if (parsedTransactions is Dictionary<string, object> dict)
|
||||
{
|
||||
if (dict.ContainsKey("events") && dict["events"] is List<object> eventsList)
|
||||
{
|
||||
transactions = new HashSet<object>(eventsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it's a dictionary but doesn't have events, add the whole dict
|
||||
transactions.Add(dict);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"Error parsing transactions JSON: {e.Message}\nJSON: {transactionsJson}");
|
||||
}
|
||||
}
|
||||
|
||||
var parameters = AppsFlyerPurchaseRevenueBridge.GetAdditionalParametersForAndroid(products, transactions);
|
||||
return AFMiniJSON.Json.Serialize(parameters);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"Error in getAdditionalParameters: {e.Message}\nProducts JSON: {productsJson}\nTransactions JSON: {transactionsJson}");
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class AppsFlyerPurchaseConnector : MonoBehaviour {
|
||||
|
||||
private static AppsFlyerPurchaseConnector instance;
|
||||
private Dictionary<string, object> pendingParameters;
|
||||
private Action<Dictionary<string, object>> pendingCallback;
|
||||
|
||||
public static AppsFlyerPurchaseConnector Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
GameObject go = new GameObject("AppsFlyerPurchaseConnector");
|
||||
instance = go.AddComponent<AppsFlyerPurchaseConnector>();
|
||||
DontDestroyOnLoad(go);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
private static AndroidJavaClass appsFlyerAndroidConnector = new AndroidJavaClass("com.appsflyer.unity.AppsFlyerAndroidWrapper");
|
||||
#endif
|
||||
|
||||
public static void init(MonoBehaviour unityObject, Store s) {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_initPurchaseConnector(unityObject.name);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
int store = mapStoreToInt(s);
|
||||
appsFlyerAndroidConnector.CallStatic("initPurchaseConnector", unityObject ? unityObject.name : null, store);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void build() {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
//not for iOS
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
appsFlyerAndroidConnector.CallStatic("build");
|
||||
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void startObservingTransactions() {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_startObservingTransactions();
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
appsFlyerAndroidConnector.CallStatic("startObservingTransactions");
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void stopObservingTransactions() {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_stopObservingTransactions();
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
appsFlyerAndroidConnector.CallStatic("stopObservingTransactions");
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void setIsSandbox(bool isSandbox) {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_setIsSandbox(isSandbox);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
appsFlyerAndroidConnector.CallStatic("setIsSandbox", isSandbox);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void setPurchaseRevenueValidationListeners(bool enableCallbacks) {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_setPurchaseRevenueDelegate();
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
appsFlyerAndroidConnector.CallStatic("setPurchaseRevenueValidationListeners", enableCallbacks);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void setAutoLogPurchaseRevenue(params AppsFlyerAutoLogPurchaseRevenueOptions[] autoLogPurchaseRevenueOptions) {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
int option = 0;
|
||||
foreach (AppsFlyerAutoLogPurchaseRevenueOptions op in autoLogPurchaseRevenueOptions) {
|
||||
option = option | (int)op;
|
||||
}
|
||||
_setAutoLogPurchaseRevenue(option);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
if (autoLogPurchaseRevenueOptions.Length == 0) {
|
||||
return;
|
||||
}
|
||||
foreach (AppsFlyerAutoLogPurchaseRevenueOptions op in autoLogPurchaseRevenueOptions) {
|
||||
switch(op) {
|
||||
case AppsFlyerAutoLogPurchaseRevenueOptions.AppsFlyerAutoLogPurchaseRevenueOptionsDisabled:
|
||||
break;
|
||||
case AppsFlyerAutoLogPurchaseRevenueOptions.AppsFlyerAutoLogPurchaseRevenueOptionsAutoRenewableSubscriptions:
|
||||
appsFlyerAndroidConnector.CallStatic("setAutoLogSubscriptions", true);
|
||||
break;
|
||||
case AppsFlyerAutoLogPurchaseRevenueOptions.AppsFlyerAutoLogPurchaseRevenueOptionsInAppPurchases:
|
||||
appsFlyerAndroidConnector.CallStatic("setAutoLogInApps", true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void setPurchaseRevenueDataSource(IAppsFlyerPurchaseRevenueDataSource dataSource)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
|
||||
if (dataSource != null)
|
||||
{
|
||||
_setPurchaseRevenueDataSource(dataSource.GetType().Name);
|
||||
AppsFlyerPurchaseRevenueBridge.RegisterDataSource(dataSource);
|
||||
}
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
if (dataSource != null)
|
||||
{
|
||||
AppsFlyerPurchaseRevenueBridge.RegisterDataSource(dataSource);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public static void setPurchaseRevenueDataSourceStoreKit2(IAppsFlyerPurchaseRevenueDataSourceStoreKit2 dataSourceSK2)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
if (dataSourceSK2 != null)
|
||||
{
|
||||
AppsFlyerPurchaseRevenueBridge.RegisterDataSourceStoreKit2(dataSourceSK2);
|
||||
_setPurchaseRevenueDataSource("AppsFlyerObjectScript_StoreKit2");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
private static int mapStoreToInt(Store s) {
|
||||
switch(s) {
|
||||
case(Store.GOOGLE):
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setStoreKitVersion(StoreKitVersion storeKitVersion) {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_setStoreKitVersion((int)storeKitVersion);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
// Android doesn't use StoreKit
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void logConsumableTransaction(string transactionJson) {
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
_logConsumableTransaction(transactionJson);
|
||||
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||
// Android doesn't use StoreKit
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _startObservingTransactions();
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _stopObservingTransactions();
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _setIsSandbox(bool isSandbox);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _setPurchaseRevenueDelegate();
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _setPurchaseRevenueDataSource(string dataSourceName);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _setAutoLogPurchaseRevenue(int option);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _initPurchaseConnector(string objectName);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _setStoreKitVersion(int storeKitVersion);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _logConsumableTransaction(string transactionJson);
|
||||
|
||||
#endif
|
||||
}
|
||||
public enum Store {
|
||||
GOOGLE = 0
|
||||
}
|
||||
public enum AppsFlyerAutoLogPurchaseRevenueOptions
|
||||
{
|
||||
AppsFlyerAutoLogPurchaseRevenueOptionsDisabled = 0,
|
||||
AppsFlyerAutoLogPurchaseRevenueOptionsAutoRenewableSubscriptions = 1 << 0,
|
||||
AppsFlyerAutoLogPurchaseRevenueOptionsInAppPurchases = 1 << 1
|
||||
}
|
||||
|
||||
public enum StoreKitVersion {
|
||||
SK1 = 0,
|
||||
SK2 = 1
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/AppsFlyerPurchaseConnector.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AppsFlyerPurchaseConnector.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0636ea07d370d437183f3762280c08ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
460
Assets/ThirdParty/AppsFlyer/AppsFlyeriOS.cs
vendored
460
Assets/ThirdParty/AppsFlyer/AppsFlyeriOS.cs
vendored
@ -1,27 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
#if UNITY_IOS
|
||||
|
||||
public class AppsFlyeriOS
|
||||
#if UNITY_IOS || UNITY_STANDALONE_OSX
|
||||
|
||||
public class AppsFlyeriOS: IAppsFlyerIOSBridge
|
||||
{
|
||||
public bool isInit { get; set; }
|
||||
|
||||
public AppsFlyeriOS() { }
|
||||
|
||||
public AppsFlyeriOS(string devKey, string appID, MonoBehaviour gameObject)
|
||||
{
|
||||
setAppsFlyerDevKey(devKey);
|
||||
setAppleAppID(appID);
|
||||
if (gameObject != null)
|
||||
{
|
||||
#if UNITY_IOS
|
||||
getConversionData(gameObject.name);
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
getConversionData(gameObject.GetType().ToString());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start Session.
|
||||
/// This will record a session and then record all background forground sessions during the lifecycle of the app.
|
||||
/// </summary>
|
||||
public static void startSDK()
|
||||
public void startSDK(bool shouldCallback, string CallBackObjectName)
|
||||
{
|
||||
startSDK(false, AppsFlyer.CallBackObjectName);
|
||||
}
|
||||
|
||||
public static void startSDK(bool shouldCallback, string callBackObjectName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_startSDK(shouldCallback, callBackObjectName);
|
||||
#if UNITY_STANDALONE_OSX && !UNITY_EDITOR
|
||||
_startSDK(shouldCallback, CallBackObjectName, getCallback);
|
||||
#elif UNITY_IOS && !UNITY_EDITOR
|
||||
_startSDK(shouldCallback, CallBackObjectName);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -31,12 +52,12 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="eventName">Name of event.</param>
|
||||
/// <param name="eventValues">Contains dictionary of values for handling by backend.</param>
|
||||
public static void sendEvent(string eventName, Dictionary<string, string> eventValues)
|
||||
public void sendEvent(string eventName, Dictionary<string, string> eventValues)
|
||||
{
|
||||
sendEvent(eventName, eventValues, false, AppsFlyer.CallBackObjectName);
|
||||
}
|
||||
|
||||
public static void sendEvent(string eventName, Dictionary<string, string> eventValues, bool shouldCallback, string callBackObjectName)
|
||||
public void sendEvent(string eventName, Dictionary<string, string> eventValues, bool shouldCallback, string callBackObjectName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_afSendEvent(eventName, AFMiniJSON.Json.Serialize(eventValues), shouldCallback, callBackObjectName);
|
||||
@ -49,7 +70,7 @@ namespace AppsFlyerSDK
|
||||
/// By doing this you can serve users with personalized content or send them to specific activities within the app,
|
||||
/// which can greatly enhance their engagement with your app.
|
||||
/// </summary>
|
||||
public static void getConversionData(string objectName)
|
||||
public void getConversionData(string objectName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_getConversionData(objectName);
|
||||
@ -61,7 +82,7 @@ namespace AppsFlyerSDK
|
||||
/// Enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and the other devices’ IDs.
|
||||
/// </summary>
|
||||
/// <param name="customerUserID">Customer ID for client.</param>
|
||||
public static void setCustomerUserID(string customerUserID)
|
||||
public void setCustomerUserId(string customerUserID)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setCustomerUserID(customerUserID);
|
||||
@ -73,7 +94,7 @@ namespace AppsFlyerSDK
|
||||
/// see [Setting additional custom data] (https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS#setting-additional-custom-data) for more information.
|
||||
/// </summary>
|
||||
/// <param name="customData">additional data Dictionary.</param>
|
||||
public static void setAdditionalData(Dictionary<string, string> customData)
|
||||
public void setAdditionalData(Dictionary<string, string> customData)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setAdditionalData(AFMiniJSON.Json.Serialize(customData));
|
||||
@ -84,7 +105,7 @@ namespace AppsFlyerSDK
|
||||
/// Use this method to set your AppsFlyer's dev key.
|
||||
/// </summary>
|
||||
/// <param name="appsFlyerDevKey">AppsFlyer's Dev-Key, which is accessible from your AppsFlyer account under 'App Settings' in the dashboard.</param>
|
||||
public static void setAppsFlyerDevKey(string appsFlyerDevKey)
|
||||
public void setAppsFlyerDevKey(string appsFlyerDevKey)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setAppsFlyerDevKey(appsFlyerDevKey);
|
||||
@ -95,7 +116,7 @@ namespace AppsFlyerSDK
|
||||
/// Use this method to set your app's Apple ID(taken from the app's page on iTunes Connect).
|
||||
/// </summary>
|
||||
/// <param name="appleAppID">your app's Apple ID.</param>
|
||||
public static void setAppleAppID(string appleAppID)
|
||||
public void setAppleAppID(string appleAppID)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setAppleAppID(appleAppID);
|
||||
@ -108,7 +129,7 @@ namespace AppsFlyerSDK
|
||||
/// You can set the currency code for all events by calling the following method.
|
||||
/// </summary>
|
||||
/// <param name="currencyCode">3 character ISO 4217 code.</param>
|
||||
public static void setCurrencyCode(string currencyCode)
|
||||
public void setCurrencyCode(string currencyCode)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setCurrencyCode(currencyCode);
|
||||
@ -120,7 +141,7 @@ namespace AppsFlyerSDK
|
||||
/// You can disable this behavior by setting the following property to true.
|
||||
/// </summary>
|
||||
/// <param name="disableCollectAppleAdSupport">boolean to disableCollectAppleAdSupport</param>
|
||||
public static void setDisableCollectAppleAdSupport(bool disableCollectAppleAdSupport)
|
||||
public void setDisableCollectAppleAdSupport(bool disableCollectAppleAdSupport)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setDisableCollectAppleAdSupport(disableCollectAppleAdSupport);
|
||||
@ -133,7 +154,7 @@ namespace AppsFlyerSDK
|
||||
/// The default value is false.
|
||||
/// </summary>
|
||||
/// <param name="isDebug">shouldEnable boolean..</param>
|
||||
public static void setIsDebug(bool isDebug)
|
||||
public void setIsDebug(bool isDebug)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setIsDebug(isDebug);
|
||||
@ -145,7 +166,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="shouldCollectDeviceName">boolean shouldCollectDeviceName.</param>
|
||||
[System.Obsolete("This is deprecated")]
|
||||
public static void setShouldCollectDeviceName(bool shouldCollectDeviceName)
|
||||
public void setShouldCollectDeviceName(bool shouldCollectDeviceName)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setShouldCollectDeviceName(shouldCollectDeviceName);
|
||||
@ -157,20 +178,71 @@ namespace AppsFlyerSDK
|
||||
/// The link that is generated for the user invite will use this OneLink as the base link.
|
||||
/// </summary>
|
||||
/// <param name="appInviteOneLinkID">OneLink ID obtained from the AppsFlyer Dashboard.</param>
|
||||
public static void setAppInviteOneLinkID(string appInviteOneLinkID)
|
||||
public void setAppInviteOneLinkID(string appInviteOneLinkID)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setAppInviteOneLinkID(appInviteOneLinkID);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the deepLink timeout value that should be used for DDL.
|
||||
/// </summary>
|
||||
/// <param name="deepLinkTimeout">deepLink timeout in milliseconds.</param>
|
||||
public void setDeepLinkTimeout(long deepLinkTimeout)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setDeepLinkTimeout(deepLinkTimeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calling enableTCFDataCollection(true) will enable collecting and sending any TCF related data.
|
||||
/// Calling enableTCFDataCollection(false) will disable the collection of TCF related data and from sending it.
|
||||
/// </summary>
|
||||
/// <param name = "shouldCollectTcfData" >should start TCF Data collection boolean.</param>
|
||||
public void enableTCFDataCollection(bool shouldCollectTcfData)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_enableTCFDataCollection(shouldCollectTcfData);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets or updates the user consent data related to GDPR and DMA regulations for advertising and data usage purposes within the application.
|
||||
/// </summary>
|
||||
/// <param name = "appsFlyerConsent" >instance of AppsFlyerConsent.</param>
|
||||
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
string isUserSubjectToGDPR = appsFlyerConsent.isUserSubjectToGDPR?.ToString().ToLower() ?? "null";
|
||||
string hasConsentForDataUsage = appsFlyerConsent.hasConsentForDataUsage?.ToString().ToLower() ?? "null";
|
||||
string hasConsentForAdsPersonalization = appsFlyerConsent.hasConsentForAdsPersonalization?.ToString().ToLower() ?? "null";
|
||||
string hasConsentForAdStorage = appsFlyerConsent.hasConsentForAdStorage?.ToString().ToLower() ?? "null";
|
||||
|
||||
_setConsentData(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization, hasConsentForAdStorage);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs ad revenue data along with additional parameters if provided.
|
||||
/// </summary>
|
||||
/// <param name = "adRevenueData" >instance of AFAdRevenueData containing ad revenue information.</param>
|
||||
/// <param name = "additionalParameters" >An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters.</param>
|
||||
public void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_logAdRevenue(adRevenueData.monetizationNetwork, adRevenueData.mediationNetwork, adRevenueData.currencyIso4217Code, adRevenueData.eventRevenue, AFMiniJSON.Json.Serialize(additionalParameters));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Anonymize user Data.
|
||||
/// Use this API during the SDK Initialization to explicitly anonymize a user's installs, events and sessions.
|
||||
/// Default is false
|
||||
/// </summary>
|
||||
/// <param name="shouldAnonymizeUser">boolean shouldAnonymizeUser.</param>
|
||||
public static void anonymizeUser(bool shouldAnonymizeUser)
|
||||
public void anonymizeUser(bool shouldAnonymizeUser)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_anonymizeUser(shouldAnonymizeUser);
|
||||
@ -181,7 +253,7 @@ namespace AppsFlyerSDK
|
||||
/// Opt-out for Apple Search Ads attributions.
|
||||
/// </summary>
|
||||
/// <param name="disableCollectIAd">boolean disableCollectIAd.</param>
|
||||
public static void setDisableCollectIAd(bool disableCollectIAd)
|
||||
public void setDisableCollectIAd(bool disableCollectIAd)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setDisableCollectIAd(disableCollectIAd);
|
||||
@ -192,7 +264,7 @@ namespace AppsFlyerSDK
|
||||
/// In app purchase receipt validation Apple environment(production or sandbox). The default value is false.
|
||||
/// </summary>
|
||||
/// <param name="useReceiptValidationSandbox">boolean useReceiptValidationSandbox.</param>
|
||||
public static void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox)
|
||||
public void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setUseReceiptValidationSandbox(useReceiptValidationSandbox);
|
||||
@ -203,7 +275,7 @@ namespace AppsFlyerSDK
|
||||
/// Set this flag to test uninstall on Apple environment(production or sandbox). The default value is false.
|
||||
/// </summary>
|
||||
/// <param name="useUninstallSandbox">boolean useUninstallSandbox.</param>
|
||||
public static void setUseUninstallSandbox(bool useUninstallSandbox)
|
||||
public void setUseUninstallSandbox(bool useUninstallSandbox)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setUseUninstallSandbox(useUninstallSandbox);
|
||||
@ -215,7 +287,7 @@ namespace AppsFlyerSDK
|
||||
/// An advertiser will be able to deeplink from a OneLink wrapped within another Universal Link and also record this retargeting conversion.
|
||||
/// </summary>
|
||||
/// <param name="resolveDeepLinkURLs">Array of urls.</param>
|
||||
public static void setResolveDeepLinkURLs(params string[] resolveDeepLinkURLs)
|
||||
public void setResolveDeepLinkURLs(params string[] resolveDeepLinkURLs)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setResolveDeepLinkURLs(resolveDeepLinkURLs.Length,resolveDeepLinkURLs);
|
||||
@ -226,7 +298,7 @@ namespace AppsFlyerSDK
|
||||
/// For advertisers who use vanity OneLinks.
|
||||
/// </summary>
|
||||
/// <param name="oneLinkCustomDomains">Array of domains.</param>
|
||||
public static void setOneLinkCustomDomains(params string[] oneLinkCustomDomains)
|
||||
public void setOneLinkCustomDomain(params string[] oneLinkCustomDomains)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setOneLinkCustomDomains(oneLinkCustomDomains.Length, oneLinkCustomDomains);
|
||||
@ -243,11 +315,12 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="cryptType">type Hash algoritm.</param>
|
||||
/// <param name="length">length of userEmails array.</param>
|
||||
/// <param name="userEmails">userEmails The list of strings that hold mails.</param>
|
||||
public static void setUserEmails(EmailCryptType cryptType, int length, params string[] userEmails)
|
||||
/// <param name="userEmails">userEmails The list of strings that hold mails.</param>}
|
||||
|
||||
public void setUserEmails(EmailCryptType cryptType, params string[] userEmails)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setUserEmails(cryptType, length, userEmails);
|
||||
_setUserEmails(cryptType, userEmails.Length, userEmails);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -255,24 +328,37 @@ namespace AppsFlyerSDK
|
||||
/// Set the user phone number.
|
||||
/// </summary>
|
||||
/// <param name="phoneNumber">User phoneNumber.</param>
|
||||
public static void setPhoneNumber(string phoneNumber){
|
||||
public void setPhoneNumber(string phoneNumber){
|
||||
#if !UNITY_EDITOR
|
||||
_setPhoneNumber(phoneNumber);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To send and validate in app purchases you can call this method from the processPurchase method.
|
||||
/// To send and validate in app purchases you can call this method from the processPurchase method - please use v2.
|
||||
/// </summary>
|
||||
/// <param name="productIdentifier">The product identifier.</param>
|
||||
/// <param name="price">The product price.</param>
|
||||
/// <param name="currency">The product currency.</param>
|
||||
/// <param name="tranactionId">The purchase transaction Id.</param>
|
||||
/// <param name="transactionId">The purchase transaction Id.</param>
|
||||
/// <param name="additionalParameters">The additional param, which you want to receive it in the raw reports.</param>
|
||||
public static void validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string tranactionId, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
||||
public void validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string transactionId, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_validateAndSendInAppPurchase(productIdentifier, price, currency, tranactionId, AFMiniJSON.Json.Serialize(additionalParameters), gameObject ? gameObject.name : null);
|
||||
_validateAndSendInAppPurchase(productIdentifier, price, currency, transactionId, AFMiniJSON.Json.Serialize(additionalParameters), gameObject ? gameObject.name : null);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// V2
|
||||
/// To send and validate in app purchases you can call this method from the processPurchase method.
|
||||
/// </summary>
|
||||
/// <param name="details">The AFSDKPurchaseDetailsIOS instance.</param>
|
||||
/// <param name="extraEventValues">The extra params, which you want to receive it in the raw reports.</param>
|
||||
public void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> extraEventValues, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_validateAndSendInAppPurchaseV2(details.productId, details.price, details.currency, details.transactionId, AFMiniJSON.Json.Serialize(extraEventValues), gameObject ? gameObject.name : null);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -281,7 +367,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="longitude">The location longitude.</param>
|
||||
/// <param name="latitude">The location latitude.</param>
|
||||
public static void recordLocation(double longitude, double latitude)
|
||||
public void recordLocation(double longitude, double latitude)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_recordLocation(longitude, latitude);
|
||||
@ -291,7 +377,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// Get AppsFlyer's unique device ID, which is created for every new install of an app.
|
||||
/// </summary>
|
||||
public static string getAppsFlyerId()
|
||||
public string getAppsFlyerId()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return _getAppsFlyerId();
|
||||
@ -304,7 +390,7 @@ namespace AppsFlyerSDK
|
||||
/// Register uninstall - you should register for remote notification and provide AppsFlyer the push device token.
|
||||
/// </summary>
|
||||
/// <param name="deviceToken">deviceToken The `deviceToken` from `-application:didRegisterForRemoteNotificationsWithDeviceToken:`.</param>
|
||||
public static void registerUninstall(byte[] deviceToken)
|
||||
public void registerUninstall(byte[] deviceToken)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_registerUninstall(deviceToken);
|
||||
@ -315,7 +401,7 @@ namespace AppsFlyerSDK
|
||||
/// Enable AppsFlyer to handle a push notification.
|
||||
/// </summary>
|
||||
/// <param name="pushPayload">pushPayload The `userInfo` from received remote notification. One of root keys should be @"af"..</param>
|
||||
public static void handlePushNotification(Dictionary<string, string> pushPayload)
|
||||
public void handlePushNotification(Dictionary<string, string> pushPayload)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_handlePushNotification(AFMiniJSON.Json.Serialize(pushPayload));
|
||||
@ -325,7 +411,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// Get SDK version.
|
||||
/// </summary>
|
||||
public static string getSDKVersion()
|
||||
public string getSdkVersion()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return _getSDKVersion();
|
||||
@ -340,7 +426,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="host">Host Name.</param>
|
||||
/// <param name="host">Host prefix.</param>
|
||||
public static void setHost(string host, string hostPrefix)
|
||||
public void setHost(string hostPrefix, string host)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setHost(host, hostPrefix);
|
||||
@ -352,7 +438,7 @@ namespace AppsFlyerSDK
|
||||
/// Default value is 5 seconds.
|
||||
/// </summary>
|
||||
/// <param name="minTimeBetweenSessions">minimum time between 2 separate sessions in seconds.</param>
|
||||
public static void setMinTimeBetweenSessions(int minTimeBetweenSessions)
|
||||
public void setMinTimeBetweenSessions(int minTimeBetweenSessions)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setMinTimeBetweenSessions(minTimeBetweenSessions);
|
||||
@ -365,7 +451,7 @@ namespace AppsFlyerSDK
|
||||
/// This can be achieved with the stopSDK API.
|
||||
/// </summary>
|
||||
/// <param name="isSDKStopped">boolean isSDKStopped.</param>
|
||||
public static void stopSDK(bool isSDKStopped)
|
||||
public void stopSDK(bool isSDKStopped)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_stopSDK(isSDKStopped);
|
||||
@ -376,7 +462,7 @@ namespace AppsFlyerSDK
|
||||
/// Was the stopSDK(boolean) API set to true.
|
||||
/// </summary>
|
||||
/// <returns>boolean isSDKStopped.</returns>
|
||||
public static bool isSDKStopped()
|
||||
public bool isSDKStopped()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return _isSDKStopped();
|
||||
@ -393,7 +479,7 @@ namespace AppsFlyerSDK
|
||||
/// <param name="url">The URL to be passed to your AppDelegate.</param>
|
||||
/// <param name="sourceApplication">The sourceApplication to be passed to your AppDelegate.</param>
|
||||
/// <param name="annotation">The annotation to be passed to your app delegate.</param>
|
||||
public static void handleOpenUrl(string url, string sourceApplication, string annotation)
|
||||
public void handleOpenUrl(string url, string sourceApplication, string annotation)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_handleOpenUrl(url, sourceApplication, annotation);
|
||||
@ -403,7 +489,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// Used by advertisers to exclude all networks/integrated partners from getting data.
|
||||
/// </summary>
|
||||
public static void setSharingFilterForAllPartners()
|
||||
public void setSharingFilterForAllPartners()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setSharingFilterForAllPartners();
|
||||
@ -414,7 +500,7 @@ namespace AppsFlyerSDK
|
||||
/// Used by advertisers to set some (one or more) networks/integrated partners to exclude from getting data.
|
||||
/// </summary>
|
||||
/// <param name="partners">partners to exclude from getting data</param>
|
||||
public static void setSharingFilter(params string[] partners)
|
||||
public void setSharingFilter(params string[] partners)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_setSharingFilter(partners.Length, partners);
|
||||
@ -439,7 +525,7 @@ namespace AppsFlyerSDK
|
||||
/// <param name="appID">promoted App ID.</param>
|
||||
/// <param name="campaign">cross promotion campaign.</param>
|
||||
/// <param name="parameters">parameters Dictionary.</param>
|
||||
public static void recordCrossPromoteImpression(string appID, string campaign, Dictionary<string, string> parameters)
|
||||
public void recordCrossPromoteImpression(string appID, string campaign, Dictionary<string, string> parameters)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_recordCrossPromoteImpression(appID, campaign, AFMiniJSON.Json.Serialize(parameters));
|
||||
@ -452,7 +538,7 @@ namespace AppsFlyerSDK
|
||||
/// <param name="appID">promoted App ID</param>
|
||||
/// <param name="campaign">cross promotion campaign</param>
|
||||
/// <param name="parameters">additional user params</param>
|
||||
public static void attributeAndOpenStore(string appID, string campaign, Dictionary<string, string> parameters, MonoBehaviour gameObject)
|
||||
public void attributeAndOpenStore(string appID, string campaign, Dictionary<string, string> parameters, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_attributeAndOpenStore(appID, campaign, AFMiniJSON.Json.Serialize(parameters), gameObject ? gameObject.name : null);
|
||||
@ -464,7 +550,7 @@ namespace AppsFlyerSDK
|
||||
/// See - https://support.appsflyer.com/hc/en-us/articles/115004480866-User-invite-attribution-
|
||||
/// </summary>
|
||||
/// <param name="parameters">parameters Dictionary.</param>
|
||||
public static void generateUserInviteLink(Dictionary<string, string> parameters, MonoBehaviour gameObject)
|
||||
public void generateUserInviteLink(Dictionary<string, string> parameters, MonoBehaviour gameObject)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_generateUserInviteLink(AFMiniJSON.Json.Serialize(parameters), gameObject ? gameObject.name : null);
|
||||
@ -477,7 +563,7 @@ namespace AppsFlyerSDK
|
||||
/// </summary>
|
||||
/// <param name="channel">channel string.</param>
|
||||
/// <param name="parameters">parameters Dictionary..</param>
|
||||
public static void recordInvite(string channel, Dictionary<string, string> parameters)
|
||||
public void recordInvite(string channel, Dictionary<string, string> parameters)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_recordInvite(channel, AFMiniJSON.Json.Serialize(parameters));
|
||||
@ -488,7 +574,7 @@ namespace AppsFlyerSDK
|
||||
/// Waits for request user authorization to access app-related data
|
||||
/// </summary>
|
||||
/// <param name="timeoutInterval">time to wait until session starts</param>
|
||||
public static void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval)
|
||||
public void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_waitForATTUserAuthorizationWithTimeoutInterval(timeoutInterval);
|
||||
@ -498,7 +584,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="isDisabled">bool should diable</param>
|
||||
public static void disableSKAdNetwork(bool isDisabled)
|
||||
public void disableSKAdNetwork(bool isDisabled)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_disableSKAdNetwork(isDisabled);
|
||||
@ -511,7 +597,7 @@ namespace AppsFlyerSDK
|
||||
/// See docs for more info.
|
||||
/// </summary>
|
||||
/// <param name="paths">array of nested json path</param>
|
||||
public static void addPushNotificationDeepLinkPath(params string[] paths)
|
||||
public void addPushNotificationDeepLinkPath(params string[] paths)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
_addPushNotificationDeepLinkPath(paths.Length, paths);
|
||||
@ -521,7 +607,7 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// subscribe to unified deep link callbacks
|
||||
/// </summary>
|
||||
public static void subscribeForDeepLink(string objectName){
|
||||
public void subscribeForDeepLink(string objectName){
|
||||
#if !UNITY_EDITOR
|
||||
_subscribeForDeepLink(objectName);
|
||||
#endif
|
||||
@ -530,145 +616,403 @@ namespace AppsFlyerSDK
|
||||
/// <summary>
|
||||
/// Set the language of the device.
|
||||
/// </summary>
|
||||
public static void setCurrentDeviceLanguage(string language){
|
||||
public void setCurrentDeviceLanguage(string language){
|
||||
#if !UNITY_EDITOR
|
||||
_setCurrentDeviceLanguage(language);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows sending custom data for partner integration purposes.
|
||||
/// </summary>
|
||||
public void setPartnerData(string partnerId, Dictionary<string, string> partnerInfo){
|
||||
#if !UNITY_EDITOR
|
||||
_setPartnerData(partnerId, AFMiniJSON.Json.Serialize(partnerInfo));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use to disable app vendor identifier (IDFV) collection, 'true' to disable.
|
||||
/// </summary>
|
||||
public void disableIDFVCollection(bool isDisabled){
|
||||
#if !UNITY_EDITOR
|
||||
_disableIDFVCollection(isDisabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
delegate void unityCallBack(string message);
|
||||
|
||||
[AOT.MonoPInvokeCallback(typeof(unityCallBack))]
|
||||
public static void getCallback(string gameObjectName, string callbackName, string message)
|
||||
{
|
||||
GameObject go = GameObject.Find("AppsFlyerObject");
|
||||
var afscript = go.GetComponent("AppsFlyerObjectScript") as AppsFlyerObjectScript;
|
||||
Type type = typeof(AppsFlyerObjectScript);
|
||||
MethodInfo info = type.GetMethod(callbackName);
|
||||
info.Invoke(afscript, new[] { message });
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* AppsFlyer ios method mapping
|
||||
*/
|
||||
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _startSDK(bool shouldCallback, string objectName);
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
private static extern void _startSDK(bool shouldCallback, string objectName, Action<string, string, string> getCallback);
|
||||
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _getConversionData(string objectName);
|
||||
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setCustomerUserID(string customerUserID);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setAdditionalData(string customData);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setAppsFlyerDevKey(string appsFlyerDevKey);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setAppleAppID(string appleAppID);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setCurrencyCode(string currencyCode);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setDisableCollectAppleAdSupport(bool disableCollectAppleAdSupport);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setIsDebug(bool isDebug);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setShouldCollectDeviceName(bool shouldCollectDeviceName);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setAppInviteOneLinkID(string appInviteOneLinkID);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setDeepLinkTimeout(long deepLinkTimeout);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _anonymizeUser(bool shouldAnonymizeUser);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _enableTCFDataCollection(bool shouldCollectTcfData);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setConsentData(string isUserSubjectToGDPR, string hasConsentForDataUsage, string hasConsentForAdsPersonalization, string hasConsentForAdStorage);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _logAdRevenue(string monetizationNetwork, MediationNetwork mediationNetwork, string currencyIso4217Code, double eventRevenue, string additionalParameters);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setDisableCollectIAd(bool disableCollectIAd);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setUseReceiptValidationSandbox(bool useReceiptValidationSandbox);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setUseUninstallSandbox(bool useUninstallSandbox);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setResolveDeepLinkURLs(int length, params string[] resolveDeepLinkURLs);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setOneLinkCustomDomains(int length, params string[] oneLinkCustomDomains);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setUserEmails(EmailCryptType cryptType, int length, params string[] userEmails);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setPhoneNumber(string phoneNumber);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _afSendEvent(string eventName, string eventValues, bool shouldCallback, string objectName);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string tranactionId, string additionalParameters, string objectName);
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string transactionId, string additionalParameters, string objectName);
|
||||
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _validateAndSendInAppPurchaseV2(string product, string price, string currency, string transactionId, string extraEventValues, string objectName);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _recordLocation(double longitude, double latitude);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern string _getAppsFlyerId();
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _registerUninstall(byte[] deviceToken);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _handlePushNotification(string pushPayload);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern string _getSDKVersion();
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setHost(string host, string hostPrefix);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setMinTimeBetweenSessions(int minTimeBetweenSessions);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _stopSDK(bool isStopSDK);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern bool _isSDKStopped();
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _handleOpenUrl(string url, string sourceApplication, string annotation);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setSharingFilterForAllPartners();
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setSharingFilter(int length, params string[] partners);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setSharingFilterForPartners(int length, params string[] partners);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _recordCrossPromoteImpression(string appID, string campaign, string parameters);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _attributeAndOpenStore(string appID, string campaign, string parameters, string gameObject);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _generateUserInviteLink(string parameters, string gameObject);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _recordInvite(string channel, string parameters);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _disableSKAdNetwork(bool isDisabled);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _addPushNotificationDeepLinkPath(int length, params string[] paths);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _subscribeForDeepLink(string objectName);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setCurrentDeviceLanguage(string language);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _setPartnerData(string partnerId, string partnerInfo);
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
[DllImport("AppsFlyerBundle")]
|
||||
#endif
|
||||
private static extern void _disableIDFVCollection(bool isDisabled);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.appsflyer:adrevenue:6.5.4"></androidPackage>
|
||||
<androidPackage spec="com.appsflyer:unity-adrevenue-generic-wrapper:6.5.4"></androidPackage>
|
||||
</androidPackages>
|
||||
|
||||
<iosPods>
|
||||
<iosPod name="AppsFlyer-AdRevenue" version="6.5.4" minTargetSdk="10.0">
|
||||
</iosPod>
|
||||
</iosPods>
|
||||
|
||||
</dependencies>
|
||||
@ -2,17 +2,15 @@
|
||||
<dependencies>
|
||||
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.appsflyer:af-android-sdk:6.4.1">
|
||||
</androidPackage>
|
||||
<androidPackage spec="com.appsflyer:unity-wrapper:6.4.1">
|
||||
</androidPackage>
|
||||
<androidPackage spec="com.android.installreferrer:installreferrer:2.1">
|
||||
</androidPackage>
|
||||
<androidPackage spec="com.appsflyer:af-android-sdk:6.17.0"></androidPackage>
|
||||
<androidPackage spec="com.appsflyer:unity-wrapper:6.17.0"></androidPackage>
|
||||
<androidPackage spec="com.android.installreferrer:installreferrer:2.1"></androidPackage>
|
||||
<androidPackage spec="com.appsflyer:purchase-connector:2.1.0"></androidPackage>
|
||||
</androidPackages>
|
||||
|
||||
<iosPods>
|
||||
<iosPod name="AppsFlyerFramework" version="6.4.1" minTargetSdk="9.0">
|
||||
</iosPod>
|
||||
<iosPod name="AppsFlyerFramework" version="6.17.1" minTargetSdk="12.0"></iosPod>
|
||||
<iosPod name="PurchaseConnector" version="6.17.1" minTargetSdk="12.0"></iosPod>
|
||||
</iosPods>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -11,6 +11,7 @@ public class AppsFlyerObjectEditor : Editor
|
||||
SerializedProperty iosDevKey;
|
||||
SerializedProperty appID;
|
||||
SerializedProperty UWPAppID;
|
||||
SerializedProperty macOSAppID;
|
||||
SerializedProperty isDebug;
|
||||
SerializedProperty getConversionData;
|
||||
|
||||
@ -21,6 +22,7 @@ public class AppsFlyerObjectEditor : Editor
|
||||
iosDevKey = serializedObject.FindProperty("iosDevKey");
|
||||
appID = serializedObject.FindProperty("appID");
|
||||
UWPAppID = serializedObject.FindProperty("UWPAppID");
|
||||
macOSAppID = serializedObject.FindProperty("macOSAppID");
|
||||
isDebug = serializedObject.FindProperty("isDebug");
|
||||
getConversionData = serializedObject.FindProperty("getConversionData");
|
||||
}
|
||||
@ -31,16 +33,16 @@ public class AppsFlyerObjectEditor : Editor
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
|
||||
GUILayout.Box((Texture)AssetDatabase.LoadAssetAtPath("Assets/AppsFlyer/Editor/logo.png", typeof(Texture)), new GUILayoutOption[] { GUILayout.Width(600) });
|
||||
GUILayout.Box((Texture)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets("appsflyer_logo")[0]), typeof(Texture)), new GUILayoutOption[] { GUILayout.Width(600) });
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.HelpBox("Set your devKey and appID to init the AppsFlyer SDK and start tracking. You must modify these fields and provide:\ndevKey - Your application devKey provided by AppsFlyer.\nappId - For iOS only. Your iTunes Application ID.\nUWP app id - For UWP only. Your application app id", MessageType.Info);
|
||||
EditorGUILayout.HelpBox("Set your devKey and appID to init the AppsFlyer SDK and start tracking. You must modify these fields and provide:\ndevKey - Your application devKey provided by AppsFlyer.\nappId - For iOS only. Your iTunes Application ID.\nUWP app id - For UWP only. Your application app id \nMac OS app id - For MacOS app only.", MessageType.Info);
|
||||
|
||||
EditorGUILayout.PropertyField(devKey);
|
||||
EditorGUILayout.PropertyField(iosDevKey);
|
||||
EditorGUILayout.PropertyField(appID);
|
||||
EditorGUILayout.PropertyField(UWPAppID);
|
||||
EditorGUILayout.PropertyField(macOSAppID);
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.HelpBox("Enable get conversion data to allow your app to recive deeplinking callbacks", MessageType.None);
|
||||
EditorGUILayout.PropertyField(getConversionData);
|
||||
|
||||
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
31
Assets/ThirdParty/AppsFlyer/IAppsFlyerAndroidBridge.cs
vendored
Normal file
31
Assets/ThirdParty/AppsFlyer/IAppsFlyerAndroidBridge.cs
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
|
||||
public interface IAppsFlyerAndroidBridge : IAppsFlyerNativeBridge
|
||||
{
|
||||
void updateServerUninstallToken(string token);
|
||||
void setImeiData(string imei);
|
||||
void setAndroidIdData(string androidId);
|
||||
void waitForCustomerUserId(bool wait);
|
||||
void setCustomerIdAndStartSDK(string id);
|
||||
string getOutOfStore();
|
||||
void setOutOfStore(string sourceName);
|
||||
void setCollectAndroidID(bool isCollect);
|
||||
void setCollectIMEI(bool isCollect);
|
||||
void setIsUpdate(bool isUpdate);
|
||||
void setPreinstallAttribution(string mediaSource, string campaign, string siteId);
|
||||
bool isPreInstalledApp();
|
||||
string getAttributionId();
|
||||
void handlePushNotifications();
|
||||
void validateAndSendInAppPurchase(string publicKey, string signature, string purchaseData, string price, string currency, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
||||
void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
||||
void setCollectOaid(bool isCollect);
|
||||
void setDisableAdvertisingIdentifiers(bool disable);
|
||||
void setDisableNetworkData(bool disable);
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/IAppsFlyerAndroidBridge.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/IAppsFlyerAndroidBridge.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdf9d1bc41a8244b3bc2d249fb6cd7aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/ThirdParty/AppsFlyer/IAppsFlyerIOSBridge.cs
vendored
Normal file
26
Assets/ThirdParty/AppsFlyer/IAppsFlyerIOSBridge.cs
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace AppsFlyerSDK
|
||||
{
|
||||
|
||||
public interface IAppsFlyerIOSBridge : IAppsFlyerNativeBridge
|
||||
{
|
||||
void setDisableCollectAppleAdSupport(bool disable);
|
||||
void setShouldCollectDeviceName(bool shouldCollectDeviceName);
|
||||
void setDisableCollectIAd(bool disableCollectIAd);
|
||||
void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox);
|
||||
void setUseUninstallSandbox(bool useUninstallSandbox);
|
||||
void validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string transactionId, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
||||
void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> extraEventValues, MonoBehaviour gameObject);
|
||||
void registerUninstall(byte[] deviceToken);
|
||||
void handleOpenUrl(string url, string sourceApplication, string annotation);
|
||||
void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval);
|
||||
void setCurrentDeviceLanguage(string language);
|
||||
void disableSKAdNetwork(bool isDisabled);
|
||||
void disableIDFVCollection(bool isDisabled);
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/AppsFlyer/IAppsFlyerIOSBridge.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/IAppsFlyerIOSBridge.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6847fb337898040288c165e3667101a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user