Refactor code for consistency and readability

- Updated import statements to use consistent formatting across files.
- Adjusted method definitions and class constructors for uniform spacing and style.
- Simplified promise handling and error messages in state handlers.
- Enhanced state transition logic in various state handlers.
- Improved quirk animation handling in WaitStateHandler.
- Streamlined animation loading and caching mechanisms in AnimationLoader.
- Updated Vite configuration for aliasing.
This commit is contained in:
2025-05-24 01:14:35 +02:00
parent 658e1e64b2
commit bb28337d94
23 changed files with 4216 additions and 1281 deletions

View File

@ -9,21 +9,21 @@
* @enum {string}
*/
export const ClipTypes = {
/** Loop animation */
LOOP: 'L',
/** Quirk animation */
QUIRK: 'Q',
/** Nested loop animation */
NESTED_LOOP: 'NL',
/** Nested quirk animation */
NESTED_QUIRK: 'NQ',
/** Nested in transition */
NESTED_IN: 'IN_NT',
/** Nested out transition */
NESTED_OUT: 'OUT_NT',
/** Transition animation */
TRANSITION: 'T',
};
/** Loop animation */
LOOP: 'L',
/** Quirk animation */
QUIRK: 'Q',
/** Nested loop animation */
NESTED_LOOP: 'NL',
/** Nested quirk animation */
NESTED_QUIRK: 'NQ',
/** Nested in transition */
NESTED_IN: 'IN_NT',
/** Nested out transition */
NESTED_OUT: 'OUT_NT',
/** Transition animation */
TRANSITION: 'T'
}
/**
* Character animation states
@ -31,15 +31,15 @@ export const ClipTypes = {
* @enum {string}
*/
export const States = {
/** Waiting/idle state */
WAIT: 'wait',
/** Reacting to input state */
REACT: 'react',
/** Typing response state */
TYPE: 'type',
/** Sleep/inactive state */
SLEEP: 'sleep',
};
/** Waiting/idle state */
WAIT: 'wait',
/** Reacting to input state */
REACT: 'react',
/** Typing response state */
TYPE: 'type',
/** Sleep/inactive state */
SLEEP: 'sleep'
}
/**
* Character emotional states
@ -47,17 +47,17 @@ export const States = {
* @enum {string}
*/
export const Emotions = {
/** Neutral emotion */
NEUTRAL: '',
/** Angry emotion */
ANGRY: 'an',
/** Shocked emotion */
SHOCKED: 'sh',
/** Happy emotion */
HAPPY: 'ha',
/** Sad emotion */
SAD: 'sa',
};
/** Neutral emotion */
NEUTRAL: '',
/** Angry emotion */
ANGRY: 'an',
/** Shocked emotion */
SHOCKED: 'sh',
/** Happy emotion */
HAPPY: 'ha',
/** Sad emotion */
SAD: 'sa'
}
/**
* Default configuration values
@ -65,14 +65,14 @@ export const Emotions = {
* @type {Object}
*/
export const Config = {
/** Default fade in duration for animations (ms) */
DEFAULT_FADE_IN: 0.3,
/** Default fade out duration for animations (ms) */
DEFAULT_FADE_OUT: 0.3,
/** Default quirk interval (ms) */
QUIRK_INTERVAL: 5000,
/** Default inactivity timeout (ms) */
INACTIVITY_TIMEOUT: 60000,
/** Quirk probability threshold */
QUIRK_PROBABILITY: 0.3,
};
/** Default fade in duration for animations (ms) */
DEFAULT_FADE_IN: 0.3,
/** Default fade out duration for animations (ms) */
DEFAULT_FADE_OUT: 0.3,
/** Default quirk interval (ms) */
QUIRK_INTERVAL: 5000,
/** Default inactivity timeout (ms) */
INACTIVITY_TIMEOUT: 60000,
/** Quirk probability threshold */
QUIRK_PROBABILITY: 0.3
}