Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KlutzyBubbles committed Feb 10, 2024
1 parent 7645691 commit 2af31e7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 137 deletions.
1 change: 0 additions & 1 deletion types/color.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ interface Color extends ColorInput {
}

// Because capitalization is ignored, and custom colors can be added, a lot more indexers can be used
// TODO Check if indexing a not known color errors or undefined
type ColorConstructor = {
[index in ColorLiteralIgnoreCase]: Color;
} & {
Expand Down
2 changes: 1 addition & 1 deletion types/object.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ interface GObject extends GlobalConstructor {
*/
attachInvisibleHider(this: void, id: string, hidden: boolean, players?: ColorLiteral[]): boolean;

UI: UI;
UI: UIConstructor;
}

interface GObjectConstructor {
Expand Down
2 changes: 1 addition & 1 deletion types/timer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type CreateTimer = {
*
* Will not be used by default
*/
parameters?: any;
parameters?: CustomTableObject;

/**
* Length of time in seconds before the function is triggered.
Expand Down
9 changes: 7 additions & 2 deletions types/turns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ interface TurnsConstructor {
/**
* If the turn order is automatic or custom. 1=auto, 2=custom.
*/
type: number;
type: TurnOrderType;

/**
* A table of strings, representing the player turn order.
*/
order: string[];
order: ColorLiteral[];

/**
* Enable/disable reversing turn rotation direction.
Expand Down Expand Up @@ -56,6 +56,11 @@ interface TurnsConstructor {
getPreviousTurnColor(this: void): ColorLiteral;
}

declare const enum TurnOrderType {
Auto = 1,
Custom = 2
}

/**
* Turns, a static global class, is the in-game turns system. It allows you to modify the player turns in the same way that the in-game Turns menu does.
*
Expand Down
132 changes: 0 additions & 132 deletions types/ui.d.ts
Original file line number Diff line number Diff line change
@@ -1,135 +1,3 @@
interface UI {
/**
* Indicates whether (the server) has finished loading all UI custom assets.
*/
loading: boolean;

/**
* Obtains the value of a specified attribute of a UI element. What it returns will typically be a string or a number.
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @param {string} attribute The name of the attribute you wish to get the value of.
* @returns {any} The value of the attribute.
*/
getAttribute(this: void, id: string, attribute: string): any;

/**
* Returns the attributes and their values of a UI element. It only returns the attributes (and values) for elements that have had those attributes set by the user.
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @returns {Record<string, any>} A table of attributes and their values.
*/
getAttributes(this: void, id: string): Record<string, any>;

/**
* Returns a table/array of custom assets.
*
* @returns {CustomAsset[]} A table/array of custom assets.
*/
getCustomAssets(this: void): CustomAsset[];

/**
* Obtains the value between elements tags, like: <Text>ValueToGet</Text>
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @returns {string} The value between elements tags.
*/
getValue(this: void, id: string): string;

/**
* Returns the contents of the current UI formatted as XML.
*
* @returns {string} The contents of the current UI formatted as XML.
*/
getXml(this: void): string;

/**
* Returns the contents of the current UI formatted as a table.
*
* @returns {XMLData} The contents of the current UI formatted as a table.
*/
getXmlTable(this: void): XMLData;

/**
* Hides the given UI element. Unlike the "active" attribute, hide triggers animations.
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @returns {boolean} True if the UI element was hidden, false otherwise.
*/
hide(this: void, id: string): boolean;

/**
* Sets the value of a specified attribute of a UI element.
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @param {string} attribute The name of the attribute you want to set the value of.
* @param {any} value The value to set for the attribute.
* @returns {boolean} True if the attribute was set, false otherwise.
*/
setAttribute(this: void, id: string, attribute: string, value: any): boolean;

/**
* Updates the value of the supplied attributes of a UI element. You do not need to set every attribute with the data table, an element will continue using any previous values you do not overwrite.
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @param {Record<string, any>} data A Table with key/value pairs representing attributes and their values.
* @returns {boolean} True if the attributes were set, false otherwise.
*/
setAttributes(this: void, id: string, data: Record<string, any>): boolean;

/**
* Replaces all classes on a UI element.
*
* @param {string} id The ID of the UI element that should have its classes replaced.
* @param {string} names Space separated class names.
* @returns {boolean} True if the classes were set, false otherwise.
*/
setClass(this: void, id: string, names: string): boolean;

/**
* Sets/replaces the custom assets which your UI may make use of.
*
* @param {CustomAsset[]} assets A table/array containing sub-tables which each represent a custom asset.
* @returns {boolean} True if the custom assets were set, false otherwise.
*/
setCustomAssets(this: void, assets: CustomAsset[]): boolean;

/**
* Updates the value between elements tags, like: <Text>ValueChanged</Text>
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @param {string} value The value to put between the element tags.
* @returns {boolean} True if the value was set, false otherwise.
*/
setValue(this: void, id: string, value: string): boolean;

/**
* Sets/replaces the UI with the contents of the provided XML.
*
* @param {string} xml A string containing XML representing the desired UI.
* @param {CustomAsset} assets A table/array containing sub-tables which each represent a custom asset.
* @returns {boolean} True if the UI was set, false otherwise.
*/
setXml(this: void, xml: string, assets: CustomAsset): boolean;

/**
* Sets/replaces the UI with the contents of the provided UI table.
*
* @param {XMLData} data The UI table to set the UI to.
* @param {CustomAsset} assets A table/array of custom assets.
* @returns {boolean} True if the UI was set, false otherwise.
*/
setXmlTable(this: void, data: XMLData, assets?: CustomAsset[]): boolean;

/**
* Displays the given UI element. Unlike the "active" attribute, show triggers animations.
*
* @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element.
* @returns {boolean} True if the UI element was shown, false otherwise.
*/
show(this: void, id: string): boolean;
}

interface UIConstructor {
/**
* Indicates whether (the server) has finished loading all UI custom assets.
Expand Down

0 comments on commit 2af31e7

Please sign in to comment.