Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

87 Zeilen
1.4 KiB

  1. let components = [
  2. 'keyboardMover',
  3. 'mouseMover',
  4. 'touchMover',
  5. 'player',
  6. 'pather',
  7. 'attackAnimation',
  8. 'lightningEffect',
  9. 'moveAnimation',
  10. 'bumpAnimation',
  11. 'animation',
  12. 'light',
  13. 'lightPatch',
  14. 'projectile',
  15. 'particles',
  16. 'explosion',
  17. 'spellbook',
  18. 'inventory',
  19. 'stats',
  20. 'chest',
  21. 'effects',
  22. 'quests',
  23. 'events',
  24. 'resourceNode',
  25. 'gatherer',
  26. 'stash',
  27. 'flash',
  28. 'chatter',
  29. 'dialogue',
  30. 'trade',
  31. 'reputation',
  32. 'serverActions',
  33. 'social',
  34. 'passives',
  35. 'sound'
  36. ].map(function (c) {
  37. return 'js/components/' + c;
  38. });
  39. define([
  40. ...components,
  41. '../system/events'
  42. ], function () {
  43. const events = arguments[arguments.length - 1];
  44. const hookEvent = function (e, cb) {
  45. if (!this.eventList[e])
  46. this.eventList[e] = [];
  47. this.eventList[e].push(cb);
  48. events.on(e, cb);
  49. };
  50. const unhookEvents = function () {
  51. Object.entries(this.eventList).forEach(([eventName, callbacks]) => {
  52. callbacks.forEach(c => events.off(eventName, c));
  53. });
  54. };
  55. let templates = {};
  56. [].forEach.call(arguments, function (t, i) {
  57. //Don't do this for the events module
  58. if (i === arguments.length - 1)
  59. return;
  60. t.eventList = {};
  61. t.hookEvent = hookEvent.bind(t);
  62. t.unhookEvents = unhookEvents.bind(t);
  63. templates[t.type] = t;
  64. });
  65. return {
  66. getTemplate: function (type) {
  67. if (type === 'lightpatch')
  68. type = 'lightPatch';
  69. let template = templates[type] || {
  70. type: type
  71. };
  72. return template;
  73. }
  74. };
  75. });