/// <summary> /// MSDK init,游戏开始的时候设置 /// </summary> public static void Init() { if (initialized) { return; } initialized = true; if (isDebug) { MSDKLog.SetLevel(MSDKLog.Level.Log); } else { MSDKLog.SetLevel(MSDKLog.Level.Error); } MSDKMessageCenter.Instance.Init(); #if GCLOUD_MSDK_WINDOWS #elif UNITY_EDITOR || UNITY_STANDALONE_WIN #else MSDKCrash.InitCrash(); #endif MSDKLog.Log("MSDK initialed !"); }
static string SynchronousDelegate(object arg) { var argsWrapper = (RetArgsWrapper)arg; var methodId = argsWrapper.MethodId; var json = argsWrapper.RetJson; MSDKLog.Log("the methodId is ( " + methodId + " ) and json=\n " + json); var className = ""; var methodName = ""; switch (methodId) { #if GCLOUD_MSDK_WINDOWS #else case (int)MSDKMethodNameID.MSDK_CRASH_CALLBACK_EXTRA_MESSAGE: className = "GCloud.MSDK.MSDKCrash"; methodName = "OnCrashCallbackMessage"; return(MSDKCrash.OnCrashCallbackMessage(json)); break; case (int)MSDKMethodNameID.MSDK_CRASH_CALLBACK_EXTRA_DATA: className = "GCloud.MSDK.MSDKCrash"; methodName = "OnCrashCallbackData"; return(MSDKCrash.OnCrashCallbackData(json)); break; #endif } #if USING_ITOP className = className.Replace("MSDK", "ITOP"); MSDKLog.Log("className=" + className + " methodName=" + methodName); if (string.IsNullOrEmpty(className) || string.IsNullOrEmpty(methodName)) { MSDKLog.LogError("something wrong with the plugins, className = " + className + " methodName = " + methodName); return(""); } try { var assembly = Assembly.GetExecutingAssembly(); var type = assembly.GetType(className, true, true); if (type != null) { var methodInfo = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static, null, new [] { typeof(string) }, null); if (methodInfo != null) { object res = methodInfo.Invoke(null, new object [] { json }); return(res.ToString()); } else { MSDKLog.LogError("cannot get this method, methodName=" + methodName); } } else { MSDKLog.LogError("current className is wrong,className=" + className); } } catch (Exception e) { MSDKLog.LogError("call method error\n" + e.StackTrace); } #endif return(""); }