From 32bc5f972afeeae7f435dde2c2564b43e0ce9790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Wed, 26 Mar 2025 09:58:33 +0800 Subject: [PATCH] modify --- Runtime/Helper/Helper.cs | 114 ---------------------------------- Runtime/Helper/Helper.cs.meta | 11 ---- 2 files changed, 125 deletions(-) delete mode 100644 Runtime/Helper/Helper.cs delete mode 100644 Runtime/Helper/Helper.cs.meta diff --git a/Runtime/Helper/Helper.cs b/Runtime/Helper/Helper.cs deleted file mode 100644 index 0a21852..0000000 --- a/Runtime/Helper/Helper.cs +++ /dev/null @@ -1,114 +0,0 @@ -using UnityEngine; - -namespace AlicizaX -{ - /// - /// 辅助器创建器相关的实用函数。 - /// - public static class Helper - { - /// - /// 创建辅助器。 - /// - /// 要创建的辅助器类型。 - /// 要创建的辅助器类型名称。 - /// 若要创建的辅助器类型为空时,使用的自定义辅助器类型。 - /// 创建的辅助器。 - public static T CreateHelper(string helperTypeName, T customHelper) where T : MonoBehaviour - { - return CreateHelper(helperTypeName, customHelper, 0); - } - - /// - /// 创建辅助器。 - /// - /// 要创建的辅助器类型。 - /// 要创建的辅助器类型名称。 - /// 若要创建的辅助器类型为空时,使用的自定义辅助器类型。 - /// 要创建的辅助器索引。 - /// 创建的辅助器。 - public static T CreateHelper(string helperTypeName, T customHelper, int index) where T : MonoBehaviour - { - T helper = null; - if (!string.IsNullOrEmpty(helperTypeName)) - { - System.Type helperType = Utility.Assembly.GetType(helperTypeName); - if (helperType == null) - { - Log.Warning("Can not find helper type '{0}'.", helperTypeName); - return null; - } - - if (!typeof(T).IsAssignableFrom(helperType)) - { - Log.Warning("Type '{0}' is not assignable from '{1}'.", typeof(T).FullName, helperType.FullName); - return null; - } - - helper = (T)new GameObject().AddComponent(helperType); - } - else if (customHelper == null) - { - Log.Warning("You must set custom helper with '{0}' type first.", typeof(T).FullName); - return null; - } - else if (customHelper.gameObject.InScene()) - { - helper = index > 0 ? Object.Instantiate(customHelper) : customHelper; - } - else - { - helper = Object.Instantiate(customHelper); - } - - return helper; - } - - /// - /// 创建辅助器。 - /// - /// 要创建的辅助器类型。 - /// - /// 要创建的辅助器类型名称。 - /// 若要创建的辅助器类型为空时,使用的自定义辅助器类型。 - /// 要创建的辅助器索引。 - /// 创建的辅助器。 - public static T CreateHelper(GameObject target, string helperTypeName, T customHelper, int index) where T : MonoBehaviour - { - GameFrameworkGuard.NotNull(target, nameof(target)); - T helper = null; - if (!string.IsNullOrEmpty(helperTypeName)) - { - System.Type helperType = Utility.Assembly.GetType(helperTypeName); - if (helperType == null) - { - Log.Warning("Can not find helper type '{0}'.", helperTypeName); - return null; - } - - if (!typeof(T).IsAssignableFrom(helperType)) - { - Log.Warning("Type '{0}' is not assignable from '{1}'.", typeof(T).FullName, helperType.FullName); - return null; - } - - helper = (T)target.AddComponent(helperType); - } - else if (customHelper == null) - { - Log.Warning("You must set custom helper with '{0}' type first.", typeof(T).FullName); - return null; - } - else if (customHelper.gameObject.InScene()) - { - helper = index > 0 ? Object.Instantiate(customHelper) : customHelper; - } - else - { - helper = Object.Instantiate(customHelper); - } - - return helper; - } - } -} diff --git a/Runtime/Helper/Helper.cs.meta b/Runtime/Helper/Helper.cs.meta deleted file mode 100644 index f805aa4..0000000 --- a/Runtime/Helper/Helper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e7b03d310d08d45429a94d6f62c942b4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: