Comments (1)
现在的DataBinding,只能绑定某个变量,到某个数据上;
然而,有些时候,ViewModel的副作用可能难以通过简单的View层变量更新体现,而需要更多复杂的处理
因此,我希望BindingSet加入回调绑定的功能,样例写法如下:
void OnVarChanged(int val); Bind(OnVarChanged).To(vm->x);Besides:响应式数据这块,是否有可能参考Vue/React的写法,实现useEffect这样复杂的监听Hook?
首先,Unity的UnityEvent 是可以绑定到ViewModel上的一个函数的。
然后你这里提到的这种情况,想将ViewModel的一个属性改变绑定到View层的一个函数上,你这个设计是不合理的,View里面应该就是一个简简单单的数据绑定,不应该在有这些逻辑。你应该通过自定义控件的方式来支持你这种需求。
参考我的ListView、或者我扩展的OSA的Grid、List等组件,还有FormattableTextMeshPro,TemplateTextMeshProUGUI。
这个道理跟 UGUI的Slider一样,我用户只关注value属性,还要滑动条最大最小值,业务逻辑只修改value属性,至于你里面还要同步更新多少值,要做多少事,那是Slider的工作,不能放在View中去做
from loxodon-framework.
Related Issues (20)
- Related to enter play mode settings HOT 6
- Git tag v2.4.5 is not aligned with the version update commit HOT 1
- [Fody]当项目中有其他包引用了Mono.Cecil相关的库文件会报错 HOT 7
- Service container doesn't register generics properly HOT 3
- ProxyType.cs的IsParameterMatch存在问题 HOT 2
- Encryption HOT 3
- Inquiry HOT 3
- [Feature] Split the framework further HOT 1
- Loxodon.Framework.Prefs.DefaultEncryptor带参数的构造函数中key和iv没有赋值啊??? HOT 1
- 请教一下使用ResourcesViewLocator加载的资产什么时候释放呢 HOT 1
- 在FormattableTextMeshProUGUI & TemplateTextMeshProUGUI中Text.text会被自身的OnEnable设置为初始值 HOT 4
- InteractionTargetProxy的Target被意外释放 HOT 4
- When will v3.0 be released? HOT 1
- 建议为每个包添加 csc.rsp HOT 6
- Loxodon.Framework.Views.TextMeshPro.GenericParameters在绑定引用类型时有概率崩溃 HOT 2
- AsyncViewInteractionAction parameter IViewGroup should be IUIViewGroup HOT 1
- 可以考虑用 CommunityToolkit.Mvvm HOT 7
- framework/AsyncInteractionRequest.lua:1: unexpected symbol near '<\239>' HOT 1
- Fody.MethodDecorator HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loxodon-framework.