@gamelearn/arcade-components 2.17.12-hotfix-animations → 2.17.13
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/README.md +107 -107
- package/dist/components/animation-component/components/AnimationComponent.js +3 -3
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +1 -1
- package/dist/components/dialog-component/components/BubbleWrapper.js +2 -13
- package/dist/components/dialog-component/components/DialogComponent.js +26 -31
- package/package.json +114 -114
package/README.md
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
# Arcade Components
|
|
2
|
-
> librería de componentes para Arcade (aka engine 2.0)
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/arcade-components) [](https://standardjs.com)
|
|
5
|
-
|
|
6
|
-
## Install
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
yarn add @gamelearn/arcade-components
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
```jsx
|
|
16
|
-
import React, { Component } from 'react';
|
|
17
|
-
|
|
18
|
-
import { Button } from 'arcade-components';
|
|
19
|
-
|
|
20
|
-
export default class App extends Component {
|
|
21
|
-
render() {
|
|
22
|
-
return (
|
|
23
|
-
<div>
|
|
24
|
-
<Button>Enjoy</Button>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Generar version hotfix para arcade/master-stg
|
|
33
|
-
|
|
34
|
-
Para generar una version hotfix nos vamos al commit que desplego la version que utiliza actualmente arcade/master-stg y creamos una rama sobre ella.
|
|
35
|
-
|
|
36
|
-
Generamos los cambios o hacemos cherrypick de ellos si ya estan creados y una vez terminemos con los cambios tendremos que cambiar la version del package.json a una tal que asi :
|
|
37
|
-
|
|
38
|
-
`"version": "1.3.5-fix-1",`
|
|
39
|
-
|
|
40
|
-
Habiendo cambiado ya la version para publicarla ejecutamos:
|
|
41
|
-
* `npm run publish-hotfix`
|
|
42
|
-
|
|
43
|
-
Una vez publicada en npm ir a la versión master de arcade y sustituir la versión de arcade-components.
|
|
44
|
-
|
|
45
|
-
## Available Scripts
|
|
46
|
-
|
|
47
|
-
Para ver Storybook en local
|
|
48
|
-
|
|
49
|
-
### `yarn start`
|
|
50
|
-
|
|
51
|
-
Para compilar la librería a dist
|
|
52
|
-
|
|
53
|
-
### `yarn compile`
|
|
54
|
-
|
|
55
|
-
Para dejar a babel observando cambios y ejecuntando auto-compilación puedes pasarle --watch
|
|
56
|
-
|
|
57
|
-
`yarn compile --watch`
|
|
58
|
-
|
|
59
|
-
### `yarn generate <componentName>`
|
|
60
|
-
|
|
61
|
-
Para añadir un componente nuevo se recomienda usar el generador automático que hara el scaffolding básico de dicho componente, coge el nombre como primer parámetro y si lo llamas sin parámetro te lo preguntará por el prompt.
|
|
62
|
-
|
|
63
|
-
`yarn generate`
|
|
64
|
-
|
|
65
|
-
## How to link arcade-components in other repos (WIP)
|
|
66
|
-
|
|
67
|
-
Para trabajar con arcade-components en local si necesidad de subir a git ni a npm no podemos trabajar con `yarn link` ya que da un error con los hooks de react.
|
|
68
|
-
|
|
69
|
-
Cómo solución alternativa podemos instalar `yalc` que permite publicar el paquete en local e importarlo desde `arcade`.
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
yarn global add yalc
|
|
73
|
-
```
|
|
74
|
-
Si teneis problemas instalándolo en global :
|
|
75
|
-
yarn global add yalc --prefix /usr/local
|
|
76
|
-
|
|
77
|
-
Para generar el paquete en el store local:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
yarn
|
|
81
|
-
yarn compile
|
|
82
|
-
yalc publish o yarn yalc publish
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Si queremos escuchar los cambios y que se vayan publicando en el store de yalc se puede hacer directamente con:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
yarn watch
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Después, en el repositorio de `arcade` tendremos que linkar el paquete generado de la siguiente forma:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
yalc link @gamelearn/arcade-components
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Y voilá, ya podremos trabajar con arcade y arcade-components en local sin publicar nada.
|
|
98
|
-
|
|
99
|
-
Una vez terminemos de trabajar con el paquete linkado en `arcade`, no nos olvidemos de borrar el link:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
yalc remove --all
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## License
|
|
106
|
-
|
|
107
|
-
UNLICENSED © [gamelearn](https://github.com/gamelearn)
|
|
1
|
+
# Arcade Components
|
|
2
|
+
> librería de componentes para Arcade (aka engine 2.0)
|
|
3
|
+
|
|
4
|
+
[](https://www.npmjs.com/package/arcade-components) [](https://standardjs.com)
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
yarn add @gamelearn/arcade-components
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
##
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import React, { Component } from 'react';
|
|
17
|
+
|
|
18
|
+
import { Button } from 'arcade-components';
|
|
19
|
+
|
|
20
|
+
export default class App extends Component {
|
|
21
|
+
render() {
|
|
22
|
+
return (
|
|
23
|
+
<div>
|
|
24
|
+
<Button>Enjoy</Button>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Generar version hotfix para arcade/master-stg
|
|
33
|
+
|
|
34
|
+
Para generar una version hotfix nos vamos al commit que desplego la version que utiliza actualmente arcade/master-stg y creamos una rama sobre ella.
|
|
35
|
+
|
|
36
|
+
Generamos los cambios o hacemos cherrypick de ellos si ya estan creados y una vez terminemos con los cambios tendremos que cambiar la version del package.json a una tal que asi :
|
|
37
|
+
|
|
38
|
+
`"version": "1.3.5-fix-1",`
|
|
39
|
+
|
|
40
|
+
Habiendo cambiado ya la version para publicarla ejecutamos:
|
|
41
|
+
* `npm run publish-hotfix`
|
|
42
|
+
|
|
43
|
+
Una vez publicada en npm ir a la versión master de arcade y sustituir la versión de arcade-components.
|
|
44
|
+
|
|
45
|
+
## Available Scripts
|
|
46
|
+
|
|
47
|
+
Para ver Storybook en local
|
|
48
|
+
|
|
49
|
+
### `yarn start`
|
|
50
|
+
|
|
51
|
+
Para compilar la librería a dist
|
|
52
|
+
|
|
53
|
+
### `yarn compile`
|
|
54
|
+
|
|
55
|
+
Para dejar a babel observando cambios y ejecuntando auto-compilación puedes pasarle --watch
|
|
56
|
+
|
|
57
|
+
`yarn compile --watch`
|
|
58
|
+
|
|
59
|
+
### `yarn generate <componentName>`
|
|
60
|
+
|
|
61
|
+
Para añadir un componente nuevo se recomienda usar el generador automático que hara el scaffolding básico de dicho componente, coge el nombre como primer parámetro y si lo llamas sin parámetro te lo preguntará por el prompt.
|
|
62
|
+
|
|
63
|
+
`yarn generate`
|
|
64
|
+
|
|
65
|
+
## How to link arcade-components in other repos (WIP)
|
|
66
|
+
|
|
67
|
+
Para trabajar con arcade-components en local si necesidad de subir a git ni a npm no podemos trabajar con `yarn link` ya que da un error con los hooks de react.
|
|
68
|
+
|
|
69
|
+
Cómo solución alternativa podemos instalar `yalc` que permite publicar el paquete en local e importarlo desde `arcade`.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
yarn global add yalc
|
|
73
|
+
```
|
|
74
|
+
Si teneis problemas instalándolo en global :
|
|
75
|
+
yarn global add yalc --prefix /usr/local
|
|
76
|
+
|
|
77
|
+
Para generar el paquete en el store local:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
yarn
|
|
81
|
+
yarn compile
|
|
82
|
+
yalc publish o yarn yalc publish
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Si queremos escuchar los cambios y que se vayan publicando en el store de yalc se puede hacer directamente con:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
yarn watch
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Después, en el repositorio de `arcade` tendremos que linkar el paquete generado de la siguiente forma:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
yalc link @gamelearn/arcade-components
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Y voilá, ya podremos trabajar con arcade y arcade-components en local sin publicar nada.
|
|
98
|
+
|
|
99
|
+
Una vez terminemos de trabajar con el paquete linkado en `arcade`, no nos olvidemos de borrar el link:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
yalc remove --all
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
UNLICENSED © [gamelearn](https://github.com/gamelearn)
|
|
@@ -48,7 +48,7 @@ var AnimationComponent = function AnimationComponent(_ref) {
|
|
|
48
48
|
}, []);
|
|
49
49
|
(0, _react.useEffect)(function () {
|
|
50
50
|
setMounted(false);
|
|
51
|
-
}, [resource.uid, animation
|
|
51
|
+
}, [resource.uid, animation.url]);
|
|
52
52
|
(0, _react.useEffect)(function () {
|
|
53
53
|
if (!mounted) {
|
|
54
54
|
var object;
|
|
@@ -58,7 +58,7 @@ var AnimationComponent = function AnimationComponent(_ref) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
if (object
|
|
61
|
+
if (object) {
|
|
62
62
|
if (makeDefault) {
|
|
63
63
|
emitEvent({
|
|
64
64
|
type: 'saveAnimation',
|
|
@@ -103,7 +103,7 @@ var AnimationComponent = function AnimationComponent(_ref) {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
}, [scene, animation
|
|
106
|
+
}, [scene, animation.url, loopTimes, emitEvent, mounted, loader, resource.uid, makeDefault, animation, resource, enableInteraction]);
|
|
107
107
|
return null;
|
|
108
108
|
};
|
|
109
109
|
|
|
@@ -231,7 +231,7 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
231
231
|
play('click-ui');
|
|
232
232
|
},
|
|
233
233
|
"aria-label": "finish button",
|
|
234
|
-
className: "gat--btn gat--btn__primary auto-evaluation__button not-transition
|
|
234
|
+
className: "gat--btn gat--btn__primary auto-evaluation__button not-transition "
|
|
235
235
|
}, /*#__PURE__*/_react.default.createElement("span", null, translate('auto-evaluation.end'))) : /*#__PURE__*/_react.default.createElement("button", {
|
|
236
236
|
type: "button",
|
|
237
237
|
onClick: function onClick() {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _arcadeThreeCore = require("@gamelearn/arcade-three-core");
|
|
13
11
|
|
|
@@ -15,19 +13,11 @@ var _SpeechBubbleComponent = _interopRequireDefault(require("./SpeechBubbleCompo
|
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
16
|
var BubbleWrapper = function BubbleWrapper(_ref) {
|
|
23
17
|
var currentMessage = _ref.currentMessage,
|
|
24
18
|
translate = _ref.translate;
|
|
25
|
-
var group = (0, _react.useRef)();
|
|
26
|
-
var bubble = (0, _react.useRef)();
|
|
27
19
|
var container = document.querySelector('.screens--container');
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement("group", {
|
|
29
|
-
ref: group
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.HtmlPro, {
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement("group", null, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.HtmlPro, {
|
|
31
21
|
onOcclude: function onOcclude() {
|
|
32
22
|
return null;
|
|
33
23
|
},
|
|
@@ -45,7 +35,6 @@ var BubbleWrapper = function BubbleWrapper(_ref) {
|
|
|
45
35
|
}
|
|
46
36
|
}, /*#__PURE__*/_react.default.createElement(_SpeechBubbleComponent.default, {
|
|
47
37
|
translate: translate,
|
|
48
|
-
ref: bubble,
|
|
49
38
|
message: currentMessage
|
|
50
39
|
})));
|
|
51
40
|
};
|
|
@@ -37,12 +37,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
|
|
40
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
-
|
|
42
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
-
|
|
44
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
|
-
|
|
46
40
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
47
41
|
|
|
48
42
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -51,6 +45,12 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
51
45
|
|
|
52
46
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
53
47
|
|
|
48
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
49
|
+
|
|
50
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
51
|
+
|
|
52
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
+
|
|
54
54
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
55
55
|
|
|
56
56
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -116,12 +116,11 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
116
116
|
camera = _useThree2[0],
|
|
117
117
|
scene = _useThree2[1];
|
|
118
118
|
|
|
119
|
-
var changedMats = (0, _react.useRef)([]);
|
|
120
|
-
|
|
121
119
|
var _useTimeout = (0, _useTimeout2.default)(),
|
|
122
120
|
start = _useTimeout.start,
|
|
123
121
|
stop = _useTimeout.stop;
|
|
124
122
|
|
|
123
|
+
var changedMats = (0, _react.useRef)([]);
|
|
125
124
|
var loader = (0, _react.useMemo)(function () {
|
|
126
125
|
return new _GLTFLoader.GLTFLoader();
|
|
127
126
|
}, []);
|
|
@@ -149,6 +148,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
149
148
|
voiceOver = _ref2.voiceOver,
|
|
150
149
|
decision = _ref2.decision;
|
|
151
150
|
|
|
151
|
+
var lastTalking = (0, _react.useRef)({});
|
|
152
152
|
var talkingCharacter = currentLineData === null || currentLineData === void 0 ? void 0 : (_currentLineData$slot = currentLineData.slots) === null || _currentLineData$slot === void 0 ? void 0 : _currentLineData$slot.find(function (slot) {
|
|
153
153
|
return slot.talking;
|
|
154
154
|
});
|
|
@@ -428,6 +428,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
428
428
|
}
|
|
429
429
|
}, [currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.id, edges, finishConversation, lines]);
|
|
430
430
|
var backLine = (0, _react.useCallback)(function () {
|
|
431
|
+
lastTalking.current = _objectSpread({}, talkingCharacter);
|
|
431
432
|
resetTalkingAnimation();
|
|
432
433
|
setAudioFailed(false);
|
|
433
434
|
|
|
@@ -439,8 +440,9 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
439
440
|
});
|
|
440
441
|
changeLine(line - 1);
|
|
441
442
|
}
|
|
442
|
-
}, [handleBranchDirection, isBranched, lastLine, line]);
|
|
443
|
+
}, [handleBranchDirection, isBranched, lastLine, line, talkingCharacter]);
|
|
443
444
|
var nextLine = (0, _react.useCallback)(function (choice, reset) {
|
|
445
|
+
lastTalking.current = _objectSpread({}, talkingCharacter);
|
|
444
446
|
resetTalkingAnimation();
|
|
445
447
|
setEdgesHistory([].concat(_toConsumableArray(edgesHistory), [currentLineData.id]));
|
|
446
448
|
setAudioFailed(false);
|
|
@@ -459,7 +461,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
459
461
|
} else if (currentLineData.decision) {
|
|
460
462
|
finishConversation();
|
|
461
463
|
}
|
|
462
|
-
}, [currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.decision, isBranched, line, lines.length, handleDecisionBranch, handleBranchDirection, finishConversation]);
|
|
464
|
+
}, [currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.decision, isBranched, line, lines.length, handleDecisionBranch, handleBranchDirection, finishConversation, talkingCharacter]);
|
|
463
465
|
|
|
464
466
|
var manualBackLine = function manualBackLine() {
|
|
465
467
|
setAutomatic(false);
|
|
@@ -507,19 +509,16 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
507
509
|
}
|
|
508
510
|
}, [edges, isBranched, lines, mounted]);
|
|
509
511
|
|
|
510
|
-
var moveBubble = function moveBubble(element
|
|
512
|
+
var moveBubble = function moveBubble(element) {
|
|
513
|
+
if (lastTalking.current.uid === element.uid) return;
|
|
511
514
|
var target = new _three.Object3D();
|
|
512
|
-
element.updateMatrix();
|
|
513
|
-
element.updateMatrixWorld();
|
|
514
515
|
var head = element.getObjectByName('Head_M');
|
|
515
516
|
head.updateMatrixWorld();
|
|
516
|
-
|
|
517
|
+
target.applyMatrix4(head.matrixWorld);
|
|
517
518
|
target.applyQuaternion(camera.quaternion);
|
|
518
|
-
var distance = camera.position.distanceTo(target.position);
|
|
519
|
-
var staticDisplay = distance > 70 && !zoomInActor && !showArrowTop;
|
|
520
519
|
var yDistance = zoomInActor ? 2.5 : 2;
|
|
521
520
|
var xDistance = zoomInActor ? 1.2 : 1.5;
|
|
522
|
-
target.translateY(
|
|
521
|
+
target.translateY(yDistance);
|
|
523
522
|
target.translateX(xDistance); // Check if character is left or right in the screen
|
|
524
523
|
|
|
525
524
|
var vector = new _three.Vector3();
|
|
@@ -532,9 +531,6 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
532
531
|
parent: element,
|
|
533
532
|
isLeft: isLeft
|
|
534
533
|
};
|
|
535
|
-
return {
|
|
536
|
-
distance: distance
|
|
537
|
-
};
|
|
538
534
|
}; // Position bubble over talking character/and switch emotions
|
|
539
535
|
|
|
540
536
|
|
|
@@ -588,17 +584,8 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
588
584
|
|
|
589
585
|
if (element && !lastSet.current) {
|
|
590
586
|
loadEmotion(talkingCharacter, element, function (mixer, action, defaultAction) {
|
|
591
|
-
var startAction = element.userData.lastEmotion ? element.userData.lastEmotion : defaultAction;
|
|
592
|
-
|
|
593
|
-
if (startAction && action && startAction !== action) {
|
|
594
|
-
mixer.stopAllAction();
|
|
595
|
-
(0, _helpers.executeCrossFade)(startAction, action, crossFadeDuration);
|
|
596
|
-
element.userData.defaultAnim = action.getClip();
|
|
597
|
-
}
|
|
598
|
-
|
|
599
587
|
if (talkingCharacter.uid === element.uid) {
|
|
600
|
-
|
|
601
|
-
moveBubble(element, showArrowTop);
|
|
588
|
+
moveBubble(element);
|
|
602
589
|
|
|
603
590
|
var setMessage = function setMessage() {
|
|
604
591
|
var _talkingCharacter$cha5;
|
|
@@ -620,6 +607,14 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
620
607
|
setMessage();
|
|
621
608
|
}
|
|
622
609
|
}
|
|
610
|
+
|
|
611
|
+
var startAction = element.userData.lastEmotion ? element.userData.lastEmotion : defaultAction;
|
|
612
|
+
|
|
613
|
+
if (startAction && action && startAction !== action) {
|
|
614
|
+
mixer.stopAllAction();
|
|
615
|
+
(0, _helpers.executeCrossFade)(startAction, action, crossFadeDuration);
|
|
616
|
+
element.userData.defaultAnim = action.getClip();
|
|
617
|
+
}
|
|
623
618
|
});
|
|
624
619
|
} else {
|
|
625
620
|
var _talkingCharacter$cha6;
|
|
@@ -769,7 +764,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
769
764
|
} else if (zoomStarted.current) {
|
|
770
765
|
zoomStarted.current = false;
|
|
771
766
|
}
|
|
772
|
-
}, [animationRunning]);
|
|
767
|
+
}, [animationRunning, camera]);
|
|
773
768
|
var disableBackButton = (0, _react.useMemo)(function () {
|
|
774
769
|
var disabled = line === 0 || previousLineWasDecision();
|
|
775
770
|
return disabled;
|
package/package.json
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@gamelearn/arcade-components",
|
|
3
|
-
"author": "Gamelearn",
|
|
4
|
-
"license": "unlicense",
|
|
5
|
-
"version": "2.17.
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"README.md"
|
|
10
|
-
],
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/gamelearn/arcade-components"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@babel/runtime": "^7.18.6",
|
|
17
|
-
"@gamelearn/arcade-styles": "2.11.2",
|
|
18
|
-
"@gamelearn/arcade-three-core": "1.17.2",
|
|
19
|
-
"@react-three/drei": "9.4.3",
|
|
20
|
-
"@react-three/fiber": "8.0.17",
|
|
21
|
-
"@testing-library/jest-dom": "^5.16.4",
|
|
22
|
-
"@testing-library/react": "^13.1.1",
|
|
23
|
-
"@testing-library/user-event": "13.5.0",
|
|
24
|
-
"global": "^4.4.0",
|
|
25
|
-
"gsap": "^3.
|
|
26
|
-
"hls.js": "0.12.4",
|
|
27
|
-
"html-react-parser": "^1.4.0",
|
|
28
|
-
"interactjs": "^1.10.11",
|
|
29
|
-
"konva": "^7.2.5",
|
|
30
|
-
"prop-types": "15.7.2",
|
|
31
|
-
"react-konva": "^18.1.0",
|
|
32
|
-
"react-konva-utils": "^0.3.0",
|
|
33
|
-
"react-pdf": "5.2.0",
|
|
34
|
-
"react-promise-suspense": "0.3.3",
|
|
35
|
-
"react-typist": "^2.0.5",
|
|
36
|
-
"three": "0.139.2",
|
|
37
|
-
"web-vitals": "0.2.4"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"start": "npm run storybook",
|
|
41
|
-
"clean": "rimraf dist",
|
|
42
|
-
"watch": "npx nodemon -e js --ignore dist --exec \"yarn compile && yalc push --changed\"",
|
|
43
|
-
"compile": "npm run clean && cross-env NODE_ENV=production babel src -d dist --ignore src/**/*.stories.js,src/**/*.test.js,src/setupTests.js",
|
|
44
|
-
"test": "react-scripts test --watchAll=false",
|
|
45
|
-
"test:watch": "react-scripts test",
|
|
46
|
-
"eject": "react-scripts eject",
|
|
47
|
-
"storybook": "start-storybook -p 6006 -s public",
|
|
48
|
-
"build-storybook": "build-storybook -o build",
|
|
49
|
-
"generate": "plop",
|
|
50
|
-
"lint": "npx eslint src --ext js,json",
|
|
51
|
-
"lint:fix": "npx eslint src --ext js,json --fix",
|
|
52
|
-
"lint:quiet": "npx eslint src --ext js,json --quiet",
|
|
53
|
-
"publish-hotfix": "yarn compile && npm publish && npm run version-tag",
|
|
54
|
-
"version-tag": "P_VER=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$P_VER && git push origin v$P_VER"
|
|
55
|
-
},
|
|
56
|
-
"browserslist": {
|
|
57
|
-
"production": [
|
|
58
|
-
">0.2%",
|
|
59
|
-
"not dead",
|
|
60
|
-
"not op_mini all"
|
|
61
|
-
],
|
|
62
|
-
"development": [
|
|
63
|
-
"last 1 chrome version",
|
|
64
|
-
"last 1 firefox version",
|
|
65
|
-
"last 1 safari version"
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"devDependencies": {
|
|
69
|
-
"@babel/cli": "7.12.10",
|
|
70
|
-
"@babel/eslint-parser": "^7.15.8",
|
|
71
|
-
"@babel/preset-env": "7.12.11",
|
|
72
|
-
"@babel/preset-react": "7.12.10",
|
|
73
|
-
"@gamelearn/version": "^1.3.1",
|
|
74
|
-
"@react-three/test-renderer": "6.0.6",
|
|
75
|
-
"@storybook/addon-actions": "6.1.11",
|
|
76
|
-
"@storybook/addon-essentials": "6.1.11",
|
|
77
|
-
"@storybook/addon-links": "6.1.11",
|
|
78
|
-
"@storybook/addons": "^6.3.8",
|
|
79
|
-
"@storybook/node-logger": "6.1.11",
|
|
80
|
-
"@storybook/preset-create-react-app": "3.1.5",
|
|
81
|
-
"@storybook/react": "6.1.11",
|
|
82
|
-
"@storybook/theming": "^6.3.8",
|
|
83
|
-
"babel-loader": "8.1.0",
|
|
84
|
-
"cross-env": "7.0.3",
|
|
85
|
-
"eslint-config-airbnb": "^18.2.1",
|
|
86
|
-
"eslint-config-prettier": "^8.3.0",
|
|
87
|
-
"eslint-plugin-json-format": "^2.0.1",
|
|
88
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
89
|
-
"husky": "4.3.0",
|
|
90
|
-
"nodemon": "^2.0.13",
|
|
91
|
-
"plop": "^2.7.4",
|
|
92
|
-
"prettier": "^2.5.0",
|
|
93
|
-
"react": "18.0.0",
|
|
94
|
-
"react-dom": "18.0.0",
|
|
95
|
-
"react-scripts": "4.0.1",
|
|
96
|
-
"rimraf": "3.0.2"
|
|
97
|
-
},
|
|
98
|
-
"jest": {
|
|
99
|
-
"transformIgnorePatterns": [
|
|
100
|
-
"node_modules/(?!(three)/)"
|
|
101
|
-
],
|
|
102
|
-
"moduleNameMapper": {
|
|
103
|
-
"^react-pdf$": "react-pdf/dist/umd/entry.jest",
|
|
104
|
-
"^react-konva-utils$": "react-pdf/dist/umd/entry.jest"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"husky": {
|
|
108
|
-
"hooks": {
|
|
109
|
-
"prepare-commit-msg": "bash node_modules/@gamelearn/version/scripts/update_version.sh -p hooks.config ${HUSKY_GIT_PARAMS}",
|
|
110
|
-
"post-commit": "bash node_modules/@gamelearn/version/scripts/after_version_update.sh -p hooks.config",
|
|
111
|
-
"post-merge": "bash node_modules/@gamelearn/version/scripts/after_version_update.sh -p hooks.config"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@gamelearn/arcade-components",
|
|
3
|
+
"author": "Gamelearn",
|
|
4
|
+
"license": "unlicense",
|
|
5
|
+
"version": "2.17.13",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/gamelearn/arcade-components"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@babel/runtime": "^7.18.6",
|
|
17
|
+
"@gamelearn/arcade-styles": "2.11.2",
|
|
18
|
+
"@gamelearn/arcade-three-core": "1.17.2",
|
|
19
|
+
"@react-three/drei": "9.4.3",
|
|
20
|
+
"@react-three/fiber": "8.0.17",
|
|
21
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
22
|
+
"@testing-library/react": "^13.1.1",
|
|
23
|
+
"@testing-library/user-event": "13.5.0",
|
|
24
|
+
"global": "^4.4.0",
|
|
25
|
+
"gsap": "^3.11.4",
|
|
26
|
+
"hls.js": "0.12.4",
|
|
27
|
+
"html-react-parser": "^1.4.0",
|
|
28
|
+
"interactjs": "^1.10.11",
|
|
29
|
+
"konva": "^7.2.5",
|
|
30
|
+
"prop-types": "15.7.2",
|
|
31
|
+
"react-konva": "^18.1.0",
|
|
32
|
+
"react-konva-utils": "^0.3.0",
|
|
33
|
+
"react-pdf": "5.2.0",
|
|
34
|
+
"react-promise-suspense": "0.3.3",
|
|
35
|
+
"react-typist": "^2.0.5",
|
|
36
|
+
"three": "0.139.2",
|
|
37
|
+
"web-vitals": "0.2.4"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"start": "npm run storybook",
|
|
41
|
+
"clean": "rimraf dist",
|
|
42
|
+
"watch": "npx nodemon -e js --ignore dist --exec \"yarn compile && yalc push --changed\"",
|
|
43
|
+
"compile": "npm run clean && cross-env NODE_ENV=production babel src -d dist --ignore src/**/*.stories.js,src/**/*.test.js,src/setupTests.js",
|
|
44
|
+
"test": "react-scripts test --watchAll=false",
|
|
45
|
+
"test:watch": "react-scripts test",
|
|
46
|
+
"eject": "react-scripts eject",
|
|
47
|
+
"storybook": "start-storybook -p 6006 -s public",
|
|
48
|
+
"build-storybook": "build-storybook -o build",
|
|
49
|
+
"generate": "plop",
|
|
50
|
+
"lint": "npx eslint src --ext js,json",
|
|
51
|
+
"lint:fix": "npx eslint src --ext js,json --fix",
|
|
52
|
+
"lint:quiet": "npx eslint src --ext js,json --quiet",
|
|
53
|
+
"publish-hotfix": "yarn compile && npm publish && npm run version-tag",
|
|
54
|
+
"version-tag": "P_VER=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$P_VER && git push origin v$P_VER"
|
|
55
|
+
},
|
|
56
|
+
"browserslist": {
|
|
57
|
+
"production": [
|
|
58
|
+
">0.2%",
|
|
59
|
+
"not dead",
|
|
60
|
+
"not op_mini all"
|
|
61
|
+
],
|
|
62
|
+
"development": [
|
|
63
|
+
"last 1 chrome version",
|
|
64
|
+
"last 1 firefox version",
|
|
65
|
+
"last 1 safari version"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@babel/cli": "7.12.10",
|
|
70
|
+
"@babel/eslint-parser": "^7.15.8",
|
|
71
|
+
"@babel/preset-env": "7.12.11",
|
|
72
|
+
"@babel/preset-react": "7.12.10",
|
|
73
|
+
"@gamelearn/version": "^1.3.1",
|
|
74
|
+
"@react-three/test-renderer": "6.0.6",
|
|
75
|
+
"@storybook/addon-actions": "6.1.11",
|
|
76
|
+
"@storybook/addon-essentials": "6.1.11",
|
|
77
|
+
"@storybook/addon-links": "6.1.11",
|
|
78
|
+
"@storybook/addons": "^6.3.8",
|
|
79
|
+
"@storybook/node-logger": "6.1.11",
|
|
80
|
+
"@storybook/preset-create-react-app": "3.1.5",
|
|
81
|
+
"@storybook/react": "6.1.11",
|
|
82
|
+
"@storybook/theming": "^6.3.8",
|
|
83
|
+
"babel-loader": "8.1.0",
|
|
84
|
+
"cross-env": "7.0.3",
|
|
85
|
+
"eslint-config-airbnb": "^18.2.1",
|
|
86
|
+
"eslint-config-prettier": "^8.3.0",
|
|
87
|
+
"eslint-plugin-json-format": "^2.0.1",
|
|
88
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
89
|
+
"husky": "4.3.0",
|
|
90
|
+
"nodemon": "^2.0.13",
|
|
91
|
+
"plop": "^2.7.4",
|
|
92
|
+
"prettier": "^2.5.0",
|
|
93
|
+
"react": "18.0.0",
|
|
94
|
+
"react-dom": "18.0.0",
|
|
95
|
+
"react-scripts": "4.0.1",
|
|
96
|
+
"rimraf": "3.0.2"
|
|
97
|
+
},
|
|
98
|
+
"jest": {
|
|
99
|
+
"transformIgnorePatterns": [
|
|
100
|
+
"node_modules/(?!(three)/)"
|
|
101
|
+
],
|
|
102
|
+
"moduleNameMapper": {
|
|
103
|
+
"^react-pdf$": "react-pdf/dist/umd/entry.jest",
|
|
104
|
+
"^react-konva-utils$": "react-pdf/dist/umd/entry.jest"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"husky": {
|
|
108
|
+
"hooks": {
|
|
109
|
+
"prepare-commit-msg": "bash node_modules/@gamelearn/version/scripts/update_version.sh -p hooks.config ${HUSKY_GIT_PARAMS}",
|
|
110
|
+
"post-commit": "bash node_modules/@gamelearn/version/scripts/after_version_update.sh -p hooks.config",
|
|
111
|
+
"post-merge": "bash node_modules/@gamelearn/version/scripts/after_version_update.sh -p hooks.config"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|