namespace XGame.Framework.UI
{
    public abstract class UIViewModule : IUIViewModel, IUIVMInitable
    {
        void IUIVMInitable.Init(IUIPanel panel, IUIViewAdapter adapter)
        {
            Init(panel as IComponentGetter, adapter);
        }
        void IUIVMInitable.Init(IUINested nested, IUIViewAdapter adapter)
        {
            Init(nested as IComponentGetter, adapter);
        }
        private void Init(IComponentGetter getter, IUIViewAdapter adapter)
        {
            BindComponents(getter, adapter);
            CustomBind(getter, adapter);
        }
        protected abstract void BindComponents(IComponentGetter getter, IUIViewAdapter adapter);
        /// <summary>
        /// 自定义绑定，有需要的重载
        /// </summary>
        /// <param name="getter"></param>
        protected virtual void CustomBind(IComponentGetter getter, IUIViewAdapter adapter)
        {
        }


    }
}
