From 9da67afe50ced46e0ef4226bbf41cc72889b9921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Mon, 23 Mar 2026 20:20:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=8B=E4=BB=B6=E4=B8=BAEv?= =?UTF-8?q?entBus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Event/{EventPublisher.cs => EventBus.cs} | 2 +- ...ventPublisher.cs.meta => EventBus.cs.meta} | 0 Runtime/ABase/Helper.meta | 3 - Runtime/ABase/Property.meta | 3 - .../{Property => Structs}/BindableProperty.cs | 0 .../BindableProperty.cs.meta | 0 .../ABase/Structs/GenericReflectionField.cs | 92 ------------------- .../Structs/GenericReflectionField.cs.meta | 11 --- .../Event/LocalizationChangeEvent.cs | 2 +- 9 files changed, 2 insertions(+), 111 deletions(-) rename Runtime/ABase/Event/{EventPublisher.cs => EventBus.cs} (97%) rename Runtime/ABase/Event/{EventPublisher.cs.meta => EventBus.cs.meta} (100%) delete mode 100644 Runtime/ABase/Helper.meta delete mode 100644 Runtime/ABase/Property.meta rename Runtime/ABase/{Property => Structs}/BindableProperty.cs (100%) rename Runtime/ABase/{Property => Structs}/BindableProperty.cs.meta (100%) delete mode 100644 Runtime/ABase/Structs/GenericReflectionField.cs delete mode 100644 Runtime/ABase/Structs/GenericReflectionField.cs.meta diff --git a/Runtime/ABase/Event/EventPublisher.cs b/Runtime/ABase/Event/EventBus.cs similarity index 97% rename from Runtime/ABase/Event/EventPublisher.cs rename to Runtime/ABase/Event/EventBus.cs index 028dbab..89de236 100644 --- a/Runtime/ABase/Event/EventPublisher.cs +++ b/Runtime/ABase/Event/EventBus.cs @@ -4,7 +4,7 @@ using Unity.IL2CPP.CompilerServices; namespace AlicizaX { - public static class EventPublisher + public static class EventBus { [Il2CppSetOption(Option.NullChecks, false)] [Il2CppSetOption(Option.DivideByZeroChecks, false)] diff --git a/Runtime/ABase/Event/EventPublisher.cs.meta b/Runtime/ABase/Event/EventBus.cs.meta similarity index 100% rename from Runtime/ABase/Event/EventPublisher.cs.meta rename to Runtime/ABase/Event/EventBus.cs.meta diff --git a/Runtime/ABase/Helper.meta b/Runtime/ABase/Helper.meta deleted file mode 100644 index e9e0687..0000000 --- a/Runtime/ABase/Helper.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 634e669ad63f4302acca846ec1a0240a -timeCreated: 1736324891 \ No newline at end of file diff --git a/Runtime/ABase/Property.meta b/Runtime/ABase/Property.meta deleted file mode 100644 index 6f0bca6..0000000 --- a/Runtime/ABase/Property.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d73cc40a000b40e4949fa532373115b5 -timeCreated: 1736324891 \ No newline at end of file diff --git a/Runtime/ABase/Property/BindableProperty.cs b/Runtime/ABase/Structs/BindableProperty.cs similarity index 100% rename from Runtime/ABase/Property/BindableProperty.cs rename to Runtime/ABase/Structs/BindableProperty.cs diff --git a/Runtime/ABase/Property/BindableProperty.cs.meta b/Runtime/ABase/Structs/BindableProperty.cs.meta similarity index 100% rename from Runtime/ABase/Property/BindableProperty.cs.meta rename to Runtime/ABase/Structs/BindableProperty.cs.meta diff --git a/Runtime/ABase/Structs/GenericReflectionField.cs b/Runtime/ABase/Structs/GenericReflectionField.cs deleted file mode 100644 index 2a3f4cd..0000000 --- a/Runtime/ABase/Structs/GenericReflectionField.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Reflection; -using UnityEngine; - -namespace AlicizaX -{ - /// - /// A generic reflection field allows you to get or set a generic (object) value for a property, field, or method. - /// - [Serializable] - public sealed class GenericReflectionField - { - public enum ReflectionType { Field, Property, Method }; - - public ReflectionType ReflectType; - public MonoBehaviour Instance; - public string ReflectName; - public bool ReflectDerived; - - public bool IsSet => Instance != null; - - private FieldInfo fieldInfo = null; - private FieldInfo FieldInfo - { - get - { - if (fieldInfo == null) - fieldInfo = Instance.GetType().GetField(ReflectName, BindingFlags.Public | BindingFlags.Instance); - - return fieldInfo; - } - } - - private PropertyInfo propertyInfo = null; - private PropertyInfo PropertyInfo - { - get - { - if (propertyInfo == null) - propertyInfo = Instance.GetType().GetProperty(ReflectName, BindingFlags.Public | BindingFlags.Instance); - - return propertyInfo; - } - } - - private MethodInfo methodInfo = null; - private MethodInfo MethodInfo - { - get - { - if (methodInfo == null) - methodInfo = Instance.GetType().GetMethod(ReflectName, BindingFlags.Public | BindingFlags.Instance); - - return methodInfo; - } - } - - public object Value - { - get => ReflectType switch - { - ReflectionType.Field => FieldInfo.GetValue(Instance), - ReflectionType.Property => PropertyInfo.GetValue(Instance), - ReflectionType.Method => MethodInfo.Invoke(Instance, new object[0]), - _ => throw new NullReferenceException() - }; - - set - { - try - { - if (ReflectType == ReflectionType.Field) - { - FieldInfo.SetValue(Instance, value); - } - else if (ReflectType == ReflectionType.Property) - { - PropertyInfo.SetValue(Instance, value); - } - else - { - MethodInfo.Invoke(Instance, new object[] { value }); - } - } - catch (Exception exception) - { - throw exception; - } - } - } - } -} diff --git a/Runtime/ABase/Structs/GenericReflectionField.cs.meta b/Runtime/ABase/Structs/GenericReflectionField.cs.meta deleted file mode 100644 index 5f28d68..0000000 --- a/Runtime/ABase/Structs/GenericReflectionField.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1f04b88956af3864487d98e1d262f914 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Localization/Event/LocalizationChangeEvent.cs b/Runtime/Localization/Event/LocalizationChangeEvent.cs index c25e2d5..8b0ae0c 100644 --- a/Runtime/Localization/Event/LocalizationChangeEvent.cs +++ b/Runtime/Localization/Event/LocalizationChangeEvent.cs @@ -13,7 +13,7 @@ namespace AlicizaX.Localization public static void Publisher(string language) { - EventPublisher.Publish(new LocalizationChangeEvent(language)); + EventBus.Publish(new LocalizationChangeEvent(language)); } } }