liangxiegame / QFramework

Godot/Unity3D System Design Architecture
https://qframework.cn
MIT License
4.3k stars 766 forks source link

关于BindableProperty的Comparer #130

Open rickytheoldtree opened 6 months ago

rickytheoldtree commented 6 months ago

新版BindableProperty中的Comparer,如果本意是用于比对引用类型,将不能按照预想效果触发;在set时<T,T,bool>中两个T一定为同一个地址的实例;如果new一个新的引用类型的实例再触发setter则这个comparer又完全不需要了;comparer唯一能实现的效果为原本地址不同的两个引用类型对象中值一样时,不触发mOnValueChanged

liangxiegame commented 6 months ago

对于引用类型的数据变更,我这里建议用 TypeEventSystem 或者 EasyEvent 自己触发变更事件。

因为 BindableProperty 是 Property 不是 Instance

凉鞋

@. | ---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年3月6日 12:59 | | 收件人 | @.> | | 抄送人 | @.> | | 主题 | [liangxiegame/QFramework] 关于BindableProperty的Comparer (Issue #130) |

新版BindableProperty中的Comparer,如果本意是用于比对引用类型,将不能按照预想效果触发;在set时<T,T,bool>中两个T一定为同一个地址的实例;如果new一个新的引用类型的实例再触发setter则这个comparer又完全不需要了;comparer唯一能实现的效果为原本地址不同的两个引用类型对象中值一样时,不触发mOnValueChanged

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>