@gamelearn/arcade-components 0.24.7 → 0.24.9

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.
@@ -13,6 +13,8 @@ var _drei = require("@react-three/drei");
13
13
 
14
14
  var _useGLB2 = _interopRequireDefault(require("../../../helpers/useGLB"));
15
15
 
16
+ var _BoundingBox = _interopRequireDefault(require("./BoundingBox"));
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
@@ -21,44 +23,82 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
21
23
 
22
24
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
25
 
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
27
+
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
29
+
30
+ 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; }
31
+
24
32
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
33
 
26
34
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
35
 
28
- var AnimateElement = function AnimateElement(_ref) {
36
+ var AnimateElement = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
29
37
  var model = _ref.model,
30
38
  position = _ref.position,
31
39
  rotation = _ref.rotation,
32
40
  animationUrl = _ref.animationUrl,
33
- props = _objectWithoutProperties(_ref, ["model", "position", "rotation", "animationUrl"]);
41
+ enableBounding = _ref.enableBounding,
42
+ layers = _ref.layers,
43
+ onClick = _ref.onClick,
44
+ onPointerOver = _ref.onPointerOver,
45
+ onPointerOut = _ref.onPointerOut,
46
+ props = _objectWithoutProperties(_ref, ["model", "position", "rotation", "animationUrl", "enableBounding", "layers", "onClick", "onPointerOver", "onPointerOut"]);
34
47
 
35
48
  var _useGLB = (0, _useGLB2.default)(animationUrl),
36
49
  animations = _useGLB.animations;
37
50
 
38
51
  var _useAnimations = (0, _drei.useAnimations)(animations),
39
- ref = _useAnimations.ref,
52
+ animationRef = _useAnimations.ref,
40
53
  mixer = _useAnimations.mixer;
41
54
 
55
+ var mouseEvents = {
56
+ onClick: onClick,
57
+ onPointerOver: onPointerOver,
58
+ onPointerOut: onPointerOut
59
+ };
60
+
61
+ var currentProps = _objectSpread(_objectSpread({}, enableBounding ? {} : mouseEvents), props);
62
+
63
+ var getRef = function getRef(node) {
64
+ if (ref) {
65
+ if (ref instanceof Function) {
66
+ ref(node);
67
+ } else {
68
+ ref.current = node;
69
+ }
70
+ }
71
+
72
+ animationRef.current = node;
73
+ };
74
+
42
75
  (0, _react.useEffect)(function () {
43
- if (ref.current) {
76
+ if (animationRef.current) {
44
77
  mixer.stopAllAction();
45
78
  var clip = animations[0];
46
- ref.current.userData.defaultAnim = clip;
47
- ref.current.userData.mixer = mixer;
79
+ animationRef.current.userData.defaultAnim = clip;
80
+ animationRef.current.userData.mixer = mixer;
48
81
 
49
82
  if (clip) {
50
- var action = mixer.clipAction(clip, ref.current);
83
+ var action = mixer.clipAction(clip, animationRef.current);
51
84
  action.play();
52
85
  }
53
86
  }
54
- }, [mixer, ref, animations]);
55
- return /*#__PURE__*/_react.default.createElement("primitive", _extends({
56
- ref: ref,
87
+ }, [mixer, animations, animationRef]);
88
+ return /*#__PURE__*/_react.default.createElement("group", {
89
+ visible: props.visible
90
+ }, enableBounding ? /*#__PURE__*/_react.default.createElement(_BoundingBox.default, _extends({
91
+ model: model,
92
+ position: position,
93
+ rotation: rotation,
94
+ layers: layers
95
+ }, mouseEvents)) : null, /*#__PURE__*/_react.default.createElement("primitive", _extends({
96
+ ref: getRef,
57
97
  object: model,
58
98
  position: position,
59
99
  rotation: rotation
60
- }, props));
61
- };
100
+ }, currentProps)));
101
+ });
62
102
 
63
103
  var _default = AnimateElement;
64
104
  exports.default = _default;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _three = require("three");
13
+
14
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
+
16
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
17
+
18
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
+
20
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
+
22
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
23
+
24
+ var BoundingBox = function BoundingBox(_ref) {
25
+ var model = _ref.model,
26
+ rotation = _ref.rotation,
27
+ position = _ref.position,
28
+ visible = _ref.visible,
29
+ props = _objectWithoutProperties(_ref, ["model", "rotation", "position", "visible"]);
30
+
31
+ var bounding = (0, _react.useRef)();
32
+ (0, _react.useEffect)(function () {
33
+ if (model && bounding.current) {
34
+ var box = new _three.Box3().setFromObject(model);
35
+ var size = box.getSize(new _three.Vector3());
36
+ bounding.current.scale.copy(size);
37
+ bounding.current.scale.x /= 2;
38
+ bounding.current.position.y = size.y / 2;
39
+ }
40
+ }, [model, position]);
41
+ return /*#__PURE__*/_react.default.createElement("mesh", _extends({
42
+ ref: bounding,
43
+ position: position,
44
+ rotation: rotation
45
+ }, props), /*#__PURE__*/_react.default.createElement("boxGeometry", {
46
+ args: [1, 1, 1]
47
+ }), /*#__PURE__*/_react.default.createElement("meshBasicMaterial", {
48
+ color: "grey",
49
+ visible: false
50
+ }));
51
+ };
52
+
53
+ BoundingBox.defaultProps = {
54
+ rotation: [0, 0, 0],
55
+ position: [0, 0, 0],
56
+ visible: true
57
+ };
58
+ var _default = BoundingBox;
59
+ exports.default = _default;
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _fiber = require("@react-three/fiber");
13
13
 
14
- var _drei = require("@react-three/drei");
15
-
16
14
  var _AnimateElement = _interopRequireDefault(require("./AnimateElement"));
17
15
 
18
16
  var _SkeletonUtils = require("three/examples/jsm/utils/SkeletonUtils");
@@ -53,24 +51,20 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
53
51
 
54
52
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
55
53
 
56
- var Element = function Element(_ref) {
54
+ var Element = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
57
55
  var url = _ref.url,
58
56
  animationUrl = _ref.animationUrl,
59
- _ref$position = _ref.position,
60
- position = _ref$position === void 0 ? [0, 0, 0] : _ref$position,
57
+ position = _ref.position,
61
58
  rotation = _ref.rotation,
62
- _ref$scale = _ref.scale,
63
- scale = _ref$scale === void 0 ? [1, 1, 1] : _ref$scale,
59
+ scale = _ref.scale,
64
60
  size = _ref.size,
65
- _ref$material = _ref.material,
66
- material = _ref$material === void 0 ? {} : _ref$material,
67
- _ref$layers = _ref.layers,
68
- layers = _ref$layers === void 0 ? 0 : _ref$layers,
61
+ material = _ref.material,
62
+ layers = _ref.layers,
69
63
  type = _ref.type,
70
- _ref$onLoad = _ref.onLoad,
71
- onLoad = _ref$onLoad === void 0 ? function () {} : _ref$onLoad,
64
+ onLoad = _ref.onLoad,
72
65
  userData = _ref.userData,
73
- props = _objectWithoutProperties(_ref, ["url", "animationUrl", "position", "rotation", "scale", "size", "material", "layers", "type", "onLoad", "userData"]);
66
+ enableBounding = _ref.enableBounding,
67
+ props = _objectWithoutProperties(_ref, ["url", "animationUrl", "position", "rotation", "scale", "size", "material", "layers", "type", "onLoad", "userData", "enableBounding"]);
74
68
 
75
69
  var model = (0, _useGLB.default)(url);
76
70
  var modelClone = (0, _react.useMemo)(function () {
@@ -79,6 +73,11 @@ var Element = function Element(_ref) {
79
73
  var usingScale = size ? Object.values(size) : scale;
80
74
  var isCharacter = type === 'character';
81
75
 
76
+ var _useState = (0, _react.useState)(false),
77
+ _useState2 = _slicedToArray(_useState, 2),
78
+ loaded = _useState2[0],
79
+ setLoaded = _useState2[1];
80
+
82
81
  if (usingScale.length < 3) {
83
82
  usingScale.push(1);
84
83
  }
@@ -93,7 +92,7 @@ var Element = function Element(_ref) {
93
92
  camera = _useThree2[1];
94
93
 
95
94
  (0, _react.useEffect)(function () {
96
- if (modelClone) {
95
+ if (modelClone && !loaded) {
97
96
  modelClone.traverse(function (node) {
98
97
  if (node.isMesh) {
99
98
  node.receiveShadow = true;
@@ -127,28 +126,39 @@ var Element = function Element(_ref) {
127
126
  }
128
127
  });
129
128
  onLoad(modelClone, currentScene, camera);
129
+ setLoaded(true);
130
130
  }
131
- }, [modelClone, material, onLoad, currentScene, camera, layers, isCharacter]);
131
+ }, [modelClone, material, loaded, onLoad, currentScene, camera, layers, isCharacter]);
132
132
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, animationUrl ? /*#__PURE__*/_react.default.createElement(_AnimateElement.default, _extends({
133
+ ref: ref,
133
134
  animationUrl: animationUrl,
134
135
  model: modelClone,
135
136
  position: position,
136
137
  rotation: rotation,
137
138
  scale: usingScale,
138
- raycast: _drei.meshBounds
139
+ enableBounding: enableBounding,
140
+ layers: layers
139
141
  }, props)) : /*#__PURE__*/_react.default.createElement("primitive", _extends({
142
+ ref: ref,
140
143
  object: modelClone,
141
144
  position: position,
142
145
  rotation: rotation,
143
- scale: usingScale,
144
- raycast: _drei.meshBounds
145
- }, props)), props.uid && /*#__PURE__*/_react.default.createElement(_Projection.default, {
146
+ scale: usingScale
147
+ }, props)), props.uid ? /*#__PURE__*/_react.default.createElement(_Projection.default, {
146
148
  object: modelClone,
147
149
  element: _objectSpread(_objectSpread({}, props), {}, {
148
150
  type: type
149
151
  })
150
- }));
151
- };
152
+ }) : null);
153
+ });
152
154
 
155
+ Element.defaultProps = {
156
+ position: [0, 0, 0],
157
+ scale: [1, 1, 1],
158
+ layers: 0,
159
+ material: {},
160
+ enableBounding: false,
161
+ onLoad: function onLoad() {}
162
+ };
153
163
  var _default = Element;
154
164
  exports.default = _default;
@@ -97,7 +97,8 @@ var ElementsList = function ElementsList(_ref) {
97
97
  },
98
98
  onPointerOut: function onPointerOut(e) {
99
99
  return onOut(e, element);
100
- }
100
+ },
101
+ enableBounding: true
101
102
  }, element));
102
103
  }
103
104
 
@@ -27,6 +27,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
27
27
 
28
28
  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; }
29
29
 
30
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
31
+
32
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
33
+
30
34
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
31
35
 
32
36
  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."); }
@@ -59,21 +63,24 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
59
63
  playSound = _soundActions[0],
60
64
  stop = _soundActions[1];
61
65
 
66
+ var _useState3 = (0, _react.useState)(false),
67
+ _useState4 = _slicedToArray(_useState3, 2),
68
+ finished = _useState4[0],
69
+ setFinished = _useState4[1];
70
+
62
71
  var backgroundImage = (background === null || background === void 0 ? void 0 : (_background$img = background.img) === null || _background$img === void 0 ? void 0 : _background$img.url) || null;
63
72
  var currentLineData = lines[currentLine];
64
73
  var voiceOverSlots = [];
65
74
  var voiceOver = currentLineData.voiceOver,
66
75
  decision = currentLineData.decision;
67
76
  var isFlex = currentLineData.flex;
68
-
69
- var translate = function translate(id) {
77
+ var translate = (0, _react.useCallback)(function (id) {
70
78
  return emitEvent({
71
79
  type: 'translate',
72
80
  payload: id
73
81
  });
74
- };
75
-
76
- var getCurrentMessage = function getCurrentMessage() {
82
+ }, [emitEvent]);
83
+ var getCurrentMessage = (0, _react.useCallback)(function () {
77
84
  if (voiceOver) {
78
85
  return currentLineData;
79
86
  }
@@ -90,9 +97,65 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
90
97
  return currentLineData.slots.find(function (slot) {
91
98
  return slot.uid && slot.text;
92
99
  });
93
- };
100
+ }, [currentLineData, voiceOver]);
101
+ var getVoice = (0, _react.useCallback)(function (_ref2) {
102
+ var id = _ref2.id,
103
+ _ref2$type = _ref2.type,
104
+ type = _ref2$type === void 0 ? 'base' : _ref2$type;
105
+ var usedVoices = translate('usedVoices');
106
+ var gameChars = translate('gameCharacters');
107
+
108
+ if (type === 'base') {
109
+ return usedVoices === null || usedVoices === void 0 ? void 0 : usedVoices[id];
110
+ } else if (type === 'character') {
111
+ var _gameChars$id;
112
+
113
+ return gameChars === null || gameChars === void 0 ? void 0 : (_gameChars$id = gameChars[id]) === null || _gameChars$id === void 0 ? void 0 : _gameChars$id.voiceId;
114
+ }
94
115
 
95
- var currentMessage = !decision ? getCurrentMessage() : {}; // Recupera la antigua linea de la conversacion para conservar los personajes en voice-over
116
+ return null;
117
+ }, [translate]);
118
+ var currentMessage = (0, _react.useMemo)(function () {
119
+ return !decision ? getCurrentMessage() : {};
120
+ }, [getCurrentMessage, decision]);
121
+ var playSpeech = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
122
+ var payload, speechUrl;
123
+ return regeneratorRuntime.wrap(function _callee$(_context) {
124
+ while (1) {
125
+ switch (_context.prev = _context.next) {
126
+ case 0:
127
+ if (!currentLineData.voice.id) {
128
+ _context.next = 7;
129
+ break;
130
+ }
131
+
132
+ payload = {
133
+ voiceId: getVoice(currentLineData.voice),
134
+ text: currentMessage.text
135
+ };
136
+
137
+ if (!(payload.voiceId && payload.text)) {
138
+ _context.next = 7;
139
+ break;
140
+ }
141
+
142
+ _context.next = 5;
143
+ return emitEvent({
144
+ type: 'playSpeech',
145
+ payload: payload
146
+ });
147
+
148
+ case 5:
149
+ speechUrl = _context.sent;
150
+ playSound(speechUrl);
151
+
152
+ case 7:
153
+ case "end":
154
+ return _context.stop();
155
+ }
156
+ }
157
+ }, _callee);
158
+ })), [currentLineData.voice, getVoice, currentMessage, emitEvent, playSound]); // Recupera la antigua linea de la conversacion para conservar los personajes en voice-over
96
159
 
97
160
  var leftWithSlots = lines.slice(0, currentLine + 1).reverse().find(function (line) {
98
161
  return line.slots;
@@ -177,6 +240,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
177
240
  if (line + 1 <= maxLine) {
178
241
  setCurrentLine(line + 1);
179
242
  } else {
243
+ setFinished(true);
180
244
  emitEvent({
181
245
  type: 'success'
182
246
  });
@@ -192,13 +256,20 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
192
256
  };
193
257
 
194
258
  (0, _react.useEffect)(function () {
195
- var _lines$currentLine, _lines$currentLine$au;
259
+ var _currentLineData$audi;
260
+
261
+ if ((currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType) === 'voice' && !finished) {
262
+ playSpeech();
263
+ } else if (currentLineData !== null && currentLineData !== void 0 && (_currentLineData$audi = currentLineData.audio) !== null && _currentLineData$audi !== void 0 && _currentLineData$audi.url) {
264
+ var _currentLineData$audi2;
265
+
266
+ playSound(currentLineData === null || currentLineData === void 0 ? void 0 : (_currentLineData$audi2 = currentLineData.audio) === null || _currentLineData$audi2 === void 0 ? void 0 : _currentLineData$audi2.url);
267
+ }
196
268
 
197
- playSound((_lines$currentLine = lines[currentLine]) === null || _lines$currentLine === void 0 ? void 0 : (_lines$currentLine$au = _lines$currentLine.audio) === null || _lines$currentLine$au === void 0 ? void 0 : _lines$currentLine$au.url);
198
269
  return function () {
199
270
  stop();
200
271
  };
201
- }, [currentLine, lines, playSound, stop]);
272
+ }, [currentLineData, currentMessage, finished, lines, playSound, playSpeech, stop]);
202
273
 
203
274
  var decisionPayload = _objectSpread(_objectSpread({}, currentLineData.payload), {}, {
204
275
  onFinish: handleClickNext,
@@ -45,12 +45,14 @@ var SlotList = function SlotList(_ref) {
45
45
  if (current.character) {
46
46
  char.name = current.alias || current.character.name;
47
47
  char.resource = char.character.resource;
48
+ char.position = char.position >= 0 ? char.position : -1;
48
49
  delete char.character;
49
50
  char.type = 'character';
50
51
  acc.push(char);
51
52
  } else if (actor) {
52
53
  var resource = actor.resource;
53
54
  char.name = current.alias || current.name;
55
+ char.position = char.position >= 0 ? char.position : -1;
54
56
  char.resource = resource;
55
57
  char.type = actor.type;
56
58
  acc.push(char);
@@ -83,7 +85,7 @@ var SlotList = function SlotList(_ref) {
83
85
  key: character.uid + index
84
86
  }, characterProps({
85
87
  character: character,
86
- active: character.talking,
88
+ active: currentMessage.position === character.position,
87
89
  slot: index
88
90
  })));
89
91
  });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.conversationPropsLodSettings = exports.conversationPropsNoFeedbackNoRewards = exports.withoutBackground = exports.voiceOverProps = exports.conversationProps = exports.converOld = void 0;
6
+ exports.textToSpeechProps = exports.conversationPropsLodSettings = exports.conversationPropsNoFeedbackNoRewards = exports.withoutBackground = exports.voiceOverProps = exports.conversationProps = exports.converOld = void 0;
7
7
 
8
8
  var _mocker = require("helpers/mocker");
9
9
 
@@ -1131,4 +1131,104 @@ var conversationPropsLodSettings = {
1131
1131
  uid: 'kjTHqx'
1132
1132
  }]
1133
1133
  };
1134
- exports.conversationPropsLodSettings = conversationPropsLodSettings;
1134
+ exports.conversationPropsLodSettings = conversationPropsLodSettings;
1135
+ var textToSpeechProps = {
1136
+ "actors": [],
1137
+ "background": {},
1138
+ "lines": [{
1139
+ "audioId_labelId": "audioId_0_u8GqjXR4",
1140
+ "audioType": "voice",
1141
+ "flex": false,
1142
+ "hasAlias": true,
1143
+ "slots": [{
1144
+ "alias": "alias_0_0_u8GqgZXt",
1145
+ "alias_labelId": "alias_0_0_u8GqgZXt",
1146
+ "emotion": "neutral",
1147
+ "talking": true,
1148
+ "text": "text_0_0_u8Gqfb0d",
1149
+ "text_labelId": "text_0_0_u8Gqfb0d",
1150
+ "uid": "OxVPqm"
1151
+ }, {
1152
+ "alias_labelId": "alias_0_1_u8GqgVBv",
1153
+ "emotion": "neutral",
1154
+ "talking": false,
1155
+ "text": "",
1156
+ "text_labelId": "text_0_1_u8GqgH0e",
1157
+ "uid": null
1158
+ }, {
1159
+ "alias_labelId": "alias_0_2_u8GqgGOU",
1160
+ "emotion": "neutral",
1161
+ "talking": false,
1162
+ "text": "",
1163
+ "text_labelId": "text_0_2_u8GqgCxs",
1164
+ "uid": null
1165
+ }, {
1166
+ "alias_labelId": "alias_0_3_u8Gqhwkb",
1167
+ "emotion": "neutral",
1168
+ "talking": false,
1169
+ "text": "",
1170
+ "text_labelId": "text_0_3_u8GqhLmZ",
1171
+ "uid": null
1172
+ }, {
1173
+ "alias_labelId": "alias_0_4_u8GqhHJG",
1174
+ "emotion": "neutral",
1175
+ "talking": false,
1176
+ "text": "",
1177
+ "text_labelId": "text_0_4_u8Gqh68W",
1178
+ "uid": null
1179
+ }],
1180
+ "text_labelId": "text_0_u8Gqjbqa",
1181
+ "voice": {
1182
+ type: "character",
1183
+ id: "OxVPqm"
1184
+ }
1185
+ }, {
1186
+ "audioId_labelId": "audioId_0_u8GqjXR4",
1187
+ "audioType": "voice",
1188
+ "flex": false,
1189
+ "hasAlias": true,
1190
+ "slots": [{
1191
+ "alias": "alias_0_0_u8GqgZXt",
1192
+ "alias_labelId": "alias_0_0_u8GqgZXt",
1193
+ "emotion": "neutral",
1194
+ "talking": true,
1195
+ "text": "text_0_0_u8Gqfb0d",
1196
+ "text_labelId": "text_0_0_u8Gqfb0d",
1197
+ "uid": "OxVPqm"
1198
+ }, {
1199
+ "alias_labelId": "alias_0_1_u8GqgVBv",
1200
+ "emotion": "neutral",
1201
+ "talking": false,
1202
+ "text": "",
1203
+ "text_labelId": "text_0_1_u8GqgH0e",
1204
+ "uid": null
1205
+ }, {
1206
+ "alias_labelId": "alias_0_2_u8GqgGOU",
1207
+ "emotion": "neutral",
1208
+ "talking": false,
1209
+ "text": "",
1210
+ "text_labelId": "text_0_2_u8GqgCxs",
1211
+ "uid": null
1212
+ }, {
1213
+ "alias_labelId": "alias_0_3_u8Gqhwkb",
1214
+ "emotion": "neutral",
1215
+ "talking": false,
1216
+ "text": "",
1217
+ "text_labelId": "text_0_3_u8GqhLmZ",
1218
+ "uid": null
1219
+ }, {
1220
+ "alias_labelId": "alias_0_4_u8GqhHJG",
1221
+ "emotion": "neutral",
1222
+ "talking": false,
1223
+ "text": "",
1224
+ "text_labelId": "text_0_4_u8Gqh68W",
1225
+ "uid": null
1226
+ }],
1227
+ "text_labelId": "text_0_u8Gqjbqa",
1228
+ voice: {
1229
+ type: "base",
1230
+ id: "female_01"
1231
+ }
1232
+ }]
1233
+ };
1234
+ exports.textToSpeechProps = textToSpeechProps;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "license": "Gamelearn",
4
- "version": "0.24.7",
4
+ "version": "0.24.9",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist",