@urso/core 0.8.21 → 0.9.1-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +227 -227
  3. package/build/js/index.js +77212 -2
  4. package/package.json +36 -50
  5. package/src/js/app.js +105 -104
  6. package/src/js/components/base/controller.js +76 -78
  7. package/src/js/components/debug/controller.js +39 -39
  8. package/src/js/components/debug/coords.js +23 -23
  9. package/src/js/components/debug/fps.js +36 -36
  10. package/src/js/components/debug/template.js +55 -55
  11. package/src/js/components/debug/timescale.js +60 -60
  12. package/src/js/components/deviceRotate/controller.js +95 -95
  13. package/src/js/components/editor/api.js +127 -127
  14. package/src/js/components/editor/controller.js +13 -13
  15. package/src/js/components/fullscreen/android.js +104 -104
  16. package/src/js/components/fullscreen/controller.js +76 -76
  17. package/src/js/components/fullscreen/desktop.js +49 -49
  18. package/src/js/components/fullscreen/ios.js +115 -115
  19. package/src/js/components/layersSwitcher/config.js +26 -26
  20. package/src/js/components/layersSwitcher/controller.js +36 -36
  21. package/src/js/components/loader/controller.js +66 -66
  22. package/src/js/components/loader/template.js +71 -71
  23. package/src/js/components/soundInitialPopup/controller.js +43 -43
  24. package/src/js/components/soundInitialPopup/template.js +110 -110
  25. package/src/js/components/stateDriven/controller.js +123 -123
  26. package/src/js/config/load.js +325 -194
  27. package/src/js/config/main.js +17 -17
  28. package/src/js/extra/browserEvents.js +57 -57
  29. package/src/js/extra/main.js +23 -25
  30. package/src/js/extra/pixiPatch.js +173 -171
  31. package/src/js/index.js +7 -7
  32. package/src/js/lib/cache.js +199 -125
  33. package/src/js/lib/composition.js +85 -85
  34. package/src/js/lib/device.js +1215 -1215
  35. package/src/js/lib/helper.js +678 -678
  36. package/src/js/lib/loader.js +216 -218
  37. package/src/js/lib/localData.js +29 -29
  38. package/src/js/lib/logger.js +69 -69
  39. package/src/js/lib/math.js +161 -161
  40. package/src/js/lib/objectPool.js +208 -208
  41. package/src/js/lib/time.js +19 -19
  42. package/src/js/lib/tween.js +153 -153
  43. package/src/js/modules/assets/baseModel.js +21 -21
  44. package/src/js/modules/assets/config.js +38 -38
  45. package/src/js/modules/assets/controller.js +65 -65
  46. package/src/js/modules/assets/models/atlas.js +19 -19
  47. package/src/js/modules/assets/models/audiosprite.js +28 -28
  48. package/src/js/modules/assets/models/bitmapFont.js +11 -11
  49. package/src/js/modules/assets/models/container.js +19 -19
  50. package/src/js/modules/assets/models/font.js +11 -11
  51. package/src/js/modules/assets/models/html.js +11 -11
  52. package/src/js/modules/assets/models/image.js +17 -17
  53. package/src/js/modules/assets/models/json.js +11 -11
  54. package/src/js/modules/assets/models/jsonAtlas.js +11 -11
  55. package/src/js/modules/assets/models/sound.js +17 -17
  56. package/src/js/modules/assets/models/spine.js +18 -17
  57. package/src/js/modules/assets/models/spineAtlas.js +11 -0
  58. package/src/js/modules/assets/service.js +564 -553
  59. package/src/js/modules/i18n/config.js +17 -17
  60. package/src/js/modules/i18n/controller.js +71 -71
  61. package/src/js/modules/instances/controller.js +357 -357
  62. package/src/js/modules/logic/config/sounds.js +23 -23
  63. package/src/js/modules/logic/controller.js +52 -52
  64. package/src/js/modules/logic/main.js +8 -8
  65. package/src/js/modules/logic/sounds.js +103 -103
  66. package/src/js/modules/objects/baseModel.js +205 -207
  67. package/src/js/modules/objects/cache.js +99 -99
  68. package/src/js/modules/objects/config.js +10 -10
  69. package/src/js/modules/objects/controller.js +139 -139
  70. package/src/js/modules/objects/find.js +58 -58
  71. package/src/js/modules/objects/models/bitmapText.js +56 -49
  72. package/src/js/modules/objects/models/button.js +208 -209
  73. package/src/js/modules/objects/models/buttonComposite.js +38 -38
  74. package/src/js/modules/objects/models/checkbox.js +100 -100
  75. package/src/js/modules/objects/models/collection.js +56 -54
  76. package/src/js/modules/objects/models/component.js +48 -48
  77. package/src/js/modules/objects/models/container.js +22 -22
  78. package/src/js/modules/objects/models/emitterFx.js +103 -114
  79. package/src/js/modules/objects/models/graphics.js +40 -40
  80. package/src/js/modules/objects/models/group.js +22 -22
  81. package/src/js/modules/objects/models/hitArea.js +187 -187
  82. package/src/js/modules/objects/models/image.js +36 -36
  83. package/src/js/modules/objects/models/imagesAnimation.js +115 -115
  84. package/src/js/modules/objects/models/mask.js +40 -40
  85. package/src/js/modules/objects/models/nineSlicePlane.js +32 -32
  86. package/src/js/modules/objects/models/slider.js +357 -357
  87. package/src/js/modules/objects/models/spine.js +354 -339
  88. package/src/js/modules/objects/models/text.js +70 -70
  89. package/src/js/modules/objects/models/toggle.js +186 -186
  90. package/src/js/modules/objects/models/world.js +22 -22
  91. package/src/js/modules/objects/pool.js +68 -68
  92. package/src/js/modules/objects/propertyAdapter.js +592 -592
  93. package/src/js/modules/objects/proxy.js +299 -298
  94. package/src/js/modules/objects/selector.js +136 -136
  95. package/src/js/modules/objects/service.js +255 -254
  96. package/src/js/modules/objects/styles.js +210 -210
  97. package/src/js/modules/observer/controller.js +168 -168
  98. package/src/js/modules/observer/events.js +51 -56
  99. package/src/js/modules/scenes/controller.js +126 -127
  100. package/src/js/modules/scenes/model.js +28 -28
  101. package/src/js/modules/scenes/pixiWrapper.js +360 -351
  102. package/src/js/modules/scenes/resolutions.js +173 -173
  103. package/src/js/modules/scenes/resolutionsConfig.js +73 -73
  104. package/src/js/modules/scenes/service.js +144 -146
  105. package/src/js/modules/soundManager/controller.js +103 -103
  106. package/src/js/modules/soundManager/soundSprite.js +314 -314
  107. package/src/js/modules/statesManager/action.js +97 -97
  108. package/src/js/modules/statesManager/all.js +23 -23
  109. package/src/js/modules/statesManager/configStates.js +77 -77
  110. package/src/js/modules/statesManager/controller.js +219 -219
  111. package/src/js/modules/statesManager/functionsStorage.js +83 -83
  112. package/src/js/modules/statesManager/helper.js +27 -27
  113. package/src/js/modules/statesManager/race.js +91 -91
  114. package/src/js/modules/statesManager/sequence.js +48 -48
  115. package/src/js/modules/template/controller.js +28 -28
  116. package/src/js/modules/template/model.js +11 -11
  117. package/src/js/modules/template/service.js +137 -137
  118. package/src/js/modules/template/types.js +50 -49
  119. package/src/js/modules/transport/baseConnectionType.js +25 -25
  120. package/src/js/modules/transport/config.js +13 -13
  121. package/src/js/modules/transport/connectionTypes/websocket.js +77 -77
  122. package/src/js/modules/transport/connectionTypes/xhr.js +47 -47
  123. package/src/js/modules/transport/controller.js +48 -48
  124. package/src/js/modules/transport/decorator.js +17 -17
  125. package/src/js/modules/transport/service.js +150 -150
  126. package/vite.config.js +31 -0
  127. package/.babelrc +0 -12
  128. package/build/js/index.js.LICENSE.txt +0 -227
  129. package/src/js/modules/objects/models/atlasImage.js +0 -52
  130. package/src/js/modules/objects/models/dragContainer.js +0 -665
  131. package/src/js/modules/objects/models/emitter.js +0 -69
  132. package/src/js/modules/objects/models/scrollbox.js +0 -67
  133. package/src/js/modules/objects/models/textInput.js +0 -68
  134. package/webpack.config.js +0 -47
@@ -1,57 +1,57 @@
1
- class ExtraBrowserEvents {
2
- constructor() {
3
- this.singleton = true;
4
-
5
- this.RESIZE_DELAY = 250; //delay for resize event (browser will refresh his own params)
6
-
7
- this._keyPressHandler = this._keyPressHandler.bind(this);
8
- this.resizeHandler = this.resizeHandler.bind(this);
9
- this.visibilitychangeHandler = this.visibilitychangeHandler.bind(this);
10
- this._pointerEventsHandler = this._pointerEventsHandler.bind(this);
11
-
12
- this._resizeTimeoutId;
13
-
14
- this.init();
15
- }
16
-
17
- init() {
18
- window.addEventListener('keydown', this._keyPressHandler);
19
- document.addEventListener("visibilitychange", this.visibilitychangeHandler);
20
-
21
- window.addEventListener('resize', this.resizeHandler);
22
- window.addEventListener('orientationchange', this.resizeHandler);
23
- document.addEventListener('fullscreenchange', this.resizeHandler);
24
- document.addEventListener('webkitfullscreenchange', this.resizeHandler);
25
- document.addEventListener('mozfullscreenchange', this.resizeHandler);
26
-
27
- document.addEventListener('mousedown', this._pointerEventsHandler);
28
- document.addEventListener('mousemove', this._pointerEventsHandler);
29
- document.addEventListener('mouseup', this._pointerEventsHandler);
30
- document.addEventListener('touchstart', this._pointerEventsHandler);
31
- document.addEventListener('touchmove', this._pointerEventsHandler);
32
- document.addEventListener('touchend', this._pointerEventsHandler);
33
- document.addEventListener('wheel', this._pointerEventsHandler);
34
- }
35
-
36
- visibilitychangeHandler() {
37
- this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_VISIBILITYCHANGE, document.visibilityState);
38
- }
39
-
40
- resizeHandler() {
41
- if (this._resizeTimeoutId)
42
- Urso.clearTimeout(this._resizeTimeoutId)
43
-
44
- this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_PRE_RESIZE);
45
- this._resizeTimeoutId = Urso.setTimeout(() => this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_RESIZE), this.RESIZE_DELAY);
46
- }
47
-
48
- _pointerEventsHandler(event) {
49
- this.emit(Urso.events.EXTRA_BROWSEREVENTS_POINTER_EVENT, event);
50
- }
51
-
52
- _keyPressHandler(event) {
53
- this.emit(Urso.events.EXTRA_BROWSEREVENTS_KEYPRESS_EVENT, event);
54
- }
55
- }
56
-
57
- module.exports = ExtraBrowserEvents;
1
+ class ExtraBrowserEvents {
2
+ constructor() {
3
+ this.singleton = true;
4
+
5
+ this.RESIZE_DELAY = 250; //delay for resize event (browser will refresh his own params)
6
+
7
+ this._keyPressHandler = this._keyPressHandler.bind(this);
8
+ this.resizeHandler = this.resizeHandler.bind(this);
9
+ this.visibilitychangeHandler = this.visibilitychangeHandler.bind(this);
10
+ this._pointerEventsHandler = this._pointerEventsHandler.bind(this);
11
+
12
+ this._resizeTimeoutId;
13
+
14
+ this.init();
15
+ }
16
+
17
+ init() {
18
+ window.addEventListener('keydown', this._keyPressHandler);
19
+ document.addEventListener("visibilitychange", this.visibilitychangeHandler);
20
+
21
+ window.addEventListener('resize', this.resizeHandler);
22
+ window.addEventListener('orientationchange', this.resizeHandler);
23
+ document.addEventListener('fullscreenchange', this.resizeHandler);
24
+ document.addEventListener('webkitfullscreenchange', this.resizeHandler);
25
+ document.addEventListener('mozfullscreenchange', this.resizeHandler);
26
+
27
+ document.addEventListener('mousedown', this._pointerEventsHandler);
28
+ document.addEventListener('mousemove', this._pointerEventsHandler);
29
+ document.addEventListener('mouseup', this._pointerEventsHandler);
30
+ document.addEventListener('touchstart', this._pointerEventsHandler);
31
+ document.addEventListener('touchmove', this._pointerEventsHandler);
32
+ document.addEventListener('touchend', this._pointerEventsHandler);
33
+ document.addEventListener('wheel', this._pointerEventsHandler);
34
+ }
35
+
36
+ visibilitychangeHandler() {
37
+ this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_VISIBILITYCHANGE, document.visibilityState);
38
+ }
39
+
40
+ resizeHandler() {
41
+ if (this._resizeTimeoutId)
42
+ Urso.clearTimeout(this._resizeTimeoutId)
43
+
44
+ this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_PRE_RESIZE);
45
+ this._resizeTimeoutId = Urso.setTimeout(() => this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_RESIZE), this.RESIZE_DELAY);
46
+ }
47
+
48
+ _pointerEventsHandler(event) {
49
+ this.emit(Urso.events.EXTRA_BROWSEREVENTS_POINTER_EVENT, event);
50
+ }
51
+
52
+ _keyPressHandler(event) {
53
+ this.emit(Urso.events.EXTRA_BROWSEREVENTS_KEYPRESS_EVENT, event);
54
+ }
55
+ }
56
+
57
+ export default ExtraBrowserEvents;
@@ -1,25 +1,23 @@
1
- import * as PIXI from 'pixi.js';
2
- window.PIXI = PIXI;
3
- window.PIXI.particles = require('pixi-particles');
4
-
5
- window.PIXI.particlesFx = require('@urso/revolt-fx');
6
-
7
- window.PIXI.spine = require("pixi-spine");
8
-
9
- import { AtlasAttachmentLoader, SkeletonJson } from "@pixi-spine/runtime-3.8";
10
- window.PIXI.spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
11
- window.PIXI.spine.SkeletonJson = SkeletonJson;
12
-
13
- window.PIXI.projection = require("pixi-projection");
14
-
15
- import { gsap } from 'gsap';
16
- window.gsap = gsap;
17
-
18
- import { Howler, Howl } from 'howler';
19
-
20
- window.UrsoUtils = {
21
- Howler: Howler,
22
- Howl: Howl,
23
- gsap: gsap,
24
- PIXI: PIXI
25
- };
1
+ import * as PIXI from 'pixi.js';
2
+ window.PIXI = PIXI;
3
+
4
+ // import * as spine from '@esotericsoftware/spine-pixi-v8';
5
+ // window.PIXI.spine = spine;
6
+
7
+ // import * as particlesFx from 'revolt-fx';
8
+ // window.PIXI.particlesFx = particlesFx;
9
+
10
+ import { gsap } from 'gsap';
11
+ window.gsap = gsap;
12
+
13
+ import { Howler, Howl } from 'howler';
14
+
15
+ window.UrsoUtils = {
16
+ Howler: Howler,
17
+ Howl: Howl,
18
+ gsap: gsap,
19
+ PIXI: PIXI
20
+ };
21
+
22
+
23
+ export default {}
@@ -1,171 +1,173 @@
1
- /**
2
- * ModulesObjectsModelsText fillCustomColors patch
3
- */
4
-
5
-
6
- /**
7
- * Render the text with letter-spacing.
8
- *
9
- * @param text - The text to draw
10
- * @param x - Horizontal position to draw the text
11
- * @param y - Vertical position to draw the text
12
- * @param isStroke - Is this drawing for the outside stroke of the
13
- * text? If not, it's for the inside fill
14
- */
15
-
16
- PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
17
- if (isStroke === void 0) { isStroke = false; }
18
- var style = this._style;
19
- // letterSpacing of 0 means normal
20
- var letterSpacing = style.letterSpacing;
21
- // Checking that we can use moddern canvas2D api
22
- // https://developer.chrome.com/origintrials/#/view_trial/3585991203293757441
23
- // note: this is unstable API, Chrome less 94 use a `textLetterSpacing`, newest use a letterSpacing
24
- // eslint-disable-next-line max-len
25
- var supportLetterSpacing = PIXI.Text.experimentalLetterSpacing
26
- && ('letterSpacing' in CanvasRenderingContext2D.prototype
27
- || 'textLetterSpacing' in CanvasRenderingContext2D.prototype);
28
-
29
- if ((letterSpacing === 0 || supportLetterSpacing) && (!this.fillCustomColors || this.fillCustomColors.length === 0)) { //colors patch in if state
30
- if (supportLetterSpacing) {
31
- this.context.letterSpacing = letterSpacing;
32
- this.context.textLetterSpacing = letterSpacing;
33
- }
34
- if (isStroke) {
35
- this.context.strokeText(text, x, y);
36
- }
37
- else {
38
- this.context.fillText(text, x, y);
39
- }
40
- return;
41
- }
42
-
43
- var currentPosition = x;
44
-
45
- var textIndexOffset = this.text.indexOf(text); //colors patch block
46
- var allTextLength = this.text.length;
47
- var customColors = new Array(allTextLength);
48
-
49
- if (this.fillCustomColors) {
50
- for (var k in this.fillCustomColors) {
51
- var colorsParams = this.fillCustomColors[k];
52
- //customColors[colorsParams.position] = colorsParams.color;
53
- customColors.fill(colorsParams.color, colorsParams.position, allTextLength);
54
- }
55
- }
56
-
57
- // Using Array.from correctly splits characters whilst keeping emoji together.
58
- // This is not supported on IE as it requires ES6, so regular text splitting occurs.
59
- // This also doesn't account for emoji that are multiple emoji put together to make something else.
60
- // Handling all of this would require a big library itself.
61
- // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516
62
- // https://github.com/orling/grapheme-splitter
63
- var stringArray = Array.from ? Array.from(text) : text.split('');
64
- var previousWidth = this.context.measureText(text).width;
65
- var currentWidth = 0;
66
-
67
- for (var i = 0; i < stringArray.length; ++i) {
68
- var currentChar = stringArray[i];
69
-
70
- if (isStroke) {
71
- this.context.strokeText(currentChar, currentPosition, y);
72
- }
73
- else {
74
- if (customColors[textIndexOffset + i]) { //colors patch block
75
- this.context.fillStyle = customColors[textIndexOffset + i];
76
- }
77
-
78
- this.context.fillText(currentChar, currentPosition, y);
79
- }
80
-
81
- currentWidth = this.context.measureText(text.substring(i + 1)).width;
82
- currentPosition += previousWidth - currentWidth + letterSpacing;
83
- previousWidth = currentWidth;
84
- }
85
- };
86
-
87
- /**
88
- * Ignoring parent mask on render by ignoreParentMask flag.
89
- * @param { Object } renderer
90
- */
91
- PIXI.Container.prototype.renderAdvanced = function (renderer) {
92
- var filters = this.filters;
93
- var mask = this._mask;
94
- let excludedFromMaskChildsIndexes = [];
95
- // push filter first as we need to ensure the stencil buffer is correct for any masking
96
- if (filters) {
97
-
98
- if (!this._enabledFilters) {
99
- this._enabledFilters = [];
100
- }
101
-
102
- this._enabledFilters.length = 0;
103
-
104
- for (var i = 0; i < filters.length; i++) {
105
- if (filters[i].enabled) {
106
- this._enabledFilters.push(filters[i]);
107
- }
108
- }
109
- }
110
-
111
- var flush = (filters && this._enabledFilters && this._enabledFilters.length)
112
- || (mask && (!mask.isMaskData || (mask.enabled && (mask.autoDetect || mask.type !== constants.MASK_TYPES.NONE))));
113
-
114
- if (flush) {
115
- renderer.batch.flush();
116
- }
117
-
118
- if (filters && this._enabledFilters && this._enabledFilters.length) {
119
- renderer.filter.push(this, this._enabledFilters);
120
- }
121
-
122
- if (mask) {
123
- renderer.mask.push(this, this._mask);
124
- }
125
-
126
- if (this.cullable) {
127
- this._renderWithCulling(renderer);
128
- } else {
129
- this._render(renderer);
130
-
131
- for (var i = 0, j = this.children.length; i < j; ++i) {
132
- if (!this.children[i].ignoreParentMask || !mask) {
133
- this.children[i].render(renderer);
134
- } else if (mask) {
135
- excludedFromMaskChildsIndexes.push(i);
136
- }
137
- }
138
- }
139
-
140
- if (flush) {
141
- renderer.batch.flush();
142
- }
143
-
144
- if (mask) {
145
- renderer.mask.pop(this);
146
- }
147
-
148
- if (excludedFromMaskChildsIndexes.length > 0) {
149
- excludedFromMaskChildsIndexes.forEach(index => this.children[index].render(renderer));
150
- renderer.batch.flush();
151
- }
152
-
153
- if (filters && this._enabledFilters && this._enabledFilters.length) {
154
- renderer.filter.pop();
155
- }
156
- }
157
-
158
- //MeshMaterial for spine with initial(setup) sequence fix
159
- Object.defineProperty(PIXI.MeshMaterial.prototype, "texture", {
160
- get: function () {
161
- return this.uniforms.uSampler
162
- },
163
- set: function (value) {
164
- if (this.uniforms.uSampler !== value) {
165
- this.uniforms.uSampler = value;
166
- this.uvMatrix.texture = value;
167
- }
168
- },
169
- enumerable: !1,
170
- configurable: !0
171
- });
1
+ /**
2
+ * ModulesObjectsModelsText fillCustomColors patch
3
+ */
4
+
5
+
6
+ /**
7
+ * Render the text with letter-spacing.
8
+ *
9
+ * @param text - The text to draw
10
+ * @param x - Horizontal position to draw the text
11
+ * @param y - Vertical position to draw the text
12
+ * @param isStroke - Is this drawing for the outside stroke of the
13
+ * text? If not, it's for the inside fill
14
+ */
15
+
16
+ PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
17
+ if (isStroke === void 0) { isStroke = false; }
18
+ var style = this._style;
19
+ // letterSpacing of 0 means normal
20
+ var letterSpacing = style.letterSpacing;
21
+ // Checking that we can use moddern canvas2D api
22
+ // https://developer.chrome.com/origintrials/#/view_trial/3585991203293757441
23
+ // note: this is unstable API, Chrome less 94 use a `textLetterSpacing`, newest use a letterSpacing
24
+ // eslint-disable-next-line max-len
25
+ var supportLetterSpacing = PIXI.Text.experimentalLetterSpacing
26
+ && ('letterSpacing' in CanvasRenderingContext2D.prototype
27
+ || 'textLetterSpacing' in CanvasRenderingContext2D.prototype);
28
+
29
+ if ((letterSpacing === 0 || supportLetterSpacing) && (!this.fillCustomColors || this.fillCustomColors.length === 0)) { //colors patch in if state
30
+ if (supportLetterSpacing) {
31
+ this.context.letterSpacing = letterSpacing;
32
+ this.context.textLetterSpacing = letterSpacing;
33
+ }
34
+ if (isStroke) {
35
+ this.context.strokeText(text, x, y);
36
+ }
37
+ else {
38
+ this.context.fillText(text, x, y);
39
+ }
40
+ return;
41
+ }
42
+
43
+ var currentPosition = x;
44
+
45
+ var textIndexOffset = this.text.indexOf(text); //colors patch block
46
+ var allTextLength = this.text.length;
47
+ var customColors = new Array(allTextLength);
48
+
49
+ if (this.fillCustomColors) {
50
+ for (var k in this.fillCustomColors) {
51
+ var colorsParams = this.fillCustomColors[k];
52
+ //customColors[colorsParams.position] = colorsParams.color;
53
+ customColors.fill(colorsParams.color, colorsParams.position, allTextLength);
54
+ }
55
+ }
56
+
57
+ // Using Array.from correctly splits characters whilst keeping emoji together.
58
+ // This is not supported on IE as it requires ES6, so regular text splitting occurs.
59
+ // This also doesn't account for emoji that are multiple emoji put together to make something else.
60
+ // Handling all of this would require a big library itself.
61
+ // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516
62
+ // https://github.com/orling/grapheme-splitter
63
+ var stringArray = Array.from ? Array.from(text) : text.split('');
64
+ var previousWidth = this.context.measureText(text).width;
65
+ var currentWidth = 0;
66
+
67
+ for (var i = 0; i < stringArray.length; ++i) {
68
+ var currentChar = stringArray[i];
69
+
70
+ if (isStroke) {
71
+ this.context.strokeText(currentChar, currentPosition, y);
72
+ }
73
+ else {
74
+ if (customColors[textIndexOffset + i]) { //colors patch block
75
+ this.context.fillStyle = customColors[textIndexOffset + i];
76
+ }
77
+
78
+ this.context.fillText(currentChar, currentPosition, y);
79
+ }
80
+
81
+ currentWidth = this.context.measureText(text.substring(i + 1)).width;
82
+ currentPosition += previousWidth - currentWidth + letterSpacing;
83
+ previousWidth = currentWidth;
84
+ }
85
+ };
86
+
87
+ /**
88
+ * Ignoring parent mask on render by ignoreParentMask flag.
89
+ * @param { Object } renderer
90
+ */
91
+ PIXI.Container.prototype.renderAdvanced = function (renderer) {
92
+ var filters = this.filters;
93
+ var mask = this._mask;
94
+ let excludedFromMaskChildsIndexes = [];
95
+ // push filter first as we need to ensure the stencil buffer is correct for any masking
96
+ if (filters) {
97
+
98
+ if (!this._enabledFilters) {
99
+ this._enabledFilters = [];
100
+ }
101
+
102
+ this._enabledFilters.length = 0;
103
+
104
+ for (var i = 0; i < filters.length; i++) {
105
+ if (filters[i].enabled) {
106
+ this._enabledFilters.push(filters[i]);
107
+ }
108
+ }
109
+ }
110
+
111
+ var flush = (filters && this._enabledFilters && this._enabledFilters.length)
112
+ || (mask && (!mask.isMaskData || (mask.enabled && (mask.autoDetect || mask.type !== constants.MASK_TYPES.NONE))));
113
+
114
+ if (flush) {
115
+ renderer.batch.flush();
116
+ }
117
+
118
+ if (filters && this._enabledFilters && this._enabledFilters.length) {
119
+ renderer.filter.push(this, this._enabledFilters);
120
+ }
121
+
122
+ if (mask) {
123
+ renderer.mask.push(this, this._mask);
124
+ }
125
+
126
+ if (this.cullable) {
127
+ this._renderWithCulling(renderer);
128
+ } else {
129
+ this._render(renderer);
130
+
131
+ for (var i = 0, j = this.children.length; i < j; ++i) {
132
+ if (!this.children[i].ignoreParentMask || !mask) {
133
+ this.children[i].render(renderer);
134
+ } else if (mask) {
135
+ excludedFromMaskChildsIndexes.push(i);
136
+ }
137
+ }
138
+ }
139
+
140
+ if (flush) {
141
+ renderer.batch.flush();
142
+ }
143
+
144
+ if (mask) {
145
+ renderer.mask.pop(this);
146
+ }
147
+
148
+ if (excludedFromMaskChildsIndexes.length > 0) {
149
+ excludedFromMaskChildsIndexes.forEach(index => this.children[index].render(renderer));
150
+ renderer.batch.flush();
151
+ }
152
+
153
+ if (filters && this._enabledFilters && this._enabledFilters.length) {
154
+ renderer.filter.pop();
155
+ }
156
+ }
157
+
158
+ //MeshMaterial for spine with initial(setup) sequence fix
159
+ Object.defineProperty(PIXI.MeshMaterial.prototype, "texture", {
160
+ get: function () {
161
+ return this.uniforms.uSampler
162
+ },
163
+ set: function (value) {
164
+ if (this.uniforms.uSampler !== value) {
165
+ this.uniforms.uSampler = value;
166
+ this.uvMatrix.texture = value;
167
+ }
168
+ },
169
+ enumerable: !1,
170
+ configurable: !0
171
+ });
172
+
173
+ export default {}
package/src/js/index.js CHANGED
@@ -1,7 +1,7 @@
1
- require('./config/load.js');
2
-
3
- //main config
4
- Urso.config = Urso.Core.Config.Main;
5
-
6
- //function to run game with engine
7
- Urso.runGame = (new Urso.Core.App()).setup;
1
+ import './config/load.js';
2
+
3
+ //main config
4
+ Urso.config = Urso.Core.Config.Main;
5
+
6
+ //function to run game with engine
7
+ Urso.runGame = (new Urso.Core.App()).setup;