@makefully/platypus 4.1.4 → 4.1.6
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.
- package/CHANGELOG.md +20 -0
- package/README.md +4 -2
- package/lib/platypus.js +1 -1
- package/package.json +7 -2
- package/src/AABB.js +685 -0
- package/src/ActionState.js +121 -0
- package/src/AssetManager.js +206 -0
- package/src/CollisionData.js +96 -0
- package/src/CollisionDataContainer.js +127 -0
- package/src/CollisionShape.js +315 -0
- package/src/Component.js +231 -0
- package/src/Data.js +64 -0
- package/src/DataMap.js +204 -0
- package/src/Entity.js +404 -0
- package/src/EntityLinker.js +113 -0
- package/src/EventHandler.js +115 -0
- package/src/EventHandlerList.js +251 -0
- package/src/Game.js +840 -0
- package/src/Gamepad.js +175 -0
- package/src/ID3CaptionPlayer.js +61 -0
- package/src/Messenger.js +365 -0
- package/src/PIXIAnimation.js +622 -0
- package/src/RandomSet.js +140 -0
- package/src/SFXPlayer.js +120 -0
- package/src/StateMap.js +252 -0
- package/src/Storage.js +152 -0
- package/src/TickerClient.js +48 -0
- package/src/TickerServer.js +23 -0
- package/src/TimeEvent.js +50 -0
- package/src/TimeEventList.js +100 -0
- package/src/VOPlayer.js +684 -0
- package/src/Vector.js +702 -0
- package/src/components/AIChaser.js +161 -0
- package/src/components/AIPacer.js +107 -0
- package/src/components/AudioMusic.js +151 -0
- package/src/components/AudioSFX.js +673 -0
- package/src/components/AudioVO.js +301 -0
- package/src/components/CollisionBasic.js +826 -0
- package/src/components/CollisionFilter.js +74 -0
- package/src/components/CollisionGroup.js +448 -0
- package/src/components/CollisionTiles.js +608 -0
- package/src/components/ComponentSwitcher.js +173 -0
- package/src/components/ControllerInput.js +65 -0
- package/src/components/Counter.js +165 -0
- package/src/components/EntityCamera.js +215 -0
- package/src/components/EntityContainer.js +549 -0
- package/src/components/EntityController.js +541 -0
- package/src/components/HandlerCamera.js +1052 -0
- package/src/components/HandlerCollision.js +1318 -0
- package/src/components/HandlerController.js +291 -0
- package/src/components/HandlerLogic.js +394 -0
- package/src/components/HandlerRender.js +217 -0
- package/src/components/Interactive.js +502 -0
- package/src/components/LevelBuilder.js +524 -0
- package/src/components/LogicAngularMovement.js +154 -0
- package/src/components/LogicAttachment.js +265 -0
- package/src/components/LogicButton.js +466 -0
- package/src/components/LogicCarrier.js +39 -0
- package/src/components/LogicDestroyMe.js +58 -0
- package/src/components/LogicDirectionalMovement.js +325 -0
- package/src/components/LogicDragDrop.js +371 -0
- package/src/components/LogicImpactLaunch.js +144 -0
- package/src/components/LogicPacingPlatform.js +64 -0
- package/src/components/LogicPortable.js +112 -0
- package/src/components/LogicPortal.js +115 -0
- package/src/components/LogicPushable.js +98 -0
- package/src/components/LogicRebounder.js +136 -0
- package/src/components/LogicRegionSpawner.js +139 -0
- package/src/components/LogicRotationalMovement.js +205 -0
- package/src/components/LogicSpawner.js +159 -0
- package/src/components/LogicStateMachine.js +382 -0
- package/src/components/LogicSwitch.js +77 -0
- package/src/components/LogicTeleportee.js +68 -0
- package/src/components/LogicTeleporter.js +93 -0
- package/src/components/LogicTimer.js +178 -0
- package/src/components/LogicWindUpRacer.js +179 -0
- package/src/components/Motion.js +371 -0
- package/src/components/Mover.js +566 -0
- package/src/components/Node.js +289 -0
- package/src/components/NodeMap.js +295 -0
- package/src/components/NodeResident.js +636 -0
- package/src/components/Orientation.js +697 -0
- package/src/components/RandomEvents.js +73 -0
- package/src/components/RelativePosition.js +204 -0
- package/src/components/RelayFamily.js +106 -0
- package/src/components/RelayGame.js +53 -0
- package/src/components/RelayLinker.js +94 -0
- package/src/components/RelayParent.js +57 -0
- package/src/components/RelaySelf.js +55 -0
- package/src/components/Render.js +178 -0
- package/src/components/RenderAnimator.js +275 -0
- package/src/components/RenderContainer.js +646 -0
- package/src/components/RenderDebug.js +319 -0
- package/src/components/RenderDestroyMe.js +59 -0
- package/src/components/RenderLottie.js +149 -0
- package/src/components/RenderProgress.js +120 -0
- package/src/components/RenderSpine.js +833 -0
- package/src/components/RenderSprite.js +527 -0
- package/src/components/RenderText.js +147 -0
- package/src/components/RenderTiles.js +1391 -0
- package/src/components/SceneChanger.js +128 -0
- package/src/components/TiledLoader.js +1451 -0
- package/src/components/Timeline.js +314 -0
- package/src/components/Tutorial.js +267 -0
- package/src/components/Tween.js +296 -0
- package/src/components/VoiceOver.js +373 -0
- package/src/components/XHR.js +129 -0
- package/src/components/index.js +79 -0
- package/src/factory.js +305 -0
- package/src/index.js +159 -0
- package/src/mixins/PIXI.Graphics.js +41 -0
- package/src/platypus.css +68 -0
- package/src/sayHello.js +50 -0
- package/src/shapes/Capsule.js +74 -0
- package/src/shapes/Circle.js +43 -0
- package/src/shapes/Ellipse.js +117 -0
- package/src/shapes/Point.js +191 -0
- package/src/shapes/Polygon.js +112 -0
- package/src/shapes/Polyline.js +97 -0
- package/src/shapes/Rectangle.js +78 -0
- package/src/shapes/RoundedRectangle.js +33 -0
- package/src/shapes/Segment.js +346 -0
- package/src/shapes/adjustedXY.js +19 -0
- package/src/shapes/castFromBox2D.js +92 -0
- package/src/shapes/castFromObject.js +53 -0
- package/src/shapes/castFromPixiGraphics.js +6 -0
- package/src/shapes/castFromPixiShape.js +89 -0
- package/src/shapes/castToBox2D.js +190 -0
- package/src/shapes/castToPixiGraphics.js +100 -0
- package/src/shapes/castToPixiShape.js +61 -0
- package/src/shapes/checkPointsMap.js +313 -0
- package/src/shapes/index.js +35 -0
- package/src/utils/array.js +73 -0
- package/src/utils/string.js +39 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
self.onmessage = ({data}) => {
|
|
2
|
+
let interval = 0;
|
|
3
|
+
|
|
4
|
+
if (data.begin) {
|
|
5
|
+
let time = performance.now();
|
|
6
|
+
|
|
7
|
+
clearInterval(interval);
|
|
8
|
+
interval = setInterval(() => {
|
|
9
|
+
const
|
|
10
|
+
newTime = performance.now();
|
|
11
|
+
|
|
12
|
+
self.postMessage({
|
|
13
|
+
deltaTime: newTime - time
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
time = newTime;
|
|
17
|
+
}, data.begin.delta);
|
|
18
|
+
}
|
|
19
|
+
if (data.stop) {
|
|
20
|
+
clearInterval(interval);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
package/src/TimeEvent.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import recycle from 'recycle';
|
|
2
|
+
|
|
3
|
+
const
|
|
4
|
+
TimeEvent = function (event = '', time = 0, message = null, entity = null, interruptable = true) {
|
|
5
|
+
if (typeof event === 'object') {
|
|
6
|
+
this.event = event.event ?? '';
|
|
7
|
+
this.message = event.message ?? message;
|
|
8
|
+
this.time = (event.time ?? 0) + time;
|
|
9
|
+
this.entity = event.entity ?? entity;
|
|
10
|
+
this.interruptable = event.interruptable ?? interruptable;
|
|
11
|
+
} else {
|
|
12
|
+
this.event = event;
|
|
13
|
+
this.message = message;
|
|
14
|
+
this.time = time;
|
|
15
|
+
this.entity = entity;
|
|
16
|
+
this.interruptable = interruptable;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
proto = TimeEvent.prototype;
|
|
20
|
+
|
|
21
|
+
proto.toJSON = function () {
|
|
22
|
+
return {
|
|
23
|
+
event: this.event,
|
|
24
|
+
message: this.message,
|
|
25
|
+
time: this.time,
|
|
26
|
+
entity: this.entity?.id ?? this.entity,
|
|
27
|
+
interruptable: this.interruptable
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns a TimeEvent from cache or creates a new one if none are available.
|
|
33
|
+
*
|
|
34
|
+
* @method platypus.TimeEvent.setUp
|
|
35
|
+
* @return {platypus.TimeEvent} The instantiated TimeEvent.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Returns a TimeEvent back to the cache.
|
|
39
|
+
*
|
|
40
|
+
* @method platypus.TimeEvent.recycle
|
|
41
|
+
* @param {platypus.TimeEvent} timeEvent The TimeEvent to be recycled.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Relinquishes properties of the TimeEvent and recycles it.
|
|
45
|
+
*
|
|
46
|
+
* @method platypus.TimeEvent#recycle
|
|
47
|
+
*/
|
|
48
|
+
recycle.add(TimeEvent, 'TimeEvent', TimeEvent, null, true);
|
|
49
|
+
|
|
50
|
+
export default TimeEvent;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import recycle from 'recycle';
|
|
2
|
+
import { arrayCache } from './utils/array';
|
|
3
|
+
import TimeEvent from './TimeEvent';
|
|
4
|
+
|
|
5
|
+
const
|
|
6
|
+
TimeEventList = function (list = [], time = 0) {
|
|
7
|
+
if (!this.list) {
|
|
8
|
+
this.list = arrayCache.setUp();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
this.addEvents(list);
|
|
12
|
+
this.time = time;
|
|
13
|
+
},
|
|
14
|
+
sortByTime = function (a, b) {
|
|
15
|
+
return a.time - b.time;
|
|
16
|
+
},
|
|
17
|
+
proto = TimeEventList.prototype;
|
|
18
|
+
|
|
19
|
+
proto.clear = function (list) {
|
|
20
|
+
return this.getEvents(Infinity, list);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
proto.addEvents = function (list, time = 0) {
|
|
24
|
+
const
|
|
25
|
+
{list: timeList} = this,
|
|
26
|
+
arr = arrayCache.setUp();
|
|
27
|
+
|
|
28
|
+
list.forEach((entry) => {
|
|
29
|
+
if (typeof entry === 'number') {
|
|
30
|
+
time += entry;
|
|
31
|
+
} else if (entry instanceof TimeEvent) {
|
|
32
|
+
timeList.push(entry);
|
|
33
|
+
arr.push(entry);
|
|
34
|
+
} else {
|
|
35
|
+
const
|
|
36
|
+
event = TimeEvent.setUp(entry, time);
|
|
37
|
+
|
|
38
|
+
timeList.push(event);
|
|
39
|
+
arr.push(event);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
timeList.sort(sortByTime);
|
|
44
|
+
|
|
45
|
+
return arr;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
proto.getEvents = function (time, limitToThese) {
|
|
49
|
+
const
|
|
50
|
+
arr = arrayCache.setUp(),
|
|
51
|
+
{list} = this;
|
|
52
|
+
|
|
53
|
+
this.time = time;
|
|
54
|
+
|
|
55
|
+
while (list.length && list[0].time <= time) {
|
|
56
|
+
if (!limitToThese || limitToThese.indexOf(list[0]) >= 0) {
|
|
57
|
+
arr.push(list.shift());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return arr;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
proto.getDuration = function () {
|
|
65
|
+
const
|
|
66
|
+
{list} = this;
|
|
67
|
+
|
|
68
|
+
return list.length ? list[list.length - 1].time : 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
proto.update = function (delta) {
|
|
72
|
+
return this.getEvents(this.time + delta);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
proto.toJSON = function () {
|
|
76
|
+
return this.list.map((entry) => entry.toJSON());
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Returns a TimeEventList from cache or creates a new one if none are available.
|
|
81
|
+
*
|
|
82
|
+
* @method platypus.TimeEventList.setUp
|
|
83
|
+
* @return {platypus.TimeEventList} The instantiated TimeEventList.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Returns a TimeEventList back to the cache.
|
|
87
|
+
*
|
|
88
|
+
* @method platypus.TimeEventList.recycle
|
|
89
|
+
* @param {platypus.TimeEventList} timeEvent The TimeEventList to be recycled.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Relinquishes properties of the TimeEventList and recycles it.
|
|
93
|
+
*
|
|
94
|
+
* @method platypus.TimeEventList#recycle
|
|
95
|
+
*/
|
|
96
|
+
recycle.add(TimeEventList, 'TimeEventList', TimeEventList, function () {
|
|
97
|
+
this.list.length = 0;
|
|
98
|
+
}, true);
|
|
99
|
+
|
|
100
|
+
export default TimeEventList;
|