@rpg-engine/long-bow 0.2.6 → 0.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,14 +10,13 @@ import PropertySelect, {
10
10
  } from '../PropertySelect/PropertySelect';
11
11
 
12
12
  export interface ICharacterProps {
13
- id: string;
14
13
  name: string;
15
- spriteKey: string;
14
+ textureKey: string;
16
15
  }
17
16
 
18
17
  export interface ICharacterSelectionProps {
19
18
  availableCharacters: ICharacterProps[];
20
- onChange: (characterSpriteKey: string) => void;
19
+ onChange: (textureKey: string) => void;
21
20
  }
22
21
 
23
22
  export const CharacterSelection: React.FC<ICharacterSelectionProps> = ({
@@ -27,7 +26,7 @@ export const CharacterSelection: React.FC<ICharacterSelectionProps> = ({
27
26
  const getPropertySelectValues = () => {
28
27
  return availableCharacters.map(item => {
29
28
  return {
30
- id: item.id,
29
+ id: item.textureKey,
31
30
  name: item.name,
32
31
  };
33
32
  });
@@ -42,17 +41,10 @@ export const CharacterSelection: React.FC<ICharacterSelectionProps> = ({
42
41
  propertySelectValues[0]
43
42
  );
44
43
 
45
- const getSelectedCharacterSpriteKey = () => {
46
- const character = availableCharacters.filter(
47
- item => item.id === selectedValue.id
48
- )[0];
49
- return character ? character.spriteKey : '';
50
- };
51
-
52
44
  const onSelectedValueChange = () => {
53
- const spriteKey = getSelectedCharacterSpriteKey();
54
- setSelectedSpriteKey(spriteKey);
55
- onChange(spriteKey);
45
+ const textureKey = selectedValue.id;
46
+ setSelectedSpriteKey(textureKey + '/down/standing/0.png');
47
+ onChange(textureKey);
56
48
  };
57
49
 
58
50
  useEffect(() => {
@@ -27,14 +27,12 @@ export const Default = Template.bind({});
27
27
 
28
28
  const availableCharacters: ICharacterProps[] = [
29
29
  {
30
- id: 'woman',
31
30
  name: 'Woman',
32
- spriteKey: 'woman-1/down/standing/0.png',
31
+ textureKey: 'woman-1',
33
32
  },
34
33
  {
35
- id: 'kid',
36
34
  name: 'Kid',
37
- spriteKey: 'kid-1/down/standing/0.png',
35
+ textureKey: 'kid-1',
38
36
  },
39
37
  ];
40
38