// Update is called once per frame void Update() { // 队列中有值,则取出并在UnityMain线程回调到游戏 string jsonStr = ""; lock (queueLock) { if (resultQueue.Count > 0) { jsonStr = (String)resultQueue.Dequeue(); } } if (String.IsNullOrEmpty(jsonStr)) { return; } JsonData data = null; try { data = JsonMapper.ToObject(jsonStr); String methodName = (string)data["MsdkMethod"]; if (String.IsNullOrEmpty(methodName)) { MsdkUtil.Log("Process message error! MsdkMethod is null."); MsdkUtil.Log(jsonStr); return; } MsdkUtil.Log("MessageCenter receive : " + jsonStr); MethodInfo methodInfo = Instance.GetType().GetMethod(methodName, new [] { typeof(string) }); methodInfo.Invoke(Instance, new object[] { jsonStr }); } catch (Exception e) { MsdkUtil.Log("update json parse exception"); MsdkUtil.Log(jsonStr); MsdkUtil.Log(e.Message); } }
public void Init() { string logVersion = "MSDK Unity Version : " + WGPlatform.Version; MsdkUtil.Log(logVersion); WGPlatform.Instance.WGBuglyLog(eBuglyLogLevel.eBuglyLogLevel_D, logVersion); MessageCenter.Instance.Init(); WGPlatform.Instance.WGSetPermission(ePermission.eOPEN_ALL); BuglyAgent.ConfigCrashReporter(2, 4); // NOT Required. Enable debug log print, please set false for release version BuglyAgent.ConfigDebugMode(false); // Setting report level BuglyAgent.ConfigAutoReportLogLevel(LogSeverity.LogException); // Required. If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project), // please call this method to enable c# exception handler only. BuglyAgent.EnableExceptionHandler(); // NOT Required. If you need to report extra data with exception, you can set the extra handler // 只在iOS的C#异常时会触发 //BuglyAgent.SetLogCallbackExtrasHandler (MyLogCallbackExtrasHandler); }
// public void WGQueryQQGroupKey(string cGroupOpenid) // { // MsdkUtil.Log("Error : This interface is only use in Android!"); // throw new NotImplementedException(); // } public void WGAddCardToWXCardPackage(string cardId, string timestamp, string sign) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGUnbindQQGroup(string cGroupOpenid, string cUnionid) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public int WGCheckYYBInstalled() { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGStartSaveUpdate(bool isUseYYB) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGSendToQQWithVideo(string summary, string videoPath) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGSendToQQWithPhoto(eQQScene scene, string imgFilePath) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGOpenMSDKLog(bool enabled) { MsdkUtil.Log("Error : This interface is only use in iOS!"); throw new NotImplementedException(); }
public void WGClearLocalNotification(LocalMessageIOS localMessage) { MsdkUtil.Log("Error : This interface is only use in iOS!"); throw new NotImplementedException(); }
public long WGAddLocalNotificationAtFront(LocalMessageIOS localMessage) { MsdkUtil.Log("Error : This interface is only use in iOS!"); throw new NotImplementedException(); }
public void WGSendToQQWithPhoto(eQQScene scene, byte[] imgData, int imgDataLen) { MsdkUtil.Log("Error : This interface is only use in iOS!"); throw new NotImplementedException(); }
public void WGSendToQQ(eQQScene scene, string title, string desc, string url, byte[] imgData, int imgDataLen) { MsdkUtil.Log("Error : This interface is only use in iOS!"); throw new NotImplementedException(); }
void OnDestroy() { MsdkUtil.Log(bridgeGameObject.name + " OnDestroy"); }
public void WGSendToWeixinWithPhotoPath(eWechatScene scene, string mediaTagName, string imgPath, string messageExt, string messageAction) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGSendToQQ(eQQScene scene, string title, string desc, string url, string imgUrl, int imgUrlLen) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGResetGuestID() { MsdkUtil.Log("Error : This interface is only use in iOS!"); throw new NotImplementedException(); }
public void WGSendToQQWithRichPhoto(string summary, ArrayList imgs) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGOpenUrl(string openUrl, eMSDK_SCREENDIR screendir) { MsdkUtil.Log("Warnning : This api was deprecated. Please use 'WGOpenUrl(string openUrl)' instead."); iOSConnector.OpenUrlWithScreenDir(openUrl, (int)screendir); }
public bool WGCheckApiSupport(eApiName apiName) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGJoinQQGroup(string qqGroupKey) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGCheckNeedUpdate() { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void WGQueryQQGroupInfo(string cUnionid, string cZoneid) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public long WGAddLocalNotification(LocalMessageAndroid msg) { MsdkUtil.Log("Error : This interface is only use in Android!"); throw new NotImplementedException(); }
public void Init() { MsdkUtil.Log("Init MSDKCallbackBridge"); }