commit da15a24596e2a2a31959adc038bc08e480a140bc Author: Foldcc_b1 Date: Wed Apr 3 15:13:12 2024 +0800 init project diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c1b2d24 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# [1.0.0] + +基础版本. + +# [1.0.1] + +### 修复 + +* 优化package.json文件 diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 0000000..17c6cce --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fca4353ab66a48e4ebe5032dc5057c7a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor.meta b/Editor.meta new file mode 100644 index 0000000..287c50d --- /dev/null +++ b/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 38a208b96bc4bfe45a74e6f2433f520b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CarshEditor.asmdef b/Editor/CarshEditor.asmdef new file mode 100644 index 0000000..6dd5961 --- /dev/null +++ b/Editor/CarshEditor.asmdef @@ -0,0 +1,14 @@ +{ + "name": "CarshEditor", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Editor/CarshEditor.asmdef.meta b/Editor/CarshEditor.asmdef.meta new file mode 100644 index 0000000..cedb676 --- /dev/null +++ b/Editor/CarshEditor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: eefc1e2f6ea9bd341bb892303ac533ff +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CrashPostProcessBuildAndroid.cs b/Editor/CrashPostProcessBuildAndroid.cs new file mode 100644 index 0000000..ba3832d --- /dev/null +++ b/Editor/CrashPostProcessBuildAndroid.cs @@ -0,0 +1,219 @@ +#if UNITY_ANDROID && UNITY_2018_2_OR_NEWER + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; +using UnityEditor; +using UnityEditor.Android; + +namespace Editor +{ + public class CrashPostProcessBuildAndroid : IPostGenerateGradleAndroidProject + { + private static readonly XNamespace AndroidNamespace = "http://schemas.android.com/apk/res/android"; + private static readonly XNamespace ToolsNamespace = "http://schemas.android.com/tools"; + private static readonly string networkConfigXml = "network_security_config"; + + public int callbackOrder { get; } + + public void OnPostGenerateGradleAndroidProject (string path) + { +#if UNITY_2019_3_OR_NEWER + var manifestPath = Path.Combine (path, "src/main/AndroidManifest.xml"); + var launcherManifestPath = Path.Combine (path, "../launcher/src/main/AndroidManifest.xml"); +#else + var manifestPath = Path.Combine(path, "unityLibrary/src/main/AndroidManifest.xml"); +#endif + // var manifestPath = Path.Combine(path, "src/main/AndroidManifest.xml"); + XDocument manifest; + XDocument launcherManifest; + try + { + manifest = XDocument.Load (manifestPath); + launcherManifest = XDocument.Load (launcherManifestPath); + } +#pragma warning disable 0168 + catch (IOException exception) +#pragma warning restore 0168 + { + return; + } + + + // Get the `manifest` element. + var elementManifest = manifest.Element ("manifest"); + if (elementManifest == null) + { + return; + } + + var elementApplication = elementManifest.Element ("application"); + if (elementApplication == null) + { + return; + } + + //增加必要权限 + AddPermission ("android.permission.INTERNET" , elementManifest); + AddPermission ("android.permission.ACCESS_NETWORK_STATE" , elementManifest); + AddPermission ("android.permission.ACCESS_WIFI_STATE" , elementManifest); + AddPermission ("android.permission.READ_PHONE_STATE" , elementManifest); + AddPermission ("android.permission.READ_LOGS" , elementManifest); + manifest.Save (manifestPath); + launcherManifest.Save (launcherManifestPath); + processNetworkConfigXml (path); + } + + public static void AddPermission (string permission , XElement manifest) + { + var metaData = new XElement ("uses-permission"); + metaData.Add (new XAttribute (AndroidNamespace + "name", permission)); + + //判断是否已经添加过了 + var isExist = manifest.Descendants ().Any (element => + element.Name.LocalName.Equals ("uses-permission") && element.Attribute (AndroidNamespace + "name")!.Value.Equals (permission)); + + if (!isExist) + { + manifest.Add (metaData); + } + } + + + private static void processNetworkConfigXml (string path) + { + // bool isChina = true; + //在application标签加上:android:networkSecurityConfig="@xml/network_security_config" + var hasAdd = addNetworkSecurityConfigInApplication (path); + +#if UNITY_2019_3_OR_NEWER + var resXmlPath = Path.Combine (path, "src/main/res/xml"); +#else + var resXmlPath = Path.Combine(path, "unityLibrary/src/main/res/xml"); +#endif + + var rexXmlDir = Path.Combine (resXmlPath, $"{networkConfigXml}.xml"); + if (File.Exists (rexXmlDir) || !hasAdd) + { + // FileUtil.DeleteFileOrDirectory (rexXmlDir); + return; + } + + + if (!Directory.Exists (resXmlPath)) + { + Directory.CreateDirectory (resXmlPath); + } + + // var fromScriptableObject = MonoScript.FromScriptableObject(this); + var xmlPath = GetScriptsPath (nameof(CrashPostProcessBuildAndroid)); + saveFile ($"{xmlPath}/{networkConfigXml}.xml", resXmlPath); + } + + public static void saveFile (string filePathName , string toFilesPath) + { + FileInfo file = new FileInfo (filePathName); + string newFileName = file.Name; + file.CopyTo (toFilesPath + "/" + newFileName, true); + } + + public static string GetScriptsPath (string scriptName) + { + string[] path = UnityEditor.AssetDatabase.FindAssets (scriptName); + if (path.Length > 1) + { + // Debug.LogError("有同名文件"+_scriptName+"获取路径失败"); + return null; + } + + //将字符串中得脚本名字和后缀统统去除掉 + string _path = AssetDatabase.GUIDToAssetPath (path[0]).Replace ((@"/" + scriptName + ".cs"), ""); + return _path; + } + + private static bool addNetworkSecurityConfigInApplication (string path) + { +#if UNITY_2019_3_OR_NEWER + var manifestPath = Path.Combine (path, "src/main/AndroidManifest.xml"); +#else + var manifestPath = Path.Combine(path, "unityLibrary/src/main/AndroidManifest.xml"); +#endif + // var manifestPath = Path.Combine(path, "src/main/AndroidManifest.xml"); + XDocument manifest; + try + { + manifest = XDocument.Load (manifestPath); + } +#pragma warning disable 0168 + catch (IOException exception) +#pragma warning restore 0168 + { + return false; + } + + // Get the `manifest` element. + var elementManifest = manifest.Element ("manifest"); + if (elementManifest == null) + { + return false; + } + + var elementApplication = elementManifest.Element ("application"); + if (elementApplication == null) + { + return false; + } + + //这个设置主要是为了适配9.0以上的机器 + // + var usesLibraryElements = elementApplication.Descendants ().Where (element => element.Name.LocalName.Equals ("uses-library")); + XElement httpLegacyElement = GetElementByName (usesLibraryElements, "org.apache.http.legacy"); + if (httpLegacyElement == null) + { + elementApplication.Add (createHttpLegacyElement ()); + } + manifest.Save (manifestPath); + + //handle anythink_network_security_config.xml + XAttribute networkConfigAttribute = elementApplication.Attribute (AndroidNamespace + "networkSecurityConfig"); + if (networkConfigAttribute == null) + { + // networkConfigAttribute.Remove (); + elementApplication.Add (new XAttribute (AndroidNamespace + "networkSecurityConfig", $"@xml/{networkConfigXml}")); + manifest.Save (manifestPath); + return true; + } + + return false; + + } + + public static XElement createHttpLegacyElement () + { + var httpFeautre = new XElement ("uses-library"); + httpFeautre.Add (new XAttribute (AndroidNamespace + "name", "org.apache.http.legacy")); + httpFeautre.Add (new XAttribute (AndroidNamespace + "required", "false")); + + return httpFeautre; + } + + private static XElement GetElementByName (IEnumerable elements, string name) + { + foreach (var element in elements) + { + var attributes = element.Attributes (); + if (attributes.Any (attribute => attribute.Name.Namespace.Equals (AndroidNamespace) + && attribute.Name.LocalName.Equals ("name") + && attribute.Value.Equals (name))) + { + return element; + } + } + + return null; + } + } +} + +#endif \ No newline at end of file diff --git a/Editor/CrashPostProcessBuildAndroid.cs.meta b/Editor/CrashPostProcessBuildAndroid.cs.meta new file mode 100644 index 0000000..9e6d03c --- /dev/null +++ b/Editor/CrashPostProcessBuildAndroid.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3f18dedb872e45c2a275c42c9f7f9e90 +timeCreated: 1712028515 \ No newline at end of file diff --git a/Editor/network_security_config.xml b/Editor/network_security_config.xml new file mode 100644 index 0000000..ffd49da --- /dev/null +++ b/Editor/network_security_config.xml @@ -0,0 +1,7 @@ + + + + + android.bugly.qq.com + + diff --git a/Editor/network_security_config.xml.meta b/Editor/network_security_config.xml.meta new file mode 100644 index 0000000..994b063 --- /dev/null +++ b/Editor/network_security_config.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f8eb860204d25d2499b4051b35d3ab74 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins.meta b/Plugins.meta new file mode 100644 index 0000000..01ea48c --- /dev/null +++ b/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 09f8e7a6d04765546a4f225a1499b330 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins.meta b/Plugins/BuglyPlugins.meta new file mode 100644 index 0000000..dbec11f --- /dev/null +++ b/Plugins/BuglyPlugins.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5cef439187fbb41ab879da2b95ac4291 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Plugins/BuglyPlugins/Android.meta b/Plugins/BuglyPlugins/Android.meta new file mode 100644 index 0000000..45b586c --- /dev/null +++ b/Plugins/BuglyPlugins/Android.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 694411f45e4e64facb88eebfc2e1df1c +folderAsset: yes +DefaultImporter: + userData: diff --git a/Plugins/BuglyPlugins/Android/libs.meta b/Plugins/BuglyPlugins/Android/libs.meta new file mode 100644 index 0000000..fc1fe80 --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab0e0a3ff5e56d2488ab6a3b23fd3b61 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/armeabi-v7a.meta b/Plugins/BuglyPlugins/Android/libs/armeabi-v7a.meta new file mode 100644 index 0000000..3d60b3f --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/armeabi-v7a.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fb7b442d8e32443e5856838741007f70 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/armeabi-v7a/libBugly.so b/Plugins/BuglyPlugins/Android/libs/armeabi-v7a/libBugly.so new file mode 100644 index 0000000..209a553 Binary files /dev/null and b/Plugins/BuglyPlugins/Android/libs/armeabi-v7a/libBugly.so differ diff --git a/Plugins/BuglyPlugins/Android/libs/armeabi-v7a/libBugly.so.meta b/Plugins/BuglyPlugins/Android/libs/armeabi-v7a/libBugly.so.meta new file mode 100644 index 0000000..5085ac1 --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/armeabi-v7a/libBugly.so.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 432060a129574479db0cfd441cdf3d69 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/armeabi.meta b/Plugins/BuglyPlugins/Android/libs/armeabi.meta new file mode 100644 index 0000000..87f8094 --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/armeabi.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 594eacd11ce124d4eaafa7da7b0960e1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/armeabi/libBugly.so b/Plugins/BuglyPlugins/Android/libs/armeabi/libBugly.so new file mode 100644 index 0000000..ee73de4 Binary files /dev/null and b/Plugins/BuglyPlugins/Android/libs/armeabi/libBugly.so differ diff --git a/Plugins/BuglyPlugins/Android/libs/armeabi/libBugly.so.meta b/Plugins/BuglyPlugins/Android/libs/armeabi/libBugly.so.meta new file mode 100644 index 0000000..b318adc --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/armeabi/libBugly.so.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 5b1ab29305b192b4a9e5b8d68cb54fd3 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/bugly-4.1.9.2.aar b/Plugins/BuglyPlugins/Android/libs/bugly-4.1.9.2.aar new file mode 100644 index 0000000..442c8ed Binary files /dev/null and b/Plugins/BuglyPlugins/Android/libs/bugly-4.1.9.2.aar differ diff --git a/Plugins/BuglyPlugins/Android/libs/bugly-4.1.9.2.aar.meta b/Plugins/BuglyPlugins/Android/libs/bugly-4.1.9.2.aar.meta new file mode 100644 index 0000000..7496f3a --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/bugly-4.1.9.2.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 0781c6de80d1d3c4daba0010f99c1ded +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/buglyagent.jar b/Plugins/BuglyPlugins/Android/libs/buglyagent.jar new file mode 100644 index 0000000..b3d5fcf Binary files /dev/null and b/Plugins/BuglyPlugins/Android/libs/buglyagent.jar differ diff --git a/Plugins/BuglyPlugins/Android/libs/buglyagent.jar.meta b/Plugins/BuglyPlugins/Android/libs/buglyagent.jar.meta new file mode 100644 index 0000000..43ee2e7 --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/buglyagent.jar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 1db231dca0f72420cb880590f799d7d5 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/x86.meta b/Plugins/BuglyPlugins/Android/libs/x86.meta new file mode 100644 index 0000000..86f270f --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/x86.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 79531ba82725e4071861c982307805c3 +folderAsset: yes +timeCreated: 1443426231 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/BuglyPlugins/Android/libs/x86/libBugly.so b/Plugins/BuglyPlugins/Android/libs/x86/libBugly.so new file mode 100644 index 0000000..571b120 Binary files /dev/null and b/Plugins/BuglyPlugins/Android/libs/x86/libBugly.so differ diff --git a/Plugins/BuglyPlugins/Android/libs/x86/libBugly.so.meta b/Plugins/BuglyPlugins/Android/libs/x86/libBugly.so.meta new file mode 100644 index 0000000..ddc9370 --- /dev/null +++ b/Plugins/BuglyPlugins/Android/libs/x86/libBugly.so.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 16eaf0ec67588418783d6f5311aa71ce +timeCreated: 1497948394 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 1 + settings: + CPU: x86 + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime.meta b/Runtime.meta new file mode 100644 index 0000000..b969e90 --- /dev/null +++ b/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5a0b159cecc51c4998c390006eee498 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/BuglyAgent.cs b/Runtime/BuglyAgent.cs new file mode 100644 index 0000000..d377458 --- /dev/null +++ b/Runtime/BuglyAgent.cs @@ -0,0 +1,1080 @@ +// ---------------------------------------- +// +// BuglyAgent.cs +// +// Author: +// Yeelik, +// +// Copyright (c) 2015 Bugly, Tencent. All rights reserved. +// +// ---------------------------------------- +// +using UnityEngine; + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; + +using System.Runtime.InteropServices; + +// We dont use the LogType enum in Unity as the numerical order doesnt suit our purposes +/// +/// Log severity. +/// { Log, LogDebug, LogInfo, LogWarning, LogAssert, LogError, LogException } +/// +public enum LogSeverity +{ + Log, + LogDebug, + LogInfo, + LogWarning, + LogAssert, + LogError, + LogException +} + +/// +/// Bugly agent. +/// +public sealed class BuglyAgent +{ + + // Define delegate support multicasting to replace the 'Application.LogCallback' + public delegate void LogCallbackDelegate (string condition,string stackTrace,LogType type); + + /// + /// Configs the type of the crash reporter and customized log level to upload + /// + /// Type. Default=0, 1=Bugly v2.x MSDK=2 + /// Log level. Off=0,Error=1,Warn=2,Info=3,Debug=4 + public static void ConfigCrashReporter(int type, int logLevel){ + _SetCrashReporterType (type); + _SetCrashReporterLogLevel (logLevel); + } + + /// + /// Init sdk with the specified appId. + /// This will initialize sdk to report native exception such as obj-c, c/c++, java exceptions, and also enable c# exception handler to report c# exception logs + /// + /// App identifier. + public static void InitWithAppId (string appId) + { + if (IsInitialized) { + DebugLog (null, "BuglyAgent has already been initialized."); + + return; + } + + if (string.IsNullOrEmpty (appId)) { + return; + } + + // init the sdk with app id + InitBuglyAgent (appId); + DebugLog (null, "Initialized with app id: {0}", appId); + + // Register the LogCallbackHandler by Application.RegisterLogCallback(Application.LogCallback) + _RegisterExceptionHandler (); + } + + /// + /// Only Enable the C# exception handler. + /// + /// + /// You can call it when you do not call the 'InitWithAppId(string)', but you must make sure initialized the sdk in elsewhere, + /// such as the native code in associated Android or iOS project. + /// + /// + /// + /// Default Level is LogError, so the LogError, LogException will auto report. + /// + /// + /// + /// You can call the method BuglyAgent.ConfigAutoReportLogLevel(LogSeverity) + /// to change the level to auto report if you known what are you doing. + /// + /// + /// + public static void EnableExceptionHandler () + { + if (IsInitialized) { + DebugLog (null, "BuglyAgent has already been initialized."); + return; + } + + DebugLog (null, "Only enable the exception handler, please make sure you has initialized the sdk in the native code in associated Android or iOS project."); + + // Register the LogCallbackHandler by Application.RegisterLogCallback(Application.LogCallback) + _RegisterExceptionHandler (); + } + + /// + /// Registers the log callback handler. + /// + /// If you need register logcallback using Application.RegisterLogCallback(LogCallback), + /// you can call this method to replace it. + /// + /// + /// + /// Handler. + public static void RegisterLogCallback (LogCallbackDelegate handler) + { + if (handler != null) { + DebugLog (null, "Add log callback handler: {0}", handler); + + _LogCallbackEventHandler += handler; + } + } + + /// + /// Sets the log callback extras handler. + /// + /// Handler. + public static void SetLogCallbackExtrasHandler(Func> handler){ + if (handler != null) { + _LogCallbackExtrasHandler = handler; + + DebugLog(null, "Add log callback extra data handler : {0}", handler); + } + } + + /// + /// Reports the exception. + /// + /// E. + /// Message. + public static void ReportException (System.Exception e, string message) + { + if (!IsInitialized) { + return; + } + + DebugLog (null, "Report exception: {0}\n------------\n{1}\n------------", message, e); + + _HandleException (e, message, false); + } + + /// + /// Reports the exception. + /// + /// Name. + /// Message. + /// Stack trace. + public static void ReportException (string name, string message, string stackTrace) + { + if (!IsInitialized) { + return; + } + + DebugLog (null, "Report exception: {0} {1} \n{2}", name, message, stackTrace); + + _HandleException (LogSeverity.LogException, name, message, stackTrace, false); + } + + /// + /// Unregisters the log callback. + /// + /// Handler. + public static void UnregisterLogCallback (LogCallbackDelegate handler) + { + if (handler != null) { + DebugLog (null, "Remove log callback handler"); + + _LogCallbackEventHandler -= handler; + } + } + + /// + /// Sets the user identifier. + /// + /// User identifier. + public static void SetUserId (string userId) + { + if (!IsInitialized) { + return; + } + DebugLog (null, "Set user id: {0}", userId); + + SetUserInfo (userId); + } + + /// + /// Sets the scene. + /// + /// Scene identifier. + public static void SetScene (int sceneId) + { + if (!IsInitialized) { + return; + } + DebugLog (null, "Set scene: {0}", sceneId); + + SetCurrentScene (sceneId); + } + + /// + /// Adds the scene data. + /// + /// Key. + /// Value. + public static void AddSceneData (string key, string value) + { + if (!IsInitialized) { + return; + } + + DebugLog (null, "Add scene data: [{0}, {1}]", key, value); + + AddKeyAndValueInScene (key, value); + } + + /// + /// Configs the debug mode. + /// + /// If set to true debug mode. + public static void ConfigDebugMode (bool enable) + { + EnableDebugMode (enable); + DebugLog (null, "{0} the log message print to console", enable ? "Enable" : "Disable"); + } + + /// + /// Configs the auto quit application. + /// + /// If set to true auto quit. + public static void ConfigAutoQuitApplication (bool autoQuit) + { + _autoQuitApplicationAfterReport = autoQuit; + } + + /// + /// Configs the auto report log level. Default is LogSeverity.LogError. + /// + /// LogSeverity { Log, LogDebug, LogInfo, LogWarning, LogAssert, LogError, LogException } + /// + /// + /// + /// Level. + public static void ConfigAutoReportLogLevel (LogSeverity level) + { + _autoReportLogLevel = level; + } + + /// + /// Configs the default. + /// + /// Channel. + /// Version. + /// User. + /// Delay. + public static void ConfigDefault (string channel, string version, string user, long delay) + { + DebugLog (null, "Config default channel:{0}, version:{1}, user:{2}, delay:{3}", channel, version, user, delay); + ConfigDefaultBeforeInit (channel, version, user, delay); + } + + /// + /// Logs the debug. + /// + /// Tag. + /// Format. + /// Arguments. + public static void DebugLog (string tag, string format, params object[] args) + { + if(!_debugMode) { + return; + } + + if (string.IsNullOrEmpty (format)) { + return; + } + + Console.WriteLine ("[BuglyAgent] - {0} : {1}", tag, string.Format (format, args)); + } + + /// + /// Prints the log. + /// + /// Level. + /// Format. + /// Arguments. + public static void PrintLog (LogSeverity level, string format, params object[] args) + { + if (string.IsNullOrEmpty (format)) { + return; + } + + LogRecord (level, string.Format (format, args)); + } + + #if UNITY_EDITOR || UNITY_STANDALONE + + #region Interface(Empty) in Editor + private static void InitBuglyAgent (string appId) + { + } + + private static void ConfigDefaultBeforeInit(string channel, string version, string user, long delay){ + } + + private static void EnableDebugMode(bool enable){ + } + + private static void SetUserInfo(string userInfo){ + } + + private static void ReportException (int type,string name, string message, string stackTrace, bool quitProgram) + { + } + + private static void SetCurrentScene(int sceneId) { + } + + private static void AddKeyAndValueInScene(string key, string value){ + } + + private static void AddExtraDataWithException(string key, string value) { + // only impl for iOS + } + + private static void LogRecord(LogSeverity level, string message){ + } + + private static void SetUnityVersion(){ + + } + #endregion + + #elif UNITY_ANDROID + // #if UNITY_ANDROID + + #region Interface for Android + private static readonly string GAME_AGENT_CLASS = "com.tencent.bugly.agent.GameAgent"; + private static readonly int TYPE_U3D_CRASH = 4; + private static readonly int GAME_TYPE_UNITY = 2; + private static bool hasSetGameType = false; + private static AndroidJavaClass _gameAgentClass = null; + + public static AndroidJavaClass GameAgent { + get { + if (_gameAgentClass == null) { + _gameAgentClass = new AndroidJavaClass(GAME_AGENT_CLASS); +// using (AndroidJavaClass clazz = new AndroidJavaClass(CLASS_UNITYAGENT)) { +// _gameAgentClass = clazz.CallStatic ("getInstance"); +// } + } + if (!hasSetGameType) { + // set game type: unity(2). + _gameAgentClass.CallStatic ("setGameType", GAME_TYPE_UNITY); + hasSetGameType = true; + } + return _gameAgentClass; + } + } + + private static string _configChannel; + private static string _configVersion; + private static string _configUser; + private static long _configDelayTime; + + private static void ConfigDefaultBeforeInit(string channel, string version, string user, long delay){ + _configChannel = channel; + _configVersion = version; + _configUser = user; + _configDelayTime = delay; + } + + private static bool _configCrashReporterPackage = false; + + private static void ConfigCrashReporterPackage(){ + + if (!_configCrashReporterPackage) { + try { + GameAgent.CallStatic("setSdkPackageName", _crashReporterPackage); + _configCrashReporterPackage = true; + } catch { + + } + } + + } + + private static void InitBuglyAgent(string appId) + { + if (IsInitialized) { + return; + } + + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("initCrashReport", appId, _configChannel, _configVersion, _configUser, _configDelayTime); + _isInitialized = true; + } catch { + + } + } + + private static void EnableDebugMode(bool enable){ + _debugMode = enable; + + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("setLogEnable", enable); + } catch { + + } + } + + private static void SetUserInfo(string userInfo){ + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("setUserId", userInfo); + } catch { + } + } + + private static void ReportException (int type, string name, string reason, string stackTrace, bool quitProgram) + { + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("postException", TYPE_U3D_CRASH, name, reason, stackTrace, quitProgram); + } catch { + + } + } + + private static void SetCurrentScene(int sceneId) { + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("setUserSceneTag", sceneId); + } catch { + + } + } + + private static void SetUnityVersion(){ + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("setSdkConfig", "UnityVersion", Application.unityVersion); + } catch { + + } + } + + private static void AddKeyAndValueInScene(string key, string value){ + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("putUserData", key, value); + } catch { + + } + } + + private static void AddExtraDataWithException(string key, string value) { + // no impl + } + + private static void LogRecord(LogSeverity level, string message){ + if (level < LogSeverity.LogWarning) { + DebugLog (level.ToString (), message); + } + + ConfigCrashReporterPackage(); + + try { + GameAgent.CallStatic("printLog", string.Format ("<{0}> - {1}", level.ToString (), message)); + } catch { + + } + } + + #endregion + + #elif UNITY_IPHONE || UNITY_IOS + + #region Interface for iOS + + private static bool _crashReporterTypeConfiged = false; + + private static void ConfigCrashReporterType(){ + if (!_crashReporterTypeConfiged) { + try { + _BuglyConfigCrashReporterType(_crashReporterType); + _crashReporterTypeConfiged = true; + } catch { + + } + } + } + + private static void ConfigDefaultBeforeInit(string channel, string version, string user, long delay){ + ConfigCrashReporterType(); + + try { + _BuglyDefaultConfig(channel, version, user, null); + } catch { + + } + } + + private static void EnableDebugMode(bool enable){ + _debugMode = enable; + } + + private static void InitBuglyAgent (string appId) + { + ConfigCrashReporterType(); + + if(!string.IsNullOrEmpty(appId)) { + + _BuglyInit(appId, _debugMode, _crashReproterCustomizedLogLevel); // Log level + } + } + + private static void SetUnityVersion(){ + ConfigCrashReporterType(); + + _BuglySetExtraConfig("UnityVersion", Application.unityVersion); + } + + private static void SetUserInfo(string userInfo){ + if(!string.IsNullOrEmpty(userInfo)) { + ConfigCrashReporterType(); + + _BuglySetUserId(userInfo); + } + } + + private static void ReportException (int type, string name, string reason, string stackTrace, bool quitProgram) + { + ConfigCrashReporterType(); + + string extraInfo = ""; + Dictionary extras = null; + if (_LogCallbackExtrasHandler != null) { + extras = _LogCallbackExtrasHandler(); + } + if (extras == null || extras.Count == 0) { + extras = new Dictionary (); + extras.Add ("UnityVersion", Application.unityVersion); + } + + if (extras != null && extras.Count > 0) { + if (!extras.ContainsKey("UnityVersion")) { + extras.Add ("UnityVersion", Application.unityVersion); + } + + StringBuilder builder = new StringBuilder(); + foreach(KeyValuePair kvp in extras){ + builder.Append(string.Format("\"{0}\" : \"{1}\"", kvp.Key, kvp.Value)).Append(" , "); + } + extraInfo = string.Format("{{ {0} }}", builder.ToString().TrimEnd(" , ".ToCharArray())); + } + + // 4 is C# exception + _BuglyReportException(4, name, reason, stackTrace, extraInfo, quitProgram); + } + + private static void SetCurrentScene(int sceneId) { + ConfigCrashReporterType(); + + _BuglySetTag(sceneId); + } + + private static void AddKeyAndValueInScene(string key, string value){ + ConfigCrashReporterType(); + + _BuglySetKeyValue(key, value); + } + + private static void AddExtraDataWithException(string key, string value) { + + } + + private static void LogRecord(LogSeverity level, string message){ + if (level < LogSeverity.LogWarning) { + DebugLog (level.ToString (), message); + } + + ConfigCrashReporterType(); + + _BuglyLogMessage(LogSeverityToInt(level), null, message); + } + + private static int LogSeverityToInt(LogSeverity logLevel){ + int level = 5; + switch(logLevel) { + case LogSeverity.Log: + level = 5; + break; + case LogSeverity.LogDebug: + level = 4; + break; + case LogSeverity.LogInfo: + level = 3; + break; + case LogSeverity.LogWarning: + case LogSeverity.LogAssert: + level = 2; + break; + case LogSeverity.LogError: + case LogSeverity.LogException: + level = 1; + break; + default: + level = 0; + break; + } + return level; + } + + // --- dllimport start --- + [DllImport("__Internal")] + private static extern void _BuglyInit(string appId, bool debug, int level); + + [DllImport("__Internal")] + private static extern void _BuglySetUserId(string userId); + + [DllImport("__Internal")] + private static extern void _BuglySetTag(int tag); + + [DllImport("__Internal")] + private static extern void _BuglySetKeyValue(string key, string value); + + [DllImport("__Internal")] + private static extern void _BuglyReportException(int type, string name, string reason, string stackTrace, string extras, bool quit); + + [DllImport("__Internal")] + private static extern void _BuglyDefaultConfig(string channel, string version, string user, string deviceId); + + [DllImport("__Internal")] + private static extern void _BuglyLogMessage(int level, string tag, string log); + + [DllImport("__Internal")] + private static extern void _BuglyConfigCrashReporterType(int type); + + [DllImport("__Internal")] + private static extern void _BuglySetExtraConfig(string key, string value); + + // dllimport end + #endregion + + #endif + + #region Privated Fields and Methods + private static event LogCallbackDelegate _LogCallbackEventHandler; + + private static bool _isInitialized = false; + private static LogSeverity _autoReportLogLevel = LogSeverity.LogError; + + private static int _crashReporterType = 1; // Default=0,1=Bugly-V2,MSDKBugly=2, IMSDKBugly=3 + +#if UNITY_ANDROID + // The crash reporter package name, default is 'com.tencent.bugly' + private static string _crashReporterPackage = "com.tencent.bugly"; +#endif +#if UNITY_IPHONE || UNITY_IOS + private static int _crashReproterCustomizedLogLevel = 2; // Off=0,Error=1,Warn=2,Info=3,Debug=4 +#endif + + #pragma warning disable 414 + private static bool _debugMode = false; + private static bool _autoQuitApplicationAfterReport = false; + + private static readonly int EXCEPTION_TYPE_UNCAUGHT = 1; + private static readonly int EXCEPTION_TYPE_CAUGHT = 2; + private static readonly string _pluginVersion = "1.5.1"; + + private static Func> _LogCallbackExtrasHandler; + + public static string PluginVersion { + get { return _pluginVersion; } + } + + public static bool IsInitialized { + get { return _isInitialized; } + } + + public static bool AutoQuitApplicationAfterReport { + get { return _autoQuitApplicationAfterReport; } + } + + private static void _SetCrashReporterType(int type){ + _crashReporterType = type; + + if (_crashReporterType == 2) { +#if UNITY_ANDROID + _crashReporterPackage = "com.tencent.bugly.msdk"; +#endif + } + + } + + private static void _SetCrashReporterLogLevel(int logLevel){ +#if UNITY_IPHONE || UNITY_IOS + _crashReproterCustomizedLogLevel = logLevel; +#endif + } + + private static void _RegisterExceptionHandler () + { + try { + // hold only one instance + + #if UNITY_5 + Application.logMessageReceived += _OnLogCallbackHandler; + #else + Application.RegisterLogCallback (_OnLogCallbackHandler); + #endif + AppDomain.CurrentDomain.UnhandledException += _OnUncaughtExceptionHandler; + + _isInitialized = true; + + DebugLog (null, "Register the log callback in Unity {0}", Application.unityVersion); + } catch { + + } + + SetUnityVersion (); + } + + private static void _UnregisterExceptionHandler () + { + try { + #if UNITY_5 + Application.logMessageReceived -= _OnLogCallbackHandler; + #else + Application.RegisterLogCallback (null); + #endif + System.AppDomain.CurrentDomain.UnhandledException -= _OnUncaughtExceptionHandler; + DebugLog (null, "Unregister the log callback in unity {0}", Application.unityVersion); + } catch { + + } + } + + private static void _OnLogCallbackHandler (string condition, string stackTrace, LogType type) + { + if (_LogCallbackEventHandler != null) { + _LogCallbackEventHandler (condition, stackTrace, type); + } + + if (!IsInitialized) { + return; + } + + if (!string.IsNullOrEmpty (condition) && condition.Contains ("[BuglyAgent] ")) { + return; + } + + if (_uncaughtAutoReportOnce) { + return; + } + + // convert the log level + LogSeverity logLevel = LogSeverity.Log; + switch (type) { + case LogType.Exception: + logLevel = LogSeverity.LogException; + break; + case LogType.Error: + logLevel = LogSeverity.LogError; + break; + case LogType.Assert: + logLevel = LogSeverity.LogAssert; + break; + case LogType.Warning: + logLevel = LogSeverity.LogWarning; + break; + case LogType.Log: + logLevel = LogSeverity.LogDebug; + break; + default: + break; + } + + if (LogSeverity.Log == logLevel) { + return; + } + + _HandleException (logLevel, null, condition, stackTrace, true); + } + + private static void _OnUncaughtExceptionHandler (object sender, System.UnhandledExceptionEventArgs args) + { + if (args == null || args.ExceptionObject == null) { + return; + } + + try { + if (args.ExceptionObject.GetType () != typeof(System.Exception)) { + return; + } + } catch { + if (UnityEngine.Debug.isDebugBuild == true) { + UnityEngine.Debug.Log ("BuglyAgent: Failed to report uncaught exception"); + } + + return; + } + + if (!IsInitialized) { + return; + } + + if (_uncaughtAutoReportOnce) { + return; + } + + _HandleException ((System.Exception)args.ExceptionObject, null, true); + } + + private static void _HandleException (System.Exception e, string message, bool uncaught) + { + if (e == null) { + return; + } + + if (!IsInitialized) { + return; + } + + string name = e.GetType ().Name; + string reason = e.Message; + + if (!string.IsNullOrEmpty (message)) { + reason = string.Format ("{0}{1}***{2}", reason, Environment.NewLine, message); + } + + StringBuilder stackTraceBuilder = new StringBuilder (""); + + StackTrace stackTrace = new StackTrace (e, true); + int count = stackTrace.FrameCount; + for (int i = 0; i < count; i++) { + StackFrame frame = stackTrace.GetFrame (i); + + stackTraceBuilder.AppendFormat ("{0}.{1}", frame.GetMethod ().DeclaringType.Name, frame.GetMethod ().Name); + + ParameterInfo[] parameters = frame.GetMethod ().GetParameters (); + if (parameters == null || parameters.Length == 0) { + stackTraceBuilder.Append (" () "); + } else { + stackTraceBuilder.Append (" ("); + + int pcount = parameters.Length; + + ParameterInfo param = null; + for (int p = 0; p < pcount; p++) { + param = parameters [p]; + stackTraceBuilder.AppendFormat ("{0} {1}", param.ParameterType.Name, param.Name); + + if (p != pcount - 1) { + stackTraceBuilder.Append (", "); + } + } + param = null; + + stackTraceBuilder.Append (") "); + } + + string fileName = frame.GetFileName (); + if (!string.IsNullOrEmpty (fileName) && !fileName.ToLower ().Equals ("unknown")) { + fileName = fileName.Replace ("\\", "/"); + + int loc = fileName.ToLower ().IndexOf ("/assets/"); + if (loc < 0) { + loc = fileName.ToLower ().IndexOf ("assets/"); + } + + if (loc > 0) { + fileName = fileName.Substring (loc); + } + + stackTraceBuilder.AppendFormat ("(at {0}:{1})", fileName, frame.GetFileLineNumber ()); + } + stackTraceBuilder.AppendLine (); + } + + // report + _reportException (uncaught, name, reason, stackTraceBuilder.ToString ()); + } + + private static void _reportException (bool uncaught, string name, string reason, string stackTrace) + { + if (string.IsNullOrEmpty (name)) { + return; + } + + if (string.IsNullOrEmpty (stackTrace)) { + stackTrace = StackTraceUtility.ExtractStackTrace (); + } + + if (string.IsNullOrEmpty (stackTrace)) { + stackTrace = "Empty"; + } else { + + try { + string[] frames = stackTrace.Split ('\n'); + + if (frames != null && frames.Length > 0) { + + StringBuilder trimFrameBuilder = new StringBuilder (); + + string frame = null; + int count = frames.Length; + for (int i = 0; i < count; i++) { + frame = frames [i]; + + if (string.IsNullOrEmpty (frame) || string.IsNullOrEmpty (frame.Trim ())) { + continue; + } + + frame = frame.Trim (); + + // System.Collections.Generic + if (frame.StartsWith ("System.Collections.Generic.") || frame.StartsWith ("ShimEnumerator")) { + continue; + } + if (frame.StartsWith ("Bugly")) { + continue; + } + if (frame.Contains ("..ctor")) { + continue; + } + + int start = frame.ToLower ().IndexOf ("(at"); + int end = frame.ToLower ().IndexOf ("/assets/"); + + if (start > 0 && end > 0) { + trimFrameBuilder.AppendFormat ("{0}(at {1}", frame.Substring (0, start).Replace (":", "."), frame.Substring (end)); + } else { + trimFrameBuilder.Append (frame.Replace (":", ".")); + } + + trimFrameBuilder.AppendLine (); + } + + stackTrace = trimFrameBuilder.ToString (); + } + } catch { + PrintLog(LogSeverity.LogWarning,"{0}", "Error to parse the stack trace"); + } + + } + + PrintLog (LogSeverity.LogError, "ReportException: {0} {1}\n*********\n{2}\n*********", name, reason, stackTrace); + + _uncaughtAutoReportOnce = uncaught && _autoQuitApplicationAfterReport; + + ReportException (uncaught ? EXCEPTION_TYPE_UNCAUGHT : EXCEPTION_TYPE_CAUGHT, name, reason, stackTrace, uncaught && _autoQuitApplicationAfterReport); + } + + private static void _HandleException (LogSeverity logLevel, string name, string message, string stackTrace, bool uncaught) + { + if (!IsInitialized) { + DebugLog (null, "It has not been initialized."); + return; + } + + if (logLevel == LogSeverity.Log) { + return; + } + + if ((uncaught && logLevel < _autoReportLogLevel)) { + DebugLog (null, "Not report exception for level {0}", logLevel.ToString ()); + return; + } + + string type = null; + string reason = null; + + if (!string.IsNullOrEmpty (message)) { + try { + if ((LogSeverity.LogException == logLevel) && message.Contains ("Exception")) { + + Match match = new Regex (@"^(?\S+):\s*(?.*)", RegexOptions.Singleline).Match (message); + + if (match.Success) { + type = match.Groups ["errorType"].Value.Trim(); + reason = match.Groups ["errorMessage"].Value.Trim (); + } + } else if ((LogSeverity.LogError == logLevel) && message.StartsWith ("Unhandled Exception:")) { + + Match match = new Regex (@"^Unhandled\s+Exception:\s*(?\S+):\s*(?.*)", RegexOptions.Singleline).Match(message); + + if (match.Success) { + string exceptionName = match.Groups ["exceptionName"].Value.Trim(); + string exceptionDetail = match.Groups ["exceptionDetail"].Value.Trim (); + + // + int dotLocation = exceptionName.LastIndexOf("."); + if (dotLocation > 0 && dotLocation != exceptionName.Length) { + type = exceptionName.Substring(dotLocation + 1); + } else { + type = exceptionName; + } + + int stackLocation = exceptionDetail.IndexOf(" at "); + if (stackLocation > 0) { + // + reason = exceptionDetail.Substring(0, stackLocation); + // substring after " at " + string callStacks = exceptionDetail.Substring(stackLocation + 3).Replace(" at ", "\n").Replace("in :0","").Replace("[0x00000]",""); + // + stackTrace = string.Format("{0}\n{1}", stackTrace, callStacks.Trim()); + + } else { + reason = exceptionDetail; + } + + // for LuaScriptException + if(type.Equals("LuaScriptException") && exceptionDetail.Contains(".lua") && exceptionDetail.Contains("stack traceback:")) { + stackLocation = exceptionDetail.IndexOf("stack traceback:"); + if(stackLocation > 0) { + reason = exceptionDetail.Substring(0, stackLocation); + // substring after "stack traceback:" + string callStacks = exceptionDetail.Substring(stackLocation + 16).Replace(" [", " \n["); + + // + stackTrace = string.Format("{0}\n{1}", stackTrace, callStacks.Trim()); + } + } + } + + } + } catch { + + } + + if (string.IsNullOrEmpty (reason)) { + reason = message; + } + } + + if (string.IsNullOrEmpty (name)) { + if (string.IsNullOrEmpty (type)) { + type = string.Format ("Unity{0}", logLevel.ToString ()); + } + } else { + type = name; + } + + _reportException (uncaught, type, reason, stackTrace); + } + + private static bool _uncaughtAutoReportOnce = false; + + #endregion + +} \ No newline at end of file diff --git a/Runtime/BuglyAgent.cs.meta b/Runtime/BuglyAgent.cs.meta new file mode 100644 index 0000000..20a57a0 --- /dev/null +++ b/Runtime/BuglyAgent.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be621fe31508b4f2ab134ee879ec97b4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Runtime/BuglyCallback.cs b/Runtime/BuglyCallback.cs new file mode 100644 index 0000000..77c70c6 --- /dev/null +++ b/Runtime/BuglyCallback.cs @@ -0,0 +1,27 @@ +// ---------------------------------------- +// +// BuglyCallbackDelegate.cs +// +// Author: +// Yeelik, +// +// Copyright (c) 2015 Bugly, Tencent. All rights reserved. +// +// ---------------------------------------- +// +using UnityEngine; +using System.Collections; + +public abstract class BuglyCallback +{ + // The delegate of callback handler which Call the Application.RegisterLogCallback(Application.LogCallback) + /// + /// Raises the application log callback handler event. + /// + /// Condition. + /// Stack trace. + /// Type. + public abstract void OnApplicationLogCallbackHandler (string condition, string stackTrace, LogType type); + +} + diff --git a/Runtime/BuglyCallback.cs.meta b/Runtime/BuglyCallback.cs.meta new file mode 100644 index 0000000..a61dcf3 --- /dev/null +++ b/Runtime/BuglyCallback.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 78e76f643d1884dcab602d5fe79b08e1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Runtime/BuglyInit.cs b/Runtime/BuglyInit.cs new file mode 100644 index 0000000..ff6b5a7 --- /dev/null +++ b/Runtime/BuglyInit.cs @@ -0,0 +1,80 @@ +// ---------------------------------------- +// +// BuglyInit.cs +// +// Author: +// Yeelik, +// +// Copyright (c) 2015 Bugly, Tencent. All rights reserved. +// +// ---------------------------------------- +// +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +public class BuglyInit : MonoBehaviour +{ + /// + /// Your Bugly App ID. Every app has a special identifier that allows Bugly to associate error monitoring data with your app. + /// Your App ID can be found on the "Setting" page of the app you are trying to monitor. + /// + /// A real App ID looks like this: 90000xxxx + private const string BuglyAppID = "YOUR APP ID GOES HERE"; + + void Awake () + { + // Enable the debug log print + BuglyAgent.ConfigDebugMode (false); + // Config default channel, version, user + BuglyAgent.ConfigDefault (null, null, null, 0); + // Config auto report log level, default is LogSeverity.LogError, so the LogError, LogException log will auto report + BuglyAgent.ConfigAutoReportLogLevel (LogSeverity.LogError); + // Config auto quit the application make sure only the first one c# exception log will be report, please don't set TRUE if you do not known what are you doing. + BuglyAgent.ConfigAutoQuitApplication (false); + // If you need register Application.RegisterLogCallback(LogCallback), you can replace it with this method to make sure your function is ok. + BuglyAgent.RegisterLogCallback (null); + + // Init the bugly sdk and enable the c# exception handler. + BuglyAgent.InitWithAppId (BuglyAppID); + + // TODO 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 (); + + // TODO NOT Required. If you need to report extra data with exception, you can set the extra handler + BuglyAgent.SetLogCallbackExtrasHandler (MyLogCallbackExtrasHandler); + + Destroy (this); + } + + // Extra data handler to packet data and report them with exception. + // Please do not do hard work in this handler + static Dictionary MyLogCallbackExtrasHandler () + { + // TODO Test log, please do not copy it + BuglyAgent.PrintLog (LogSeverity.Log, "extra handler"); + + // TODO Sample code, please do not copy it + Dictionary extras = new Dictionary (); + extras.Add ("ScreenSolution", string.Format ("{0}x{1}", Screen.width, Screen.height)); + extras.Add ("deviceModel", SystemInfo.deviceModel); + extras.Add ("deviceName", SystemInfo.deviceName); + extras.Add ("deviceType", SystemInfo.deviceType.ToString ()); + + extras.Add ("deviceUId", SystemInfo.deviceUniqueIdentifier); + extras.Add ("gDId", string.Format ("{0}", SystemInfo.graphicsDeviceID)); + extras.Add ("gDName", SystemInfo.graphicsDeviceName); + extras.Add ("gDVdr", SystemInfo.graphicsDeviceVendor); + extras.Add ("gDVer", SystemInfo.graphicsDeviceVersion); + extras.Add ("gDVdrID", string.Format ("{0}", SystemInfo.graphicsDeviceVendorID)); + + extras.Add ("graphicsMemorySize", string.Format ("{0}", SystemInfo.graphicsMemorySize)); + extras.Add ("systemMemorySize", string.Format ("{0}", SystemInfo.systemMemorySize)); + extras.Add ("UnityVersion", Application.unityVersion); + + BuglyAgent.PrintLog (LogSeverity.LogInfo, "Package extra data"); + return extras; + } +} + diff --git a/Runtime/BuglyInit.cs.meta b/Runtime/BuglyInit.cs.meta new file mode 100644 index 0000000..4c6c0ff --- /dev/null +++ b/Runtime/BuglyInit.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a717f6955eddf4463ad541714a1b5483 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Runtime/CrashConfig.cs b/Runtime/CrashConfig.cs new file mode 100644 index 0000000..7984b97 --- /dev/null +++ b/Runtime/CrashConfig.cs @@ -0,0 +1,91 @@ +using System; +using System.IO; +using UnityEngine; + +namespace Runtime +{ + [CreateAssetMenu (menuName = "CrashConfig")] + public class CrashConfig : ScriptableObject + { + private const string BuglyGUID = "BuglyGUID"; + + [SerializeField] private string BuglyAppID; + [SerializeField] private string BuglyChannel; + [SerializeField] private bool HasDebugMode; + [SerializeField] private bool EnableCrashReport; + public event Action LogCallbackEvent; + public bool HasInit => this._hasInit; + + private bool _hasInit; + private static CrashConfig _instance; + + private static CrashConfig Instance + { + get + { + if (_instance == null) + { + _instance = Resources.Load (nameof(CrashConfig)); + } +#if UNITY_EDITOR + if (_instance == null) + { + _instance = CreateInstance (); + // 自定义资源保存路径 + string path = "Assets/Resources"; + //如果项目总不包含该路径,创建一个 + if (!Directory.Exists (path)) + { + Directory.CreateDirectory (path); + } + UnityEditor.AssetDatabase.CreateAsset (_instance, path + $"/{nameof(CrashConfig)}.asset"); + UnityEditor.AssetDatabase.Refresh (); + } +#endif + return _instance; + } + } + + [RuntimeInitializeOnLoadMethod (RuntimeInitializeLoadType.AfterSceneLoad)] + private static void OnEnableCrashReport () + { + if (Instance != null && Instance.EnableCrashReport) + { + Instance.InitCrash (); + } + } + + private void InitCrash () + { + if (this._hasInit) + { + return; + } + + this._hasInit = true; + var buglyGuid = PlayerPrefs.HasKey (BuglyGUID) ? PlayerPrefs.GetString (BuglyGUID) : Guid.NewGuid ().ToString (); + PlayerPrefs.SetString (BuglyGUID, buglyGuid); + + // 开启SDK的日志打印,发布版本请务必关闭 + if (this.HasDebugMode) + { + BuglyAgent.ConfigDebugMode (true); + } + + // 注册日志回调,替换使用 'Application.RegisterLogCallback(Application.LogCallback)'注册日志回调的方式 + BuglyAgent.RegisterLogCallback (OnLogCallBack); + + BuglyAgent.ConfigDefault (this.BuglyChannel, Application.version , buglyGuid , 0); + + BuglyAgent.InitWithAppId (this.BuglyAppID); + + // 如果你确认已在对应的iOS工程或Android工程中初始化SDK,那么在脚本中只需启动C#异常捕获上报功能即可 + BuglyAgent.EnableExceptionHandler (); + } + + private void OnLogCallBack (string condition, string stacktrace, LogType type) + { + this.LogCallbackEvent?.Invoke (condition, stacktrace, type); + } + } +} \ No newline at end of file diff --git a/Runtime/CrashConfig.cs.meta b/Runtime/CrashConfig.cs.meta new file mode 100644 index 0000000..a853a01 --- /dev/null +++ b/Runtime/CrashConfig.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 629b16a8ebee41a2b7e74748deb97933 +timeCreated: 1712026840 \ No newline at end of file diff --git a/Runtime/CrashRuntime.asmdef b/Runtime/CrashRuntime.asmdef new file mode 100644 index 0000000..6b51421 --- /dev/null +++ b/Runtime/CrashRuntime.asmdef @@ -0,0 +1,3 @@ +{ + "name": "CrashRuntime" +} diff --git a/Runtime/CrashRuntime.asmdef.meta b/Runtime/CrashRuntime.asmdef.meta new file mode 100644 index 0000000..7a26c50 --- /dev/null +++ b/Runtime/CrashRuntime.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 65e2e7312783df74897ad85f7b1afc1c +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scenes.meta b/Scenes.meta new file mode 100644 index 0000000..7fe8e10 --- /dev/null +++ b/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 131a6b21c8605f84396be9f6751fb6e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scenes/SampleScene.unity b/Scenes/SampleScene.unity new file mode 100644 index 0000000..f931d62 --- /dev/null +++ b/Scenes/SampleScene.unity @@ -0,0 +1,1035 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &161591347 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 161591351} + - component: {fileID: 161591350} + - component: {fileID: 161591349} + - component: {fileID: 161591348} + - component: {fileID: 161591352} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &161591348 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161591347} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &161591349 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161591347} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &161591350 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161591347} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 519420031} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &161591351 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161591347} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 801322814} + - {fileID: 1161226897} + - {fileID: 1033092919} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &161591352 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161591347} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c675d2e692371d4c96ff83aac4144ce, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &180057926 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 180057929} + - component: {fileID: 180057928} + - component: {fileID: 180057927} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &180057927 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 180057926} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &180057928 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 180057926} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &180057929 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 180057926} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &519420028 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 519420032} + - component: {fileID: 519420031} + - component: {fileID: 519420029} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &519420029 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 +--- !u!20 &519420031 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 0 + m_HDR: 1 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &519420032 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &759411393 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 759411394} + - component: {fileID: 759411396} + - component: {fileID: 759411395} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &759411394 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 759411393} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1161226897} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &759411395 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 759411393} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6D4B\u8BD5\u65E5\u5FD7" +--- !u!222 &759411396 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 759411393} + m_CullTransparentMesh: 1 +--- !u!1 &801322813 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 801322814} + - component: {fileID: 801322817} + - component: {fileID: 801322816} + - component: {fileID: 801322815} + m_Layer: 5 + m_Name: Button (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &801322814 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 801322813} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 815225328} + m_Father: {fileID: 161591351} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -223.00002, y: 0} + m_SizeDelta: {x: 160, y: 142.3114} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &801322815 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 801322813} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 801322816} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 161591352} + m_TargetAssemblyTypeName: SampleTest, Assembly-CSharp + m_MethodName: Test1 + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &801322816 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 801322813} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &801322817 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 801322813} + m_CullTransparentMesh: 1 +--- !u!1 &815225327 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 815225328} + - component: {fileID: 815225330} + - component: {fileID: 815225329} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &815225328 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 815225327} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 801322814} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &815225329 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 815225327} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6D4B\u8BD5\u5D29\u6E83" +--- !u!222 &815225330 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 815225327} + m_CullTransparentMesh: 1 +--- !u!1 &1033092918 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1033092919} + - component: {fileID: 1033092922} + - component: {fileID: 1033092921} + - component: {fileID: 1033092920} + m_Layer: 5 + m_Name: Button (Legacy) (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1033092919 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1033092918} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1186451766} + m_Father: {fileID: 161591351} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 226, y: 0} + m_SizeDelta: {x: 160, y: 142.3114} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1033092920 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1033092918} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1033092921} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 161591352} + m_TargetAssemblyTypeName: SampleTest, Assembly-CSharp + m_MethodName: Test3 + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &1033092921 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1033092918} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1033092922 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1033092918} + m_CullTransparentMesh: 1 +--- !u!1 &1161226896 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1161226897} + - component: {fileID: 1161226900} + - component: {fileID: 1161226899} + - component: {fileID: 1161226898} + m_Layer: 5 + m_Name: Button (Legacy) (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1161226897 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1161226896} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 759411394} + m_Father: {fileID: 161591351} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.000015259, y: 0} + m_SizeDelta: {x: 160, y: 142.3114} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1161226898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1161226896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1161226899} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 161591352} + m_TargetAssemblyTypeName: SampleTest, Assembly-CSharp + m_MethodName: Test2 + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &1161226899 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1161226896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1161226900 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1161226896} + m_CullTransparentMesh: 1 +--- !u!1 &1186451765 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1186451766} + - component: {fileID: 1186451768} + - component: {fileID: 1186451767} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1186451766 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1186451765} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1033092919} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1186451767 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1186451765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6D4B\u8BD5\u9519\u8BEF" +--- !u!222 &1186451768 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1186451765} + m_CullTransparentMesh: 1 diff --git a/Scenes/SampleScene.unity.meta b/Scenes/SampleScene.unity.meta new file mode 100644 index 0000000..c1e3c88 --- /dev/null +++ b/Scenes/SampleScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2cda990e2423bbf4892e6590ba056729 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scenes/SampleTest.cs b/Scenes/SampleTest.cs new file mode 100644 index 0000000..d2e39a2 --- /dev/null +++ b/Scenes/SampleTest.cs @@ -0,0 +1,33 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Diagnostics; + +public class SampleTest : MonoBehaviour +{ + + public void Test1 () + { + // //获取Unity的Activity Class + // using (var activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) + // { + // //获取对应的实例化对象,这两句都是固定写法 + // using (var activityContext = activityClass.GetStatic("currentActivity")) + // { + // activityContext.Call ("Test1"); + // } + // } + // UnityEngine.Diagnostics.Utils.NativeAssert ("测试原生断言"); + UnityEngine.Diagnostics.Utils.ForceCrash (ForcedCrashCategory.AccessViolation); + } + + public void Test2 () + { + BuglyAgent.ReportException ("测试2" , "测试异常" , "测试异常信息 "); + } + + public void Test3 () + { + BuglyAgent.ReportException ("测试3" , "测试异常" , "测试异常信息 "); + } +} diff --git a/Scenes/SampleTest.cs.meta b/Scenes/SampleTest.cs.meta new file mode 100644 index 0000000..8901b0d --- /dev/null +++ b/Scenes/SampleTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c675d2e692371d4c96ff83aac4144ce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..8237902 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "com.foldcc.cc-framework.crashreport", + "displayName": "CC-Framework.CrashReport", + "description": "Crash检测, 异常上报", + "version": "1.0.0", + "unity": "2022.1", + "license": "MIT", + "repository": { + "type": "git", + "url": "http://private.lightyears.ltd:18640/foldcc/CC-Framework.CrashReport" + }, + "author": { + "name": "foldcc", + "email": "lhyuau@qq.com", + "url": "https://gitee.com/foldcc" + }, + "dependencies": + { + }, + "keywords": [ + "Framework" + ] +} diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..4617fe3 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6bdc75239432ff3458a7b98e29519e6d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: