@minecraft/server-ui 2.1.0-beta.1.26.30-preview.26 → 2.1.0-beta.1.26.30-preview.28
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/index.d.ts +780 -221
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -35,32 +35,32 @@ import * as minecraftcommon from '@minecraft/common';
|
|
|
35
35
|
import * as minecraftserver from '@minecraft/server';
|
|
36
36
|
/**
|
|
37
37
|
* @beta
|
|
38
|
-
* The reason why a data driven screen (
|
|
38
|
+
* The reason why a data driven UI screen (MessageBox or
|
|
39
39
|
* CustomForm) was closed.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export enum DataDrivenScreenClosedReason {
|
|
42
42
|
/**
|
|
43
43
|
* @remarks
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* The screen was closed by the client (e.g., the player
|
|
45
|
+
* dismissed it or there was a client authoritative close
|
|
46
|
+
* button).
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
+
ClientClosed = 'ClientClosed',
|
|
49
50
|
/**
|
|
50
51
|
* @remarks
|
|
51
|
-
*
|
|
52
|
+
* The screen was closed by the server, likely by the close
|
|
53
|
+
* API.
|
|
52
54
|
*
|
|
53
55
|
*/
|
|
54
|
-
|
|
56
|
+
ServerClosed = 'ServerClosed',
|
|
55
57
|
/**
|
|
56
58
|
* @remarks
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* message box, the 'Close' button on a custom form, or either
|
|
60
|
-
* button in the message box)
|
|
59
|
+
* The screen could not be shown because the player was busy
|
|
60
|
+
* with another UI interaction.
|
|
61
61
|
*
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
UserBusy = 'UserBusy',
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export enum FormCancelationReason {
|
|
@@ -74,13 +74,34 @@ export enum FormRejectReason {
|
|
|
74
74
|
ServerShutdown = 'ServerShutdown',
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* @beta
|
|
79
|
+
* The reason why a form visibility operation failed.
|
|
80
|
+
*/
|
|
81
|
+
export enum FormVisibilityErrorReason {
|
|
82
|
+
/**
|
|
83
|
+
* @remarks
|
|
84
|
+
* The operation failed because the form is already being shown
|
|
85
|
+
* to the player.
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
AlreadyShowing = 'AlreadyShowing',
|
|
89
|
+
/**
|
|
90
|
+
* @remarks
|
|
91
|
+
* The operation failed because the form is not currently being
|
|
92
|
+
* shown to the player.
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
NotShowing = 'NotShowing',
|
|
96
|
+
}
|
|
97
|
+
|
|
77
98
|
/**
|
|
78
99
|
* @beta
|
|
79
100
|
* An enum representing the errors that can occur during text
|
|
80
101
|
* filtering. This is used to provide more context about the
|
|
81
102
|
* filtering process.
|
|
82
103
|
*/
|
|
83
|
-
export
|
|
104
|
+
export enum TextFilteringError {
|
|
84
105
|
/**
|
|
85
106
|
* @remarks
|
|
86
107
|
* The text was not filtered because the player disabled text
|
|
@@ -303,151 +324,298 @@ export class ActionFormResponse extends FormResponse {
|
|
|
303
324
|
|
|
304
325
|
/**
|
|
305
326
|
* @beta
|
|
306
|
-
* A customizable form that lets you
|
|
307
|
-
* toggles, dropdowns, sliders,
|
|
308
|
-
*
|
|
309
|
-
*
|
|
327
|
+
* A customizable data driven (DDUI) form that lets you add
|
|
328
|
+
* buttons, labels, toggles, dropdowns, sliders, text fields,
|
|
329
|
+
* and more. The form layout is built by calling methods to add
|
|
330
|
+
* components before calling show(). Any Observable values
|
|
331
|
+
* bound to form components will automatically update the UI
|
|
332
|
+
* when their values change.
|
|
310
333
|
*/
|
|
311
|
-
export
|
|
334
|
+
export class CustomForm {
|
|
335
|
+
/**
|
|
336
|
+
* @remarks
|
|
337
|
+
* Creates a new CustomForm for the specified player with the
|
|
338
|
+
* given title.
|
|
339
|
+
*
|
|
340
|
+
* @param player
|
|
341
|
+
* The player to show this form to.
|
|
342
|
+
* @param title
|
|
343
|
+
* The title text to display at the top of the form.
|
|
344
|
+
* @throws This function can throw errors.
|
|
345
|
+
*
|
|
346
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
347
|
+
*/
|
|
348
|
+
constructor(
|
|
349
|
+
player: minecraftserver.Player,
|
|
350
|
+
title: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
351
|
+
);
|
|
312
352
|
/**
|
|
313
353
|
* @remarks
|
|
314
|
-
*
|
|
315
|
-
*
|
|
354
|
+
* Adds a clickable button to the form layout. Returns the form
|
|
355
|
+
* instance to allow method chaining.
|
|
356
|
+
*
|
|
357
|
+
* This function can't be called in restricted-execution mode.
|
|
358
|
+
*
|
|
359
|
+
* @param label
|
|
360
|
+
* The text label to display on the button.
|
|
361
|
+
* @param onClick
|
|
362
|
+
* A callback function that is invoked when the player clicks
|
|
363
|
+
* the button.
|
|
364
|
+
* @param options
|
|
365
|
+
* Optional configuration for the button, such as a tooltip,
|
|
366
|
+
* disabled state, or visibility.
|
|
367
|
+
* @throws This function can throw errors.
|
|
316
368
|
*
|
|
369
|
+
* {@link InvalidFormModificationError}
|
|
317
370
|
*/
|
|
318
371
|
button(
|
|
319
|
-
label:
|
|
372
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
320
373
|
onClick: () => void,
|
|
321
374
|
options?: ButtonOptions,
|
|
322
375
|
): CustomForm;
|
|
323
376
|
/**
|
|
324
377
|
* @remarks
|
|
325
|
-
*
|
|
326
|
-
* form is not
|
|
378
|
+
* Closes the form if it is currently being shown to the
|
|
379
|
+
* player. Throws a FormVisibilityError if the form is not
|
|
380
|
+
* currently open.
|
|
381
|
+
*
|
|
382
|
+
* This function can't be called in restricted-execution mode.
|
|
383
|
+
*
|
|
384
|
+
* @throws This function can throw errors.
|
|
385
|
+
*
|
|
386
|
+
* {@link minecraftcommon.EngineError}
|
|
327
387
|
*
|
|
388
|
+
* {@link FormVisibilityError}
|
|
389
|
+
*
|
|
390
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
328
391
|
*/
|
|
329
392
|
close(): void;
|
|
330
393
|
/**
|
|
331
394
|
* @remarks
|
|
332
|
-
* Adds a close
|
|
395
|
+
* Adds a close button to the form at the bottom and as an 'X'
|
|
396
|
+
* in the corner. Returns the form instance to allow method
|
|
397
|
+
* chaining.
|
|
398
|
+
*
|
|
399
|
+
* This function can't be called in restricted-execution mode.
|
|
400
|
+
*
|
|
401
|
+
* @throws This function can throw errors.
|
|
333
402
|
*
|
|
403
|
+
* {@link InvalidFormModificationError}
|
|
334
404
|
*/
|
|
335
405
|
closeButton(): CustomForm;
|
|
336
406
|
/**
|
|
337
407
|
* @remarks
|
|
338
|
-
*
|
|
408
|
+
* Adds a horizontal divider line to the form layout. Useful
|
|
409
|
+
* for visually separating sections of the form. Returns the
|
|
410
|
+
* form instance to allow method chaining.
|
|
339
411
|
*
|
|
412
|
+
* This function can't be called in restricted-execution mode.
|
|
413
|
+
*
|
|
414
|
+
* @param options
|
|
415
|
+
* Optional configuration for the divider, such as visibility.
|
|
416
|
+
* @throws This function can throw errors.
|
|
417
|
+
*
|
|
418
|
+
* {@link InvalidFormModificationError}
|
|
340
419
|
*/
|
|
341
420
|
divider(options?: DividerOptions): CustomForm;
|
|
342
421
|
/**
|
|
343
422
|
* @remarks
|
|
344
|
-
*
|
|
345
|
-
*
|
|
423
|
+
* Adds a dropdown selection control to the form layout. The
|
|
424
|
+
* current selection is tracked via an ObservableNumber and
|
|
425
|
+
* will update when the player changes the selection. Returns
|
|
426
|
+
* the form instance to allow method chaining.
|
|
346
427
|
*
|
|
428
|
+
* This function can't be called in restricted-execution mode.
|
|
429
|
+
*
|
|
430
|
+
* @param label
|
|
431
|
+
* The text label displayed around the dropdown.
|
|
432
|
+
* @param value
|
|
433
|
+
* An ObservableNumber that holds the index of the currently
|
|
434
|
+
* selected item.
|
|
435
|
+
* @param items
|
|
436
|
+
* The list of items to display in the dropdown.
|
|
437
|
+
* @param options
|
|
438
|
+
* Optional configuration for the dropdown, such as a
|
|
439
|
+
* description, disabled state, or visibility.
|
|
440
|
+
* @throws This function can throw errors.
|
|
441
|
+
*
|
|
442
|
+
* {@link InvalidFormModificationError}
|
|
443
|
+
*
|
|
444
|
+
* {@link InvalidObservableError}
|
|
347
445
|
*/
|
|
348
446
|
dropdown(
|
|
349
|
-
label:
|
|
350
|
-
value:
|
|
351
|
-
items:
|
|
447
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
448
|
+
value: ObservableNumber,
|
|
449
|
+
items: DropdownItemData[],
|
|
352
450
|
options?: DropdownOptions,
|
|
353
451
|
): CustomForm;
|
|
354
452
|
/**
|
|
355
453
|
* @remarks
|
|
356
|
-
*
|
|
357
|
-
*
|
|
454
|
+
* Adds a header text component to the form layout. Headers are
|
|
455
|
+
* displayed in a larger or bolder style than regular labels,
|
|
456
|
+
* and are suitable for section titles. Returns the form
|
|
457
|
+
* instance to allow method chaining.
|
|
358
458
|
*
|
|
459
|
+
* This function can't be called in restricted-execution mode.
|
|
460
|
+
*
|
|
461
|
+
* @param text
|
|
462
|
+
* The header text to display.
|
|
463
|
+
* @param options
|
|
464
|
+
* Optional configuration for the header, such as visibility.
|
|
465
|
+
* @throws This function can throw errors.
|
|
466
|
+
*
|
|
467
|
+
* {@link InvalidFormModificationError}
|
|
359
468
|
*/
|
|
360
|
-
header(
|
|
361
|
-
text: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
362
|
-
options?: TextOptions,
|
|
363
|
-
): CustomForm;
|
|
469
|
+
header(text: ObservableString | ObservableUIRawMessage | string | UIRawMessage, options?: TextOptions): CustomForm;
|
|
364
470
|
/**
|
|
365
471
|
* @remarks
|
|
366
472
|
* Returns true if the form is currently being shown to the
|
|
367
|
-
* player.
|
|
473
|
+
* player, false otherwise.
|
|
474
|
+
*
|
|
475
|
+
* This function can't be called in restricted-execution mode.
|
|
368
476
|
*
|
|
369
477
|
*/
|
|
370
478
|
isShowing(): boolean;
|
|
371
479
|
/**
|
|
372
480
|
* @remarks
|
|
373
|
-
*
|
|
374
|
-
* form.
|
|
481
|
+
* Adds a read-only text label to the form layout. Returns the
|
|
482
|
+
* form instance to allow method chaining.
|
|
483
|
+
*
|
|
484
|
+
* This function can't be called in restricted-execution mode.
|
|
375
485
|
*
|
|
486
|
+
* @param text
|
|
487
|
+
* The text to display in the label.
|
|
488
|
+
* @param options
|
|
489
|
+
* Optional configuration for the label, such as visibility.
|
|
490
|
+
* @throws This function can throw errors.
|
|
491
|
+
*
|
|
492
|
+
* {@link InvalidFormModificationError}
|
|
376
493
|
*/
|
|
377
|
-
label(
|
|
378
|
-
text: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
379
|
-
options?: TextOptions,
|
|
380
|
-
): CustomForm;
|
|
494
|
+
label(text: ObservableString | ObservableUIRawMessage | string | UIRawMessage, options?: TextOptions): CustomForm;
|
|
381
495
|
/**
|
|
382
496
|
* @remarks
|
|
383
|
-
* Shows the form to the player.
|
|
384
|
-
*
|
|
385
|
-
*
|
|
497
|
+
* Shows the form to the player. Returns a promise that
|
|
498
|
+
* resolves with a DataDrivenScreenClosedReason indicating how
|
|
499
|
+
* the form was closed.
|
|
386
500
|
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
501
|
+
* This function can't be called in restricted-execution mode.
|
|
502
|
+
*
|
|
503
|
+
* @throws This function can throw errors.
|
|
504
|
+
*
|
|
505
|
+
* {@link minecraftcommon.EngineError}
|
|
506
|
+
*
|
|
507
|
+
* {@link FormVisibilityError}
|
|
508
|
+
*
|
|
509
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
389
510
|
*/
|
|
390
511
|
show(): Promise<DataDrivenScreenClosedReason>;
|
|
391
512
|
/**
|
|
392
513
|
* @remarks
|
|
393
|
-
*
|
|
394
|
-
*
|
|
514
|
+
* Adds a numeric slider control to the form layout. The
|
|
515
|
+
* current value is tracked via an ObservableNumber and will
|
|
516
|
+
* update as the player moves the slider. Returns the form
|
|
517
|
+
* instance to allow method chaining.
|
|
518
|
+
*
|
|
519
|
+
* This function can't be called in restricted-execution mode.
|
|
520
|
+
*
|
|
521
|
+
* @param label
|
|
522
|
+
* The text label displayed around the slider.
|
|
523
|
+
* @param value
|
|
524
|
+
* An ObservableNumber that holds the current value of the
|
|
525
|
+
* slider.
|
|
526
|
+
* @param min
|
|
527
|
+
* The minimum value of the slider range.
|
|
528
|
+
* @param max
|
|
529
|
+
* The maximum value of the slider range.
|
|
530
|
+
* @param options
|
|
531
|
+
* Optional configuration for the slider, such as step size, a
|
|
532
|
+
* description, disabled state, or visibility.
|
|
533
|
+
* @throws This function can throw errors.
|
|
534
|
+
*
|
|
535
|
+
* {@link InvalidFormModificationError}
|
|
395
536
|
*
|
|
537
|
+
* {@link InvalidObservableError}
|
|
396
538
|
*/
|
|
397
539
|
slider(
|
|
398
|
-
label:
|
|
399
|
-
value:
|
|
400
|
-
|
|
401
|
-
|
|
540
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
541
|
+
value: ObservableNumber,
|
|
542
|
+
min: number | ObservableNumber,
|
|
543
|
+
max: number | ObservableNumber,
|
|
402
544
|
options?: SliderOptions,
|
|
403
545
|
): CustomForm;
|
|
404
546
|
/**
|
|
405
547
|
* @remarks
|
|
406
|
-
*
|
|
548
|
+
* Adds a vertical spacer component to the form layout. Useful
|
|
549
|
+
* for adding empty space between form components. Returns the
|
|
550
|
+
* form instance to allow method chaining.
|
|
407
551
|
*
|
|
552
|
+
* This function can't be called in restricted-execution mode.
|
|
553
|
+
*
|
|
554
|
+
* @param options
|
|
555
|
+
* Optional configuration for the spacer, such as visibility.
|
|
556
|
+
* @throws This function can throw errors.
|
|
557
|
+
*
|
|
558
|
+
* {@link InvalidFormModificationError}
|
|
408
559
|
*/
|
|
409
560
|
spacer(options?: SpacingOptions): CustomForm;
|
|
410
561
|
/**
|
|
411
562
|
* @remarks
|
|
412
|
-
*
|
|
413
|
-
*
|
|
563
|
+
* Adds a text input field to the form layout. The current text
|
|
564
|
+
* value is tracked via an ObservableString and will update as
|
|
565
|
+
* the player types. Returns the form instance to allow method
|
|
566
|
+
* chaining.
|
|
567
|
+
*
|
|
568
|
+
* This function can't be called in restricted-execution mode.
|
|
569
|
+
*
|
|
570
|
+
* @param label
|
|
571
|
+
* The text label displayed around the text field.
|
|
572
|
+
* @param text
|
|
573
|
+
* An ObservableString that holds the current text value of the
|
|
574
|
+
* input field.
|
|
575
|
+
* @param options
|
|
576
|
+
* Optional configuration for the text field, such as a
|
|
577
|
+
* description, disabled state, or visibility.
|
|
578
|
+
* @throws This function can throw errors.
|
|
579
|
+
*
|
|
580
|
+
* {@link InvalidFormModificationError}
|
|
414
581
|
*
|
|
582
|
+
* {@link InvalidObservableError}
|
|
415
583
|
*/
|
|
416
584
|
textField(
|
|
417
|
-
label:
|
|
418
|
-
text:
|
|
585
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
586
|
+
text: ObservableString,
|
|
419
587
|
options?: TextFieldOptions,
|
|
420
588
|
): CustomForm;
|
|
421
589
|
/**
|
|
422
590
|
* @remarks
|
|
423
|
-
*
|
|
424
|
-
*
|
|
591
|
+
* Adds a toggle (on/off switch) control to the form layout.
|
|
592
|
+
* The current state is tracked via an ObservableBoolean and
|
|
593
|
+
* will update when the player toggles it. Returns the form
|
|
594
|
+
* instance to allow method chaining.
|
|
425
595
|
*
|
|
596
|
+
* This function can't be called in restricted-execution mode.
|
|
597
|
+
*
|
|
598
|
+
* @param label
|
|
599
|
+
* The text label displayed next to the toggle.
|
|
600
|
+
* @param toggled
|
|
601
|
+
* An ObservableBoolean that holds the current on/off state of
|
|
602
|
+
* the toggle.
|
|
603
|
+
* @param options
|
|
604
|
+
* Optional configuration for the toggle, such as a
|
|
605
|
+
* description, disabled state, or visibility.
|
|
606
|
+
* @throws This function can throw errors.
|
|
607
|
+
*
|
|
608
|
+
* {@link InvalidFormModificationError}
|
|
609
|
+
*
|
|
610
|
+
* {@link InvalidObservableError}
|
|
426
611
|
*/
|
|
427
612
|
toggle(
|
|
428
|
-
label:
|
|
429
|
-
toggled:
|
|
613
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
614
|
+
toggled: ObservableBoolean,
|
|
430
615
|
options?: ToggleOptions,
|
|
431
616
|
): CustomForm;
|
|
432
|
-
/**
|
|
433
|
-
* @remarks
|
|
434
|
-
* Creates a Custom form to show to the player. Use this
|
|
435
|
-
* instead of a constructor.
|
|
436
|
-
*
|
|
437
|
-
*/
|
|
438
|
-
static create(
|
|
439
|
-
player: minecraftserver.Player,
|
|
440
|
-
title: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
441
|
-
): CustomForm;
|
|
442
617
|
}
|
|
443
618
|
|
|
444
|
-
/**
|
|
445
|
-
* @beta
|
|
446
|
-
* Thrown when attempting to close a DDUI form that isn't open.
|
|
447
|
-
*/
|
|
448
|
-
// @ts-ignore Class inheritance allowed for native defined classes
|
|
449
|
-
export declare class FormCloseError extends Error {}
|
|
450
|
-
|
|
451
619
|
/**
|
|
452
620
|
* Base type for a form response.
|
|
453
621
|
*/
|
|
@@ -470,67 +638,126 @@ export class FormResponse {
|
|
|
470
638
|
|
|
471
639
|
/**
|
|
472
640
|
* @beta
|
|
473
|
-
* A simple message form
|
|
641
|
+
* A simple message form with two buttons and a text body. Use
|
|
642
|
+
* this class to show a basic dialog to a player and handle the
|
|
643
|
+
* player's button selection.
|
|
474
644
|
*/
|
|
475
|
-
export
|
|
645
|
+
export class MessageBox {
|
|
646
|
+
/**
|
|
647
|
+
* @remarks
|
|
648
|
+
* Creates a new MessageBox for the specified player with the
|
|
649
|
+
* given title.
|
|
650
|
+
*
|
|
651
|
+
* @param player
|
|
652
|
+
* The player to show this message box to.
|
|
653
|
+
* @param title
|
|
654
|
+
* The title text to display at the top of the message box.
|
|
655
|
+
* @throws This function can throw errors.
|
|
656
|
+
*
|
|
657
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
658
|
+
*/
|
|
659
|
+
constructor(
|
|
660
|
+
player: minecraftserver.Player,
|
|
661
|
+
title: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
662
|
+
);
|
|
476
663
|
/**
|
|
477
664
|
* @remarks
|
|
478
|
-
* Sets the
|
|
479
|
-
*
|
|
480
|
-
*
|
|
665
|
+
* Sets the body text displayed in the message box. Returns the
|
|
666
|
+
* message box instance to allow method chaining.
|
|
667
|
+
*
|
|
668
|
+
* This function can't be called in restricted-execution mode.
|
|
669
|
+
*
|
|
670
|
+
* @param body
|
|
671
|
+
* The body text to display. Accepts either a plain string or
|
|
672
|
+
* an ObservableString.
|
|
673
|
+
* @throws This function can throw errors.
|
|
481
674
|
*
|
|
675
|
+
* {@link InvalidFormModificationError}
|
|
482
676
|
*/
|
|
483
|
-
body(
|
|
677
|
+
body(body: ObservableString | ObservableUIRawMessage | string | UIRawMessage): MessageBox;
|
|
484
678
|
/**
|
|
485
679
|
* @remarks
|
|
486
|
-
* Sets the
|
|
680
|
+
* Sets the label for the first button of the message box.
|
|
681
|
+
* Returns the message box instance to allow method chaining.
|
|
682
|
+
*
|
|
683
|
+
* This function can't be called in restricted-execution mode.
|
|
684
|
+
*
|
|
685
|
+
* @param label
|
|
686
|
+
* The text label to display on the first button.
|
|
687
|
+
* @param tooltip
|
|
688
|
+
* Optional tooltip text shown when hovering over the first
|
|
689
|
+
* button.
|
|
690
|
+
* @throws This function can throw errors.
|
|
487
691
|
*
|
|
692
|
+
* {@link InvalidFormModificationError}
|
|
488
693
|
*/
|
|
489
694
|
button1(
|
|
490
|
-
label:
|
|
491
|
-
tooltip?:
|
|
695
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
696
|
+
tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
492
697
|
): MessageBox;
|
|
493
698
|
/**
|
|
494
699
|
* @remarks
|
|
495
|
-
* Sets the
|
|
700
|
+
* Sets the label for the second button of the message box.
|
|
701
|
+
* Returns the message box instance to allow method chaining.
|
|
496
702
|
*
|
|
703
|
+
* This function can't be called in restricted-execution mode.
|
|
704
|
+
*
|
|
705
|
+
* @param label
|
|
706
|
+
* The text label to display on the second button.
|
|
707
|
+
* @param tooltip
|
|
708
|
+
* Optional tooltip text shown when hovering over the second
|
|
709
|
+
* button.
|
|
710
|
+
* @throws This function can throw errors.
|
|
711
|
+
*
|
|
712
|
+
* {@link InvalidFormModificationError}
|
|
497
713
|
*/
|
|
498
714
|
button2(
|
|
499
|
-
label:
|
|
500
|
-
tooltip?:
|
|
715
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
716
|
+
tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
501
717
|
): MessageBox;
|
|
502
718
|
/**
|
|
503
719
|
* @remarks
|
|
504
|
-
*
|
|
505
|
-
*
|
|
720
|
+
* Closes the message box if it is currently being shown to the
|
|
721
|
+
* player. Throws a FormVisibilityError if the form is not
|
|
722
|
+
* currently open.
|
|
723
|
+
*
|
|
724
|
+
* This function can't be called in restricted-execution mode.
|
|
725
|
+
*
|
|
726
|
+
* @throws This function can throw errors.
|
|
727
|
+
*
|
|
728
|
+
* {@link minecraftcommon.EngineError}
|
|
506
729
|
*
|
|
730
|
+
* {@link FormVisibilityError}
|
|
731
|
+
*
|
|
732
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
507
733
|
*/
|
|
508
734
|
close(): void;
|
|
509
735
|
/**
|
|
510
736
|
* @remarks
|
|
511
737
|
* Returns true if the message box is currently being shown to
|
|
512
|
-
* the player.
|
|
738
|
+
* the player, false otherwise.
|
|
739
|
+
*
|
|
740
|
+
* This function can't be called in restricted-execution mode.
|
|
513
741
|
*
|
|
514
742
|
*/
|
|
515
743
|
isShowing(): boolean;
|
|
516
744
|
/**
|
|
517
745
|
* @remarks
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
746
|
+
* Shows the message box to the player. Returns a promise that
|
|
747
|
+
* resolves with a MessageBoxResult containing the close reason
|
|
748
|
+
* and the player's button selection.
|
|
521
749
|
*
|
|
522
|
-
|
|
523
|
-
show(): Promise<MessageBoxResult>;
|
|
524
|
-
/**
|
|
525
|
-
* @remarks
|
|
526
|
-
* Creates a message box for a certain player. Use this instead
|
|
527
|
-
* of a constructor.
|
|
750
|
+
* This function can't be called in restricted-execution mode.
|
|
528
751
|
*
|
|
752
|
+
* @throws This function can throw errors.
|
|
753
|
+
*
|
|
754
|
+
* {@link minecraftcommon.EngineError}
|
|
755
|
+
*
|
|
756
|
+
* {@link FormVisibilityError}
|
|
757
|
+
*
|
|
758
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
529
759
|
*/
|
|
530
|
-
|
|
531
|
-
player: minecraftserver.Player,
|
|
532
|
-
title: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
533
|
-
): MessageBox;
|
|
760
|
+
show(): Promise<MessageBoxResult>;
|
|
534
761
|
}
|
|
535
762
|
|
|
536
763
|
/**
|
|
@@ -918,81 +1145,299 @@ export class ModalFormResponse extends FormResponse {
|
|
|
918
1145
|
|
|
919
1146
|
/**
|
|
920
1147
|
* @beta
|
|
921
|
-
*
|
|
922
|
-
*
|
|
1148
|
+
* An observable that holds a boolean value. Listeners are
|
|
1149
|
+
* notified whenever the value changes.
|
|
923
1150
|
*/
|
|
924
|
-
export
|
|
1151
|
+
export class ObservableBoolean {
|
|
925
1152
|
/**
|
|
926
1153
|
* @remarks
|
|
927
|
-
*
|
|
1154
|
+
* Creates a new ObservableBoolean with the provided initial
|
|
1155
|
+
* boolean value.
|
|
928
1156
|
*
|
|
1157
|
+
* This function can't be called in restricted-execution mode.
|
|
1158
|
+
*
|
|
1159
|
+
* This function can be called in early-execution mode.
|
|
1160
|
+
*
|
|
1161
|
+
* @param data
|
|
1162
|
+
* The initial boolean value for this observable.
|
|
1163
|
+
* @param options
|
|
1164
|
+
* Optional configuration for the observable, such as whether
|
|
1165
|
+
* the value can be written by the client.
|
|
929
1166
|
*/
|
|
930
|
-
|
|
1167
|
+
constructor(data: boolean, options?: ObservableOptions);
|
|
931
1168
|
/**
|
|
932
1169
|
* @remarks
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
* This delay is only applied to the getFilteredText function
|
|
939
|
-
* and can be used to simulate network latency when testing.
|
|
1170
|
+
* Returns the current boolean value held by this observable.
|
|
1171
|
+
*
|
|
1172
|
+
* This function can't be called in restricted-execution mode.
|
|
1173
|
+
*
|
|
1174
|
+
* This function can be called in early-execution mode.
|
|
940
1175
|
*
|
|
941
1176
|
*/
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1177
|
+
getData(): boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* @remarks
|
|
1180
|
+
* Updates the boolean value held by this observable. If the
|
|
1181
|
+
* new value differs from the current value, all subscribed
|
|
1182
|
+
* listeners are notified with the new value.
|
|
1183
|
+
*
|
|
1184
|
+
* This function can't be called in restricted-execution mode.
|
|
1185
|
+
*
|
|
1186
|
+
* This function can be called in early-execution mode.
|
|
1187
|
+
*
|
|
1188
|
+
* @param data
|
|
1189
|
+
* The new boolean value to set.
|
|
1190
|
+
*/
|
|
1191
|
+
setData(data: boolean): void;
|
|
1192
|
+
/**
|
|
1193
|
+
* @remarks
|
|
1194
|
+
* Registers a callback to be invoked whenever the observable's
|
|
1195
|
+
* value changes. Returns the callback, which can be passed to
|
|
1196
|
+
* unsubscribe to remove the listener.
|
|
1197
|
+
*
|
|
1198
|
+
* This function can't be called in restricted-execution mode.
|
|
1199
|
+
*
|
|
1200
|
+
* This function can be called in early-execution mode.
|
|
1201
|
+
*
|
|
1202
|
+
* @param callback
|
|
1203
|
+
* A function that receives the new boolean value each time the
|
|
1204
|
+
* observable changes.
|
|
1205
|
+
*/
|
|
1206
|
+
subscribe(callback: (arg0: boolean) => void): (arg0: boolean) => void;
|
|
946
1207
|
/**
|
|
947
1208
|
* @remarks
|
|
948
|
-
*
|
|
949
|
-
*
|
|
1209
|
+
* Removes a previously registered listener from this
|
|
1210
|
+
* observable. Returns true if the listener was found and
|
|
1211
|
+
* removed, false if it was not found.
|
|
950
1212
|
*
|
|
1213
|
+
* This function can't be called in restricted-execution mode.
|
|
1214
|
+
*
|
|
1215
|
+
* This function can be called in early-execution mode.
|
|
1216
|
+
*
|
|
1217
|
+
* @param callback
|
|
1218
|
+
* The callback handle previously returned by subscribe.
|
|
951
1219
|
*/
|
|
952
|
-
|
|
1220
|
+
unsubscribe(callback: (arg0: boolean) => void): boolean;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* @beta
|
|
1225
|
+
* An observable that holds a numeric value. Listeners are
|
|
1226
|
+
* notified whenever the value changes.
|
|
1227
|
+
*/
|
|
1228
|
+
export class ObservableNumber {
|
|
953
1229
|
/**
|
|
954
1230
|
* @remarks
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
1231
|
+
* Creates a new ObservableNumber with the provided initial
|
|
1232
|
+
* numeric value.
|
|
1233
|
+
*
|
|
1234
|
+
* This function can't be called in restricted-execution mode.
|
|
1235
|
+
*
|
|
1236
|
+
* This function can be called in early-execution mode.
|
|
1237
|
+
*
|
|
1238
|
+
* @param data
|
|
1239
|
+
* The initial numeric value for this observable.
|
|
1240
|
+
* @param options
|
|
1241
|
+
* Optional configuration for the observable, such as whether
|
|
1242
|
+
* the value can be written by the client.
|
|
1243
|
+
*/
|
|
1244
|
+
constructor(data: number, options?: ObservableOptions);
|
|
1245
|
+
/**
|
|
1246
|
+
* @remarks
|
|
1247
|
+
* Returns the current numeric value held by this observable.
|
|
1248
|
+
*
|
|
1249
|
+
* This function can't be called in restricted-execution mode.
|
|
1250
|
+
*
|
|
1251
|
+
* This function can be called in early-execution mode.
|
|
1252
|
+
*
|
|
1253
|
+
*/
|
|
1254
|
+
getData(): number;
|
|
1255
|
+
/**
|
|
1256
|
+
* @remarks
|
|
1257
|
+
* Updates the numeric value held by this observable. If the
|
|
1258
|
+
* new value differs from the current value, all subscribed
|
|
1259
|
+
* listeners are notified with the new value.
|
|
1260
|
+
*
|
|
1261
|
+
* This function can't be called in restricted-execution mode.
|
|
1262
|
+
*
|
|
1263
|
+
* This function can be called in early-execution mode.
|
|
958
1264
|
*
|
|
1265
|
+
* @param data
|
|
1266
|
+
* The new numeric value to set.
|
|
959
1267
|
*/
|
|
960
|
-
|
|
961
|
-
toJSON(): unknown;
|
|
1268
|
+
setData(data: number): void;
|
|
962
1269
|
/**
|
|
963
1270
|
* @remarks
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
*
|
|
1271
|
+
* Registers a callback to be invoked whenever the observable's
|
|
1272
|
+
* value changes. Returns the callback, which can be passed to
|
|
1273
|
+
* unsubscribe to remove the listener.
|
|
1274
|
+
*
|
|
1275
|
+
* This function can't be called in restricted-execution mode.
|
|
1276
|
+
*
|
|
1277
|
+
* This function can be called in early-execution mode.
|
|
967
1278
|
*
|
|
1279
|
+
* @param callback
|
|
1280
|
+
* A function that receives the new numeric value each time the
|
|
1281
|
+
* observable changes.
|
|
968
1282
|
*/
|
|
969
|
-
|
|
1283
|
+
subscribe(callback: (arg0: number) => void): (arg0: number) => void;
|
|
970
1284
|
/**
|
|
971
1285
|
* @remarks
|
|
972
|
-
*
|
|
1286
|
+
* Removes a previously registered listener from this
|
|
1287
|
+
* observable. Returns true if the listener was found and
|
|
1288
|
+
* removed, false if it was not found.
|
|
1289
|
+
*
|
|
1290
|
+
* This function can't be called in restricted-execution mode.
|
|
1291
|
+
*
|
|
1292
|
+
* This function can be called in early-execution mode.
|
|
973
1293
|
*
|
|
1294
|
+
* @param callback
|
|
1295
|
+
* The callback handle previously returned by subscribe.
|
|
974
1296
|
*/
|
|
975
|
-
|
|
976
|
-
data: T,
|
|
977
|
-
options?: ObservableOptions,
|
|
978
|
-
): Observable<T>;
|
|
1297
|
+
unsubscribe(callback: (arg0: number) => void): boolean;
|
|
979
1298
|
}
|
|
980
1299
|
|
|
981
1300
|
/**
|
|
982
1301
|
* @beta
|
|
983
|
-
*
|
|
984
|
-
*
|
|
1302
|
+
* An observable that holds a string value. Listeners are
|
|
1303
|
+
* notified whenever the value changes.
|
|
985
1304
|
*/
|
|
986
|
-
|
|
987
|
-
|
|
1305
|
+
export class ObservableString {
|
|
1306
|
+
/**
|
|
1307
|
+
* @remarks
|
|
1308
|
+
* Creates a new ObservableString with the provided initial
|
|
1309
|
+
* string value.
|
|
1310
|
+
*
|
|
1311
|
+
* This function can't be called in restricted-execution mode.
|
|
1312
|
+
*
|
|
1313
|
+
* This function can be called in early-execution mode.
|
|
1314
|
+
*
|
|
1315
|
+
* @param data
|
|
1316
|
+
* The initial string value for this observable.
|
|
1317
|
+
* @param options
|
|
1318
|
+
* Optional configuration for the observable, such as whether
|
|
1319
|
+
* the value can be written by the client.
|
|
1320
|
+
*/
|
|
1321
|
+
constructor(data: string, options?: ObservableOptions);
|
|
1322
|
+
/**
|
|
1323
|
+
* @remarks
|
|
1324
|
+
* Returns the current string value held by this observable.
|
|
1325
|
+
*
|
|
1326
|
+
* This function can't be called in restricted-execution mode.
|
|
1327
|
+
*
|
|
1328
|
+
* This function can be called in early-execution mode.
|
|
1329
|
+
*
|
|
1330
|
+
*/
|
|
1331
|
+
getData(): string;
|
|
1332
|
+
/**
|
|
1333
|
+
* @remarks
|
|
1334
|
+
* Gets filtered data from the Observable (only available for
|
|
1335
|
+
* strings). In case of failure, it will return an array of
|
|
1336
|
+
* TextFilteringError that can provide more context about the
|
|
1337
|
+
* filtering process. For testing purposes, the options are
|
|
1338
|
+
* available under 'Creator -> Text Filtering' settings menu.
|
|
1339
|
+
* This delay is only applied to the getFilteredText function
|
|
1340
|
+
* and can be used to simulate network latency when testing.
|
|
1341
|
+
*
|
|
1342
|
+
* This function can't be called in restricted-execution mode.
|
|
1343
|
+
*
|
|
1344
|
+
* @throws This function can throw errors.
|
|
1345
|
+
*
|
|
1346
|
+
* {@link minecraftcommon.EngineError}
|
|
1347
|
+
*
|
|
1348
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
1349
|
+
*/
|
|
1350
|
+
getFilteredText(player: minecraftserver.Player): Promise<TextFilteringError[] | string>;
|
|
1351
|
+
/**
|
|
1352
|
+
* @remarks
|
|
1353
|
+
* Updates the string value held by this observable. If the new
|
|
1354
|
+
* value differs from the current value, all subscribed
|
|
1355
|
+
* listeners are notified with the new value.
|
|
1356
|
+
*
|
|
1357
|
+
* This function can't be called in restricted-execution mode.
|
|
1358
|
+
*
|
|
1359
|
+
* This function can be called in early-execution mode.
|
|
1360
|
+
*
|
|
1361
|
+
* @param data
|
|
1362
|
+
* The new string value to set.
|
|
1363
|
+
*/
|
|
1364
|
+
setData(data: string): void;
|
|
1365
|
+
/**
|
|
1366
|
+
* @remarks
|
|
1367
|
+
* Registers a callback to be invoked whenever the observable's
|
|
1368
|
+
* value changes. Returns the callback, which can be passed to
|
|
1369
|
+
* unsubscribe to remove the listener.
|
|
1370
|
+
*
|
|
1371
|
+
* This function can't be called in restricted-execution mode.
|
|
1372
|
+
*
|
|
1373
|
+
* This function can be called in early-execution mode.
|
|
1374
|
+
*
|
|
1375
|
+
* @param callback
|
|
1376
|
+
* A function that receives the new string value each time the
|
|
1377
|
+
* observable changes.
|
|
1378
|
+
*/
|
|
1379
|
+
subscribe(callback: (arg0: string) => void): (arg0: string) => void;
|
|
1380
|
+
/**
|
|
1381
|
+
* @remarks
|
|
1382
|
+
* Removes a previously registered listener from this
|
|
1383
|
+
* observable. Returns true if the listener was found and
|
|
1384
|
+
* removed, false if it was not found.
|
|
1385
|
+
*
|
|
1386
|
+
* This function can't be called in restricted-execution mode.
|
|
1387
|
+
*
|
|
1388
|
+
* This function can be called in early-execution mode.
|
|
1389
|
+
*
|
|
1390
|
+
* @param callback
|
|
1391
|
+
* The callback handle previously returned by subscribe.
|
|
1392
|
+
*/
|
|
1393
|
+
unsubscribe(callback: (arg0: string) => void): boolean;
|
|
1394
|
+
}
|
|
988
1395
|
|
|
989
1396
|
/**
|
|
990
1397
|
* @beta
|
|
991
|
-
* Thrown when a DDUI screen is rejected because the server is
|
|
992
|
-
* shutting down.
|
|
993
1398
|
*/
|
|
994
|
-
|
|
995
|
-
|
|
1399
|
+
export class ObservableUIRawMessage {
|
|
1400
|
+
/**
|
|
1401
|
+
* @remarks
|
|
1402
|
+
* This function can't be called in restricted-execution mode.
|
|
1403
|
+
*
|
|
1404
|
+
* This function can be called in early-execution mode.
|
|
1405
|
+
*
|
|
1406
|
+
*/
|
|
1407
|
+
constructor(data: UIRawMessage, options?: ObservableOptions);
|
|
1408
|
+
/**
|
|
1409
|
+
* @remarks
|
|
1410
|
+
* This function can't be called in restricted-execution mode.
|
|
1411
|
+
*
|
|
1412
|
+
* This function can be called in early-execution mode.
|
|
1413
|
+
*
|
|
1414
|
+
*/
|
|
1415
|
+
getData(): UIRawMessage;
|
|
1416
|
+
/**
|
|
1417
|
+
* @remarks
|
|
1418
|
+
* This function can't be called in restricted-execution mode.
|
|
1419
|
+
*
|
|
1420
|
+
* This function can be called in early-execution mode.
|
|
1421
|
+
*
|
|
1422
|
+
*/
|
|
1423
|
+
setData(data: UIRawMessage): void;
|
|
1424
|
+
/**
|
|
1425
|
+
* @remarks
|
|
1426
|
+
* This function can't be called in restricted-execution mode.
|
|
1427
|
+
*
|
|
1428
|
+
* This function can be called in early-execution mode.
|
|
1429
|
+
*
|
|
1430
|
+
*/
|
|
1431
|
+
subscribe(callback: (arg0: UIRawMessage) => void): (arg0: UIRawMessage) => void;
|
|
1432
|
+
/**
|
|
1433
|
+
* @remarks
|
|
1434
|
+
* This function can't be called in restricted-execution mode.
|
|
1435
|
+
*
|
|
1436
|
+
* This function can be called in early-execution mode.
|
|
1437
|
+
*
|
|
1438
|
+
*/
|
|
1439
|
+
unsubscribe(callback: (arg0: UIRawMessage) => void): boolean;
|
|
1440
|
+
}
|
|
996
1441
|
|
|
997
1442
|
export class UIManager {
|
|
998
1443
|
private constructor();
|
|
@@ -1007,64 +1452,69 @@ export class UIManager {
|
|
|
1007
1452
|
|
|
1008
1453
|
/**
|
|
1009
1454
|
* @beta
|
|
1010
|
-
*
|
|
1455
|
+
* Options for configuring a button component.
|
|
1011
1456
|
*/
|
|
1012
1457
|
export interface ButtonOptions {
|
|
1013
1458
|
/**
|
|
1014
1459
|
* @remarks
|
|
1015
|
-
*
|
|
1460
|
+
* When true or bound to a true ObservableBoolean, the button
|
|
1461
|
+
* is shown but cannot be pressed.
|
|
1016
1462
|
*
|
|
1017
1463
|
*/
|
|
1018
|
-
disabled?:
|
|
1464
|
+
disabled?: boolean | ObservableBoolean;
|
|
1019
1465
|
/**
|
|
1020
1466
|
* @remarks
|
|
1021
|
-
*
|
|
1467
|
+
* Text shown in a tooltip when the player hovers over the
|
|
1468
|
+
* button.
|
|
1022
1469
|
*
|
|
1023
1470
|
*/
|
|
1024
|
-
tooltip?:
|
|
1471
|
+
tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1025
1472
|
/**
|
|
1026
1473
|
* @remarks
|
|
1027
|
-
*
|
|
1474
|
+
* When false or bound to a false ObservableBoolean, the button
|
|
1475
|
+
* is hidden.
|
|
1028
1476
|
*
|
|
1029
1477
|
*/
|
|
1030
|
-
visible?:
|
|
1478
|
+
visible?: boolean | ObservableBoolean;
|
|
1031
1479
|
}
|
|
1032
1480
|
|
|
1033
1481
|
/**
|
|
1034
1482
|
* @beta
|
|
1035
|
-
*
|
|
1483
|
+
* Options for configuring a divider component in a CustomForm.
|
|
1036
1484
|
*/
|
|
1037
1485
|
export interface DividerOptions {
|
|
1038
1486
|
/**
|
|
1039
1487
|
* @remarks
|
|
1040
|
-
*
|
|
1488
|
+
* When false or bound to a false ObservableBoolean, the
|
|
1489
|
+
* divider is hidden.
|
|
1041
1490
|
*
|
|
1042
1491
|
*/
|
|
1043
|
-
visible?:
|
|
1492
|
+
visible?: boolean | ObservableBoolean;
|
|
1044
1493
|
}
|
|
1045
1494
|
|
|
1046
1495
|
/**
|
|
1047
1496
|
* @beta
|
|
1048
|
-
*
|
|
1497
|
+
* Represents a single item in a dropdown component.
|
|
1049
1498
|
*/
|
|
1050
|
-
export interface
|
|
1499
|
+
export interface DropdownItemData {
|
|
1051
1500
|
/**
|
|
1052
1501
|
* @remarks
|
|
1053
|
-
*
|
|
1054
|
-
* selected.
|
|
1502
|
+
* Optional descriptive text shown around the dropdown when
|
|
1503
|
+
* this item is selected.
|
|
1055
1504
|
*
|
|
1056
1505
|
*/
|
|
1057
|
-
description?:
|
|
1506
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1058
1507
|
/**
|
|
1059
1508
|
* @remarks
|
|
1060
|
-
* The
|
|
1509
|
+
* The text displayed for this item in the dropdown list.
|
|
1061
1510
|
*
|
|
1062
1511
|
*/
|
|
1063
|
-
label:
|
|
1512
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1064
1513
|
/**
|
|
1065
1514
|
* @remarks
|
|
1066
|
-
* The value
|
|
1067
|
-
*
|
|
1515
|
+
* The numeric value associated with this dropdown item. This
|
|
1516
|
+
* is the value the bound ObservableNumber will be set to when
|
|
1517
|
+
* the player selects this item.
|
|
1068
1518
|
*
|
|
1069
1519
|
*/
|
|
1070
1520
|
value: number;
|
|
@@ -1072,32 +1522,37 @@ export interface DropdownItem {
|
|
|
1072
1522
|
|
|
1073
1523
|
/**
|
|
1074
1524
|
* @beta
|
|
1075
|
-
*
|
|
1525
|
+
* Options for configuring a dropdown component.
|
|
1076
1526
|
*/
|
|
1077
1527
|
export interface DropdownOptions {
|
|
1078
1528
|
/**
|
|
1079
1529
|
* @remarks
|
|
1080
|
-
*
|
|
1530
|
+
* Descriptive text shown around the dropdown to provide
|
|
1531
|
+
* additional context.
|
|
1081
1532
|
*
|
|
1082
1533
|
*/
|
|
1083
|
-
description?:
|
|
1534
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1084
1535
|
/**
|
|
1085
1536
|
* @remarks
|
|
1086
|
-
*
|
|
1537
|
+
* When true or bound to a true ObservableBoolean, the dropdown
|
|
1538
|
+
* is shown but cannot be changed.
|
|
1087
1539
|
*
|
|
1088
1540
|
*/
|
|
1089
|
-
disabled?:
|
|
1541
|
+
disabled?: boolean | ObservableBoolean;
|
|
1090
1542
|
/**
|
|
1091
1543
|
* @remarks
|
|
1092
|
-
*
|
|
1544
|
+
* When false or bound to a false ObservableBoolean, the
|
|
1545
|
+
* dropdown is hidden.
|
|
1093
1546
|
*
|
|
1094
1547
|
*/
|
|
1095
|
-
visible?:
|
|
1548
|
+
visible?: boolean | ObservableBoolean;
|
|
1096
1549
|
}
|
|
1097
1550
|
|
|
1098
1551
|
/**
|
|
1099
1552
|
* @beta
|
|
1100
|
-
* The result when
|
|
1553
|
+
* The result returned when an MessageBox is closed. Contains
|
|
1554
|
+
* the reason the message box was closed and the player's
|
|
1555
|
+
* button selection, if applicable.
|
|
1101
1556
|
*/
|
|
1102
1557
|
export interface MessageBoxResult {
|
|
1103
1558
|
/**
|
|
@@ -1108,8 +1563,9 @@ export interface MessageBoxResult {
|
|
|
1108
1563
|
closeReason: DataDrivenScreenClosedReason;
|
|
1109
1564
|
/**
|
|
1110
1565
|
* @remarks
|
|
1111
|
-
* The button
|
|
1112
|
-
* without
|
|
1566
|
+
* The index of the button the player selected. Not set if the
|
|
1567
|
+
* message box was closed without a button selection (e.g., the
|
|
1568
|
+
* player was busy or the server closed it).
|
|
1113
1569
|
*
|
|
1114
1570
|
*/
|
|
1115
1571
|
selection?: number;
|
|
@@ -1209,128 +1665,137 @@ export interface ModalFormDataToggleOptions {
|
|
|
1209
1665
|
|
|
1210
1666
|
/**
|
|
1211
1667
|
* @beta
|
|
1212
|
-
*
|
|
1668
|
+
* Configuration options for creating an Observable. Controls
|
|
1669
|
+
* how the observable value can be accessed and modified.
|
|
1213
1670
|
*/
|
|
1214
1671
|
export interface ObservableOptions {
|
|
1215
1672
|
/**
|
|
1216
1673
|
* @remarks
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
* to this observable.
|
|
1674
|
+
* When true, allows the client to write to this observable's
|
|
1675
|
+
* value directly, enabling two-way data binding between the UI
|
|
1676
|
+
* and the observable.
|
|
1221
1677
|
*
|
|
1222
1678
|
*/
|
|
1223
|
-
clientWritable
|
|
1679
|
+
clientWritable: boolean;
|
|
1224
1680
|
}
|
|
1225
1681
|
|
|
1226
1682
|
/**
|
|
1227
1683
|
* @beta
|
|
1228
|
-
*
|
|
1684
|
+
* Options for configuring a slider component.
|
|
1229
1685
|
*/
|
|
1230
1686
|
export interface SliderOptions {
|
|
1231
1687
|
/**
|
|
1232
1688
|
* @remarks
|
|
1233
|
-
*
|
|
1689
|
+
* Descriptive text shown around the slider to provide
|
|
1690
|
+
* additional context.
|
|
1234
1691
|
*
|
|
1235
1692
|
*/
|
|
1236
|
-
description?:
|
|
1693
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1237
1694
|
/**
|
|
1238
1695
|
* @remarks
|
|
1239
|
-
*
|
|
1696
|
+
* When true or bound to a true ObservableBoolean, the slider
|
|
1697
|
+
* is shown but cannot be moved.
|
|
1240
1698
|
*
|
|
1241
1699
|
*/
|
|
1242
|
-
disabled?:
|
|
1700
|
+
disabled?: boolean | ObservableBoolean;
|
|
1243
1701
|
/**
|
|
1244
1702
|
* @remarks
|
|
1245
|
-
* The
|
|
1246
|
-
*
|
|
1247
|
-
* will be 0, 2, 4, 6, 8, 10.
|
|
1703
|
+
* The increment amount between each slider step. Defaults to 1
|
|
1704
|
+
* if not specified.
|
|
1248
1705
|
*
|
|
1249
1706
|
*/
|
|
1250
|
-
step?:
|
|
1707
|
+
step?: number | ObservableNumber;
|
|
1251
1708
|
/**
|
|
1252
1709
|
* @remarks
|
|
1253
|
-
*
|
|
1710
|
+
* When false or bound to a false ObservableBoolean, the slider
|
|
1711
|
+
* is hidden.
|
|
1254
1712
|
*
|
|
1255
1713
|
*/
|
|
1256
|
-
visible?:
|
|
1714
|
+
visible?: boolean | ObservableBoolean;
|
|
1257
1715
|
}
|
|
1258
1716
|
|
|
1259
1717
|
/**
|
|
1260
1718
|
* @beta
|
|
1261
|
-
*
|
|
1719
|
+
* Options for configuring a spacer component.
|
|
1262
1720
|
*/
|
|
1263
1721
|
export interface SpacingOptions {
|
|
1264
1722
|
/**
|
|
1265
1723
|
* @remarks
|
|
1266
|
-
*
|
|
1724
|
+
* When false or bound to a false ObservableBoolean, the spacer
|
|
1725
|
+
* is hidden.
|
|
1267
1726
|
*
|
|
1268
1727
|
*/
|
|
1269
|
-
visible?:
|
|
1728
|
+
visible?: boolean | ObservableBoolean;
|
|
1270
1729
|
}
|
|
1271
1730
|
|
|
1272
1731
|
/**
|
|
1273
1732
|
* @beta
|
|
1274
|
-
*
|
|
1733
|
+
* Options for configuring a text field component.
|
|
1275
1734
|
*/
|
|
1276
1735
|
export interface TextFieldOptions {
|
|
1277
1736
|
/**
|
|
1278
1737
|
* @remarks
|
|
1279
|
-
*
|
|
1738
|
+
* Descriptive text shown around the text field label to
|
|
1739
|
+
* provide additional context.
|
|
1280
1740
|
*
|
|
1281
1741
|
*/
|
|
1282
|
-
description?:
|
|
1742
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1283
1743
|
/**
|
|
1284
1744
|
* @remarks
|
|
1285
|
-
*
|
|
1745
|
+
* When true or bound to a true ObservableBoolean, the text
|
|
1746
|
+
* field is shown but cannot be edited.
|
|
1286
1747
|
*
|
|
1287
1748
|
*/
|
|
1288
|
-
disabled?:
|
|
1749
|
+
disabled?: boolean | ObservableBoolean;
|
|
1289
1750
|
/**
|
|
1290
1751
|
* @remarks
|
|
1291
|
-
*
|
|
1752
|
+
* When false or bound to a false ObservableBoolean, the text
|
|
1753
|
+
* field is hidden.
|
|
1292
1754
|
*
|
|
1293
1755
|
*/
|
|
1294
|
-
visible?:
|
|
1756
|
+
visible?: boolean | ObservableBoolean;
|
|
1295
1757
|
}
|
|
1296
1758
|
|
|
1297
1759
|
/**
|
|
1298
1760
|
* @beta
|
|
1299
|
-
*
|
|
1300
|
-
* CustomForm}.
|
|
1761
|
+
* Options for configuring a text component (label or header).
|
|
1301
1762
|
*/
|
|
1302
1763
|
export interface TextOptions {
|
|
1303
1764
|
/**
|
|
1304
1765
|
* @remarks
|
|
1305
|
-
*
|
|
1766
|
+
* When false or bound to a false ObservableBoolean, the text
|
|
1767
|
+
* component is hidden.
|
|
1306
1768
|
*
|
|
1307
1769
|
*/
|
|
1308
|
-
visible?:
|
|
1770
|
+
visible?: boolean | ObservableBoolean;
|
|
1309
1771
|
}
|
|
1310
1772
|
|
|
1311
1773
|
/**
|
|
1312
1774
|
* @beta
|
|
1313
|
-
*
|
|
1775
|
+
* Options for configuring a toggle component.
|
|
1314
1776
|
*/
|
|
1315
1777
|
export interface ToggleOptions {
|
|
1316
1778
|
/**
|
|
1317
1779
|
* @remarks
|
|
1318
|
-
*
|
|
1780
|
+
* Descriptive text shown around the toggle to provide
|
|
1781
|
+
* additional context.
|
|
1319
1782
|
*
|
|
1320
1783
|
*/
|
|
1321
|
-
description?:
|
|
1784
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1322
1785
|
/**
|
|
1323
1786
|
* @remarks
|
|
1324
|
-
*
|
|
1787
|
+
* When true or bound to a true ObservableBoolean, the toggle
|
|
1788
|
+
* is shown but cannot be interacted with.
|
|
1325
1789
|
*
|
|
1326
1790
|
*/
|
|
1327
|
-
disabled?:
|
|
1791
|
+
disabled?: boolean | ObservableBoolean;
|
|
1328
1792
|
/**
|
|
1329
1793
|
* @remarks
|
|
1330
|
-
*
|
|
1794
|
+
* When false or bound to a false ObservableBoolean, the toggle
|
|
1795
|
+
* is hidden.
|
|
1331
1796
|
*
|
|
1332
1797
|
*/
|
|
1333
|
-
visible?:
|
|
1798
|
+
visible?: boolean | ObservableBoolean;
|
|
1334
1799
|
}
|
|
1335
1800
|
|
|
1336
1801
|
/**
|
|
@@ -1353,17 +1818,17 @@ export interface UIRawMessage {
|
|
|
1353
1818
|
text?: string;
|
|
1354
1819
|
/**
|
|
1355
1820
|
* @remarks
|
|
1356
|
-
* Provides a
|
|
1821
|
+
* Provides a localization string where, if the client has an
|
|
1357
1822
|
* available resource in the players' language which matches
|
|
1358
|
-
* the
|
|
1823
|
+
* the localization string, will get translated on the client.
|
|
1359
1824
|
*
|
|
1360
1825
|
*/
|
|
1361
1826
|
translate?: string;
|
|
1362
1827
|
/**
|
|
1363
1828
|
* @remarks
|
|
1364
|
-
* Arguments for the
|
|
1365
|
-
* of strings or UIRawMessage containing an array of raw
|
|
1366
|
-
* objects.
|
|
1829
|
+
* Arguments for the localization string. Can be either an
|
|
1830
|
+
* array of strings or UIRawMessage containing an array of raw
|
|
1831
|
+
* text objects.
|
|
1367
1832
|
*
|
|
1368
1833
|
*/
|
|
1369
1834
|
with?: string[] | UIRawMessage;
|
|
@@ -1380,4 +1845,98 @@ export class FormRejectError extends Error {
|
|
|
1380
1845
|
readonly reason: FormRejectReason;
|
|
1381
1846
|
}
|
|
1382
1847
|
|
|
1848
|
+
/**
|
|
1849
|
+
* @beta
|
|
1850
|
+
* Thrown when a form visibility operation fails, such as
|
|
1851
|
+
* attempting to show a form that is already showing or
|
|
1852
|
+
* attempting to close a form that is not currently open.
|
|
1853
|
+
*/
|
|
1854
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1855
|
+
export class FormVisibilityError extends Error {
|
|
1856
|
+
private constructor();
|
|
1857
|
+
/**
|
|
1858
|
+
* @remarks
|
|
1859
|
+
* The identifier of the form that caused the visibility error.
|
|
1860
|
+
*
|
|
1861
|
+
* This property can be read in early-execution mode.
|
|
1862
|
+
*
|
|
1863
|
+
*/
|
|
1864
|
+
readonly formId: string;
|
|
1865
|
+
/**
|
|
1866
|
+
* @remarks
|
|
1867
|
+
* The reason the form visibility operation failed.
|
|
1868
|
+
*
|
|
1869
|
+
* This property can be read in early-execution mode.
|
|
1870
|
+
*
|
|
1871
|
+
*/
|
|
1872
|
+
readonly reason: FormVisibilityErrorReason;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* @beta
|
|
1877
|
+
* Thrown when attempting to interact with a form using an
|
|
1878
|
+
* invalid or unknown form identifier.
|
|
1879
|
+
*/
|
|
1880
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1881
|
+
export class InvalidFormError extends Error {
|
|
1882
|
+
private constructor();
|
|
1883
|
+
/**
|
|
1884
|
+
* @remarks
|
|
1885
|
+
* The identifier of the invalid form that was referenced.
|
|
1886
|
+
*
|
|
1887
|
+
* This property can be read in early-execution mode.
|
|
1888
|
+
*
|
|
1889
|
+
*/
|
|
1890
|
+
readonly formId: string;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
/**
|
|
1894
|
+
* @beta
|
|
1895
|
+
* Thrown when attempting to modify a form after it has already
|
|
1896
|
+
* been shown to a player. Form properties cannot be changed
|
|
1897
|
+
* while the form is active.
|
|
1898
|
+
*/
|
|
1899
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1900
|
+
export class InvalidFormModificationError extends Error {
|
|
1901
|
+
private constructor();
|
|
1902
|
+
/**
|
|
1903
|
+
* @remarks
|
|
1904
|
+
* The identifier of the form that was illegally modified after
|
|
1905
|
+
* being shown.
|
|
1906
|
+
*
|
|
1907
|
+
* This property can be read in early-execution mode.
|
|
1908
|
+
*
|
|
1909
|
+
*/
|
|
1910
|
+
readonly formId: string;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* @beta
|
|
1915
|
+
* Thrown when an observable value is expected to be writable,
|
|
1916
|
+
* but it is not.
|
|
1917
|
+
*/
|
|
1918
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1919
|
+
export class InvalidObservableError extends Error {
|
|
1920
|
+
private constructor();
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* @beta
|
|
1925
|
+
* Thrown when a form operation fails because the target player
|
|
1926
|
+
* has left the game.
|
|
1927
|
+
*/
|
|
1928
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1929
|
+
export class PlayerLeftError extends Error {
|
|
1930
|
+
private constructor();
|
|
1931
|
+
/**
|
|
1932
|
+
* @remarks
|
|
1933
|
+
* The identifier of the form that was being shown when the
|
|
1934
|
+
* player left the game.
|
|
1935
|
+
*
|
|
1936
|
+
* This property can be read in early-execution mode.
|
|
1937
|
+
*
|
|
1938
|
+
*/
|
|
1939
|
+
readonly formId: string;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1383
1942
|
export const uiManager: UIManager;
|