Giter Site home page Giter Site logo

kodelua's Introduction

Kode v3 是一个轻量级的 MVC 框架

Kode 是为了开发移动游戏,结合使用 cocos2d-x 框架而开发一个轻量级的框架。此框架已经应用在一款大型的横版格斗手游,所以稳定性可以保证,同时也会持续地维护和更新,已经更新到 kode v3 了,v3 最大的改动是对逻辑代码做了按需加载(lazy loading)优化,对于比较大型的应用(游戏),初始化时性能会有很大的提高。

什么是 MVCS?

  • M 就是 Model 层,存储数据的地方,只提供2种接口,gets 和 sets 接口。
  • V 就是 View 层,界面显示的地方,处理界面的显示并提供 update 接口(提供给 controller 调用)来更新界面。
  • C 就是 Controller 层,处理游戏逻辑的地方,她需要与其他所有层打交道,她是总管。
  • S 就是 Service 层,负责与服务器端(如果用在客户端,完全可以用在服务器端)交互,只提供2中接口,请求和响应接口。
  • E 就是 消息(事件)层,Controller 与 Controller 之间,Model 和 Service 与 Controller 的交互就是通过消息。

推荐结合 quick-cocos2d-x 框架一起使用,quick-cocos2d-x 针对 cocos2d-x 进行的大量的封装,并且能支持屏幕自适应,开发 Android 应用不在烦恼:)。

运行测试,在终端下运行:./main.lua,运行前请确保你已经安装了 lua 环境

输出:

[Info]
app start
Testing roleController
csv data: {
  1 = {
    1 = "Andy",
    2 = "male",
    3 = "18",
  },
  2 = {
    1 = "Nataly",
    2 = "female",
    3 = "18",
  },
  3 = {
    1 = "Peter",
    2 = "male",
    3 = "20",
  },
}
role service: request getting bag size
role service: onBagGetSize
role bag info: {
	type = "role_bag",
	name = "bag_get_size",
	body = {
		size = 32,
	}
}
role model: get bag size: 32

windows 下运行 makeluamodule.exe 来创建新的模块,自动创建一个完整项目所有的代码和文件。

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.