Components
Components
template.components.pageX.index
local sceneName = ... -- local scene = require('controller.scene').new(sceneName, { name = "{{name}}", components = { layers = { {{#layers}} {{>recursive}} {{/layers}} }, audios = { {{#audios}} long={ {{#long}} "{{.}}", {{/long}} }, short={ {{#short}}"{{.}}", {{/short}} } {{/audios}} }, groups = { {{#groups}} "{{.}}", {{/groups}} }, timers = { {{#timers}} "{{.}}", {{/timers}} }, variables = { {{#variables}} "{{.}}", {{/variables}} }, page = { {{#page}}"{{.}}", {{/page}} } }, commands = { {{#events}} "{{.}}", {{/events}} }, onInit = function(scene) print("onInit") end }) -- return scene
editor.util
please notice saveLua func uses model.components
function M.renderIndex(book, page, model) local dst = "App/"..book.."/"..page .."/components/index.lua" local tmplt = "editor.template/components/pageX/index.lua" ... ... M.saveLua(tmplt, dst, {name = model.name, events = model.commands, layers = model.components.layers, audios = model.components.audios, timers = model.components.timers, groups = model.components.groups, variables = model.components.variables, page = model.components.page, }, partial) return dst end
bookFree.timer.index
local sceneName = ... -- local scene = require('controller.scene').new(sceneName, { name = "timer", components = { layers = { { bg={} }, }, audios = {}, groups = {}, timers = {"timerOne", "timerTwo"}, variables = {"varOne", "varTwo"}, page = {} }, commands = { "timerAction", "variableAction", }, onInit = function(scene) print("onInit") end }) -- return scene
example bookFree/timer
the editor files
- components.pageX.timers.timer
- comonents.editor.timer.index
- comonents.editor.timer.buttons
- comonents.editor.timer.timerTable
- components.editor.timer.defaults
- components.editor.timer.controller.cancel
- components.editor.timer.controller.save
example bookFree/page1
.
├── assets
├── commands
├── components <==== page components
│ ├── page1
│ │ ├── audios
│ │ ├── layers
│ │ │ ├── bg.lua
│ │ │ ├── gotoBtn.lua
│ │ │ ├── gotoBtn_animation.lua <=== animation component lua
│ │ │ ├── title.lua
│ │ │ └── title_animation.lua <=== animation component lua
│ │ ├── groups
│ │ ├── page
│ │ ├── times
│ │ ├── variables
│ │ └── index.lua
│ └── page2
├── models
│ ├── page1
│ │ ├── bg.json
│ │ ├── events
│ │ │ └── eventOne.json
│ │ ├── gotoBtn.json
│ │ ├── gotoBtn_animation.json <=== animation component json
│ │ ├── index.json
│ │ ├── title.json
│ │ └── title_animation.json <=== animation component json
│ └── page2