Getting Start(toturial)
Last updated
Last updated
Create a new empty gameobject and add a c# script component.
Create a contex class drive from class "HnFramework.MVC.Contex", e.g. "XXContex".
Override function "InitCommand".
Create a SceneCommand or StartCommand class drive from class "HnFramework.MVC.Command", e.g. "XXCommand".
Override function "InitModel".
Call function "BindCommand(new XXCommand(this));" in the function "InitCommand" of "XXContex".
Create other bussiness Command class drive from class "HnFramework.MVC.Command".
Override function "OnStart", and add listener.
Create model class drive from class "HnFramework.MVC.Model", e.g. "XXModel".
Call function "BindModel(enum, XXModel.GetSingleton());" in the function "InitModel" of "SceneCommand".
Create mediator class drive from class "HnFramework.MVC.Mediator", e.g. "XXMediator".
Override function "OnInit", then get view class and add listener.
Create view class drive from class "HnFramework.MVC.View", e.g. "XXView" and add the script component to any ui gameobject.
Override function "InitMediator", and bind mediator.
You can call function "DispatchCommand(enum)" to make command work(e.g. get model datas) in view or mediator class.
You can call function "DispatchMediator(enum)" to update UI in command class.