本文共 2429 字,大约阅读时间需要 8 分钟。
首先下载官方MSDK for unity
创建一个GameObject并命名为Msdk,它将作为MSDK回调物体
bugly上报模块
初始化
void InitBugly() { // 开启SDK的调式开关 Bugly.EnableLog (true); // 设置C#堆栈日志捕获的级别,默认为Exception,可以选择为Assert、Error等 Bugly.RegisterHandler (LogSeverity.Exception); // 如果你已经在Unity项目导出的Android或iOS工程中进行了SDK的初始化,则只需调用此方法完成C#堆栈捕获功能的开启 Bugly.EnableExceptionHandler(); }回调
using com.tencent.bugly.unity3d;public class BuglyInit : MonoBehaviour { // this is for iOS public string BuglyAppIdForIOS = ""; public string BuglyAppChannelForIOS = ""; public string BuglyAppVersionForIOS = ""; //public bool AutoThrow = true; // this will be config by editor public string GameObjectForCallback = ""; public bool DebugEnable = false; public LogSeverity LogLevel = LogSeverity.Exception; // this is for android public string BuglyAppIdForAndroid = ""; public string AppVersionForAndroid = ""; public string AppChannelForAndroid = ""; public string ReportDelayTimeForAndroid = ""; void Awake () { DontDestroyOnLoad (this.gameObject); Debugger.setDebugLevel(LogSeverity.Log); Bugly.SetGameObjectForCallback (GameObjectForCallback); Bugly.EnableLog (DebugEnable); Bugly.RegisterHandler (LogLevel); #if UNITY_IPHONE Bugly.SetAppVersion (BuglyAppVersionForIOS); Bugly.SetChannel (BuglyAppChannelForIOS); Bugly.InitSDK (BuglyAppIdForIOS); Bugly.SetGameObjectForCallback("Bugly"); Bugly.SetCrashHappenCallback ("_callbackCrashHappen"); #endif #if UNITY_ANDROID Bugly.SetAppVersion (AppVersionForAndroid); Bugly.SetChannel (AppChannelForAndroid); Bugly.SetReportDelayTime(ReportDelayTimeForAndroid); Bugly.InitSDK (BuglyAppIdForAndroid); #endif } void _callbackCrashHappen(string data){ Debugger.Debug ("on crash callback"); if (data != null) { Debugger.Info("receive message :" + data); } }}手Q微信授权登陆
接口
WGPlatform.Instance.WGLoginQQ ();
WGPlatform.Instance.WGLoginWX ();回调
void OnLoginNotify(string jsonRet)查询个人信息 接口
WGPlatform.Instance.WGQueryMyQQInfo ();
WGPlatform.Instance.WGQueryMyWXInfo();回调
void OnRelationNotify(string jsonRet)同玩好友信息
接口
WGPlatform.Instance.WGQueryQQGameFriendsInfo ();
WGPlatform.Instance.WGQueryWXGameFriendsInfo();回调
void OnRelationNotify(string jsonRet)
转载地址:http://hgzvf.baihongyu.com/