Skip to content

Commit 7066d47

Browse files
committed
Actualiza CHANGELOG y versiones a 2.2.0; añade descubrimiento de métodos de interfaz para FluxAttribute.
1 parent 9b371b6 commit 7066d47

7 files changed

Lines changed: 54 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this package will be documented in this file.
33

4+
## [2.2.0] - 2026-02-23
5+
6+
## Added
7+
- FluxAttribute discovery now also scans interface method definitions. When a `[MethodFlux]` or `[StateFlux]` attribute is placed on an interface method, `MonoFlux` will automatically bind it to the concrete implementation via `GetInterfaceMap`. This allows declaring flux bindings directly in interfaces.
8+
49
## [2.1.3] - 2024-07-19
510

611
## Added

CHANGELOG_CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 更改日志
22
这个软件包的所有显著变化都将记录在这个文件中。
3+
## [2.2.0] - 2026-02-23
4+
5+
## 添加
6+
- FluxAttribute 发现现在也会扫描接口方法定义。当 `[MethodFlux]``[StateFlux]` 属性放置在接口方法上时,`MonoFlux` 将通过 `GetInterfaceMap` 自动绑定到具体实现。这允许直接在接口中声明 flux 绑定。
7+
38
## [2.1.1] - 2024-05-14
49

510
## 添加

CHANGELOG_JP.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# チャンジェログ
22
本パッケージの注目すべき変更点はすべてこのファイルに記載される予定です。
33

4+
## [2.2.0] - 2026-02-23
5+
6+
## 追加した
7+
- FluxAttribute の検出がインターフェースメソッドの定義もスキャンするようになりました。`[MethodFlux]` または `[StateFlux]` 属性がインターフェースメソッドに配置されている場合、`MonoFlux``GetInterfaceMap` を介して具体的な実装に自動的にバインドします。これにより、インターフェース内で直接 flux バインディングを宣言できるようになります。
8+
49
## [2.1.1] - 2024-05-14
510

611
## 追加した

CHANGELOG_KR.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 변경 로그
22
이 패키지에 대한 모든 주목할만한 변경 사항은 이 파일에 문서화됩니다.
3+
## [2.2.0] - 2026-02-23
4+
5+
## 추가됨
6+
- FluxAttribute 검색이 이제 인터페이스 메서드 정의도 스캔합니다. `[MethodFlux]` 또는 `[StateFlux]` 속성이 인터페이스 메서드에 배치되면, `MonoFlux``GetInterfaceMap`을 통해 구체적인 구현에 자동으로 바인딩합니다. 이를 통해 인터페이스에서 직접 flux 바인딩을 선언할 수 있습니다.
7+
38
## [2.1.1] - 2024-05-14
49

510
## 추가됨

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ npm i com.xavierarpa.uniflux
5151
|-----------|--------------:|------:|-----:|
5252
| UniFlux (Dispatch<string>) | 10.000 | 0B | 1ms |
5353
| UniFlux (ADD Store<string>) | 10.000 | 1.2MB | ~3ms |
54-
| UniFlux (REMOVE Store<string>) | 10.000 | 1.2MB | ~30ms |
54+
| UniFlux (REMOVE Store<string>) | 10.000 | 1.2MB | ~3ms |
5555

5656
Note: Storing (ADD and REMOVE) by design is planned to do it once so there's no problem in performance.
5757

Runtime/Plugin/Core/Internal/Classes/FluxAttributeUtils.cs

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ internal static void SubscribeAttributes<T>(in T obj, in bool condition) where T
7474
{
7575
if (!m_monofluxes.ContainsKey(obj))
7676
{
77-
m_monofluxes.Add(obj,obj.GetType().GetMethods(m_bindingflag_all).Where(method =>
77+
var type = obj.GetType();
78+
79+
// Phase 1: Discover methods with FluxAttribute on the concrete class
80+
var discoveredMethods = type.GetMethods(m_bindingflag_all).Where(method =>
7881
{
7982
#pragma warning disable CS0618
8083
if(System.Attribute.GetCustomAttributes(method).FirstOrDefault((_att) => _att is FluxAttribute) is FluxAttribute _attribute)
@@ -85,8 +88,34 @@ internal static void SubscribeAttributes<T>(in T obj, in bool condition) where T
8588
return true;
8689
}
8790
else return false;
88-
}).ToList()
89-
);
91+
}).ToList();
92+
93+
// Phase 2: Discover FluxAttributes declared on interface method definitions
94+
var interfaces = type.GetInterfaces();
95+
for (int iIdx = 0; iIdx < interfaces.Length; iIdx++)
96+
{
97+
var map = type.GetInterfaceMap(interfaces[iIdx]);
98+
for (int j = 0; j < map.InterfaceMethods.Length; j++)
99+
{
100+
var ifaceMethod = map.InterfaceMethods[j];
101+
#pragma warning disable CS0618
102+
if (System.Attribute.GetCustomAttributes(ifaceMethod).FirstOrDefault(a => a is FluxAttribute) is FluxAttribute attr)
103+
#pragma warning restore CS0618
104+
{
105+
var implMethod = map.TargetMethods[j];
106+
if (!m_methods.ContainsKey(implMethod))
107+
{
108+
m_methods.Add(implMethod, attr);
109+
}
110+
if (!discoveredMethods.Contains(implMethod))
111+
{
112+
discoveredMethods.Add(implMethod);
113+
}
114+
}
115+
}
116+
}
117+
118+
m_monofluxes.Add(obj, discoveredMethods);
90119
}
91120
//
92121
List<MethodInfo> methods = m_monofluxes[obj];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.xavierarpa.uniflux",
33
"displayName": "UniFlux",
4-
"version": "2.1.4",
4+
"version": "2.2.0",
55
"author": "Xavier Arpa",
66
"unity": "2019.3",
77
"documentation": "README.md",

0 commit comments

Comments
 (0)