Comparing version 0.1.14 to 0.1.16
import * as PIXI from "pixi.js"; | ||
import { Layers } from "../definitions/client"; | ||
import { CharacterData, MonsterData } from "../definitions/server"; | ||
import { UICharacterData, UIMonsterData } from "../definitions/server"; | ||
export declare type MonsterSpriteData = { | ||
data: MonsterData; | ||
data: UIMonsterData; | ||
lastDirection: number; | ||
@@ -13,3 +13,3 @@ focusedHover?: boolean; | ||
export declare type CharacterSpriteData = { | ||
data: CharacterData; | ||
data: UICharacterData; | ||
lastDirection: number; | ||
@@ -26,3 +26,3 @@ focusedHover?: boolean; | ||
export declare function removeAllSprites(): void; | ||
export declare function renderCharacter(layers: Layers, character: CharacterData, initialDirection?: number): PIXI.AnimatedSprite; | ||
export declare function renderMonster(layers: Layers, monster: MonsterData, initialDirection?: number): PIXI.AnimatedSprite; | ||
export declare function renderCharacter(layers: Layers, character: UICharacterData, initialDirection?: number): PIXI.AnimatedSprite; | ||
export declare function renderMonster(layers: Layers, monster: UIMonsterData, initialDirection?: number): PIXI.AnimatedSprite; |
@@ -1,4 +0,4 @@ | ||
import { CXData, MapName, StatusInfo } from "alclient" | ||
import { BankInfo, CXData, MapName, StatusInfo } from "alclient" | ||
export type CharacterData = { | ||
export type UICharacterData = { | ||
cx?: CXData | ||
@@ -19,3 +19,3 @@ hp: number | ||
export type MonsterData = { | ||
export type UIMonsterData = { | ||
aa?: number | ||
@@ -44,6 +44,21 @@ hp: number | ||
export type TabData = { | ||
export type UIData = { | ||
mapData: MapData | ||
monsters: Map<string, MonsterData> | ||
players: Map<string, CharacterData> | ||
monsters: Map<string, UIMonsterData> | ||
players: Map<string, UICharacterData> | ||
bank?: BankInfo | ||
} | ||
export type ServerToClientEvents = { | ||
"bank": (bankInfo: BankInfo) => void | ||
"character": (characterData: UICharacterData) => void | ||
"map": (mapData: MapData) => void | ||
"monster": (MonsterData: UIMonsterData) => void | ||
"newTab": (tabName: string) => void | ||
"remove": (entityID: string) => void | ||
"removeAll": () => void | ||
} | ||
export type ClientToServerEvents = { | ||
"switchTab": (tabName: string) => void | ||
} |
@@ -13,3 +13,3 @@ import Express from "express"; | ||
let G; | ||
const tabs = new Map(); | ||
const observers = new Map(); | ||
export function startServer(port = 8080, g) { | ||
@@ -24,8 +24,8 @@ G = g; | ||
connection.on("switchTab", (newTab) => { | ||
if (!tabs.has(newTab)) | ||
if (!observers.has(newTab)) | ||
return; | ||
for (const [tab] of tabs) | ||
for (const [tab] of observers) | ||
connection.leave(tab); | ||
connection.join(newTab); | ||
const tabData = tabs.get(newTab); | ||
const tabData = observers.get(newTab); | ||
connection.emit("map", tabData.mapData); | ||
@@ -36,4 +36,6 @@ for (const [, monsterData] of tabData.monsters) | ||
connection.emit("character", characterData); | ||
if (tabData.bank) | ||
connection.emit("bank", tabData.bank); | ||
}); | ||
for (const [tab] of tabs) | ||
for (const [tab] of observers) | ||
connection.emit("newTab", tab); | ||
@@ -43,4 +45,4 @@ }); | ||
export function addSocket(tabName, characterSocket, initialPosition = { map: "main", x: 0, y: 0 }) { | ||
if (!tabs.has(tabName)) { | ||
tabs.set(tabName, { | ||
if (!observers.has(tabName)) { | ||
observers.set(tabName, { | ||
mapData: { | ||
@@ -68,3 +70,3 @@ map: initialPosition.map, | ||
const data = args; | ||
const tabData = tabs.get(tabName); | ||
const tabData = observers.get(tabName); | ||
tabData.monsters.delete(data.id) || tabData.players.delete(data.id); | ||
@@ -76,3 +78,3 @@ io.to(tabName).emit("remove", data.id); | ||
const data = args; | ||
const tabData = tabs.get(tabName); | ||
const tabData = observers.get(tabName); | ||
tabData.monsters.delete(data.id) || tabData.players.delete(data.id); | ||
@@ -92,5 +94,5 @@ io.to(tabName).emit("remove", data.id); | ||
const data = args; | ||
const tabData = tabs.get(tabName); | ||
const tabData = observers.get(tabName); | ||
if (data.type == "all") { | ||
io.to(tabName).emit("clear"); | ||
io.to(tabName).emit("removeAll"); | ||
tabData.monsters.clear(); | ||
@@ -155,3 +157,3 @@ tabData.players.clear(); | ||
}; | ||
const tabData = tabs.get(tabName); | ||
const tabData = observers.get(tabName); | ||
tabData.mapData = mapData; | ||
@@ -204,3 +206,3 @@ tabData.monsters.clear(); | ||
const data = args; | ||
const tabData = tabs.get(tabName); | ||
const tabData = observers.get(tabName); | ||
tabData.mapData.x = data.x; | ||
@@ -223,2 +225,6 @@ tabData.mapData.y = data.y; | ||
}; | ||
if (data.user) { | ||
tabData.bank = data.user; | ||
io.to(tabName).emit("bank", data.user); | ||
} | ||
io.to(tabName).emit("character", characterData); | ||
@@ -235,3 +241,3 @@ tabData.players.set(data.id, characterData); | ||
}; | ||
const tabData = tabs.get(tabName); | ||
const tabData = observers.get(tabName); | ||
tabData.mapData = mapData; | ||
@@ -238,0 +244,0 @@ io.to(tabName).emit("map", mapData); |
{ | ||
"name": "algui", | ||
"version": "0.1.14", | ||
"version": "0.1.16", | ||
"description": "GUI Tests for the MMORPG Adventure.Land", | ||
@@ -21,11 +21,10 @@ "main": "build/server/index.js", | ||
"dependencies": { | ||
"@pixi-essentials/cull": "^1.1.0", | ||
"@pixi/layers": "^1.0.11", | ||
"@types/express": "^4.17.13", | ||
"@types/json-diff": "^0.7.0", | ||
"express": "^4.17.2", | ||
"json-diff": "^0.7.1", | ||
"express": "^4.17.3", | ||
"json-diff": "^0.7.3", | ||
"pixi-viewport": "^4.34.4", | ||
"pixi-webfont-loader": "^1.0.2", | ||
"pixi.js": "^6.2.0", | ||
"pixi.js": "^6.3.0", | ||
"socket.io": "^4.4.1", | ||
@@ -36,22 +35,22 @@ "socket.io-client": "^4.4.1" | ||
"@types/offscreencanvas": "^2019.6.4", | ||
"@typescript-eslint/eslint-plugin": "^5.10.2", | ||
"@typescript-eslint/parser": "^5.10.2", | ||
"alclient": "^0.9.28", | ||
"@typescript-eslint/eslint-plugin": "^5.18.0", | ||
"@typescript-eslint/parser": "^5.18.0", | ||
"alclient": "^0.9.73", | ||
"copy-webpack-plugin": "^10.2.4", | ||
"copyfiles": "^2.4.1", | ||
"css-loader": "^6.5.1", | ||
"eslint": "^8.8.0", | ||
"css-loader": "^6.7.1", | ||
"eslint": "^8.13.0", | ||
"file-loader": "^6.2.0", | ||
"html-inline-css-webpack-plugin": "^1.11.1", | ||
"html-webpack-plugin": "^5.5.0", | ||
"mini-css-extract-plugin": "^2.5.3", | ||
"mini-css-extract-plugin": "^2.6.0", | ||
"rimraf": "^3.0.2", | ||
"ts-loader": "^9.2.6", | ||
"typescript": "^4.5.5", | ||
"ts-loader": "^9.2.8", | ||
"typescript": "^4.6.3", | ||
"url-loader": "^4.1.1", | ||
"webpack": "^5.68.0", | ||
"webpack": "^5.72.0", | ||
"webpack-cdn-plugin": "^3.3.1", | ||
"webpack-cli": "^4.9.2", | ||
"webpack-dev-server": "^4.7.3" | ||
"webpack-dev-server": "^4.8.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
10
5455926
212
11536
- Removed@pixi-essentials/cull@^1.1.0
- Removed@pixi-essentials/cull@1.1.0(transitive)
Updatedexpress@^4.17.3
Updatedjson-diff@^0.7.3
Updatedpixi.js@^6.3.0