All Projects → curtisgo → cocos-creator-puremvc

curtisgo / cocos-creator-puremvc

Licence: other
cocos-creator-puremvc 是一个cocos creator项目基础架构。

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to cocos-creator-puremvc

skynet-cocos-creator
skynet cocoscreator puremvc
Stars: ✭ 44 (-10.2%)
Mutual labels:  puremvc, cocoscreator
CosmosFramework
CosmosFramework is a lightweight plug-in Unity development framework . Has a rich Unity method extensions and toolchain. async/await syntax support, multi-network channel support.Long term support for this project
Stars: ✭ 176 (+259.18%)
Mutual labels:  puremvc
puremvc-delphi-standard-framework
A Delphi implementation of PureMVC (http://puremvc.org/)
Stars: ✭ 44 (-10.2%)
Mutual labels:  puremvc
AppFacadeMVC
AppFacade For PureMVC
Stars: ✭ 13 (-73.47%)
Mutual labels:  puremvc
Engine
Cocos Creator is a complete package of game development tools and workflow, including a game engine, resource management, scene editing, game preview, debug and publish one project to multiple platforms.
Stars: ✭ 2,574 (+5153.06%)
Mutual labels:  cocoscreator
2048
使用 Cocos Creator 开发微信小游戏 2048(代码基于 Cocos Creator 1.10)
Stars: ✭ 26 (-46.94%)
Mutual labels:  cocoscreator
CocosCreator-ScrollVIewPlus
Cocos Creator ScrollVIew 优化系列
Stars: ✭ 83 (+69.39%)
Mutual labels:  cocoscreator
cocos-creator-level-editor
Cocos Creator 关卡编辑器
Stars: ✭ 28 (-42.86%)
Mutual labels:  cocoscreator
cocos2d-bgfx
cocos2d-x-lite use bgfx as the rendering backend
Stars: ✭ 54 (+10.2%)
Mutual labels:  cocoscreator
CocosCreatorWebGL
用cocos creator实现《WebGL编程指南》里面的案例
Stars: ✭ 27 (-44.9%)
Mutual labels:  cocoscreator
CocosProjectTemplate
一个Cocos Creator使用的应用基础框架 微信小游戏版本https://github.com/ustchcl/CocosProjectTemplateWx
Stars: ✭ 20 (-59.18%)
Mutual labels:  cocoscreator
firing balls
Physical pinball game with cocos creator 小游戏【不停歇的球】源码
Stars: ✭ 120 (+144.9%)
Mutual labels:  cocoscreator

cocos-creator-puremvc

cocos-creator-puremvc 是一个cocos creator项目基础架构。

技术栈

安装

使用npm installyarn,推荐使用后者。如果你更喜欢npm的话,需要修改package.json内的proto编译命令

编译proto

npm run protoyarn proto

script目录结构

  • controller
    • bootstrap 需要初始化的MVC
    • commands 游戏内Command,增加Command基本都应该在这里
    • StartupCommand.ts 启动Command
  • lib
    • puremvc puremvc源代码和d.ts文件
  • model
    • vos vo对象
    • GameProxy.ts 游戏数据代理示例
  • services 服务
    • api.ts fetch请求包装
  • utils
    • request.ts fetch包装
  • view
    • component 视图组件
    • StartViewMediator.ts Start场景中介
  • AppFacade.ts puremvc入口
  • Constants.ts 常量定义
  • Start.ts 开始场景启动脚本,AppFacade在这里初始化

注意点

  1. Command与Proxy、Mediator
    Command管理应用程序的 Business Logic(业务逻辑),要协调Model 与视图状态。

    Model 通过使用 Proxy 来保证数据的完整性、一致性 。Proxy 集中程序的Domain Logic(域逻辑),并对外公布操作数据对象的API。它封装了所有对数据模型的操作,不管数据是客户端还是服务器端的。

    Mediator 和Proxy 可以提供一些操作接口让Command 调用来管理View Component 和Data Object ,同时对 Command隐藏具体操作的细节。

  2. 一般一个Mediator(handleNotification方法)处理的Notification应该在4、5个之内。
    还要注意的是,Mediator的职责应该要细分。如果处理的Notification很多,则意味着Mediator需要被拆分,在拆分后的子模块的Mediator里处理要比全部放在一起更好。

  3. 应该避免Mediator与Proxy 直接交互。
    通常应该遵从了这个规则,但实际上项目Mediator中不可避免需要获取Proxy数据,如果每次都通过一个Notification去获取数据,然后返回数据给Mediator,这样无形中增加了通信次数、带反馈数据的通信加重通信负担。所以可以适当是的在Mediator中facade.retrieveProxy获取Proxy然后拿到数据,而且从proxy直接拿数据,可以保证拿到最新数据。

参考文档

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].