hytopia 0.1.46 → 0.1.47

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/server.d.ts CHANGED
@@ -1813,6 +1813,8 @@ export declare class Player {
1813
1813
  /** The camera for the player. */
1814
1814
  readonly camera: PlayerCamera;
1815
1815
 
1816
+ /** The UI for the player. */
1817
+ readonly ui: PlayerUI;
1816
1818
 
1817
1819
 
1818
1820
 
@@ -1846,6 +1848,7 @@ export declare class Player {
1846
1848
 
1847
1849
 
1848
1850
 
1851
+
1849
1852
  }
1850
1853
 
1851
1854
  /**
@@ -2183,6 +2186,63 @@ export declare type PlayerOrientationState = {
2183
2186
  yaw: number;
2184
2187
  };
2185
2188
 
2189
+ /**
2190
+ * The UI for a player.
2191
+ *
2192
+ * @remarks
2193
+ * UI allows control of all in-game overlays a player
2194
+ * sees. UI is controlled by HTML, CSS and JavaScript
2195
+ * files you provide in your `assets` folder.
2196
+ *
2197
+ * @public
2198
+ */
2199
+ export declare class PlayerUI {
2200
+ /** The player that the UI belongs to. @readonly */
2201
+ readonly player: Player;
2202
+ /**
2203
+ * A function that is called when the player's client UI
2204
+ * sends data to the server.
2205
+ *
2206
+ * @remarks
2207
+ * Data sent is an object of any shape defined by you
2208
+ * and controlled with invocations of `hytopia.ui.sendData()`
2209
+ * from your loaded client UI files.
2210
+ *
2211
+ * @param playerUI - The PlayerUI instance that the data is from.
2212
+ * @param data - The data sent from the client UI.
2213
+ */
2214
+ onData?: (playerUI: PlayerUI, data: object) => void;
2215
+
2216
+ /**
2217
+ * Loads client UI for the player.
2218
+ * @param htmlUri - The ui html uri to load.
2219
+ */
2220
+ load(htmlUri: string): void;
2221
+ /**
2222
+ * Sends data to the player's client UI.
2223
+ * @param data - The data to send to the client UI.
2224
+ */
2225
+ sendData(data: object): void;
2226
+ }
2227
+
2228
+ /** Payloads for events a PlayerUI instance can emit. @public */
2229
+ export declare namespace PlayerUIEventPayload {
2230
+ export interface Load {
2231
+ playerUI: PlayerUI;
2232
+ htmlUri: string;
2233
+ }
2234
+ export interface SendData {
2235
+ playerUI: PlayerUI;
2236
+ data: object;
2237
+ }
2238
+ }
2239
+
2240
+ /** Event types a */
2241
+ export declare enum PlayerUIEventType {
2242
+ LOAD = "PLAYER_UI.LOAD",
2243
+ SEND_DATA = "PLAYER_UI.SEND_DATA"
2244
+ }
2245
+
2186
2246
  /**
2187
2247
  * The port the server will run on. You can override
2188
2248
  * this in your .env by setting PORT. When deployed in