1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| var Start = window.Start = cc.Scene.extend({ _screenLayer: null, _startLayer:null, _gameLayer:null, _isInit: false, ctor: function(){ this._super(); }, onEnter: function(){ this._isInit = true;
this._screenLayer = new cc.Layer(); this.addChild(this._screenLayer);
this._startLayer = new StartLayer(); this._screenLayer.addChild(this._startLayer);
if(typeof rotateHandler === 'function') { rotateHandler(); } this._super(); }, onExit: function(){ }, _resize: function(deg,rate,size){ if(!this._isInit) return; this._screenLayer.rotation = deg; this._screenLayer.scale = rate;
this._startLayer._resize(size); } });
var StartLayer = cc.Layer.extend({ _bg:null, _cat:null, _frameCount:0, _catIsMoving: false, ctor: function(){ this._super();
this._bg = new cc.Sprite(res.mainBg); this._bg.x = cc.winSize.width/2; this._bg.y = cc.winSize.height/2; this.addChild(this._bg);
this.round1 = new cc.Sprite(res.round1); this.round1.x = cc.winSize.width/2; this.round1.y = cc.winSize.height/2; this.round1.scale = 0.3; this.addChild(this.round1);
var r = new cc.rotateBy(0.6, 360).repeatForever(); this.round1.runAction(r);
this.round2 = new cc.Sprite(res.round2); this.round2.x = cc.winSize.width/2 - 100; this.round2.y = cc.winSize.width/2 - 100; this.addChild(this.round2); }, _resize : function(size){ var height = cc.winSize.height, width = cc.winSize.width; if(width/height>=size.width/size.height){ width = height*size.width/size.height; }else{ height = width*size.height/size.width; }
this.round2.x = (size.width + width) / 2 + 10; this.round2.y = (size.height + height) / 2 + 10; } });
|