ball 项目提交
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Uni2SDK;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace UNSDK
|
||||
{
|
||||
public class SdkConfigMgr : ScriptableObject
|
||||
{
|
||||
[FormerlySerializedAs("Secret")] public string secret;
|
||||
[FormerlySerializedAs("Host")] public string host;
|
||||
[FormerlySerializedAs("IsLog")] public bool isLog;
|
||||
|
||||
public static bool IsInitSuccess = false;
|
||||
|
||||
private static SdkConfigMgr _instance;
|
||||
|
||||
public static SdkConfigMgr Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance) return _instance;
|
||||
_instance = AssetTools.GetScriptableObject<SdkConfigMgr>(typeof(SdkConfigMgr).Name, "Assets/Resources", false, false);
|
||||
return _instance;
|
||||
}
|
||||
set => _instance = value;
|
||||
}
|
||||
|
||||
|
||||
public static void Init(string packageName = "")
|
||||
{
|
||||
var package = StringExtensions.IsNullOrWhiteSpace(packageName) ? Application.identifier: packageName;
|
||||
|
||||
Uni2SDKManager.Instance.SetPackage(package);
|
||||
|
||||
Uni2SDKManager.Instance.SetLog(Instance.isLog);
|
||||
|
||||
Uni2SDKManager.Instance.Init(Instance.host,Instance.secret, (b, msg) =>
|
||||
{
|
||||
IsInitSuccess = b;
|
||||
Debug.Log($"init SDK bool===={b} WvManager.Instance.Init s==={msg}");
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭有感
|
||||
/// 必须调用,且在退出有感界界面时调用
|
||||
/// 调用此方法后,可以将其他游戏界面等显示了
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
Uni2SDKManager.Instance.Close();
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 开启有感
|
||||
/// 开启时:需要将其他游戏界面等隐藏,注意,是隐藏,不是在其界面上再添加一个界面
|
||||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
Uni2SDKManager.Instance.Open(0,164,0,176);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user