@rpgjs/client 5.0.0-alpha.13 → 5.0.0-alpha.15
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/dist/Game/Map.d.ts +2 -1
- package/dist/RpgClient.d.ts +39 -0
- package/dist/RpgClientEngine.d.ts +138 -2
- package/dist/index10.js +2 -3
- package/dist/index10.js.map +1 -1
- package/dist/index15.js +59 -17
- package/dist/index15.js.map +1 -1
- package/dist/index16.js.map +1 -1
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +303 -3
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +3 -0
- package/dist/index20.js.map +1 -1
- package/dist/index22.js +31 -31
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +2 -2
- package/dist/index23.js.map +1 -1
- package/dist/index25.js +1 -2
- package/dist/index25.js.map +1 -1
- package/dist/index30.js.map +1 -1
- package/dist/index31.js.map +1 -1
- package/dist/index33.js +1 -1
- package/dist/index34.js +1 -1
- package/dist/index36.js +6 -4402
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +3686 -170
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +172 -486
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +498 -71
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +6 -1
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +67 -10
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +3 -93
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +123 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +20 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +12 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +113 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +136 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +137 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +112 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +9 -0
- package/dist/index49.js.map +1 -0
- package/dist/index8.js +8 -0
- package/dist/index8.js.map +1 -1
- package/dist/services/mmorpg.d.ts +1 -0
- package/package.json +8 -8
- package/src/Game/Map.ts +5 -1
- package/src/Game/Object.ts +37 -4
- package/src/RpgClient.ts +40 -0
- package/src/RpgClientEngine.ts +374 -11
- package/src/components/animations/animation.ce +1 -2
- package/src/components/character.ce +81 -20
- package/src/components/gui/dialogbox/index.ce +1 -2
- package/src/module.ts +8 -0
- package/src/services/mmorpg.ts +7 -1
package/dist/index39.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index39.js","sources":["../src/components/gui/dialogbox/selection.ce"],"sourcesContent":["<Container controls flexDirection=\"column\" margin={[0, 0, 0, 50]}>\n @for ((item,index) of items) { \n <ItemMenu text={@item.@text} isSelected={@selected(@index)} /> \n }\n</Container>\n\n<script>\n import { signal, computed, mount, Howl } from \"canvasengine\";\n import ItemMenu from \"./itemMenu.ce\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n import { inject } from \"../../../core/inject\";\n\n const {\n items,\n wrapAround,\n onSelect,\n selectedIndex,\n } = defineProps();\n\n const client = inject(RpgClientEngine);\n const keyboardControls = client.globalConfig.keyboardControls;\n const sounds = client.sounds;\n const dialogBoxCursorSound = client.globalConfig?.box?.sounds?.cursorMove\n const dialogBoxCursorSelectSound = client.globalConfig?.box?.sounds?.cursorSelect\n\n\n const playDialogBoxSound = (soundId) => {\n if (!soundId) return;\n const sound = new Howl.Howl({\n src: [sounds.get(soundId)?.src]\n })\n sound.play()\n }\n\n const selected = (index) => {\n return computed(() => {\n return index === selectedIndex();\n })\n }\n\n mount((element) => {\n return () => {\n element.directives.controls.onDestroy()\n }\n })\n\n const controls = signal({\n down: {\n bind: keyboardControls.down,\n keyDown() {\n playDialogBoxSound(dialogBoxCursorSound);\n selectedIndex.update((currentIndex) => {\n if (wrapAround) {\n return (currentIndex + 1) % items().length;\n } else {\n return Math.min(currentIndex + 1, items().length - 1);\n }\n });\n },\n },\n up: {\n bind: keyboardControls.up,\n keyDown() {\n playDialogBoxSound(dialogBoxCursorSound);\n selectedIndex.update((currentIndex) => {\n if (wrapAround) {\n return (currentIndex - 1 + items().length) % items().length;\n } else {\n return Math.max(currentIndex - 1, 0);\n }\n });\n },\n },\n enter: {\n bind: keyboardControls.action,\n keyDown() {\n onSelect?.(selectedIndex());\n playDialogBoxSound(dialogBoxCursorSelectSound);\n },\n },\n });\n</script>\n"],"names":["ItemMenu"],"mappings":";;;;;AASqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AAClC,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa;AAC9H,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AACpC,IAAI,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB;AAC3D,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM;AAC1B,IAAI,oBAAoB,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,UAAU;AACjN,IAAI,0BAA0B,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,E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E,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAACA,WAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1L,QAAQ,OAAO;AACf,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"index39.js","sources":["../../../node_modules/.pnpm/partysocket@1.1.5/node_modules/partysocket/dist/chunk-ZCZZNAX5.mjs"],"sourcesContent":["// src/ws.ts\nif (!globalThis.EventTarget || !globalThis.Event) {\n console.error(`\n PartySocket requires a global 'EventTarget' class to be available!\n You can polyfill this global by adding this to your code before any partysocket imports: \n \n \\`\\`\\`\n import 'partysocket/event-target-polyfill';\n \\`\\`\\`\n Please file an issue at https://github.com/partykit/partykit if you're still having trouble.\n`);\n}\nvar ErrorEvent = class extends Event {\n message;\n error;\n // biome-ignore lint/suspicious/noExplicitAny: vibes\n constructor(error, target) {\n super(\"error\", target);\n this.message = error.message;\n this.error = error;\n }\n};\nvar CloseEvent = class extends Event {\n code;\n reason;\n wasClean = true;\n // biome-ignore lint/style/useDefaultParameterLast: legacy\n // biome-ignore lint/suspicious/noExplicitAny: legacy\n constructor(code = 1e3, reason = \"\", target) {\n super(\"close\", target);\n this.code = code;\n this.reason = reason;\n }\n};\nvar Events = {\n Event,\n ErrorEvent,\n CloseEvent\n};\nfunction assert(condition, msg) {\n if (!condition) {\n throw new Error(msg);\n }\n}\nfunction cloneEventBrowser(e) {\n return new e.constructor(e.type, e);\n}\nfunction cloneEventNode(e) {\n if (\"data\" in e) {\n const evt2 = new MessageEvent(e.type, e);\n return evt2;\n }\n if (\"code\" in e || \"reason\" in e) {\n const evt2 = new CloseEvent(\n // @ts-expect-error we need to fix event/listener types\n e.code || 1999,\n // @ts-expect-error we need to fix event/listener types\n e.reason || \"unknown reason\",\n e\n );\n return evt2;\n }\n if (\"error\" in e) {\n const evt2 = new ErrorEvent(e.error, e);\n return evt2;\n }\n const evt = new Event(e.type, e);\n return evt;\n}\nvar _a;\nvar isNode =\n typeof process !== \"undefined\" &&\n typeof ((_a = process.versions) == null ? void 0 : _a.node) !== \"undefined\" &&\n typeof document === \"undefined\";\nvar cloneEvent = isNode ? cloneEventNode : cloneEventBrowser;\nvar DEFAULT = {\n maxReconnectionDelay: 1e4,\n minReconnectionDelay: 1e3 + Math.random() * 4e3,\n minUptime: 5e3,\n reconnectionDelayGrowFactor: 1.3,\n connectionTimeout: 4e3,\n maxRetries: Number.POSITIVE_INFINITY,\n maxEnqueuedMessages: Number.POSITIVE_INFINITY,\n startClosed: false,\n debug: false\n};\nvar didWarnAboutMissingWebSocket = false;\nvar ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {\n _ws;\n _retryCount = -1;\n _uptimeTimeout;\n _connectTimeout;\n _shouldReconnect = true;\n _connectLock = false;\n _binaryType = \"blob\";\n _closeCalled = false;\n _messageQueue = [];\n _debugLogger = console.log.bind(console);\n _url;\n _protocols;\n _options;\n constructor(url, protocols, options = {}) {\n super();\n this._url = url;\n this._protocols = protocols;\n this._options = options;\n if (this._options.startClosed) {\n this._shouldReconnect = false;\n }\n if (this._options.debugLogger) {\n this._debugLogger = this._options.debugLogger;\n }\n this._connect();\n }\n static get CONNECTING() {\n return 0;\n }\n static get OPEN() {\n return 1;\n }\n static get CLOSING() {\n return 2;\n }\n static get CLOSED() {\n return 3;\n }\n get CONNECTING() {\n return _ReconnectingWebSocket.CONNECTING;\n }\n get OPEN() {\n return _ReconnectingWebSocket.OPEN;\n }\n get CLOSING() {\n return _ReconnectingWebSocket.CLOSING;\n }\n get CLOSED() {\n return _ReconnectingWebSocket.CLOSED;\n }\n get binaryType() {\n return this._ws ? this._ws.binaryType : this._binaryType;\n }\n set binaryType(value) {\n this._binaryType = value;\n if (this._ws) {\n this._ws.binaryType = value;\n }\n }\n /**\n * Returns the number or connection retries\n */\n get retryCount() {\n return Math.max(this._retryCount, 0);\n }\n /**\n * The number of bytes of data that have been queued using calls to send() but not yet\n * transmitted to the network. This value resets to zero once all queued data has been sent.\n * This value does not reset to zero when the connection is closed; if you keep calling send(),\n * this will continue to climb. Read only\n */\n get bufferedAmount() {\n const bytes = this._messageQueue.reduce((acc, message) => {\n if (typeof message === \"string\") {\n acc += message.length;\n } else if (message instanceof Blob) {\n acc += message.size;\n } else {\n acc += message.byteLength;\n }\n return acc;\n }, 0);\n return bytes + (this._ws ? this._ws.bufferedAmount : 0);\n }\n /**\n * The extensions selected by the server. This is currently only the empty string or a list of\n * extensions as negotiated by the connection\n */\n get extensions() {\n return this._ws ? this._ws.extensions : \"\";\n }\n /**\n * A string indicating the name of the sub-protocol the server selected;\n * this will be one of the strings specified in the protocols parameter when creating the\n * WebSocket object\n */\n get protocol() {\n return this._ws ? this._ws.protocol : \"\";\n }\n /**\n * The current state of the connection; this is one of the Ready state constants\n */\n get readyState() {\n if (this._ws) {\n return this._ws.readyState;\n }\n return this._options.startClosed\n ? _ReconnectingWebSocket.CLOSED\n : _ReconnectingWebSocket.CONNECTING;\n }\n /**\n * The URL as resolved by the constructor\n */\n get url() {\n return this._ws ? this._ws.url : \"\";\n }\n /**\n * Whether the websocket object is now in reconnectable state\n */\n get shouldReconnect() {\n return this._shouldReconnect;\n }\n /**\n * An event listener to be called when the WebSocket connection's readyState changes to CLOSED\n */\n onclose = null;\n /**\n * An event listener to be called when an error occurs\n */\n onerror = null;\n /**\n * An event listener to be called when a message is received from the server\n */\n onmessage = null;\n /**\n * An event listener to be called when the WebSocket connection's readyState changes to OPEN;\n * this indicates that the connection is ready to send and receive data\n */\n onopen = null;\n /**\n * Closes the WebSocket connection or connection attempt, if any. If the connection is already\n * CLOSED, this method does nothing\n */\n close(code = 1e3, reason) {\n this._closeCalled = true;\n this._shouldReconnect = false;\n this._clearTimeouts();\n if (!this._ws) {\n this._debug(\"close enqueued: no ws instance\");\n return;\n }\n if (this._ws.readyState === this.CLOSED) {\n this._debug(\"close: already closed\");\n return;\n }\n this._ws.close(code, reason);\n }\n /**\n * Closes the WebSocket connection or connection attempt and connects again.\n * Resets retry counter;\n */\n reconnect(code, reason) {\n this._shouldReconnect = true;\n this._closeCalled = false;\n this._retryCount = -1;\n if (!this._ws || this._ws.readyState === this.CLOSED) {\n this._connect();\n } else {\n this._disconnect(code, reason);\n this._connect();\n }\n }\n /**\n * Enqueue specified data to be transmitted to the server over the WebSocket connection\n */\n send(data) {\n if (this._ws && this._ws.readyState === this.OPEN) {\n this._debug(\"send\", data);\n this._ws.send(data);\n } else {\n const { maxEnqueuedMessages = DEFAULT.maxEnqueuedMessages } =\n this._options;\n if (this._messageQueue.length < maxEnqueuedMessages) {\n this._debug(\"enqueue\", data);\n this._messageQueue.push(data);\n }\n }\n }\n _debug(...args) {\n if (this._options.debug) {\n this._debugLogger(\"RWS>\", ...args);\n }\n }\n _getNextDelay() {\n const {\n reconnectionDelayGrowFactor = DEFAULT.reconnectionDelayGrowFactor,\n minReconnectionDelay = DEFAULT.minReconnectionDelay,\n maxReconnectionDelay = DEFAULT.maxReconnectionDelay\n } = this._options;\n let delay = 0;\n if (this._retryCount > 0) {\n delay =\n minReconnectionDelay *\n reconnectionDelayGrowFactor ** (this._retryCount - 1);\n if (delay > maxReconnectionDelay) {\n delay = maxReconnectionDelay;\n }\n }\n this._debug(\"next delay\", delay);\n return delay;\n }\n _wait() {\n return new Promise((resolve) => {\n setTimeout(resolve, this._getNextDelay());\n });\n }\n _getNextProtocols(protocolsProvider) {\n if (!protocolsProvider) return Promise.resolve(null);\n if (\n typeof protocolsProvider === \"string\" ||\n Array.isArray(protocolsProvider)\n ) {\n return Promise.resolve(protocolsProvider);\n }\n if (typeof protocolsProvider === \"function\") {\n const protocols = protocolsProvider();\n if (!protocols) return Promise.resolve(null);\n if (typeof protocols === \"string\" || Array.isArray(protocols)) {\n return Promise.resolve(protocols);\n }\n if (protocols.then) {\n return protocols;\n }\n }\n throw Error(\"Invalid protocols\");\n }\n _getNextUrl(urlProvider) {\n if (typeof urlProvider === \"string\") {\n return Promise.resolve(urlProvider);\n }\n if (typeof urlProvider === \"function\") {\n const url = urlProvider();\n if (typeof url === \"string\") {\n return Promise.resolve(url);\n }\n if (url.then) {\n return url;\n }\n }\n throw Error(\"Invalid URL\");\n }\n _connect() {\n if (this._connectLock || !this._shouldReconnect) {\n return;\n }\n this._connectLock = true;\n const {\n maxRetries = DEFAULT.maxRetries,\n connectionTimeout = DEFAULT.connectionTimeout\n } = this._options;\n if (this._retryCount >= maxRetries) {\n this._debug(\"max retries reached\", this._retryCount, \">=\", maxRetries);\n return;\n }\n this._retryCount++;\n this._debug(\"connect\", this._retryCount);\n this._removeListeners();\n this._wait()\n .then(() =>\n Promise.all([\n this._getNextUrl(this._url),\n this._getNextProtocols(this._protocols || null)\n ])\n )\n .then(([url, protocols]) => {\n if (this._closeCalled) {\n this._connectLock = false;\n return;\n }\n if (\n !this._options.WebSocket &&\n typeof WebSocket === \"undefined\" &&\n !didWarnAboutMissingWebSocket\n ) {\n console.error(`\\u203C\\uFE0F No WebSocket implementation available. You should define options.WebSocket. \n\nFor example, if you're using node.js, run \\`npm install ws\\`, and then in your code:\n\nimport PartySocket from 'partysocket';\nimport WS from 'ws';\n\nconst partysocket = new PartySocket({\n host: \"127.0.0.1:1999\",\n room: \"test-room\",\n WebSocket: WS\n});\n\n`);\n didWarnAboutMissingWebSocket = true;\n }\n const WS = this._options.WebSocket || WebSocket;\n this._debug(\"connect\", { url, protocols });\n this._ws = protocols ? new WS(url, protocols) : new WS(url);\n this._ws.binaryType = this._binaryType;\n this._connectLock = false;\n this._addListeners();\n this._connectTimeout = setTimeout(\n () => this._handleTimeout(),\n connectionTimeout\n );\n })\n .catch((err) => {\n this._connectLock = false;\n this._handleError(new Events.ErrorEvent(Error(err.message), this));\n });\n }\n _handleTimeout() {\n this._debug(\"timeout event\");\n this._handleError(new Events.ErrorEvent(Error(\"TIMEOUT\"), this));\n }\n _disconnect(code = 1e3, reason) {\n this._clearTimeouts();\n if (!this._ws) {\n return;\n }\n this._removeListeners();\n try {\n if (\n this._ws.readyState === this.OPEN ||\n this._ws.readyState === this.CONNECTING\n ) {\n this._ws.close(code, reason);\n }\n this._handleClose(new Events.CloseEvent(code, reason, this));\n } catch (error) {}\n }\n _acceptOpen() {\n this._debug(\"accept open\");\n this._retryCount = 0;\n }\n _handleOpen = (event) => {\n this._debug(\"open event\");\n const { minUptime = DEFAULT.minUptime } = this._options;\n clearTimeout(this._connectTimeout);\n this._uptimeTimeout = setTimeout(() => this._acceptOpen(), minUptime);\n assert(this._ws, \"WebSocket is not defined\");\n this._ws.binaryType = this._binaryType;\n this._messageQueue.forEach((message) => {\n var _a2;\n return (_a2 = this._ws) == null ? void 0 : _a2.send(message);\n });\n this._messageQueue = [];\n if (this.onopen) {\n this.onopen(event);\n }\n this.dispatchEvent(cloneEvent(event));\n };\n _handleMessage = (event) => {\n this._debug(\"message event\");\n if (this.onmessage) {\n this.onmessage(event);\n }\n this.dispatchEvent(cloneEvent(event));\n };\n _handleError = (event) => {\n this._debug(\"error event\", event.message);\n this._disconnect(void 0, event.message === \"TIMEOUT\" ? \"timeout\" : void 0);\n if (this.onerror) {\n this.onerror(event);\n }\n this._debug(\"exec error listeners\");\n this.dispatchEvent(cloneEvent(event));\n this._connect();\n };\n _handleClose = (event) => {\n this._debug(\"close event\");\n this._clearTimeouts();\n if (this._shouldReconnect) {\n this._connect();\n }\n if (this.onclose) {\n this.onclose(event);\n }\n this.dispatchEvent(cloneEvent(event));\n };\n _removeListeners() {\n if (!this._ws) {\n return;\n }\n this._debug(\"removeListeners\");\n this._ws.removeEventListener(\"open\", this._handleOpen);\n this._ws.removeEventListener(\"close\", this._handleClose);\n this._ws.removeEventListener(\"message\", this._handleMessage);\n this._ws.removeEventListener(\"error\", this._handleError);\n }\n _addListeners() {\n if (!this._ws) {\n return;\n }\n this._debug(\"addListeners\");\n this._ws.addEventListener(\"open\", this._handleOpen);\n this._ws.addEventListener(\"close\", this._handleClose);\n this._ws.addEventListener(\"message\", this._handleMessage);\n this._ws.addEventListener(\"error\", this._handleError);\n }\n _clearTimeouts() {\n clearTimeout(this._connectTimeout);\n clearTimeout(this._uptimeTimeout);\n }\n};\n\nexport { ErrorEvent, CloseEvent, ReconnectingWebSocket };\n/*!\n * Reconnecting WebSocket\n * by Pedro Ladaria <pedro.ladaria@gmail.com>\n * https://github.com/pladaria/reconnecting-websocket\n * License MIT\n */\n//# sourceMappingURL=chunk-ZCZZNAX5.mjs.map\n"],"names":[],"mappings":"AAAA;AACA,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;AAClD,EAAE,OAAO,CAAC,KAAK,CAAC;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC;AACF;AACG,IAAC,UAAU,GAAG,cAAc,KAAK,CAAC;AACrC,EAAE,OAAO;AACT,EAAE,KAAK;AACP;AACA,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE;AAC7B,IAAI,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;AAC1B,IAAI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO;AAChC,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK;AACtB,EAAE;AACF;AACG,IAAC,UAAU,GAAG,cAAc,KAAK,CAAC;AACrC,EAAE,IAAI;AACN,EAAE,MAAM;AACR,EAAE,QAAQ,GAAG,IAAI;AACjB;AACA;AACA,EAAE,WAAW,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,EAAE;AAC/C,IAAI,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;AAC1B,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI;AACpB,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM;AACxB,EAAE;AACF;AACA,IAAI,MAAM,GAAG;AACb,EAAE,KAAK;AACP,EAAE,UAAU;AACZ,EAAE;AACF,CAAC;AACD,SA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AAO,EAAE,IAAI,CAAC,YAAY,CAAC;AAC5D,EAAE;AACF,EAAE,aAAa,GAAG;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;AACnB,MAAM;AACN,IAAI;AACJ,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;AAC/B,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC;AACvD,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC;AACzD,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC;AAC7D,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC;AACzD,EAAE;AACF,EAAE,cAAc,GAAG;AACnB,IAAI,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC;AACtC,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC;AACrC,EAAE;AACF;AAGA;AACA;AACA;AACA;AACA;AACA;;;;","x_google_ignoreList":[0]}
|
package/dist/index4.js
CHANGED
|
@@ -9,6 +9,9 @@ class BridgeWebsocket extends AbstractWebsocket {
|
|
|
9
9
|
super(context);
|
|
10
10
|
this.context = context;
|
|
11
11
|
this.options = options;
|
|
12
|
+
const id = localStorage.getItem("rpgjs-user-id") || crypto.randomUUID();
|
|
13
|
+
localStorage.setItem("rpgjs-user-id", id);
|
|
14
|
+
this.privateId = id;
|
|
12
15
|
}
|
|
13
16
|
async connection(listeners) {
|
|
14
17
|
class Room {
|
|
@@ -16,7 +19,8 @@ class BridgeWebsocket extends AbstractWebsocket {
|
|
|
16
19
|
const instance = new Room();
|
|
17
20
|
this.socket = await connectionRoom({
|
|
18
21
|
host: this.options.host || window.location.host,
|
|
19
|
-
room: "lobby-1"
|
|
22
|
+
room: "lobby-1",
|
|
23
|
+
id: this.privateId
|
|
20
24
|
}, instance);
|
|
21
25
|
listeners?.(this.socket);
|
|
22
26
|
}
|
|
@@ -32,6 +36,7 @@ class BridgeWebsocket extends AbstractWebsocket {
|
|
|
32
36
|
updateProperties({ room }) {
|
|
33
37
|
this.socket.conn.updateProperties({
|
|
34
38
|
room,
|
|
39
|
+
id: this.privateId,
|
|
35
40
|
host: this.options.host
|
|
36
41
|
});
|
|
37
42
|
}
|
package/dist/index4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":["../src/services/mmorpg.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\nimport { connectionRoom } from \"@signe/sync/client\";\nimport { RpgGui } from \"../Gui/Gui\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { AbstractWebsocket, WebSocketToken } from \"./AbstractSocket\";\nimport { UpdateMapService, UpdateMapToken } from \"@rpgjs/common\";\n\ninterface MmorpgOptions {\n host?: string;\n}\n\nclass BridgeWebsocket extends AbstractWebsocket {\n
|
|
1
|
+
{"version":3,"file":"index4.js","sources":["../src/services/mmorpg.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\nimport { connectionRoom } from \"@signe/sync/client\";\nimport { RpgGui } from \"../Gui/Gui\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { AbstractWebsocket, WebSocketToken } from \"./AbstractSocket\";\nimport { UpdateMapService, UpdateMapToken } from \"@rpgjs/common\";\n\ninterface MmorpgOptions {\n host?: string;\n}\n\nclass BridgeWebsocket extends AbstractWebsocket {\n private socket: any;\n private privateId: string;\n\n constructor(protected context: Context, private options: MmorpgOptions = {}) {\n super(context);\n const id = localStorage.getItem(\"rpgjs-user-id\") || crypto.randomUUID()\n localStorage.setItem(\"rpgjs-user-id\", id)\n this.privateId = id\n }\n\n async connection(listeners?: (data: any) => void) {\n // tmp\n class Room {\n \n }\n const instance = new Room()\n this.socket = await connectionRoom({\n host: this.options.host || window.location.host,\n room: \"lobby-1\",\n id: this.privateId\n }, instance)\n\n listeners?.(this.socket)\n }\n\n on(key: string, callback: (data: any) => void) {\n this.socket.on(key, callback);\n }\n\n off(event: string, callback: (data: any) => void) {\n this.socket.off(event, callback);\n }\n\n emit(event: string, data: any) {\n this.socket.emit(event, data);\n }\n\n updateProperties({ room }: { room: any }) {\n this.socket.conn.updateProperties({\n room: room,\n id: this.privateId,\n host: this.options.host\n })\n }\n\n async reconnect(listeners?: (data: any) => void) {\n this.socket.conn.reconnect()\n }\n}\n\nclass UpdateMapStandaloneService extends UpdateMapService {\n constructor(protected context: Context, private options: MmorpgOptions) {\n super(context);\n }\n\n async update(map: any) {\n // nothing\n }\n}\n\nexport function provideMmorpg(options: MmorpgOptions) {\n return [\n {\n provide: WebSocketToken,\n useFactory: (context: Context) => new BridgeWebsocket(context, options),\n },\n {\n provide: UpdateMapToken,\n useFactory: (context: Context) => new UpdateMapStandaloneService(context, options),\n },\n RpgGui,\n RpgClientEngine,\n ];\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,wBAAwB,iBAAA,CAAkB;AAAA,EAI9C,WAAA,CAAsB,OAAA,EAA0B,OAAA,GAAyB,EAAC,EAAG;AAC3E,IAAA,KAAA,CAAM,OAAO,CAAA;AADO,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAA0B,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAE9C,IAAA,MAAM,KAAK,YAAA,CAAa,OAAA,CAAQ,eAAe,CAAA,IAAK,OAAO,UAAA,EAAW;AACtE,IAAA,YAAA,CAAa,OAAA,CAAQ,iBAAiB,EAAE,CAAA;AACxC,IAAA,IAAA,CAAK,SAAA,GAAY,EAAA;AAAA,EACnB;AAAA,EAEA,MAAM,WAAW,SAAA,EAAiC;AAAA,IAEhD,MAAM,IAAA,CAAK;AAAA;AAGX,IAAA,MAAM,QAAA,GAAW,IAAI,IAAA,EAAK;AAC1B,IAAA,IAAA,CAAK,MAAA,GAAS,MAAM,cAAA,CAAe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SAAS,cAAc,OAAA,EAAwB;AACpD,EAAA,OAAO;AAAA,IACL;AAAA,MACE,OAAA,EAAS,cAAA;AAAA,MACT,YAAY,CAAC,OAAA,KAAqB,IAAI,eAAA,CAAgB,SAAS,OAAO;AAAA,KACxE;AAAA,IACA;AAAA,MACE,OAAA,EAAS,cAAA;AAAA,MACT,YAAY,CAAC,OAAA,KAAqB,IAAI,0BAAA,CAA2B,SAAS,OAAO;AAAA,KACnF;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
package/dist/index40.js
CHANGED
|
@@ -1,18 +1,75 @@
|
|
|
1
|
-
import { useProps, useDefineProps,
|
|
1
|
+
import { useProps, useDefineProps, mount, signal, h, Container, loop, Howl, computed } from 'canvasengine';
|
|
2
|
+
import component$1 from './index43.js';
|
|
3
|
+
import { RpgClientEngine } from './index2.js';
|
|
4
|
+
import { inject } from './index6.js';
|
|
2
5
|
|
|
3
6
|
function component($$props) {
|
|
4
7
|
useProps($$props);
|
|
5
8
|
const defineProps = useDefineProps($$props);
|
|
6
|
-
var _a
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
var _g = defineProps(), items = _g.items, wrapAround = _g.wrapAround, onSelect = _g.onSelect, selectedIndex = _g.selectedIndex;
|
|
11
|
+
var client = inject(RpgClientEngine);
|
|
12
|
+
var keyboardControls = client.globalConfig.keyboardControls;
|
|
13
|
+
var sounds = client.sounds;
|
|
14
|
+
var dialogBoxCursorSound = (_c = (_b = (_a = client.globalConfig) === null || _a === void 0 ? void 0 : _a.box) === null || _b === void 0 ? void 0 : _b.sounds) === null || _c === void 0 ? void 0 : _c.cursorMove;
|
|
15
|
+
var dialogBoxCursorSelectSound = (_f = (_e = (_d = client.globalConfig) === null || _d === void 0 ? void 0 : _d.box) === null || _e === void 0 ? void 0 : _e.sounds) === null || _f === void 0 ? void 0 : _f.cursorSelect;
|
|
16
|
+
var playDialogBoxSound = function (soundId) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (!soundId)
|
|
19
|
+
return;
|
|
20
|
+
var sound = new Howl.Howl({
|
|
21
|
+
src: [(_a = sounds.get(soundId)) === null || _a === void 0 ? void 0 : _a.src]
|
|
22
|
+
});
|
|
23
|
+
sound.play();
|
|
24
|
+
};
|
|
25
|
+
var selected = function (index) {
|
|
26
|
+
return computed(function () {
|
|
27
|
+
return index === selectedIndex();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
mount(function (element) {
|
|
31
|
+
return function () {
|
|
32
|
+
element.directives.controls.onDestroy();
|
|
33
|
+
};
|
|
11
34
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
var controls = signal({
|
|
36
|
+
down: {
|
|
37
|
+
bind: keyboardControls.down,
|
|
38
|
+
keyDown: function () {
|
|
39
|
+
playDialogBoxSound(dialogBoxCursorSound);
|
|
40
|
+
selectedIndex.update(function (currentIndex) {
|
|
41
|
+
if (wrapAround) {
|
|
42
|
+
return (currentIndex + 1) % items().length;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return Math.min(currentIndex + 1, items().length - 1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
up: {
|
|
51
|
+
bind: keyboardControls.up,
|
|
52
|
+
keyDown: function () {
|
|
53
|
+
playDialogBoxSound(dialogBoxCursorSound);
|
|
54
|
+
selectedIndex.update(function (currentIndex) {
|
|
55
|
+
if (wrapAround) {
|
|
56
|
+
return (currentIndex - 1 + items().length) % items().length;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return Math.max(currentIndex - 1, 0);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
enter: {
|
|
65
|
+
bind: keyboardControls.action,
|
|
66
|
+
keyDown: function () {
|
|
67
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedIndex());
|
|
68
|
+
playDialogBoxSound(dialogBoxCursorSelectSound);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
let $this = h(Container, { controls, flexDirection: 'column', margin: [0, 0, 0, 50] }, loop(items, (item, index) => h(component$1, { text: item.text, isSelected: selected(index) })));
|
|
16
73
|
return $this
|
|
17
74
|
}
|
|
18
75
|
|
package/dist/index40.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index40.js","sources":["../src/components/gui/dialogbox/
|
|
1
|
+
{"version":3,"file":"index40.js","sources":["../src/components/gui/dialogbox/selection.ce"],"sourcesContent":["<Container controls flexDirection=\"column\" margin={[0, 0, 0, 50]}>\n @for ((item,index) of items) { \n <ItemMenu text={@item.@text} isSelected={@selected(@index)} /> \n }\n</Container>\n\n<script>\n import { signal, computed, mount, Howl } from \"canvasengine\";\n import ItemMenu from \"./itemMenu.ce\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n import { inject } from \"../../../core/inject\";\n\n const {\n items,\n wrapAround,\n onSelect,\n selectedIndex,\n } = defineProps();\n\n const client = inject(RpgClientEngine);\n const keyboardControls = client.globalConfig.keyboardControls;\n const sounds = client.sounds;\n const dialogBoxCursorSound = client.globalConfig?.box?.sounds?.cursorMove\n const dialogBoxCursorSelectSound = client.globalConfig?.box?.sounds?.cursorSelect\n\n\n const playDialogBoxSound = (soundId) => {\n if (!soundId) return;\n const sound = new Howl.Howl({\n src: [sounds.get(soundId)?.src]\n })\n sound.play()\n }\n\n const selected = (index) => {\n return computed(() => {\n return index === selectedIndex();\n })\n }\n\n mount((element) => {\n return () => {\n element.directives.controls.onDestroy()\n }\n })\n\n const controls = signal({\n down: {\n bind: keyboardControls.down,\n keyDown() {\n playDialogBoxSound(dialogBoxCursorSound);\n selectedIndex.update((currentIndex) => {\n if (wrapAround) {\n return (currentIndex + 1) % items().length;\n } else {\n return Math.min(currentIndex + 1, items().length - 1);\n }\n });\n },\n },\n up: {\n bind: keyboardControls.up,\n keyDown() {\n playDialogBoxSound(dialogBoxCursorSound);\n selectedIndex.update((currentIndex) => {\n if (wrapAround) {\n return (currentIndex - 1 + items().length) % items().length;\n } else {\n return Math.max(currentIndex - 1, 0);\n }\n });\n },\n },\n enter: {\n bind: keyboardControls.action,\n keyDown() {\n onSelect?.(selectedIndex());\n playDialogBoxSound(dialogBoxCursorSelectSound);\n },\n },\n });\n</script>\n"],"names":["ItemMenu"],"mappings":";;;;;AASqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AAClC,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa;AAC9H,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AACpC,IAAI,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB;AAC3D,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM;AAC1B,IAAI,oBAAoB,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,UAAU;AACjN,IAAI,0BAA0B,GAAG,CAAC,EAAE,GAAG,CA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,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAACA,WAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1L,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index41.js
CHANGED
|
@@ -1,96 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { trigger, signal } from 'canvasengine';
|
|
3
|
-
import { inject } from './index6.js';
|
|
4
|
-
import { RpgClientEngine } from './index2.js';
|
|
1
|
+
import * as external from './index36.js';
|
|
5
2
|
|
|
6
|
-
class RpgClientObject extends RpgCommonPlayer {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.emitParticleTrigger = trigger();
|
|
10
|
-
this.particleName = signal("");
|
|
11
|
-
this.animationCurrentIndex = signal(0);
|
|
12
|
-
this.animationIsPlaying = signal(false);
|
|
13
|
-
this._param = signal({});
|
|
14
|
-
this.hooks.callHooks("client-sprite-onInit", this).subscribe();
|
|
15
|
-
}
|
|
16
|
-
get hooks() {
|
|
17
|
-
return inject(ModulesToken);
|
|
18
|
-
}
|
|
19
|
-
flash(color, duration = 100) {
|
|
20
|
-
return new Promise((resolve) => {
|
|
21
|
-
const lastTint = this.tint();
|
|
22
|
-
this.tint.set(color);
|
|
23
|
-
setTimeout(() => {
|
|
24
|
-
this.tint.set(lastTint);
|
|
25
|
-
resolve(true);
|
|
26
|
-
}, duration);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Reset animation state when animation changes externally
|
|
31
|
-
*
|
|
32
|
-
* This method should be called when the animation changes due to movement
|
|
33
|
-
* or other external factors to ensure the animation system doesn't get stuck
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* // Reset when player starts moving
|
|
38
|
-
* player.resetAnimationState();
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
resetAnimationState() {
|
|
42
|
-
this.animationIsPlaying.set(false);
|
|
43
|
-
this.animationCurrentIndex.set(0);
|
|
44
|
-
if (this.animationSubscription) {
|
|
45
|
-
this.animationSubscription.unsubscribe();
|
|
46
|
-
this.animationSubscription = void 0;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Set a custom animation for a specific number of times
|
|
51
|
-
*
|
|
52
|
-
* Plays a custom animation for the specified number of repetitions.
|
|
53
|
-
* The animation system prevents overlapping animations and automatically
|
|
54
|
-
* returns to the previous animation when complete.
|
|
55
|
-
*
|
|
56
|
-
* @param animationName - Name of the animation to play
|
|
57
|
-
* @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* // Play attack animation 3 times
|
|
62
|
-
* player.setAnimation('attack', 3);
|
|
63
|
-
*
|
|
64
|
-
* // Play continuous spell animation
|
|
65
|
-
* player.setAnimation('spell');
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
setAnimation(animationName, nbTimes = Infinity) {
|
|
69
|
-
if (this.animationIsPlaying()) return;
|
|
70
|
-
this.animationIsPlaying.set(true);
|
|
71
|
-
const previousAnimationName = this.animationName();
|
|
72
|
-
this.animationCurrentIndex.set(0);
|
|
73
|
-
if (this.animationSubscription) {
|
|
74
|
-
this.animationSubscription.unsubscribe();
|
|
75
|
-
}
|
|
76
|
-
this.animationSubscription = this.animationCurrentIndex.observable.subscribe((index) => {
|
|
77
|
-
if (index >= nbTimes) {
|
|
78
|
-
this.animationCurrentIndex.set(0);
|
|
79
|
-
this.animationName.set(previousAnimationName);
|
|
80
|
-
this.animationIsPlaying.set(false);
|
|
81
|
-
if (this.animationSubscription) {
|
|
82
|
-
this.animationSubscription.unsubscribe();
|
|
83
|
-
this.animationSubscription = void 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this.animationName.set(animationName);
|
|
88
|
-
}
|
|
89
|
-
showComponentAnimation(id, params) {
|
|
90
|
-
const engine = inject(RpgClientEngine);
|
|
91
|
-
engine.getComponentAnimation(id).displayEffect(params, this);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
3
|
|
|
95
|
-
|
|
4
|
+
|
|
5
|
+
export { external as default, external as z };
|
|
96
6
|
//# sourceMappingURL=index41.js.map
|
package/dist/index41.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index41.js","sources":[
|
|
1
|
+
{"version":3,"file":"index41.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/index42.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { RpgCommonPlayer, ModulesToken } from '@rpgjs/common';
|
|
2
|
+
import { trigger, signal } from 'canvasengine';
|
|
3
|
+
import { inject } from './index6.js';
|
|
4
|
+
import { RpgClientEngine } from './index2.js';
|
|
5
|
+
|
|
6
|
+
class RpgClientObject extends RpgCommonPlayer {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.emitParticleTrigger = trigger();
|
|
10
|
+
this.particleName = signal("");
|
|
11
|
+
this.animationCurrentIndex = signal(0);
|
|
12
|
+
this.animationIsPlaying = signal(false);
|
|
13
|
+
this._param = signal({});
|
|
14
|
+
this.frames = [];
|
|
15
|
+
this.hooks.callHooks("client-sprite-onInit", this).subscribe();
|
|
16
|
+
this._frames.observable.subscribe(({ items }) => {
|
|
17
|
+
if (!this.id) return;
|
|
18
|
+
this.frames = [...this.frames, ...items];
|
|
19
|
+
});
|
|
20
|
+
this.engine.tick.pipe(
|
|
21
|
+
//throttleTime(10)
|
|
22
|
+
).subscribe(() => {
|
|
23
|
+
const frame = this.frames.shift();
|
|
24
|
+
if (frame) {
|
|
25
|
+
const entity = this.engine.scene.getBody(this.id);
|
|
26
|
+
const isLocalPlayer = this.id === this.engine.playerIdSignal();
|
|
27
|
+
if (entity && !isLocalPlayer) {
|
|
28
|
+
const { x: oldX, y: oldY } = entity.position;
|
|
29
|
+
const dt = 1 / 60;
|
|
30
|
+
const velocity = {
|
|
31
|
+
x: (frame.x - oldX) / dt,
|
|
32
|
+
y: (frame.y - oldY) / dt
|
|
33
|
+
};
|
|
34
|
+
entity.setVelocity(velocity);
|
|
35
|
+
}
|
|
36
|
+
this.engine.scene.setBodyPosition(this.id, frame.x, frame.y);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
get hooks() {
|
|
41
|
+
return inject(ModulesToken);
|
|
42
|
+
}
|
|
43
|
+
get engine() {
|
|
44
|
+
return inject(RpgClientEngine);
|
|
45
|
+
}
|
|
46
|
+
flash(color, duration = 100) {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const lastTint = this.tint();
|
|
49
|
+
this.tint.set(color);
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
this.tint.set(lastTint);
|
|
52
|
+
resolve(true);
|
|
53
|
+
}, duration);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Reset animation state when animation changes externally
|
|
58
|
+
*
|
|
59
|
+
* This method should be called when the animation changes due to movement
|
|
60
|
+
* or other external factors to ensure the animation system doesn't get stuck
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* // Reset when player starts moving
|
|
65
|
+
* player.resetAnimationState();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
resetAnimationState() {
|
|
69
|
+
this.animationIsPlaying.set(false);
|
|
70
|
+
this.animationCurrentIndex.set(0);
|
|
71
|
+
if (this.animationSubscription) {
|
|
72
|
+
this.animationSubscription.unsubscribe();
|
|
73
|
+
this.animationSubscription = void 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Set a custom animation for a specific number of times
|
|
78
|
+
*
|
|
79
|
+
* Plays a custom animation for the specified number of repetitions.
|
|
80
|
+
* The animation system prevents overlapping animations and automatically
|
|
81
|
+
* returns to the previous animation when complete.
|
|
82
|
+
*
|
|
83
|
+
* @param animationName - Name of the animation to play
|
|
84
|
+
* @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* // Play attack animation 3 times
|
|
89
|
+
* player.setAnimation('attack', 3);
|
|
90
|
+
*
|
|
91
|
+
* // Play continuous spell animation
|
|
92
|
+
* player.setAnimation('spell');
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
setAnimation(animationName, nbTimes = Infinity) {
|
|
96
|
+
if (this.animationIsPlaying()) return;
|
|
97
|
+
this.animationIsPlaying.set(true);
|
|
98
|
+
const previousAnimationName = this.animationName();
|
|
99
|
+
this.animationCurrentIndex.set(0);
|
|
100
|
+
if (this.animationSubscription) {
|
|
101
|
+
this.animationSubscription.unsubscribe();
|
|
102
|
+
}
|
|
103
|
+
this.animationSubscription = this.animationCurrentIndex.observable.subscribe((index) => {
|
|
104
|
+
if (index >= nbTimes) {
|
|
105
|
+
this.animationCurrentIndex.set(0);
|
|
106
|
+
this.animationName.set(previousAnimationName);
|
|
107
|
+
this.animationIsPlaying.set(false);
|
|
108
|
+
if (this.animationSubscription) {
|
|
109
|
+
this.animationSubscription.unsubscribe();
|
|
110
|
+
this.animationSubscription = void 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
this.animationName.set(animationName);
|
|
115
|
+
}
|
|
116
|
+
showComponentAnimation(id, params) {
|
|
117
|
+
const engine = inject(RpgClientEngine);
|
|
118
|
+
engine.getComponentAnimation(id).displayEffect(params, this);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { RpgClientObject };
|
|
123
|
+
//# sourceMappingURL=index42.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index42.js","sources":["../src/Game/Object.ts"],"sourcesContent":["import { Hooks, ModulesToken, RpgCommonPlayer } from \"@rpgjs/common\";\nimport { sync } from \"@signe/sync\";\nimport { trigger, signal } from \"canvasengine\";\nimport { debounceTime, Subscription, throttleTime } from \"rxjs\";\nimport { inject } from \"../core/inject\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\n\nexport abstract class RpgClientObject extends RpgCommonPlayer {\n abstract type: string;\n emitParticleTrigger = trigger()\n particleName = signal('')\n animationCurrentIndex = signal(0)\n animationIsPlaying = signal(false)\n _param = signal({})\n frames: { x: number; y: number; ts: number }[] = []\n\n constructor() {\n super()\n this.hooks.callHooks(\"client-sprite-onInit\", this).subscribe();\n\n this._frames.observable.subscribe(({ items }) => {\n if (!this.id) return;\n //if (this.id == this.engine.playerIdSignal()!) return;\n this.frames = [...this.frames, ...items]\n })\n\n this.engine.tick\n .pipe(\n //throttleTime(10)\n )\n .subscribe(() => {\n const frame = this.frames.shift()\n if (frame) {\n const entity = this.engine.scene.getBody(this.id)\n const isLocalPlayer = this.id === this.engine.playerIdSignal()\n if (entity && !isLocalPlayer) {\n const { x: oldX, y: oldY } = entity.position\n const dt = 1 / 60 // Assume 60 FPS for now\n const velocity = {\n x: (frame.x - oldX) / dt,\n y: (frame.y - oldY) / dt\n }\n entity.setVelocity(velocity)\n }\n this.engine.scene.setBodyPosition(this.id, frame.x, frame.y)\n }\n })\n }\n\n get hooks() {\n return inject<Hooks>(ModulesToken);\n }\n\n get engine() {\n return inject(RpgClientEngine)\n }\n\n private animationSubscription?: Subscription\n\n flash(color: string, duration: number = 100) {\n return new Promise((resolve) => {\n const lastTint = this.tint()\n this.tint.set(color);\n setTimeout(() => {\n this.tint.set(lastTint)\n resolve(true)\n }, duration)\n })\n }\n\n /**\n * Reset animation state when animation changes externally\n * \n * This method should be called when the animation changes due to movement\n * or other external factors to ensure the animation system doesn't get stuck\n * \n * @example\n * ```ts\n * // Reset when player starts moving\n * player.resetAnimationState();\n * ```\n */\n resetAnimationState() {\n this.animationIsPlaying.set(false);\n this.animationCurrentIndex.set(0);\n if (this.animationSubscription) {\n this.animationSubscription.unsubscribe();\n this.animationSubscription = undefined;\n }\n }\n\n /**\n * Set a custom animation for a specific number of times\n * \n * Plays a custom animation for the specified number of repetitions.\n * The animation system prevents overlapping animations and automatically\n * returns to the previous animation when complete.\n * \n * @param animationName - Name of the animation to play\n * @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)\n * \n * @example\n * ```ts\n * // Play attack animation 3 times\n * player.setAnimation('attack', 3);\n * \n * // Play continuous spell animation\n * player.setAnimation('spell');\n * ```\n */\n setAnimation(animationName: string, nbTimes: number = Infinity) {\n if (this.animationIsPlaying()) return;\n this.animationIsPlaying.set(true);\n const previousAnimationName = this.animationName();\n this.animationCurrentIndex.set(0);\n\n // Clean up any existing subscription\n if (this.animationSubscription) {\n this.animationSubscription.unsubscribe();\n }\n\n this.animationSubscription = this.animationCurrentIndex.observable.subscribe(index => {\n if (index >= nbTimes) {\n this.animationCurrentIndex.set(0);\n this.animationName.set(previousAnimationName);\n this.animationIsPlaying.set(false);\n if (this.animationSubscription) {\n this.animationSubscription.unsubscribe();\n this.animationSubscription = undefined;\n }\n }\n })\n this.animationName.set(animationName);\n }\n\n showComponentAnimation(id: string, params: any) {\n const engine = inject(RpgClientEngine)\n engine.getComponentAnimation(id).displayEffect(params, this)\n }\n} "],"names":[],"mappings":";;;;;AAOO,MAAe,wBAAwB,eAAA,CAAgB;AAAA,EAS5D,WAAA,GAAc;AACZ,IAAA,KAAA,EAAM;AARR,IAAA,IAAA,CAAA,mBAAA,GAAsB,OAAA,EAAQ;AAC9B,IAAA,IAAA,CAAA,YAAA,GAAe,OAAO,EAAE,CAAA;AACxB,IAAA,IAAA,CAAA,qBAAA,GAAwB,OAAO,CAAC,CAAA;AAChC,IAAA,IAAA,CAAA,kBAAA,GAAqB,OAAO,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QAAA,EAAU;AAC9D,IAAA,IAAI,IAAA,CAAK,oBAAmB,EAAG;AAC/B,IAAA,IAAA,CAAK,kBAAA,CAAmB,IAAI,IAAI,CAAA;AAChC,IAAA,MAAM,qBAAA,GAAwB,KAAK,aAAA,EAAc;AACjD,IAAA,IAAA,CAAK,qBAAA,CAAsB,IAAI,CAAC,CAAA;AAGhC,IAAA,IAAI,KAAK,qBAAA,EAAuB;AAC9B,MAAA,IAAA,CAAK,sBAAsB,WAAA,EAAY;AAAA,IACzC;AAEA,IAAA,IAAA,CAAK,qBAAA,GAAwB,IAAA,CAAK,qBAAA,CAAsB,UAAA,CAAW,UAAU,CAAA,KAAA,KAAS;AACpF,MAAA,IAAI,SAAS,OAAA,EAAS;AACpB,QAAA,IAAA,CAAK,qBAAA,CAAsB,IAAI,CAAC,CAAA;AAChC,QAAA,IAAA,CAAK,aAAA,CAAc,IAAI,qBAAqB,CAAA;AAC5C,QAAA,IAAA,CAAK,kBAAA,CAAmB,IAAI,KAAK,CAAA;AACjC,QAAA,IAAI,KAAK,qBAAA,EAAuB;AAC9B,UAAA,IAAA,CAAK,sBAAsB,WAAA,EAAY;AACvC,UAAA,IAAA,CAAK,qBAAA,GAAwB,MAAA;AAAA,QAC/B;AAAA,MACF;AAAA,IACF,CAAC,CAAA;AACD,IAAA,IAAA,CAAK,aAAA,CAAc,IAAI,aAAa,CAAA;AAAA,EACtC;AAAA,EAEA,sBAAA,CAAuB,IAAY,MAAA,EAAa;AAC9C,IAAA,MAAM,MAAA,GAAS,OAAO,eAAe,CAAA;AACrC,IAAA,MAAA,CAAO,qBAAA,CAAsB,EAAE,CAAA,CAAE,aAAA,CAAc,QAAQ,IAAI,CAAA;AAAA,EAC7D;AACF;;;;"}
|
package/dist/index43.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useProps, useDefineProps, animatedSignal, h, Container, Rect, Text } from 'canvasengine';
|
|
2
|
+
|
|
3
|
+
function component($$props) {
|
|
4
|
+
useProps($$props);
|
|
5
|
+
const defineProps = useDefineProps($$props);
|
|
6
|
+
var _a = defineProps(), text = _a.text, isSelected = _a.isSelected;
|
|
7
|
+
var alpha = animatedSignal(1, {
|
|
8
|
+
repeatType: "reverse",
|
|
9
|
+
duration: 500,
|
|
10
|
+
repeat: Infinity,
|
|
11
|
+
});
|
|
12
|
+
alpha.set(0.5);
|
|
13
|
+
var height = 40;
|
|
14
|
+
var width = 256;
|
|
15
|
+
let $this = h(Container, null, [h(Rect, { width, height, color: '#595971', alpha, visible: isSelected }), h(Container, { flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }, h(Text, { text, color: '#fff', fontSize: 18, margin: 10 }))]);
|
|
16
|
+
return $this
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { component as default };
|
|
20
|
+
//# sourceMappingURL=index43.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index43.js","sources":["../src/components/gui/dialogbox/itemMenu.ce"],"sourcesContent":["<Container>\n <Rect width height color=\"#595971\" alpha visible={isSelected} />\n <Container flexDirection=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <Text text color=\"#fff\" fontSize={18} margin={10} />\n </Container>\n</Container>\n\n<script>\nimport { animatedSignal } from \"canvasengine\";\n\nconst { text, isSelected } = defineProps();\n\nconst alpha = animatedSignal(1, {\n repeatType: \"reverse\",\n duration: 500,\n repeat: Infinity,\n});\n\nalpha.set(0.5);\n\nconst height = 40;\nconst width = 256;\n</script>"],"names":[],"mappings":";;AAQqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU;AAC1E,IAAI,KAAK,GAAG,cAAc,CAAC,CAAC,EAAE;AAC9B,IAAI,UAAU,EAAE,SAAS;AACzB,IAAI,QAAQ,EAAE,GAAG;AACjB,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC,CAAC;AACF,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AACd,IAAI,MAAM,GAAG,EAAE;AACf,IAAI,KAAK,GAAG,GAAG;AACf,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACrQ,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index44.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import errorMap from './index48.js';
|
|
2
|
+
|
|
3
|
+
let overrideErrorMap = errorMap;
|
|
4
|
+
function setErrorMap(map) {
|
|
5
|
+
overrideErrorMap = map;
|
|
6
|
+
}
|
|
7
|
+
function getErrorMap() {
|
|
8
|
+
return overrideErrorMap;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { errorMap as defaultErrorMap, getErrorMap, setErrorMap };
|
|
12
|
+
//# sourceMappingURL=index44.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index44.js","sources":["../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js"],"sourcesContent":["import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n"],"names":["defaultErrorMap"],"mappings":";;AACA,IAAI,gBAAgB,GAAGA,QAAe;AAE/B,SAAS,WAAW,CAAC,GAAG,EAAE;AACjC,IAAI,gBAAgB,GAAG,GAAG;AAC1B;AACO,SAAS,WAAW,GAAG;AAC9B,IAAI,OAAO,gBAAgB;AAC3B;;;;","x_google_ignoreList":[0]}
|