namespace XGame.Framework.UI { public abstract class UIController : IUIController, IUIContextSetter, IUIViewModelSetter where TViewModel : class, IUIViewModel { private UIContext _context; public UIContext Context => _context; UIContext IUIContextSetter.Context { set => _context = value; } private IUIViewModel _viewModel; protected TViewModel VM => _viewModel as TViewModel; IUIViewModel IUIViewModelSetter.ViewModel { set => _viewModel = value; } protected abstract void OnEnable(object intent); protected abstract void OnDisable(); void IUIController.Enable(object intent) { OnEnable(intent); } void IUIController.Disable() { OnDisable(); } } }