123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace LoyalSoftSDK
- {
- public enum Platform
- {
- Default,
- Android,
- IOS
- }
- public abstract class LoyalGameSDK
- {
- //这个改成Default可以在uinity简单看下效果,导出的时候一定要改回Android
- public static Platform platform = Platform.Default;
- private static LoyalGameSDK instance;
- public static LoyalGameSDK Instance
- {
- get
- {
- if (instance == null)
- {
- if (GlobalConfig.is_SandBox == true)
- {
- platform = Platform.Default;
- }
- else
- {
- if ( (GlobalConfig.netType == eNetType.Online || GlobalConfig.netType == eNetType.Online_dev)) // 正式网络
- {
- if (Application.platform == RuntimePlatform.Android)
- {
- platform = Platform.Android;
- }
- else if (Application.platform == RuntimePlatform.WindowsEditor)
- {
- platform = Platform.Default;
- }
- else if (Application.platform == RuntimePlatform.IPhonePlayer)
- {
- platform = Platform.IOS;
- }
- }
- }
- if (platform == Platform.Default)
- {
- instance = new LoyalGameSDKDefault();
- }
- else if (platform == Platform.Android)
- {
- instance = new LoyalGameSDKAndroid();
- }
- else if (platform == Platform.IOS)
- {
- instance = new LoyalGameSDKIOS();
- }
- else
- {
- Debug.LogError("应用平台未知!");
- }
- }
- return instance;
- }
- }
- //
- public string plantName = "";
- public const string appid = "102";
- //SDK消息回调
- public delegate void CallBackHandler(LoyalGameCallbackData data);
- public CallBackHandler onSDKCallBack;
- /// <summary>
- /// 平台初始化
- /// </summary>
- public abstract void Init();
- /// <summary>
- /// 登录
- /// </summary>
- public abstract void Login(bool autoLogin);
- /// <summary>
- /// 登录
- /// 用于腾讯应用宝,QQ登录,plant="QQ";微信登录,plant="WX"
- /// </summary>
- /// <param name="plant">用于腾讯应用宝,QQ登录,plant="QQ";微信登录,plant="WX"</param>
- public abstract void Login(string plant);
- /// <summary>
- /// 登出
- /// </summary>
- public abstract void Logout();
- /// <summary>
- /// 上传用户游戏数据
- /// </summary>
- public abstract void SubmitGameData(LoyalGameExtraData extraData);
- /// <summary>
- /// 退出游戏(IOS没有)
- /// </summary>
- public abstract void ExitGame(LoyalGameExtraData extraData);
- /// <summary>
- /// 支付
- /// </summary>
- public abstract void Pay(LoyalGamePayData payData);
- /// <summary>
- /// 打开网页
- /// </summary>
- /// <param name="url"></param>
- public abstract void OpenUrl(string url);
- /// <summary>
- /// 扩展项,考虑特殊平台的必要方法实现
- /// </summary>
- /// <param name="funcName"></param>
- /// <param name="param"></param>
- public abstract void CallOther(string funcName, params object[] param);
- /// <summary>
- /// 游戏重新启动(Android端)
- /// </summary>
- public abstract void Restar();
- /// <summary>
- /// Android端退出游戏
- /// </summary>
- public abstract void FoceExit();
- }
- }
|