25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

99 satır
1.9 KiB

  1. define([
  2. 'js/system/client',
  3. 'ui/factory',
  4. 'js/renderer',
  5. 'js/objects/objects',
  6. 'js/rendering/effects',
  7. 'js/rendering/numbers',
  8. 'js/input',
  9. 'js/system/events',
  10. 'js/resources',
  11. 'ui/templates/inventory/inventory',
  12. 'ui/templates/equipment/equipment',
  13. 'ui/templates/stash/stash',
  14. 'ui/templates/hud/hud',
  15. 'ui/templates/online/online',
  16. 'ui/templates/quests/quests',
  17. 'ui/templates/dialogue/dialogue',
  18. 'ui/templates/smithing/smithing',
  19. 'ui/templates/overlay/overlay',
  20. 'ui/templates/tooltips/tooltips',
  21. 'ui/templates/reputation/reputation',
  22. 'ui/templates/death/death'
  23. ], function(
  24. client,
  25. uiFactory,
  26. renderer,
  27. objects,
  28. effects,
  29. numbers,
  30. input,
  31. events,
  32. resources
  33. ) {
  34. return {
  35. hasFocus: true,
  36. init: function() {
  37. client.init(this.onClientReady.bind(this));
  38. },
  39. onClientReady: function() {
  40. client.request({
  41. module: 'clientConfig',
  42. method: 'getResourcesList',
  43. callback: this.onGetResourceList.bind(this)
  44. });
  45. },
  46. onGetResourceList: function(list) {
  47. resources.init(list);
  48. events.on('onResourcesLoaded', this.start.bind(this));
  49. },
  50. start: function() {
  51. window.onfocus = this.onFocus.bind(this, true);
  52. window.onblur = this.onFocus.bind(this, false);
  53. $(window).on('contextmenu', function(e) {
  54. e.preventDefault();
  55. return false;
  56. });
  57. objects.init();
  58. renderer.init();
  59. input.init();
  60. numbers.init();
  61. uiFactory.init();
  62. uiFactory.build('login', 'body');
  63. this.update();
  64. this.render();
  65. },
  66. onFocus: function(hasFocus) {
  67. //Hack: Later we might want to make it not render when out of focus
  68. this.hasFocus = true;
  69. if (!hasFocus)
  70. input.resetKeys();
  71. },
  72. render: function() {
  73. numbers.render();
  74. renderer.render();
  75. requestAnimationFrame(this.render.bind(this));
  76. },
  77. update: function() {
  78. objects.update();
  79. renderer.update();
  80. uiFactory.update();
  81. setTimeout(this.update.bind(this), 16);
  82. }
  83. };
  84. });