pregame.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. (function() {
  2. FZ.Game = {};
  3. FZ.Game.checkButtun = function(theButton) {
  4. var Position = theButton.getPosition();
  5. if (FZ.ControlManager.Mouse.x > Position.x
  6. && FZ.ControlManager.Mouse.y > Position.y
  7. && FZ.ControlManager.Mouse.x < Position.x
  8. + theButton.__theImages[0][0].width
  9. && FZ.ControlManager.Mouse.y < Position.y
  10. + theButton.__theImages[0][0].height) {
  11. theButton.setFrame(1 + (FZ.ControlManager.Mouse.leftKey ? 1 : 0));
  12. return true;
  13. } else {
  14. theButton.setFrame(0);
  15. }
  16. return false;
  17. };
  18. FZ.Game.PreLoadingState = new (FZ.newClass( {
  19. StateName : FZ.StateDefs.GAME_STATE_PRELOADING,
  20. m_test_timer : 0,
  21. preProcess : function() {
  22. // loading the resources for the loading state
  23. FZ.spriteManager.addResource("LOADING_BG",0,"imgs/MAIN_MENU_AND_LOADING_BG.png",0,0,1);
  24. FZ.spriteManager.addResource("majong_BG",0,"imgs/majong_BG.png",0,0,1);
  25. FZ.spriteManager.addResource("loading_empty",0,"imgs/loading_empty.png",0,0,1);
  26. FZ.spriteManager.addResource("loading_full",0,"imgs/loading_full.png",0,0,1);
  27. FZ.spriteManager.addResource("SpilSplash",0,"imgs/SpilSplash.png",0,0,1);
  28. this.m_timer = setTimeout(FZ.Tools.bind(this, this.AIUpdate), 500);
  29. },
  30. postProcess : function() {
  31. },
  32. AIUpdate : function() {
  33. FZ.PrintLog("" + this.m_test_timer);
  34. if (FZ.ResourceManager.isResourceLoaded()) {
  35. FZ.GameBase.switchToState(FZ.StateDefs.GAME_STATE_LOGO);
  36. }
  37. else {
  38. this.m_timer = setTimeout(FZ.Tools.bind(this, this.AIUpdate), 200);
  39. }
  40. }
  41. }, FZ.BaseState))();
  42. })();