using System.Collections.Generic;
using System;
using UnityEngine;
// using BF.UNet.Utility;
// using BF.NativeCore.Platform;
namespace BF
{
// [System.Serializable]
// public class ReqVsn
// {
// public string vsn;
// public string appName;
// public int sid;
// public ReqVsn(string vsn, string appName, int sid)
// {
// this.vsn = vsn;
// this.appName = appName;
// this.sid = sid;
// }
// // public ReqVsn(UNetUtility.ReqVsn reqVsn)
// // {
// // appName = reqVsn.appName;
// // sid = reqVsn.sid;
// // vsn = reqVsn.vsn;
// // }
// }
// [System.Serializable]
// public class RspVsn
// {
// ///
// /// 是否请求成功
// ///
// public bool isSuccess;
// ///
// /// 请求失败后的错误消息;成功时,没有此消息
// ///
// public string errorMsg;
// public string vsn;
// public List cdnUrl;
// public string md5;
// public string storeUrl;
// // public RspVsn(UNetUtility.RspVsn rspVsn)
// // {
// // isSuccess = rspVsn.isSuccess;
// // errorMsg = rspVsn.errorMsg;
// // vsn = rspVsn.vsn;
// // cdnUrl = rspVsn.cdnUrl;
// // md5 = rspVsn.md5;
// // storeUrl = rspVsn.storeUrl;
// // }
// }
public class SDKManager : ManagerBase
{
//新版本登陆,支付,第三方辅助SDK
public BFLoginSDKManager BFLoginSDKMgr { get; private set; }
public BFPaySDKManager BFPaySDKMgr { get; private set; }
public IAPManager IosPaySDKMgr { get; private set; }
// public BFAdmobSDKManager BFAdmobSDKMgr { get; private set; }
public BFIronSourceSDKManager BFIronSourceSDKMgr { get; private set; }
public BFNativeSDKManager BFNativeSDKMgr { get; private set; }
public BFThirdReportSDKManager BFThirdReportSDKMgr { get; private set; }
static SDKManager instance;
public static SDKManager Create()
{
BFLog.LogAssert(instance == null, "This method only allows BFMain to call once");
instance = new SDKManager();
return instance;
}
SDKManager() { }
public override void Init()
{
base.Init();
//初始化SDK部分
var sdkGo = UnityEngine.GameObject.Find("SDKManager");
if (sdkGo == null)
{
sdkGo = new GameObject("SDKManager");
}
// 登陆
BFLoginSDKMgr = sdkGo.AddComponent();
// 支付
BFPaySDKMgr = sdkGo.AddComponent();
// 广告
// BFAdmobSDKMgr = sdkGo.AddComponent();
BFIronSourceSDKMgr = sdkGo.AddComponent();
// 三方上报
BFThirdReportSDKMgr = sdkGo.AddComponent();
// native交互管理
BFNativeSDKMgr = sdkGo.AddComponent();
IosPaySDKMgr = IAPManager.Instance;
GameObject.DontDestroyOnLoad(sdkGo);
}
public override void Destroy()
{
base.Destroy();
instance = null;
}
///
/// 返回当前系统语言,格式为:语言码_地区码,例如: zh_CN
/// 语言码和国家/地区码当前系统都是返回的二位码
/// 语言码 https://omegat.sourceforge.io/manual-latest/zh_CN/appendix.languages.html
/// 国家/地区码 http://www.mohrss.gov.cn/SYrlzyhshbzb/zhuanti/jinbaogongcheng/Jbgcbiaozhunguifan/201112/t20111206_47429.html
///
public string GetLanguage()
{
return NativeUtils.GetLanguageAndCountry();
}
public string GetTimeZone()
{
return NativeUtils.GetTimeZone();
}
}
}