1 /* 2 * 游戏主场景 3 */ 4 var GameMainScene = ccui.Layout.extend( 5 { 6 ctor:function() 7 { 8 this._super(); 9 this.zinit(); 10 this.setTopInfor(); 11 this.addStarLayout(); 12 }, 13 //游戏主场景顶部显示信息 14 setTopInfor:function() 15 { 16 var gameTopInfo = new GameTopInformation(); 17 gameTopInfo.y = this.size.height - gameTopInfo.height; 18 this.addChild(gameTopInfo, 1); 19 }, 20 //将星星层添加到主场景 21 addStarLayout:function() 22 { 23 var starLayout = GameStarLayout.createLayout(); 24 this.addChild(starLayout, 1); 25 }, 26 //初始化 27 zinit:function() 28 { 29 //设置布局大小 30 this.size = cc.size(480, 800); 31 this.setSize(this.size); 32 //实例化背景图片 33 var backGround = new myImage(res.mainbacktop); 34 backGround.y = this.size.height - backGround.height; 35 this.addChild(backGround, 0); 36 var backGround1 = new myImage(res.mainbackbottom); 37 this.addChild(backGround1, 0); 38 } 39 }); 40 41 42 GameMainScene.createScene = function() 43 { 44 var gameLayout = new GameMainScene(); 45 var scene = cc.Scene.create(); 46 scene.addChild(gameLayout); 47 return scene; 48 };
时间: 2024-10-11 17:21:31