Coder Social home page Coder Social logo

mvptutorial's Introduction

MVP

Model即数据,我们会在UI里新建一个抽象类/接口 代表着我们所需要的数据, 比如物品Model,然后它被物品类继承.
Presenter接收数据的修改事件,发送给View让View修改界面. 接收View的事件,通知Model,修改数据.
View即UI界面的绑定

Presenter为UI的代表, 绑定在UI的根部. 比如背包UI里面有诺干的物品,那么背包的P就应该在背包的根, 物品的P是物品的根(仍然是背包的子物体).

M->P: 使用观察者模式
P->V: 直接绑定方法
V->P: 必须使用Delegate
P->M: 直接修改

分模块

分模块需要注意的地方是, 各模块之间不应该有相互的引用,也就是A引用B, B引用A.

由于Unity的特性, 我们不能够直接使用Interface, 需要提供一定的桥接 桥接方式:
- 接口选择器
- 使用抽象类

mvptutorial's People

Contributors

imitater967 avatar

Stargazers

 avatar  avatar KinoiraLink avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.