ShowPage.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. (function(fg, cjs){
  2. var lib = {},p;
  3. lib.show = function(){
  4. this.girl = Girl.getPerson(fg.gameData.dressData);
  5. fg.gameLayer.addChild(this.girl);
  6. this.btn = new cjs.Container;
  7. this.replayBtn = new cjs.Sprite(new cjs.SpriteSheet({
  8. images:[fg.getAsset('btns')],
  9. frames:[[0,100,90,38,0]]
  10. }));
  11. this.btn.addChild(this.replayBtn);
  12. this.moreBtn = new cjs.Sprite(new cjs.SpriteSheet({
  13. images:[fg.getAsset('btns')],
  14. frames:[[100,0,90,38,0]]
  15. }));
  16. this.moreBtn.setTransform(650-548, 0);
  17. this.btn.addChild(this.moreBtn);
  18. var moreLink = GameAPI.Branding.getLink('more_games');
  19. if(!('error' in moreLink)) {
  20. this.moreBtn.addEventListener('click', moreLink.action);
  21. }
  22. this.replayBtn.addEventListener('click', cjs.proxy(this.replayHandler, this));
  23. fg.gameLayer.addChild(this.btn);
  24. fg.currentScene = this;
  25. this.doLayout();
  26. this.btn.y = stage.canvas.height + 50;
  27. this.btn.x = 548*wScale;
  28. cjs.Tween.get(this.btn).to({y:stage.canvas.height - 100*currentScale},8*fps);
  29. };
  30. lib.replayHandler = function(evt) {
  31. SoundController.getInstance().play('fx_click');
  32. this.replayBtn.removeAllEventListeners('click');
  33. cjs.Tween.get(this.girl).to({x:-400*wScale},8*fps);
  34. cjs.Tween.get(this.btn).to({y:stage.canvas.height + 50},8*fps).call(this.goNext, [], this);
  35. };
  36. lib.goNext = function(){
  37. fg.jumpTo('StartPage');
  38. };
  39. lib.doLayout = function(){
  40. this.girl.setTransform(423*wScale, stage.canvas.height - 200*1.19*currentScale, 1.19*currentScale, 1.19*currentScale)
  41. this.btn.scaleX = this.btn.scaleY = currentScale;
  42. this.btn.x = stage.canvas.width - 200*currentScale;
  43. this.btn.y = stage.canvas.height - 100*currentScale;
  44. };
  45. lib.doClean = function(){
  46. fg.gameLayer.removeAllChildren();
  47. };
  48. fg.scenes.ShowPage = lib;
  49. })(FandlrGame, createjs);