update: 更新 Debugger 接口, 回调
parent
1cc30c8a1f
commit
6d17f595b2
|
|
@ -188,8 +188,15 @@ namespace Guru
|
||||||
add => _onGuruServiceReady += value;
|
add => _onGuruServiceReady += value;
|
||||||
remove => _onGuruServiceReady -= value;
|
remove => _onGuruServiceReady -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static Action<bool> _onDebuggerDisplayed;
|
||||||
|
public static event Action<bool> OnDisplayDebugger
|
||||||
|
{
|
||||||
|
add => _onDebuggerDisplayed += value;
|
||||||
|
remove => _onDebuggerDisplayed -= value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
namespace Guru
|
||||||
|
{
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public partial class GuruSDK
|
||||||
|
{
|
||||||
|
private static bool _isDebuggerInited = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示 Debugger
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool ShowDebugger()
|
||||||
|
{
|
||||||
|
if (IsServiceReady)
|
||||||
|
{
|
||||||
|
InitDebuggerLayout();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void InitDebuggerLayout()
|
||||||
|
{
|
||||||
|
var settings = GuruSettings.Instance;
|
||||||
|
var v = GuruAppVersion.Load();
|
||||||
|
var app_version = (v == null ? $"{Application.version} (unknown)" : $"{v.version} ({v.code})");
|
||||||
|
var uid = (string.IsNullOrEmpty(UID) ? "NULL" : UID);
|
||||||
|
var device_id = (string.IsNullOrEmpty(DeviceId) ? "NULL" : DeviceId);
|
||||||
|
var push_token = (string.IsNullOrEmpty(PushToken) ? "NULL" : PushToken);
|
||||||
|
var auth_token = (string.IsNullOrEmpty(AuthToken) ? "NULL" : AuthToken);
|
||||||
|
var fid = (string.IsNullOrEmpty(FireabseId) ? "NULL" : FireabseId);
|
||||||
|
var adjust_id = (string.IsNullOrEmpty(AdjustId) ? "NULL" : AdjustId);
|
||||||
|
var idfa = (string.IsNullOrEmpty(IDFA) ? "NULL" : IDFA);
|
||||||
|
var gsid = (string.IsNullOrEmpty(GSADID) ? "NULL" : GSADID);
|
||||||
|
|
||||||
|
// ------------ Info Page --------------------
|
||||||
|
Debugger.Instance.AddOption("Info/Guru SDK", GuruSDK.Version);
|
||||||
|
Debugger.Instance.AddOption("Info/Unity Version", Application.unityVersion);
|
||||||
|
Debugger.Instance.AddOption("Info/Name", settings.ProductName);
|
||||||
|
Debugger.Instance.AddOption("Info/Bundle Id", settings.GameIdentifier);
|
||||||
|
Debugger.Instance.AddOption("Info/Version", app_version);
|
||||||
|
Debugger.Instance.AddOption("Info/Uid", uid).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/Device ID", device_id).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/Push Token", push_token).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/Auth Token", auth_token).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/Firebase Id", fid).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/Adjust Id", adjust_id).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/IDFA", idfa).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/GSADID", gsid).AddCopyButton();
|
||||||
|
Debugger.Instance.AddOption("Info/Debug Mode", GuruSDK.IsDebugMode? "true" : "false");
|
||||||
|
Debugger.Instance.AddOption("Info/Screen size", $"{Screen.width} x {Screen.height}");
|
||||||
|
|
||||||
|
|
||||||
|
// ------------ Ads Page --------------------
|
||||||
|
Debugger.Instance.AddOption("Ads/Show Ads Debug Panel", "", ShowMaxDebugPanel);
|
||||||
|
|
||||||
|
var badsId = settings.ADSetting.GetBannerID();
|
||||||
|
var iadsId = settings.ADSetting.GetInterstitialID();
|
||||||
|
var radsId = settings.ADSetting.GetRewardedVideoID();
|
||||||
|
|
||||||
|
Debugger.Instance.AddOption("Ads/Banner Id", badsId);
|
||||||
|
Debugger.Instance.AddOption("Ads/Interstitial Id", iadsId);
|
||||||
|
Debugger.Instance.AddOption("Ads/Rewarded Id", radsId);
|
||||||
|
|
||||||
|
|
||||||
|
Debugger.Show(); // 显示 Debugger 界面
|
||||||
|
Debugger.OnClosed -= OnDebuggerClosed;
|
||||||
|
Debugger.OnClosed += OnDebuggerClosed;
|
||||||
|
Callbacks.SDK._onDebuggerDisplayed?.Invoke(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void OnDebuggerClosed()
|
||||||
|
{
|
||||||
|
Debugger.OnClosed -= OnDebuggerClosed;
|
||||||
|
Callbacks.SDK._onDebuggerDisplayed?.Invoke(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 002605b9e408487bb69d27d07dda016c
|
||||||
|
timeCreated: 1711078536
|
||||||
|
|
@ -5,9 +5,8 @@ namespace Guru
|
||||||
|
|
||||||
public static string UID => _model?.UserId ?? IPMConfig.IPM_UID;
|
public static string UID => _model?.UserId ?? IPMConfig.IPM_UID;
|
||||||
public static string DeviceId => IPMConfig.IPM_DEVICE_ID ?? ""; // TODO: change it to _model member later.
|
public static string DeviceId => IPMConfig.IPM_DEVICE_ID ?? ""; // TODO: change it to _model member later.
|
||||||
|
|
||||||
public static string PushToken => IPMConfig.IPM_PUSH_TOKEN ?? ""; // TODO: change it to _model member later.
|
public static string PushToken => IPMConfig.IPM_PUSH_TOKEN ?? ""; // TODO: change it to _model member later.
|
||||||
|
public static string AuthToken => IPMConfig.IPM_TOKEN ?? ""; // TODO: change it to _model member later.
|
||||||
public static string SupportEmail => GuruSettings.SupportEmail ?? "";
|
public static string SupportEmail => GuruSettings.SupportEmail ?? "";
|
||||||
|
|
||||||
public static string StoreUrl
|
public static string StoreUrl
|
||||||
|
|
@ -33,6 +32,11 @@ namespace Guru
|
||||||
public static string AppVersionString => GuruAppVersion.ToString();
|
public static string AppVersionString => GuruAppVersion.ToString();
|
||||||
|
|
||||||
public static bool IsNewUser => IPMConfig.IPM_NEWUSER;
|
public static bool IsNewUser => IPMConfig.IPM_NEWUSER;
|
||||||
|
|
||||||
|
public static string FireabseId => IPMConfig.FIREBASE_ID;
|
||||||
|
public static string IDFA => IPMConfig.ADJUST_IDFA;
|
||||||
|
public static string AdjustId => IPMConfig.ADJUST_ID;
|
||||||
|
public static string GSADID => IPMConfig.ADJUST_ADID;
|
||||||
|
|
||||||
|
|
||||||
private static GuruAppVersion _appVersion;
|
private static GuruAppVersion _appVersion;
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,14 @@ namespace Guru
|
||||||
/// 初始化成功标志位
|
/// 初始化成功标志位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsInitialSuccess { get; private set; } = false;
|
public static bool IsInitialSuccess { get; private set; } = false;
|
||||||
|
/// <summary>
|
||||||
|
/// Firebase 就绪标志位
|
||||||
|
/// </summary>
|
||||||
public static bool IsFirebaseReady { get; private set; } = false;
|
public static bool IsFirebaseReady { get; private set; } = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 服务就绪标志位
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsServiceReady { get; private set; } = false;
|
||||||
|
|
||||||
#region 初始化
|
#region 初始化
|
||||||
|
|
||||||
|
|
@ -334,9 +339,13 @@ namespace Guru
|
||||||
Debug.LogError($"--- ERROR on StartConsentFlow: {ex.Message}");
|
Debug.LogError($"--- ERROR on StartConsentFlow: {ex.Message}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IsServiceReady = true;
|
||||||
|
|
||||||
// 中台服务初始化结束
|
// 中台服务初始化结束
|
||||||
Callbacks.SDK._onGuruServiceReady?.Invoke();
|
Callbacks.SDK._onGuruServiceReady?.Invoke();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue