Skip to content

Commit

Permalink
update: add icon.getStateNames() API & tidy up code
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleactii committed Oct 24, 2024
1 parent 0057ec6 commit 57306ee
Show file tree
Hide file tree
Showing 10 changed files with 362 additions and 28 deletions.
112 changes: 110 additions & 2 deletions docs/Frame.html

Large diffs are not rendered by default.

226 changes: 221 additions & 5 deletions docs/Icon.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/VYI.html

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions docs/frame.mjs.html

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions docs/icon.mjs.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/vyi.mjs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vyi",
"version": "1.6.0",
"version": "1.61.0",
"description": "A lightweight module to read / manage .vyi files created in the Vylocity Game Engine.",
"main": "src/vyi.mjs",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion src/frame.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export class Frame {
}
/**
* Exports this frame's data into proper vyi format.
* @private
* @returns {Array} An array of data related to this frame in the proper vyi format.
*/
export() {
Expand Down
14 changes: 10 additions & 4 deletions src/icon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -590,16 +590,23 @@ export class Icon {
return this.states.get(pId);
}
/**
* Returns an array of all the states this icons has.
* @returns {Array} An array of states this icon has.
* Returns an array of all the states this icon has.
* @returns {Icon[]} An array of states this icon has.
*/
getStates() {
return Array.from(this.states.values());
}
/**
* Returns an array of all the state names this icon has.
* @returns {string[]} An array of the state names.
*/
getStateNames() {
return this.states.map((pState) => pState.getName());
}
/**
* Gets all the states belonging to this icon.
* @private
* @returns {Array} An array containing the state data of all frames.
* @returns {object[]} An array containing the state data of all frames.
*/
getStatesData() {
const stateDataArray = this.getStates().map((pState) => pState.exportAsState());
Expand All @@ -624,7 +631,6 @@ export class Icon {
}
/**
* Exports this icon's data into proper vyi format.
* @private
* @returns {Array} An array of data related to this icon in the proper vyi format.
*/
export() {
Expand Down

0 comments on commit 57306ee

Please sign in to comment.