[WIP] firebase init Error
This commit is contained in:
238
sdk-intergration/Packages/tysdk/Runtime/UnityBridgeFunc.cs
Normal file
238
sdk-intergration/Packages/tysdk/Runtime/UnityBridgeFunc.cs
Normal file
@@ -0,0 +1,238 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace tysdk
|
||||
{
|
||||
|
||||
public enum EAccoutType
|
||||
{
|
||||
hwGoogle,
|
||||
hwFacebook,
|
||||
hwGuest,
|
||||
}
|
||||
|
||||
public static class UnityBridgeFunc
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
//更新登录支付域名
|
||||
public static void UnityResetServerUrl(string url){}
|
||||
|
||||
//登录
|
||||
public static void UnityLoginByTokenFun(string token){}
|
||||
public static void UnityLogin(EAccoutType accoutType){}
|
||||
|
||||
public static void UnityGetIdentityFun(string type){}
|
||||
|
||||
public static void UnityLoginOut(){}
|
||||
|
||||
//支付
|
||||
public static void UnityKnow(string userId, string productId, string productPrice, string productName,
|
||||
string productCount, string prodorderId, string appInfo){}
|
||||
|
||||
//打点
|
||||
public static void SetGaUserInfo(string userId){}
|
||||
|
||||
public static void SetGaCommonInfo(string SetGaCommonInfo){}
|
||||
|
||||
public static void GAReportParams(int type, string eventstr, string paramstr){}
|
||||
|
||||
//ATT
|
||||
public static void RequestATT(){}
|
||||
|
||||
public static int GetATT() {return 1;}
|
||||
|
||||
//广告相关
|
||||
public static void UnitySetAdBoxUserInfo(string userId){}
|
||||
|
||||
public static void UnityInitADSConfig(){}
|
||||
|
||||
public static void UnityLoadRvADS(){}
|
||||
|
||||
public static void UnityShowRVAD(){}
|
||||
|
||||
#elif UNITY_ANDROID
|
||||
|
||||
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
||||
|
||||
//更新登录支付域名
|
||||
public static void UnityResetServerUrl(string url)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnityResetServerUrl", url);
|
||||
}
|
||||
}
|
||||
|
||||
//登录
|
||||
public static void UnityLoginByTokenFun(string token)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnityLoginByTokenFun", token);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnityLogin(EAccoutType accoutType)
|
||||
{
|
||||
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnityLogin", accoutType);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnityGetIdentityFun(string type)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnityGetIdentityFun", type);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnityLoginOut()
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnityLoginOut");
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnityLogOutByChannel()
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
if(PlayerPrefs.HasKey("last_login_channel"))
|
||||
{
|
||||
sdkManager.CallStatic("UnityLogOutByChannel", PlayerPrefs.GetString("last_login_channel"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//支付
|
||||
public static void UnityKnow(string userId, string productId, string productPrice, string productName,
|
||||
string productCount, string prodorderId, string appInfo)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnityKnow",userId, productId, productPrice, productName,
|
||||
productCount, prodorderId, appInfo);
|
||||
}
|
||||
}
|
||||
|
||||
//打点
|
||||
public static void SetGaUserInfo(string userId)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("SetGaUserInfo", userId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetGaCommonInfo(string SetGaCommonInfo)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("SetGaCommonInfo", SetGaCommonInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GAReportParams(int type, string eventstr, string paramstr)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("GAReportParams", type, eventstr, paramstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//ATT
|
||||
public static void RequestATT(){}
|
||||
|
||||
public static int GetATT() {return 1;}
|
||||
|
||||
//广告相关
|
||||
public static void UnitySetAdBoxUserInfo(string userId){}
|
||||
|
||||
public static void UnityInitADSConfig(){}
|
||||
|
||||
public static void UnityLoadRvADS(){}
|
||||
|
||||
public static void UnityShowRVAD(){}
|
||||
|
||||
#elif UNITY_IOS
|
||||
|
||||
//更新登录支付域名
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityResetServerUrl(string url);
|
||||
|
||||
//登录
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByTokenFun(string token);
|
||||
|
||||
public static void UnityLogin(EAccoutType accoutType)
|
||||
{
|
||||
switch (accoutType)
|
||||
{
|
||||
case EAccoutType.hwGoogle:
|
||||
UnityLoginByGoogle();
|
||||
break;
|
||||
case EAccoutType.hwFacebook:
|
||||
UnityLoginByFacebook();
|
||||
break;
|
||||
case EAccoutType.hwGuest:
|
||||
UnityLoginByGuest();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByGuest();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByGoogle();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByFacebook();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityGetIdentityFun(string type);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginOut();
|
||||
|
||||
//支付
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityKnow(string userId, string productId, string productPrice, string productName,
|
||||
string productCount, string prodorderId, string appInfo);
|
||||
|
||||
//打点
|
||||
[DllImport("__Internal")]
|
||||
public static extern void SetGaUserInfo(string userId);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void SetGaCommonInfo(string SetGaCommonInfo);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void GAReportParams(int type, string eventstr, string paramstr);
|
||||
|
||||
//广告相关
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnitySetAdBoxUserInfo(string userId);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityInitADSConfig();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoadRvADS();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityShowRVAD();
|
||||
|
||||
//ATT
|
||||
[DllImport("__Internal")]
|
||||
public static extern void RequestATT();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern int GetATT();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user