UIViewModule.cs 939 B

1234567891011121314151617181920212223242526272829
  1. namespace XGame.Framework.UI
  2. {
  3. public abstract class UIViewModule : IUIViewModel, IUIVMInitable
  4. {
  5. void IUIVMInitable.Init(IUIPanel panel, IUIViewAdapter adapter)
  6. {
  7. Init(panel as IComponentGetter, adapter);
  8. }
  9. void IUIVMInitable.Init(IUINested nested, IUIViewAdapter adapter)
  10. {
  11. Init(nested as IComponentGetter, adapter);
  12. }
  13. private void Init(IComponentGetter getter, IUIViewAdapter adapter)
  14. {
  15. BindComponents(getter, adapter);
  16. CustomBind(getter, adapter);
  17. }
  18. protected abstract void BindComponents(IComponentGetter getter, IUIViewAdapter adapter);
  19. /// <summary>
  20. /// 自定义绑定,有需要的重载
  21. /// </summary>
  22. /// <param name="getter"></param>
  23. protected virtual void CustomBind(IComponentGetter getter, IUIViewAdapter adapter)
  24. {
  25. }
  26. }
  27. }