Fix the bugs that title and button disappeared because of camera setting

This commit is contained in:
samuele3hu 2015-04-14 15:40:12 +08:00
parent b2c3628aee
commit dd3b6ced34
2 changed files with 9 additions and 7 deletions

View File

@ -1032,7 +1032,6 @@ end
---------------------------------------- ----------------------------------------
local Sprite3DCubeMapTest = class("Sprite3DCubeMapTest", function () local Sprite3DCubeMapTest = class("Sprite3DCubeMapTest", function ()
local layer = cc.Layer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer return layer
end) end)
@ -1045,9 +1044,6 @@ function Sprite3DCubeMapTest:ctor()
end end
function Sprite3DCubeMapTest:init() function Sprite3DCubeMapTest:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event) self:registerScriptHandler(function (event)
if event == "enter" then if event == "enter" then
self:onEnter() self:onEnter()
@ -1068,6 +1064,9 @@ end
function Sprite3DCubeMapTest:onEnter() function Sprite3DCubeMapTest:onEnter()
local s = cc.Director:getInstance():getWinSize() local s = cc.Director:getInstance():getWinSize()
self:addNewSpriteWithCoords(cc.p(s.width / 2, s.height / 2)) self:addNewSpriteWithCoords(cc.p(s.width / 2, s.height / 2))
Helper.initWithLayer(self)
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
end end
function Sprite3DCubeMapTest:onExit() function Sprite3DCubeMapTest:onExit()

View File

@ -5,7 +5,7 @@ require "cocos.3d.3dConstants"
---------------------------------------- ----------------------------------------
local TerrainSimple = class("TerrainSimple", function () local TerrainSimple = class("TerrainSimple", function ()
local layer = cc.Layer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer return layer
end) end)
@ -15,8 +15,7 @@ function TerrainSimple:ctor()
end end
function TerrainSimple:init() function TerrainSimple:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
local visibleSize = cc.Director:getInstance():getVisibleSize() local visibleSize = cc.Director:getInstance():getVisibleSize()
@ -26,6 +25,10 @@ function TerrainSimple:init()
self._camera:setPosition3D(cc.vec3(-1, 1.6, 4)) self._camera:setPosition3D(cc.vec3(-1, 1.6, 4))
self:addChild(self._camera) self:addChild(self._camera)
Helper.initWithLayer(self)
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
local detailMapR = { _detailMapSrc = "TerrainTest/dirt.jpg", _detailMapSize = 35} local detailMapR = { _detailMapSrc = "TerrainTest/dirt.jpg", _detailMapSize = 35}
local detailMapG = { _detailMapSrc = "TerrainTest/Grass2.jpg", _detailMapSize = 35} local detailMapG = { _detailMapSrc = "TerrainTest/Grass2.jpg", _detailMapSize = 35}
local detailMapB = { _detailMapSrc = "TerrainTest/road.jpg", _detailMapSize = 35} local detailMapB = { _detailMapSrc = "TerrainTest/road.jpg", _detailMapSize = 35}