87 lines
3.7 KiB
C#
87 lines
3.7 KiB
C#
|
|
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);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|