场景中的布局
节点树的结构
CocosStudio自动生成成的代码:
--------------------------------------------------------------
-- This file was automatically generated by Cocos Studio.
-- Do not make changes to this file.
-- All changes will be lost.
--------------------------------------------------------------
local luaExtend = require "LuaExtend"
-- using for layout to decrease count of local variables
local layout = nil
local localLuaFile = nil
local innerCSD = nil
local innerProject = nil
local localFrame = nil
local Result = {}
------------------------------------------------------------
-- function call description
-- create function caller should provide a function to
-- get a callback function in creating scene process.
-- the returned callback function will be registered to
-- the callback event of the control.
-- the function provider is as below :
-- Callback callBackProvider(luaFileName, node, callbackName)
-- parameter description:
-- luaFileName : a string, lua file name
-- node : a Node, event source
-- callbackName : a string, callback function name
-- the return value is a callback function
------------------------------------------------------------
function Result.create(callBackProvider)
local result={}
setmetatable(result, luaExtend)
--Create Scene
local Scene=cc.Node:create()
Scene:setName("Scene")
--Create Default
local Default = cc.Sprite:create("HelloWorld.png")
Default:setName("Default")
Default:setTag(5)
Default:setCascadeColorEnabled(true)
Default:setCascadeOpacityEnabled(true)
Default:setPosition(196.4735, 508.5832)
Default:setScaleX(0.4093)
Default:setScaleY(0.4093)
layout = ccui.LayoutComponent:bindLayoutComponent(Default)
layout:setPositionPercentX(0.2047)
layout:setPositionPercentY(0.7947)
layout:setPercentWidth(1.0000)
layout:setPercentHeight(1.0000)
layout:setSize({width = 960.0000, height = 640.0000})
layout:setLeftMargin(-283.5265)
layout:setRightMargin(283.5265)
layout:setTopMargin(-188.5832)
layout:setBottomMargin(188.5832)
Default:setBlendFunc({src = 1, dst = 771})
Scene:addChild(Default)
--Create Button
local Button = ccui.Button:create()
Button:ignoreContentAdaptWithSize(false)
Button:loadTextureNormal("Default/Button_Normal.png",0)
Button:loadTexturePressed("Default/Button_Press.png",0)
Button:loadTextureDisabled("Default/Button_Disable.png",0)
Button:setTitleFontSize(14)
Button:setTitleText("Button")
Button:setTitleColor({r = 65, g = 65, b = 70})
Button:setScale9Enabled(true)
Button:setCapInsets({x = 15, y = 11, width = 16, height = 14})
Button:setLayoutComponentEnabled(true)
Button:setName("Button")
Button:setTag(60)
Button:setCascadeColorEnabled(true)
Button:setCascadeOpacityEnabled(true)
Button:setPosition(457.2020, 601.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(Button)
layout:setPositionPercentX(0.4763)
layout:setPositionPercentY(0.9397)
layout:setPercentWidth(0.0479)
layout:setPercentHeight(0.0563)
layout:setSize({width = 46.0000, height = 36.0000})
layout:setLeftMargin(434.2020)
layout:setRightMargin(479.7980)
layout:setTopMargin(20.5933)
layout:setBottomMargin(583.4067)
Scene:addChild(Button)
--Create CheckBox
local CheckBox = ccui.CheckBox:create()
CheckBox:ignoreContentAdaptWithSize(false)
CheckBox:loadTextureBackGround("Default/CheckBox_Normal.png",0)
CheckBox:loadTextureBackGroundSelected("Default/CheckBox_Press.png",0)
CheckBox:loadTextureBackGroundDisabled("Default/CheckBox_Disable.png",0)
CheckBox:loadTextureFrontCross("Default/CheckBoxNode_Normal.png",0)
CheckBox:loadTextureFrontCrossDisabled("Default/CheckBoxNode_Disable.png",0)
CheckBox:setSelected(true)
CheckBox:setLayoutComponentEnabled(true)
CheckBox:setName("CheckBox")
CheckBox:setTag(61)
CheckBox:setCascadeColorEnabled(true)
CheckBox:setCascadeOpacityEnabled(true)
CheckBox:setPosition(535.2020, 601.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(CheckBox)
layout:setPositionPercentX(0.5575)
layout:setPositionPercentY(0.9397)
layout:setPercentWidth(0.0417)
layout:setPercentHeight(0.0625)
layout:setSize({width = 40.0000, height = 40.0000})
layout:setLeftMargin(515.2020)
layout:setRightMargin(404.7980)
layout:setTopMargin(18.5933)
layout:setBottomMargin(581.4067)
Scene:addChild(CheckBox)
--Create Image
local Image = ccui.ImageView:create()
Image:ignoreContentAdaptWithSize(false)
Image:loadTexture("Default/ImageFile.png",0)
Image:setLayoutComponentEnabled(true)
Image:setName("Image")
Image:setTag(62)
Image:setCascadeColorEnabled(true)
Image:setCascadeOpacityEnabled(true)
Image:setPosition(613.2020, 602.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(Image)
layout:setPositionPercentX(0.6388)
layout:setPositionPercentY(0.9413)
layout:setPercentWidth(0.0479)
layout:setPercentHeight(0.0719)
layout:setSize({width = 46.0000, height = 46.0000})
layout:setLeftMargin(590.2020)
layout:setRightMargin(323.7980)
layout:setTopMargin(14.5933)
layout:setBottomMargin(579.4067)
Scene:addChild(Image)
--Create Text
local Text = ccui.Text:create()
Text:ignoreContentAdaptWithSize(true)
Text:setTextAreaSize({width = 0, height = 0})
Text:setFontSize(20)
Text:setString([[Text Label]])
Text:setLayoutComponentEnabled(true)
Text:setName("Text")
Text:setTag(63)
Text:setCascadeColorEnabled(true)
Text:setCascadeOpacityEnabled(true)
Text:setPosition(704.2020, 601.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(Text)
layout:setPositionPercentX(0.7335)
layout:setPositionPercentY(0.9397)
layout:setPercentWidth(0.1042)
layout:setPercentHeight(0.0313)
layout:setSize({width = 100.0000, height = 20.0000})
layout:setLeftMargin(654.2020)
layout:setRightMargin(205.7980)
layout:setTopMargin(28.5933)
layout:setBottomMargin(591.4067)
Scene:addChild(Text)
--Create AtlasLabel
local AtlasLabel = ccui.TextAtlas:create([[./0123456789]],
"Default/TextAtlas.png",
14,
18,
".")
AtlasLabel:setLayoutComponentEnabled(true)
AtlasLabel:setName("AtlasLabel")
AtlasLabel:setTag(64)
AtlasLabel:setCascadeColorEnabled(true)
AtlasLabel:setCascadeOpacityEnabled(true)
AtlasLabel:setPosition(856.2020, 600.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(AtlasLabel)
layout:setPositionPercentX(0.8919)
layout:setPositionPercentY(0.9381)
layout:setPercentWidth(0.1750)
layout:setPercentHeight(0.0281)
layout:setSize({width = 168.0000, height = 18.0000})
layout:setLeftMargin(772.2020)
layout:setRightMargin(19.7980)
layout:setTopMargin(30.5933)
layout:setBottomMargin(591.4067)
Scene:addChild(AtlasLabel)
--Create BitmapFontLabel
local BitmapFontLabel = ccui.TextBMFont:create()
BitmapFontLabel:setString([[Fnt Text Label]])
BitmapFontLabel:setLayoutComponentEnabled(true)
BitmapFontLabel:setName("BitmapFontLabel")
BitmapFontLabel:setTag(65)
BitmapFontLabel:setCascadeColorEnabled(true)
BitmapFontLabel:setCascadeOpacityEnabled(true)
BitmapFontLabel:setPosition(480.2020, 512.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(BitmapFontLabel)
layout:setPositionPercentX(0.5002)
layout:setPositionPercentY(0.8006)
layout:setPercentWidth(0.0781)
layout:setPercentHeight(0.0234)
layout:setSize({width = 75.0000, height = 15.0000})
layout:setLeftMargin(442.7020)
layout:setRightMargin(442.2980)
layout:setTopMargin(120.0933)
layout:setBottomMargin(504.9067)
Scene:addChild(BitmapFontLabel)
--Create LoadingBar
local LoadingBar = ccui.LoadingBar:create()
LoadingBar:loadTexture("Default/LoadingBarFile.png",0)
LoadingBar:ignoreContentAdaptWithSize(false)
LoadingBar:setPercent(80)
LoadingBar:setLayoutComponentEnabled(true)
LoadingBar:setName("LoadingBar")
LoadingBar:setTag(66)
LoadingBar:setCascadeColorEnabled(true)
LoadingBar:setCascadeOpacityEnabled(true)
LoadingBar:setPosition(669.2020, 515.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(LoadingBar)
layout:setPositionPercentX(0.6971)
layout:setPositionPercentY(0.8053)
layout:setPercentWidth(0.2083)
layout:setPercentHeight(0.0219)
layout:setSize({width = 200.0000, height = 14.0000})
layout:setLeftMargin(569.2020)
layout:setRightMargin(190.7980)
layout:setTopMargin(117.5933)
layout:setBottomMargin(508.4067)
Scene:addChild(LoadingBar)
--Create Slider
local Slider = ccui.Slider:create()
Slider:ignoreContentAdaptWithSize(false)
Slider:loadBarTexture("Default/Slider_Back.png",0)
Slider:loadProgressBarTexture("Default/Slider_PressBar.png",0)
Slider:loadSlidBallTextureNormal("Default/SliderNode_Normal.png",0)
Slider:loadSlidBallTexturePressed("Default/SliderNode_Press.png",0)
Slider:loadSlidBallTextureDisabled("Default/SliderNode_Disable.png",0)
Slider:setPercent(50)
Slider:setLayoutComponentEnabled(true)
Slider:setName("Slider")
Slider:setTag(67)
Slider:setCascadeColorEnabled(true)
Slider:setCascadeOpacityEnabled(true)
Slider:setPosition(542.2020, 444.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(Slider)
layout:setPositionPercentX(0.5648)
layout:setPositionPercentY(0.6944)
layout:setPercentWidth(0.2083)
layout:setPercentHeight(0.0219)
layout:setSize({width = 200.0000, height = 14.0000})
layout:setLeftMargin(442.2020)
layout:setRightMargin(317.7980)
layout:setTopMargin(188.5933)
layout:setBottomMargin(437.4067)
Scene:addChild(Slider)
--Create TextField
local TextField = ccui.TextField:create()
TextField:ignoreContentAdaptWithSize(false)
tolua.cast(TextField:getVirtualRenderer(), "cc.Label"):setLineBreakWithoutSpace(true)
TextField:setFontSize(20)
TextField:setPlaceHolder("Text Field")
TextField:setString([[]])
TextField:setMaxLength(10)
TextField:setLayoutComponentEnabled(true)
TextField:setName("TextField")
TextField:setTag(68)
TextField:setCascadeColorEnabled(true)
TextField:setCascadeOpacityEnabled(true)
TextField:setPosition(493.2020, 392.4067)
layout = ccui.LayoutComponent:bindLayoutComponent(TextField)
layout:setPositionPercentX(0.5138)
layout:setPositionPercentY(0.6131)
layout:setPercentWidth(0.1042)
layout:setPercentHeight(0.0313)
layout:setSize({width = 100.0000, height = 20.0000})
layout:setLeftMargin(443.2020)
layout:setRightMargin(416.7980)
layout:setTopMargin(237.5933)
layout:setBottomMargin(382.4067)
Scene:addChild(TextField)
--Create Panel
local Panel = ccui.Layout:create()
Panel:ignoreContentAdaptWithSize(false)
Panel:setClippingEnabled(false)
Panel:setBackGroundColorType(1)
Panel:setBackGroundColor({r = 150, g = 200, b = 255})
Panel:setBackGroundColorOpacity(102)
Panel:setTouchEnabled(true);
Panel:setLayoutComponentEnabled(true)
Panel:setName("Panel")
Panel:setTag(69)
Panel:setCascadeColorEnabled(true)
Panel:setCascadeOpacityEnabled(true)
Panel:setPosition(24.0804, 159.6305)
layout = ccui.LayoutComponent:bindLayoutComponent(Panel)
layout:setPositionPercentX(0.0251)
layout:setPositionPercentY(0.2494)
layout:setPercentWidth(0.2083)
layout:setPercentHeight(0.3125)
layout:setSize({width = 200.0000, height = 200.0000})
layout:setLeftMargin(24.0804)
layout:setRightMargin(735.9196)
layout:setTopMargin(280.3695)
layout:setBottomMargin(159.6305)
Scene:addChild(Panel)
--Create ListView
local ListView = ccui.ListView:create()
ListView:setDirection(1)
ListView:setGravity(0)
ListView:ignoreContentAdaptWithSize(false)
ListView:setClippingEnabled(false)
ListView:setBackGroundColorType(1)
ListView:setBackGroundColor({r = 150, g = 150, b = 255})
ListView:setBackGroundColorOpacity(102)
ListView:setLayoutComponentEnabled(true)
ListView:setName("ListView")
ListView:setTag(70)
ListView:setCascadeColorEnabled(true)
ListView:setCascadeOpacityEnabled(true)
ListView:setPosition(275.4456, 157.4640)
layout = ccui.LayoutComponent:bindLayoutComponent(ListView)
layout:setPositionPercentX(0.2869)
layout:setPositionPercentY(0.2460)
layout:setPercentWidth(0.2083)
layout:setPercentHeight(0.3125)
layout:setSize({width = 200.0000, height = 200.0000})
layout:setLeftMargin(275.4456)
layout:setRightMargin(484.5544)
layout:setTopMargin(282.5359)
layout:setBottomMargin(157.4640)
Scene:addChild(ListView)
--Create PageView
local PageView = ccui.PageView:create()
PageView:ignoreContentAdaptWithSize(false)
PageView:setClippingEnabled(false)
PageView:setBackGroundColorType(1)
PageView:setBackGroundColor({r = 150, g = 150, b = 100})
PageView:setBackGroundColorOpacity(102)
PageView:setLayoutComponentEnabled(true)
PageView:setName("PageView")
PageView:setTag(71)
PageView:setCascadeColorEnabled(true)
PageView:setCascadeOpacityEnabled(true)
PageView:setPosition(528.9765, 156.3800)
layout = ccui.LayoutComponent:bindLayoutComponent(PageView)
layout:setPositionPercentX(0.5510)
layout:setPositionPercentY(0.2443)
layout:setPercentWidth(0.2083)
layout:setPercentHeight(0.3125)
layout:setSize({width = 200.0000, height = 200.0000})
layout:setLeftMargin(528.9765)
layout:setRightMargin(231.0235)
layout:setTopMargin(283.6200)
layout:setBottomMargin(156.3800)
Scene:addChild(PageView)
--Create ScrollView
local ScrollView = ccui.ScrollView:create()
ScrollView:setInnerContainerSize({width = 800, height = 300})
ScrollView:ignoreContentAdaptWithSize(false)
ScrollView:setClippingEnabled(false)
ScrollView:setBackGroundColorType(1)
ScrollView:setBackGroundColor({r = 255, g = 150, b = 100})
ScrollView:setBackGroundColorOpacity(102)
ScrollView:setLayoutComponentEnabled(true)
ScrollView:setName("ScrollView")
ScrollView:setTag(72)
ScrollView:setCascadeColorEnabled(true)
ScrollView:setCascadeOpacityEnabled(true)
ScrollView:setPosition(25.4703, 20.3567)
layout = ccui.LayoutComponent:bindLayoutComponent(ScrollView)
layout:setPositionPercentX(0.0265)
layout:setPositionPercentY(0.0318)
layout:setPercentWidth(0.8333)
layout:setPercentHeight(0.1563)
layout:setSize({width = 800.0000, height = 100.0000})
layout:setLeftMargin(25.4703)
layout:setRightMargin(134.5297)
layout:setTopMargin(519.6432)
layout:setBottomMargin(20.3567)
Scene:addChild(ScrollView)
--Create Node
local Node=cc.Node:create()
Node:setName("Node")
Node:setTag(73)
Node:setCascadeColorEnabled(true)
Node:setCascadeOpacityEnabled(true)
Node:setPosition(855.4041, 442.9095)
layout = ccui.LayoutComponent:bindLayoutComponent(Node)
layout:setPositionPercentX(0.8910)
layout:setPositionPercentY(0.6920)
layout:setLeftMargin(855.4041)
layout:setRightMargin(104.5959)
layout:setTopMargin(197.0905)
layout:setBottomMargin(442.9095)
Scene:addChild(Node)
--Create Particle
local Particle = cc.ParticleSystemQuad:create("Default/defaultParticle.plist")
Particle:setName("Particle")
Particle:setTag(74)
Particle:setCascadeColorEnabled(true)
Particle:setCascadeOpacityEnabled(true)
Particle:setPosition(852.1537, 280.3887)
layout = ccui.LayoutComponent:bindLayoutComponent(Particle)
layout:setPositionPercentX(0.8877)
layout:setPositionPercentY(0.4381)
layout:setLeftMargin(852.1537)
layout:setRightMargin(107.8463)
layout:setTopMargin(359.6113)
layout:setBottomMargin(280.3887)
Particle:setBlendFunc({src = 775, dst = 1})
Scene:addChild(Particle)
--Create Animation
result['animation'] = ccs.ActionTimeline:create()
result['animation']:setDuration(0)
result['animation']:setTimeSpeed(1.0000)
--Create Animation List
result['root'] = Scene
return result;
end
return Result