mycj_demo/mycj/Assets/Game/Scripts/FB-Framework/FB-MVC/FBController.cs

68 lines
1.8 KiB
C#
Raw Normal View History

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