68 lines
2.1 KiB
C#
68 lines
2.1 KiB
C#
|
using UnityEngine;
|
|||
|
using Thousandto.CoreSDK.Event;
|
|||
|
using Thousandto.CoreSDK;
|
|||
|
|
|||
|
namespace Thousandto.CoreSDK
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// SDK初始化操作,注册一些事件
|
|||
|
/// 这是常规SDK,包含账号系统,充值系统,不包含数据统计功能
|
|||
|
/// </summary>
|
|||
|
public class SDKInitialize
|
|||
|
{
|
|||
|
//运行时平台
|
|||
|
public static MyRuntimePlatform RumtimePlatform = MyRuntimePlatform.None;
|
|||
|
|
|||
|
private static SDKInitialize _instance;
|
|||
|
|
|||
|
public static SDKInitialize Instance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_instance == null)
|
|||
|
{
|
|||
|
_instance = new SDKInitialize();
|
|||
|
Application.logMessageReceived += LogCallback;
|
|||
|
}
|
|||
|
return SDKInitialize._instance;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private SDKInitialize()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public static void LogCallback(string condition, string stackTrace, LogType type)
|
|||
|
{
|
|||
|
if(type == LogType.Error || type == LogType.Exception)
|
|||
|
{
|
|||
|
//LogManager中已经有日志记录了,这里没必要
|
|||
|
//PlatformInterface.reportCatchedException(condition, stackTrace);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static void SetRuntimePlatform(MyRuntimePlatform platform)
|
|||
|
{
|
|||
|
RumtimePlatform = platform;
|
|||
|
switch (platform)
|
|||
|
{
|
|||
|
case MyRuntimePlatform.AndroidEditor:
|
|||
|
case MyRuntimePlatform.IOSEditor:
|
|||
|
case MyRuntimePlatform.StandaloneEditor:
|
|||
|
SDKBridge.SDKPlatform = SDKPlatform.EDITOR;
|
|||
|
break;
|
|||
|
case MyRuntimePlatform.Android:
|
|||
|
case MyRuntimePlatform.IOS:
|
|||
|
SDKBridge.SDKPlatform = SDKPlatform.Normal;
|
|||
|
break;
|
|||
|
case MyRuntimePlatform.Standalone:
|
|||
|
SDKBridge.SDKPlatform = SDKPlatform.PC;
|
|||
|
break;
|
|||
|
default:
|
|||
|
SDKBridge.SDKPlatform = SDKPlatform.EDITOR;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|