@gamelearn/arcade-components 1.24.3 → 1.25.1
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/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js
CHANGED
|
@@ -64,6 +64,7 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
|
|
|
64
64
|
index = _useState2[0],
|
|
65
65
|
setIndex = _useState2[1];
|
|
66
66
|
|
|
67
|
+
var resolvedItems = (0, _react.useRef)({});
|
|
67
68
|
var puzzleId = "chained-image-click-puzzle_".concat(index, "_").concat(nodeId);
|
|
68
69
|
|
|
69
70
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
@@ -152,7 +153,8 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
|
|
|
152
153
|
action: 'resolve',
|
|
153
154
|
payload: {
|
|
154
155
|
element: puzzleId,
|
|
155
|
-
rewards: info.resolve.rewards
|
|
156
|
+
rewards: info.resolve.rewards,
|
|
157
|
+
finish: index + 1 >= list.length
|
|
156
158
|
}
|
|
157
159
|
});
|
|
158
160
|
};
|
|
@@ -163,8 +165,9 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
|
|
|
163
165
|
}));
|
|
164
166
|
}, [info, setInfo, puzzleId]);
|
|
165
167
|
(0, _react.useEffect)(function () {
|
|
166
|
-
if (currentPuzzleStatus) {
|
|
168
|
+
if (currentPuzzleStatus && !resolvedItems.current[puzzleId]) {
|
|
167
169
|
onComplete([], true, true);
|
|
170
|
+
resolvedItems.current[puzzleId] = true;
|
|
168
171
|
}
|
|
169
172
|
}, [onComplete, puzzleId, currentPuzzleStatus]);
|
|
170
173
|
return /*#__PURE__*/_react.default.createElement(_imageClickWrapperComponent.default, _extends({
|
|
@@ -382,7 +382,36 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
}, [edges, isBranched, lines, mounted]);
|
|
385
|
+
}, [edges, isBranched, lines, mounted]);
|
|
386
|
+
|
|
387
|
+
var moveBubble = function moveBubble(element, target, showArrowTop) {
|
|
388
|
+
element.updateMatrix();
|
|
389
|
+
element.updateMatrixWorld();
|
|
390
|
+
var head = element.getObjectByName('Head_M');
|
|
391
|
+
head.updateMatrix();
|
|
392
|
+
head.updateMatrixWorld();
|
|
393
|
+
head.getWorldPosition(target.position);
|
|
394
|
+
target.applyQuaternion(camera.quaternion);
|
|
395
|
+
var distance = camera.position.distanceTo(target.position);
|
|
396
|
+
var staticDisplay = distance > 70 && !zoomInActor && !showArrowTop;
|
|
397
|
+
target.translateY(staticDisplay || showArrowTop ? 0 : 2); // Detectar posicion de personaje a izq o derecha de pantalla
|
|
398
|
+
|
|
399
|
+
var vector = new _three.Vector3();
|
|
400
|
+
vector.setFromMatrixPosition(head.matrixWorld);
|
|
401
|
+
var p = vector.project(defaultCamera);
|
|
402
|
+
target.translateX(headSize);
|
|
403
|
+
var isLeft = p.x < 0;
|
|
404
|
+
messagePosition.current = {
|
|
405
|
+
pos: target.position.toArray(),
|
|
406
|
+
child: head,
|
|
407
|
+
parent: element,
|
|
408
|
+
isLeft: isLeft
|
|
409
|
+
};
|
|
410
|
+
return {
|
|
411
|
+
distance: distance
|
|
412
|
+
};
|
|
413
|
+
}; // Position bubble over talking character/and switch emotions
|
|
414
|
+
|
|
386
415
|
|
|
387
416
|
(0, _react.useEffect)(function () {
|
|
388
417
|
if (isDecision) {
|
|
@@ -450,29 +479,8 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
450
479
|
setTimeout(function () {
|
|
451
480
|
if (talkingCharacter.uid === element.uid) {
|
|
452
481
|
var showArrowTop = talkingCharacter.text.length > maxCharacterToSwitch;
|
|
453
|
-
element.updateMatrix();
|
|
454
|
-
element.updateMatrixWorld();
|
|
455
|
-
var head = element.getObjectByName('Head_M');
|
|
456
482
|
var target = new _three.Object3D();
|
|
457
|
-
|
|
458
|
-
head.updateMatrixWorld();
|
|
459
|
-
head.getWorldPosition(target.position);
|
|
460
|
-
target.applyQuaternion(camera.quaternion);
|
|
461
|
-
var distance = camera.position.distanceTo(target.position);
|
|
462
|
-
var staticDisplay = distance > 70 && !zoomInActor && !showArrowTop;
|
|
463
|
-
target.translateY(staticDisplay || showArrowTop ? 0 : 3); // Detectar posicion de personaje a izq o derecha de pantalla
|
|
464
|
-
|
|
465
|
-
var vector = new _three.Vector3();
|
|
466
|
-
vector.setFromMatrixPosition(head.matrixWorld);
|
|
467
|
-
var p = vector.project(defaultCamera);
|
|
468
|
-
target.translateX(headSize);
|
|
469
|
-
var isLeft = p.x < 0;
|
|
470
|
-
messagePosition.current = {
|
|
471
|
-
pos: target.position.toArray(),
|
|
472
|
-
child: head,
|
|
473
|
-
parent: element,
|
|
474
|
-
isLeft: isLeft
|
|
475
|
-
};
|
|
483
|
+
moveBubble(element, target, showArrowTop);
|
|
476
484
|
|
|
477
485
|
if (zoomInActor) {
|
|
478
486
|
setAnimationRunning(true);
|
|
@@ -482,7 +490,9 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
482
490
|
setTimeout(function () {
|
|
483
491
|
var _talkingCharacter$cha;
|
|
484
492
|
|
|
485
|
-
|
|
493
|
+
var _moveBubble = moveBubble(element, target, showArrowTop),
|
|
494
|
+
distance = _moveBubble.distance;
|
|
495
|
+
|
|
486
496
|
setCurrentMessage({
|
|
487
497
|
text: talkingCharacter.text,
|
|
488
498
|
name: talkingCharacter.alias || ((_talkingCharacter$cha = talkingCharacter.character) === null || _talkingCharacter$cha === void 0 ? void 0 : _talkingCharacter$cha.name),
|
|
@@ -571,7 +581,9 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
571
581
|
var y = bubbleRect.y - bubbleRect.height;
|
|
572
582
|
|
|
573
583
|
if (!messagePosition.current.isLeft || (x < 0 || x > window.innerWidth) && currentMessage.inScene) {
|
|
574
|
-
var
|
|
584
|
+
var _messagePosition$curr = messagePosition.current,
|
|
585
|
+
child = _messagePosition$curr.child,
|
|
586
|
+
parent = _messagePosition$curr.parent;
|
|
575
587
|
|
|
576
588
|
if (child) {
|
|
577
589
|
var target = new _three.Object3D();
|
|
@@ -579,6 +591,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
579
591
|
target.applyQuaternion(camera.quaternion);
|
|
580
592
|
groupRef.current.position.copy(target.position);
|
|
581
593
|
groupRef.current.updateMatrixWorld();
|
|
594
|
+
moveBubble(parent, target, false);
|
|
582
595
|
var divider = isMobile ? 10 : 6;
|
|
583
596
|
var distanceX = bubbleRect.width + bubbleRect.width / divider;
|
|
584
597
|
bubbleRef.current.parentNode.style.transform = "translate3d(-".concat(distanceX, "px, -").concat(bubbleRect.height, "px, 0px)");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gamelearn/arcade-components",
|
|
3
3
|
"author": "Gamelearn",
|
|
4
4
|
"license": "unlicense",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.25.1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@gamelearn/arcade-styles": "0.12.0",
|
|
17
|
-
"@gamelearn/arcade-three-core": "1.
|
|
17
|
+
"@gamelearn/arcade-three-core": "1.13.0",
|
|
18
18
|
"@react-three/drei": "9.4.3",
|
|
19
19
|
"@react-three/fiber": "8.0.10",
|
|
20
|
-
"@testing-library/jest-dom": "5.
|
|
21
|
-
"@testing-library/react": "
|
|
20
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
21
|
+
"@testing-library/react": "^13.1.1",
|
|
22
22
|
"@testing-library/user-event": "13.5.0",
|
|
23
23
|
"global": "^4.4.0",
|
|
24
24
|
"gsap": "^3.10.1",
|