// Felix-Bang:FBController //   へ     /| //  /\7    ∠_/ //  / │   / / // │ Z _,< /   /`ヽ // │     ヽ   /  〉 //  Y     `  /  / // イ● 、 ●  ⊂⊃〈  / // ()  へ    | \〈 //  >ー 、_  ィ  │ // //  / へ   / ノ<| \\ //  ヽ_ノ  (_/  │// //  7       |/ //  >―r ̄ ̄`ー―_ // Describe:控制器基类:协调M和V之间的交互,无需实例化,动态创建执行命令 // 1. 获取到模型和视图,并且调用方法 // 2. 处理视图发出的事件 // Createtime:2018/9/19 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace FBFramework { public abstract class FBController { /// 获取Model protected T GetModel() where T : FBModel { return FBMVC.GetModel() as T; } /// 获取View protected T GetView() where T : FBView { return FBMVC.GetView() as T; } /// 注册新Model protected void RegisterModel(FBModel model) { FBMVC.RegisterModel(model); } /// 注册新View protected void RegisterView(FBView view) { FBMVC.RegisterView(view); } /// 注册新Controller protected void RegisterController(string eventName, Type controllerType) { FBMVC.RegisterController(eventName, controllerType); } // 处理事件 public abstract void Execute(object data = null); } }