evotars 0.0.2 → 0.0.4

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.
Files changed (71) hide show
  1. package/dist/app.d.ts +24 -0
  2. package/dist/config/constants.d.ts +1 -0
  3. package/dist/entities/EmoteSpitter.d.ts +15 -0
  4. package/dist/entities/Evotar.d.ts +78 -0
  5. package/dist/entities/Message.d.ts +27 -0
  6. package/dist/entities/Name.d.ts +14 -0
  7. package/dist/entities/SpriteContainer.d.ts +16 -0
  8. package/dist/entities/TrailEffect.d.ts +15 -0
  9. package/dist/evotars.d.ts +15 -0
  10. package/dist/evotars.js +705 -0
  11. package/dist/evotars.umd.cjs +1 -0
  12. package/dist/evotarsManager.d.ts +30 -0
  13. package/dist/helpers/timer.d.ts +14 -0
  14. package/dist/helpers/types.d.ts +10 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/services/soundService.d.ts +14 -0
  17. package/dist/services/spriteService.d.ts +63 -0
  18. package/dist/types/dto/action.d.ts +56 -0
  19. package/{src/types/dto/chatter.ts → dist/types/dto/chatter.d.ts} +2 -2
  20. package/dist/types/dto/event.d.ts +9 -0
  21. package/dist/types/dto/message.d.ts +8 -0
  22. package/dist/types/dto/settings.d.ts +5 -0
  23. package/dist/types/dto/user.d.ts +12 -0
  24. package/package.json +30 -3
  25. package/.editorconfig +0 -13
  26. package/.prettierrc.json +0 -3
  27. package/index.html +0 -13
  28. package/index.ts +0 -1
  29. package/public/fonts/Rubik.ttf +0 -0
  30. package/public/sounds/jump.mp3 +0 -0
  31. package/public/sprites/agent/agent.json +0 -166
  32. package/public/sprites/agent/agent.png +0 -0
  33. package/public/sprites/cat/cat.json +0 -231
  34. package/public/sprites/cat/cat.png +0 -0
  35. package/public/sprites/dude/dude.json +0 -231
  36. package/public/sprites/dude/dude.png +0 -0
  37. package/public/sprites/girl/girl.json +0 -231
  38. package/public/sprites/girl/girl.png +0 -0
  39. package/public/sprites/nerd/nerd.json +0 -231
  40. package/public/sprites/nerd/nerd.png +0 -0
  41. package/public/sprites/senior/senior.json +0 -231
  42. package/public/sprites/senior/senior.png +0 -0
  43. package/public/sprites/sith/sith.json +0 -166
  44. package/public/sprites/sith/sith.png +0 -0
  45. package/src/app.ts +0 -63
  46. package/src/config/config.ts +0 -133
  47. package/src/config/constants.ts +0 -1
  48. package/src/dudes.ts +0 -71
  49. package/src/entities/Dude.ts +0 -453
  50. package/src/entities/DudeEmoteSpitter.ts +0 -60
  51. package/src/entities/DudeMessage.ts +0 -163
  52. package/src/entities/DudeName.ts +0 -39
  53. package/src/entities/DudeSpriteContainer.ts +0 -68
  54. package/src/entities/DudeTrailEffect.ts +0 -72
  55. package/src/helpers/timer.ts +0 -43
  56. package/src/helpers/types.ts +0 -11
  57. package/src/index.ts +0 -1
  58. package/src/main.ts +0 -75
  59. package/src/services/assetsLoader.ts +0 -27
  60. package/src/services/dudesManager.ts +0 -305
  61. package/src/services/soundService.ts +0 -28
  62. package/src/services/spriteProvider.ts +0 -93
  63. package/src/styles.css +0 -16
  64. package/src/types/dto/action.ts +0 -68
  65. package/src/types/dto/event.ts +0 -9
  66. package/src/types/dto/message.ts +0 -8
  67. package/src/types/dto/settings.ts +0 -5
  68. package/src/types/dto/user.ts +0 -13
  69. package/tsconfig.json +0 -23
  70. /package/{src/types/dto/index.ts → dist/types/dto/index.d.ts} +0 -0
  71. /package/{src/types/index.ts → dist/types/index.d.ts} +0 -0
@@ -1,93 +0,0 @@
1
- import { AsepriteData, assetsLoader } from './assetsLoader';
2
- import * as PIXI from 'pixi.js';
3
-
4
- export type DudeLayerAnimatedSprite = {
5
- layer: DudeSpriteLayers;
6
- sprite: PIXI.AnimatedSprite;
7
- };
8
-
9
- export type DudeTagAnimatedSprites = {
10
- [tag in DudeSpriteTags]: DudeLayerAnimatedSprite[];
11
- };
12
-
13
- export enum DudeSpriteLayers {
14
- Body = 'Body',
15
- Eyes = 'Eyes',
16
- }
17
-
18
- export enum DudeSpriteTags {
19
- Idle = 'Idle',
20
- Jump = 'Jump',
21
- Fall = 'Fall',
22
- Land = 'Land',
23
- Run = 'Run',
24
- Die = 'Die',
25
- }
26
-
27
- export type FrameTag = {
28
- from: number;
29
- name: string;
30
- to: number;
31
- direction: string;
32
- };
33
-
34
- export class SpriteProvider {
35
- public createLayerAnimatedSprites(
36
- name: string,
37
- sheet: PIXI.Spritesheet<AsepriteData>,
38
- frameTag: FrameTag
39
- ): DudeLayerAnimatedSprite[] {
40
- const layers = sheet.data.meta.layers;
41
-
42
- if (layers) {
43
- const textures = Object.fromEntries<PIXI.FrameObject[]>(
44
- layers.map((layer) => [layer.name, []])
45
- );
46
-
47
- for (let i = frameTag.from; i <= frameTag.to; i++) {
48
- const framekey = i.toString();
49
-
50
- for (const layer in textures) {
51
- const key = name + '_' + layer + '_' + framekey;
52
- const texture = sheet.textures[key];
53
- const time = sheet.data.frames[key].duration;
54
-
55
- textures[layer].push({ texture: texture, time: time });
56
- }
57
- }
58
-
59
- return Object.entries(textures).map((entry) => {
60
- const sprite = new PIXI.AnimatedSprite(entry[1]);
61
- sprite.texture.baseTexture.scaleMode = PIXI.SCALE_MODES.NEAREST;
62
- return { layer: entry[0] as DudeSpriteLayers, sprite };
63
- });
64
- }
65
-
66
- throw Error("Sprite sheet doesn't have layers");
67
- }
68
-
69
- public createTagAnimatedSprites(sheetName: string): DudeTagAnimatedSprites {
70
- if (!sheetName) {
71
- throw Error('Sheet is not defined');
72
- }
73
-
74
- const sheet = assetsLoader.sheets[sheetName];
75
-
76
- return (sheet.data.meta.frameTags ?? []).reduce<DudeTagAnimatedSprites>(
77
- (sprites, tag) => {
78
- if (tag && tag.name) {
79
- sprites[tag.name as DudeSpriteTags] = this.createLayerAnimatedSprites(
80
- sheetName,
81
- sheet,
82
- tag
83
- );
84
- }
85
-
86
- return sprites;
87
- },
88
- {} as DudeTagAnimatedSprites
89
- );
90
- }
91
- }
92
-
93
- export const spriteProvider = new SpriteProvider();
package/src/styles.css DELETED
@@ -1,16 +0,0 @@
1
- :root {
2
- margin: 0;
3
- padding: 0;
4
- }
5
-
6
- body {
7
- margin: 0;
8
- padding: 0;
9
- width: 100%;
10
- height: 100%;
11
- overflow: hidden;
12
- }
13
-
14
- #root {
15
- height: 400px;
16
- }
@@ -1,68 +0,0 @@
1
- import { UserInfo } from "./user";
2
-
3
- export type ActionData = Record<string, string | number | undefined>;
4
-
5
- export type ActionableData = {
6
- arguments: string[];
7
- action: ActionData;
8
- };
9
-
10
- export type ActionEntity = {
11
- id: number;
12
- name: string;
13
- title: string;
14
- description: string;
15
- data: ActionData;
16
- };
17
-
18
- export type UserActionEntity = {
19
- userId: string;
20
- cooldown: number;
21
- info: UserInfo;
22
- } & ActionEntity;
23
-
24
- export type JumpUserActionEntity = {
25
- name: "jump";
26
- data: {
27
- velocityX: number;
28
- velocityY: number;
29
- };
30
- } & UserActionEntity;
31
-
32
- export type ColorUserActionEntity = {
33
- name: "color";
34
- data: {
35
- color: string;
36
- };
37
- } & UserActionEntity;
38
-
39
- export type GrowUserActionEntity = {
40
- name: "grow";
41
- data: {
42
- duration: number;
43
- scale: number;
44
- };
45
- } & UserActionEntity;
46
-
47
- export type DashUserActionEntity = {
48
- name: "dash";
49
- data: {
50
- force: number;
51
- };
52
- } & UserActionEntity;
53
-
54
- export const isJumpUserActionEntity = (
55
- entity: ActionEntity,
56
- ): entity is JumpUserActionEntity => entity.name == "jump";
57
-
58
- export const isColorUserActionEntity = (
59
- entity: ActionEntity,
60
- ): entity is ColorUserActionEntity => entity.name == "color";
61
-
62
- export const isGrowUserActionEntity = (
63
- entity: ActionEntity,
64
- ): entity is GrowUserActionEntity => entity.name == "grow";
65
-
66
- export const isDashUserActionEntity = (
67
- entity: ActionEntity,
68
- ): entity is DashUserActionEntity => entity.name == "dash";
@@ -1,9 +0,0 @@
1
- import { UserInfo } from './user';
2
-
3
- export type RaidData = {
4
- broadcaster: {
5
- id: string;
6
- info: UserInfo;
7
- };
8
- viewers: number;
9
- };
@@ -1,8 +0,0 @@
1
- import { UserInfo } from './user';
2
-
3
- export type MessageEntity = {
4
- userId: string;
5
- message: string;
6
- emotes: string[];
7
- info: UserInfo;
8
- };
@@ -1,5 +0,0 @@
1
- export type SettingsEntity = {
2
- showAnonymousDudes?: boolean;
3
- fallingDudes?: boolean;
4
- fallingRaiders?: boolean;
5
- };
@@ -1,13 +0,0 @@
1
- export type UserEntity = {
2
- userId: number;
3
- guid: string;
4
- displayName: string;
5
- profileImageUrl: string;
6
- previewUrl: string;
7
- };
8
-
9
- export type UserInfo = {
10
- displayName: string;
11
- color?: string;
12
- sprite?: string;
13
- }
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "module": "ESNext",
6
- "lib": ["ES2020", "DOM", "DOM.Iterable", "ES2021.String"],
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "noEmit": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "noFallthroughCasesInSwitch": true
21
- },
22
- "include": ["src"]
23
- }
File without changes