uFrame 1.6杂乱笔记与一些翻译

来源:互联网 发布:百度推广搜索seo 编辑:程序博客网 时间:2024/06/09 18:36

The Kernel
The Kernel是uFrame的本质,负责处理加载场景,系统和服务。

Subsystems
作为一个容器,组成许多Nodes。
Subsystems允许你分离项目中的逻辑部分和可复用部分。
System Loaders
System Loaders常用语初始化信息。

Node
Elements

  • 主要负责ViewModel(Unity中uFrame框架附带了Controller)部分
    For example, Player element could contain information about player properties like health, running speed, obtained weapons or
    actions; Shoot, TakeDamage or Die.
    一个Elements会创建对应的ViewModel和Controller类
    这里写图片描述

  • Inheritance(继承)

    如下图,可以连接两个elements,后者继承前者。 SettingsScreen Element will contain the IsActive property and Close command of its parent SubScreen.这里写图片描述

Views

  • 游戏中的表现层(数据来源与绑定ViewModel)。
    For instance, a PlayerView should probably exist on some kind of Player GameObject, and a PlayerHUDView should probably exist on some
    kind of GUI GameObject to bind to and express a player’s stats and
    other properties.

  • Important Methods(可以重写)
    All Views inherit from a ViewBase class. Here are the most important methods. You can override all of them.
    InitializeViewModel()
    View匹配ViewModel时的一些初始化。不勾选Initialize ViewModel则不被执行
    PreBind()
    This happens before the View begins creating bindings to its given ViewModel.
    Bind()
    This is where the View actually creates property bindings, collection bindings, and command bindings to the given ViewModel. The base.Bind() call will automatically create the bindings specified in the uFrame diagram for this specific View type.If you have any further manual bindings you need to do, this can be agood place to implement them.
    AfterBind()
    This is called immediately after the View creates bindings to its ViewModel.

  • Inspector options
    ViewModel Indentifier 关联的ViewModel的标识,可指定。
    Dispose On Destroy 若勾选上, View被销毁是,ViewModel也被销毁。
    Initialize ViewModel 是否自己来初始化ViewModel属性值。

  • Bindings
    每一个绑定都会生成对应的方法在ViewBase类里。
    有一些方法(TODO)

  • Execution Order
    For Views instantiated at runtime
    Awake > OnEnable > PreBind > Bind > AfterBind >InitializeViewModel > Start > Update loop begins
    For Views existing “SceneFirst” before runtime
    Awake > OnEnable > CreateModel > InitializeViewModel > Start (before base call) > PreBind > Bind >AfterBind > Start (after base call)
    When Destroying an object
    OnDisable > OnDestroy (before base.OnDestroy() call) >UnBind > OnDestroy (after base.OnDestroy() call)

View components

  • 用于扩展View的功能(一些方法)。
    看例子:
    https://github.com/InvertGames/uFrame.Documentation/blob/master/uFrameMVVM/pages/nodes/view-component-node.md

Enums

  • 用于定义新的属性类型给Elements使用。

Scene Types

  • 为了使用uFrame加载/卸载场景,必须使用Scene Types创建以便于给uFrame识别。
    可以定义怎样加载/卸载场景。
    可以多个场景共用一个Scene Types(有什么意义?案例中的选择关卡,多个关卡场景共用一个Scene Types)

  • Scene Types存在在一个场景的游戏入口,因为uFrame需要知道哪些场景被加载和保存 场景的引用,在需要移除场景时。

  • Scene Type Settings
    可以使用它来pass data给场景加载。

  • Generated Scene Types Scene Type是mono behaviour。让uFrame关联监听场景(当场景加载或被卸载时)。

  • Scene Loader
    一个Scene Type生成一个Scene Loader,交给uFrame Kernel管理。
    专门负责对应的Scene Type加载/卸载的一些功能。
    LoadScene() 对应 Unity’s LoadSceneAdditively()
    UnloadScene() 对应 the scene root game object is destroyed

  • Execution Order
    When you enter play mode, first executed will be the Start() method which is responsible for loading the kernel. You can override
    the KernelLoading() method to execute custom code before the kernel
    starts loading and the KernelLoaded() to execute custom code after
    the kernel finish loading.
    After the kernel is loaded, a SceneAwakeEvent is published. Read more in the Events page.
    SceneManagementService will receive this event, find a Scene Loader for the Scene Type and call its Load() coroutine.

Service Node

  • Service也是交给uFrame Kernel管理。
    可以写一些Commands和Events让Service订阅。
    字面上的意思,提供一些服务给其他节点。

Simple Classes(看文档)

  • 自定义的类。
    可作为Element的属性和command的参数。

Type References(看文档)

  • 可以指定新的类型在其他Nodes使用。
    不会被uFrame生成,要自己创建。
    一般在services配合handlers使用(大概)。

  • 自定义类型,不被uFrame创建

Command Node

  • 能被事件系统订阅。
    一般用来传递数据给Controller。

Computed Properties

  • 根据properties来计算得出另一些属性。比如血量少于0则得出死亡属性。

Element

  • ViewModels当需要时存在内存中。如果运行时View存在在场景中,它将会执行ViewCreatedEvent,ViewService将会匹配指定绑定的ViewModel,如果不存在则创建。大概只存在一个。

  • Creation And Initialization
    Creating a ViewModel with the Extension Method 在uframe 1.6中是通过额外的方法(使用正确的controller)创建ViewModel this.CreateViewModel()

Designer Overview

  • For instance, a PlayerView should probably exist on some kind of
    Player GameObject, and a PlayerHUDView should probably exist on some
    kind of GUI GameObject to bind to and express a player’s stats and
    other properties.
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 犯罪人在拘留所生了小孩怎么办 我申请了进京证更换车辆怎么办 丈夫去世前想把财产留给妻子怎么办 假货中通代收货款发现是假货怎么办 注册志愿者时身份证被使用该怎么办 双眼皮贴贴的皮肤送了怎么办? 满60岁社保末满十五年怎么办 眼角膜少了一块怎么办应该吃什么 左右胸相差一个罩杯左右怎么办 穿一字肩的裙子没有无肩内衣怎么办 农业网柑橘被奄24小时怎么办 钱包被偷了小偷抓到了钱不认怎么办 快高考了很想学却没有动力怎么办? 孩子高三了学习状态不好怎么办 离婚时对方说把钱都花了怎么办 挂科太多学校不给毕业证怎么办 大专挂科太多学校让延期毕业怎么办 安卓手机老是收到垃圾短信怎么办 高铁站行李拉安检仪上应该怎么办 连壁金融立案了投资钱怎么办 联壁金融倒了投资人的钱怎么办 改签的高铁票错过了怎么办 高铁票错过了当天没别的车次怎么办 电脑文件剪切到u盘不见了怎么办 电脑剪切到u盘然后打不开了怎么办 淘宝未满十八岁限制购买物品怎么办 网上飞机订票手机号填写错了怎么办 室外回填土都是砂土压不实怎么办 王牌车新车储气筒漏气查不到怎么办 顺丰快递保价后商品出现问题怎么办 未保价快递丢失没有价值证明怎么办 安卓手机谷歌地图怎么用不了怎么办 ae模板版本太高打不开怎么办 苹果手机高德地图信号弱怎么办 网上订好火车票后没赶上火车怎么办 丰巢快递柜没收到短信怎么办 被不同号码骚扰电话打个不停怎么办 手机注册被骚扰电话打个不停怎么办 网贷不停的打骚扰电话怎么办 发改委的可研报告过期了怎么办 买到没有预售证的房子怎么办