@urso/core 0.7.95-dev → 0.7.95

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.
@@ -149,12 +149,11 @@ object-assign
149
149
  */
150
150
 
151
151
  /*!
152
- * GSAP 3.12.5
152
+ * GSAP 3.13.0
153
153
  * https://gsap.com
154
154
  *
155
- * @license Copyright 2008-2024, GreenSock. All rights reserved.
156
- * Subject to the terms at https://gsap.com/standard-license or for
157
- * Club GSAP members, the agreement issued with that membership.
155
+ * @license Copyright 2008-2025, GreenSock. All rights reserved.
156
+ * Subject to the terms at https://gsap.com/standard-license
158
157
  * @author: Jack Doyle, jack@greensock.com
159
158
  */
160
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.7.95-dev",
3
+ "version": "0.7.95",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -30,7 +30,8 @@
30
30
  "pixi-scrollbox": "^2.3.1",
31
31
  "pixi-spine": "^3.1.2",
32
32
  "pixi-viewport": "^4.34.0",
33
- "pixi.js": "^6.2.0"
33
+ "pixi.js": "^6.2.0",
34
+ "pixi-text-input": "^1.2.1"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@babel/core": "^7.12.10",
@@ -1,10 +1,12 @@
1
1
  import * as PIXI from 'pixi.js';
2
+ import TextInput from 'pixi-text-input';
2
3
  window.PIXI = PIXI;
3
4
  window.PIXI.particles = require('pixi-particles');
4
5
 
5
6
  window.PIXI.particlesFx = require('@urso/revolt-fx');
6
7
 
7
8
  window.PIXI.spine = require("pixi-spine");
9
+ window.PIXI.TextInput = TextInput;
8
10
 
9
11
  import { AtlasAttachmentLoader, SkeletonJson } from "@pixi-spine/runtime-3.8";
10
12
  window.PIXI.spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
@@ -1,9 +1,11 @@
1
1
  const ModulesObjectsBaseModel = require('./../baseModel');
2
2
 
3
3
  class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
4
+
4
5
  constructor(params) {
5
6
  super(params);
6
7
  this._isDisabled = false;
8
+ this._isDown = false;
7
9
 
8
10
  this.type = Urso.types.objects.HITAREA;
9
11
 
@@ -24,6 +26,17 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
24
26
  this.onOverCallback = Urso.helper.recursiveGet('onOverCallback', params, false);
25
27
  this.onOutCallback = Urso.helper.recursiveGet('onOutCallback', params, false);
26
28
  this.onTouchMoveCallback = Urso.helper.recursiveGet('onTouchMoveCallback', params, false);
29
+
30
+ /**
31
+ * customInteractionArea object ex:
32
+ * Circle: { "type": "circle", "params": [0, 0, 100] }
33
+ * Rectangle: { "type": "rectangle", "params": [0, 0, 100, 100] }
34
+ * Polygon: {
35
+ * "type": "polygon",
36
+ * "params": [ 0, 0, 100, 0, 100, 100, 50, 150, 0, 100 ];
37
+ * }
38
+ * */
39
+ this.customInteractionArea = Urso.helper.recursiveGet('customInteractionArea', params, null);
27
40
  }
28
41
 
29
42
  enable() {
@@ -56,11 +69,14 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
56
69
  this._baseObject
57
70
  .on('pointerdown', this._onPressDown.bind(this))
58
71
  .on('pointerup', this._onPressUp.bind(this))
59
- .on('pointerupoutside', this._onPressUp.bind(this))
72
+ .on('pointerupoutside', this._onPressUpOutside.bind(this))
60
73
  .on('pointerover', this._onOver.bind(this))
61
74
  .on('pointerout', this._onOut.bind(this))
62
75
  .on('touchmove', this._onTouchmove.bind(this));
63
- };
76
+
77
+ if (this.customInteractionArea)
78
+ this._baseObject.hitArea = this._getHitAreaObject(this.customInteractionArea);
79
+ }
64
80
 
65
81
  _onTouchmove(event) {
66
82
  const position = this._getEventLocalPosition(event);
@@ -73,6 +89,11 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
73
89
  if (this._isDisabled)
74
90
  return false;
75
91
 
92
+ if (this._isDown)
93
+ return false;
94
+
95
+ this._isDown = true;
96
+
76
97
  if (this.keyDownAction) {
77
98
  const position = this._getEventLocalPosition(event);
78
99
  this.keyDownAction(position);
@@ -83,12 +104,24 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
83
104
  if (this._isDisabled)
84
105
  return false;
85
106
 
107
+ if (!this._isDown)
108
+ return false;
109
+
110
+ this._isDown = false;
111
+
86
112
  if (this.action) {
87
113
  const position = this._getEventLocalPosition(event);
88
114
  this.action(position);
89
115
  }
90
116
  }
91
117
 
118
+ _onPressUpOutside() {
119
+ if (this._isDisabled)
120
+ return false;
121
+
122
+ this._isDown = false;
123
+ }
124
+
92
125
  _onOver() {
93
126
  if (this._isDisabled)
94
127
  return false;
@@ -114,6 +147,24 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
114
147
 
115
148
  return { x, y };
116
149
  }
150
+
151
+ _getHitAreaObject({ type, params }) {
152
+ if (!type) {
153
+ return null;
154
+ }
155
+
156
+ const objects = {
157
+ 'rectangle': PIXI.Rectangle,
158
+ 'circle': PIXI.Circle,
159
+ 'polygon': PIXI.Polygon
160
+ }
161
+
162
+ if (!objects[type]) {
163
+ return null;
164
+ }
165
+
166
+ return new objects[type](...params);
167
+ }
117
168
  }
118
169
 
119
170
  module.exports = ModulesObjectsModelsHitArea;
@@ -86,9 +86,10 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
86
86
  * play spine animation and execute function after animation completes
87
87
  * @param {String} animation - name of the animation to be played
88
88
  * @param {Function} func - function to be executed
89
+ * @param {Number} [track] - you can define track number for current animation
89
90
  */
90
- playAndThen(animation, func) {
91
- this.playInSequenceAndThen([animation], func);
91
+ playAndThen(animation, func, track) {
92
+ this.playInSequenceAndThen([animation], func, track);
92
93
  }
93
94
 
94
95
  /**
@@ -103,17 +104,19 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
103
104
  * play spine animations in sequence and execute function after last animation completes
104
105
  * @param {String[]} animations - names of the animations to be played
105
106
  * @param {Function} func - function to be executed
107
+ * @param {Number} [track] - you can define track number for current animation
106
108
  */
107
- playInSequenceAndThen(animations, func) {
108
- this._playInSequenceAndThen(animations, func);
109
+ playInSequenceAndThen(animations, func, track) {
110
+ this._playInSequenceAndThen(animations, func, track);
109
111
  }
110
112
 
111
113
  /**
112
114
  * play spine animations in sequence and execute function after last animation completes
113
115
  * @param {String[]} animations - names of the animations to be played
114
116
  * @param {Function} func - function to be executed
117
+ * @param {Number} [track] - you can define track number for current animation
115
118
  */
116
- _playInSequenceAndThen(animations, func) {
119
+ _playInSequenceAndThen(animations, func, track) {
117
120
  this.stop();
118
121
  let removeSelf = () => { };
119
122
  let animationCount = 0;
@@ -123,7 +126,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
123
126
  animationCount++;
124
127
 
125
128
  if (animations[animationCount])
126
- this.play(animations[animationCount])
129
+ this.play(animations[animationCount], false, track)
127
130
  else {
128
131
  func && func();
129
132
  removeSelf();
@@ -133,7 +136,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
133
136
 
134
137
  removeSelf = () => this._baseObject.state.removeListener(completer);
135
138
  this._baseObject.state.addListener(completer);
136
- this.play(animations[0]);
139
+ this.play(animations[0], false, track);
137
140
  }
138
141
 
139
142
  /**
@@ -319,7 +322,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
319
322
  if (replaceSlotContents)
320
323
  currentSlot.removeChildren(); //todo check if its proxy and reset parent
321
324
 
322
- this.addChild(object); //todo make removeChild for addedToSlotObjects
325
+ this.addChild(object, true); //todo make removeChild for addedToSlotObjects
323
326
  currentSlot.addChild(object._baseObject);
324
327
  Urso.objects.refreshStyles();
325
328
  } else {
@@ -323,7 +323,7 @@ class PropertyAdapter {
323
323
  case 'left':
324
324
  return 0;
325
325
  case 'right':
326
- return object.parent ? this._getWidthAsNumber(object.parent) - this._getWidthAsNumber(object) : 0; //parentWidth-objectWidth
326
+ return object.parent ? this._getWidthAsNumber(object.parent) : 0; //parentWidth
327
327
  case 'center':
328
328
  const parentWidth = object.parent ? this._getWidthAsNumber(object.parent) : 0;
329
329
  return parentWidth / 2;
@@ -458,10 +458,7 @@ class PropertyAdapter {
458
458
  return this._getRoundedPercentageOfNumber(object[propertyName], parentValue);
459
459
 
460
460
  case 'boolean':
461
- if (this._canBeParent(object))
462
- return this._getPropertyAsNumber(object.parent, propertyName, parentPropertyName);
463
- else
464
- return object._baseObject[propertyName];
461
+ return this._getPropertyAsNumber(object.parent, propertyName, parentPropertyName)
465
462
 
466
463
  default:
467
464
  Urso.logger.error('Property value not number or string!', object, propertyName);
@@ -34,8 +34,17 @@ class ModulesScenesPixiWrapper {
34
34
 
35
35
  //define renderer
36
36
  PIXI.utils.skipHello();
37
- this._renderer = new PIXI.Renderer({ preserveDrawingBuffer: true, width: 1, height: 1 });
38
- document.body.appendChild(this._renderer.view);
37
+ const app = new PIXI.Application();
38
+ this.ticker = app.ticker;
39
+ this.ticker.autoStart = false;
40
+ this.ticker.stop();
41
+
42
+ //this._renderer = new PIXI.Renderer({ preserveDrawingBuffer: true, width: 1, height: 1 });
43
+ //document.body.appendChild(this._renderer.view);
44
+ this._renderer = app.renderer;
45
+ document.body.appendChild(app.view);
46
+
47
+ //debugger
39
48
 
40
49
  //root and world
41
50
  this._root = new PIXI.Container();
@@ -286,6 +295,8 @@ class ModulesScenesPixiWrapper {
286
295
 
287
296
  this.currentScene.update(deltaTime);
288
297
  this.currentScene.render();
298
+ //this._renderer.render(this._root);
299
+ this.ticker.update(deltaTime);
289
300
  this._renderer.render(this._root);
290
301
  };
291
302
 
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_urso_core=self.webpackChunk_urso_core||[]).push([[162],{88058:(d,a,r)=>{var O=r(8507),X=r(36697),e=r(46719);O.XO.add(X.U),O.XO.add(e.y)},42162:(d,a,r)=>{r.r(a),r(88058),r(26197),r(17801),r(25361),r(28849),r(28299),r(15311),r(4241),r(11981),r(51437),r(95902)},95902:(d,a,r)=>{var O=r(8507),X=r(69430),e=r(90825);O.XO.add(e.u),O.XO.add(X.L)},25361:(d,a,r)=>{var O=r(8507),X=r(40378),e=r(49260);O.XO.add(e.S),O.XO.add(X.GH)},28849:(d,a,r)=>{var O=r(8507),X=r(41892);O.XO.add(X.G)},51437:(d,a,r)=>{var O=r(8507),X=r(56880);O.XO.add(X.e)},11981:(d,a,r)=>{var O=r(8507),X=r(75773);O.XO.add(X.x)},15311:(d,a,r)=>{var O=r(8507),X=r(70661);O.XO.add(X.n)},4241:(d,a,r)=>{var O=r(8507),X=r(76829),e=r(47602);O.XO.add(e.Q),O.XO.add(X.n)},28299:(d,a,r)=>{var O=r(8507),X=r(45369),e=r(87278);O.XO.add(e.p),O.XO.add(X.e)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_urso_core=self.webpackChunk_urso_core||[]).push([[24],{88058:(d,a,r)=>{var O=r(8507),X=r(36697),v=r(46719);O.XO.add(X.U),O.XO.add(v.y)},22024:(d,a,r)=>{r.r(a);var O=r(8507),X=r(44980),v=r(83946),e=r(74302);O.XO.add(v.a),X.mc.mixin(e.K),r(88058);var c=r(60809),s=r(90317);O.XO.add(c.C),X.mc.mixin(s.e),r(26197),r(17801),r(25361),r(28849),r(28299),r(15311),r(4241),r(11981),r(51437),r(95902)},95902:(d,a,r)=>{var O=r(8507),X=r(69430),v=r(90825);O.XO.add(v.u),O.XO.add(X.L)},25361:(d,a,r)=>{var O=r(8507),X=r(40378),v=r(49260);O.XO.add(v.S),O.XO.add(X.GH)},28849:(d,a,r)=>{var O=r(8507),X=r(41892);O.XO.add(X.G)},51437:(d,a,r)=>{var O=r(8507),X=r(56880);O.XO.add(X.e)},11981:(d,a,r)=>{var O=r(8507),X=r(75773);O.XO.add(X.x)},15311:(d,a,r)=>{var O=r(8507),X=r(70661);O.XO.add(X.n)},4241:(d,a,r)=>{var O=r(8507),X=r(76829),v=r(47602);O.XO.add(v.Q),O.XO.add(X.n)},28299:(d,a,r)=>{var O=r(8507),X=r(45369),v=r(87278);O.XO.add(v.p),O.XO.add(X.e)}}]);