正在完善BS 0.1

This commit is contained in:
2025-09-27 21:51:48 +08:00
parent 4c4298d413
commit f7ff4fe7b3
3 changed files with 23 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
[返回](../RootEnv-README.md) [返回](../README.md)
# /Convention # /Convention

View File

@@ -14,13 +14,11 @@
信号接口,用于事件系统的消息传递 信号接口,用于事件系统的消息传递
### IModel ### IModel
模型接口,定义数据模型的序列化和反序列化能力: 模型类接口, 仅作为接口倒置
- `Save()` 保存数据到字符串
- `Load(string data)` 从字符串加载数据
### IConvertable<T> ### IConvertable<T>
转换接口,提供类型转换能力: 转换接口,提供类型转换能力:
- `ConvertTo()` 转换为目标类型 - `T ConvertTo()` 转换为目标类型
### IConvertModel<T> ### IConvertModel<T>
组合接口,同时继承 `IModel``IConvertable<T>` 组合接口,同时继承 `IModel``IConvertable<T>`
@@ -41,34 +39,33 @@
## 注册系统 ## 注册系统
### 对象注册 ### 对象注册相关
- `Register(Type slot, object target, Action completer, params Type[] dependences)`
- `Register<T>(T target, Action completer, params Type[] dependences)`
提供基于类型的依赖注入容器: 向slot槽注册实例target, 并设置依赖dependences, 当槽的所有依赖的槽都注册完成后触发completer
- 支持依赖关系管理 - `void Register(Type slot, object target, Action completer, Type[] dependences) throw(InvalidOperation)`
- 支持注册完成回调
- 自动解析依赖顺序 解除slot槽中的注册
- `bool Unregister(Type slot) noexcpect`
### 注册查询 ### 注册查询
- `Contains(Type type)` / `Contains<T>()` - `bool Contains(Type slot)`
- `Get(Type type)` / `Get<T>()` - `bool Get(Type slot)`
## 事件系统 ## 事件系统
### 消息监听 ### 消息监听
- `AddListener<Signal>(Type slot, Action<Signal> listener)`
- `SendMessage(Type slot, ISignal signal)`
- `SendMessage<Signal>(Signal signal)`
提供类型安全的事件分发机制: Listening类, 拥有停止监听的函数`StopListening()`
- 支持按类型注册监听器 - `class Listening`
- 支持泛型消息类型
- 自动管理监听器生命周期
### Listening类 向指定的槽slot中添加监听信号Signal的监听器listener
监听器管理类,提供: - `Listening AddListener<Signal>(Type slot, Action<Signal> listener) where Signal : ISignal`
- `StopListening()` 停止监听
向指定的槽slot发送信号signal
- `void SendMessage(Type slot, ISignal signal)`
向所有槽广播信号signal
- `void SendMessage<Signal>(Signal signal)`
## 时间线系统 ## 时间线系统

View File

@@ -14,6 +14,8 @@
基础标准`BS`, 增强提案`EP` 基础标准`BS`, 增强提案`EP`
- `0.1.1` `BS` Architecture 增强, 允许Unregister
- `Asynchrony` `EP` Async异步表达式 - `Asynchrony` `EP` Async异步表达式
- `Visual` `EP` Visual - `Visual` `EP` Visual