You've already forked FullScreenPokemon
mirror of
https://github.com/FullScreenShenanigans/FullScreenPokemon.git
synced 2026-04-28 12:58:40 -07:00
90646a8b16
* Started moving components to gulp-shenanigans This is a first round of refactoring. All non-reset functions in `FullScreenPokemon.ts` have been moved to dedicated classes, though many haven't had the references updated. * Brought in .files, BattleMovr, MenuGraphr * Fixed up imported files for tslint * Fixed test dependencies to run * Added settings files to compilation * Added necessary prototypes in FSP.ts * Converted settings classes to Generate* functions This way, `src\FullScreenPokemon.ts` can decide when to call the generators. It does so immediately after defining the `FullScreenPokemon` class and its prototype values. * Refactored settings into generators This fixes most scoping issues with settings files. Note that a few modules have local updates that will need to be pushed for this to build successfully. * Fixed scoping for menus * Removed Function::bind usages No more! * Fleshed out html build settings lib\index.html works now * Fixed reference issues with MapScreenr's variables They're no longer direct members of MapScreenr itself, but rather of its `variables` member. * Bump gulp-shenanigans to 0.4.0 * Fixed some case sensitivity * Fixed some more case sensitivity * Fixed case sensitivity for main settings * Bump gulp-shenanigans to 0.4.1 * Added and removed logs in src/main.ts (#296) * Added test logs to main.ts * Removed src/main.ts logs * Moved sounds into the correct src\ directory These were pulled in from master but not moved accordingly. * Fixed new tslint errors from gulp-shenanigans From updating to a newer tslint.json with the setup task, the more strict rules are now being violated. * Bumped gulp-shenanigans to 0.4.2 * Bump gulp-shenanigans to 0.4.3 * Onboarded shenanigans.json The biggest change is that LevelEditr and UserWrappr are no longer pre-packaged with GameStartr. They're now separately defined in FSP. * Brought in recent module updates Also fixed some scoping issues with battles. * Fixed the pause menu to open on pause buttons Previously they were calling the GamesRunnr pause functions, which aren't what was intended. * Bumped UserWrappr to 0.5.4 * Fixed onload listeners in src\main.ts (#300) * Added test throw for body innerHTML * Put main.ts logic behind a load event * Removed remaining main.ts throw * Moved require logic out of onload in main.ts * Fix load listener placement * Bumped MapsCreatr to 0.5.3 Fixed scoping issues with macros * Removed LevelEditor reference from Storage.ts Since LevelEditor is no longer defined on FSP, saving a game can't use its beautification function * Changed saving dialog to delete all menus when done * Fixed TimeHandlr scope issues for battle cutscenes
143 lines
4.4 KiB
TypeScript
143 lines
4.4 KiB
TypeScript
declare namespace StringFilr {
|
|
/**
|
|
* The core stored library in a StringFilr, as a tree of data.
|
|
*/
|
|
interface ILibrary<T> {
|
|
[i: string]: T | ILibrary<T>;
|
|
}
|
|
/**
|
|
* A cache of previously completed lookups.
|
|
*/
|
|
interface ICache<T> {
|
|
[i: string]: T | ILibrary<T>;
|
|
}
|
|
/**
|
|
* Settings to initialize a new IStringFilr.
|
|
*/
|
|
interface IStringFilrSettings<T> {
|
|
/**
|
|
* An Object containing data stored as children of sub-Objects.
|
|
*/
|
|
library: ILibrary<T>;
|
|
/**
|
|
* A String to use as a default key to rescue on, if provided.
|
|
*/
|
|
normal?: string;
|
|
/**
|
|
* Whether the library is required to contain the normal key in every
|
|
* descendent (by default, false).
|
|
*/
|
|
requireNormalKey?: boolean;
|
|
}
|
|
/**
|
|
* A path-based cache for quick loops in nested data structures.
|
|
*/
|
|
interface IStringFilr<T> {
|
|
/**
|
|
* @returns The base library of stored information.
|
|
*/
|
|
getLibrary(): ILibrary<T>;
|
|
/**
|
|
* @returns The optional normal class String.
|
|
*/
|
|
getNormal(): string;
|
|
/**
|
|
* @returns The complete cache of previously completed lookups.
|
|
*/
|
|
getCache(): ICache<T>;
|
|
/**
|
|
* @returns A cached value, if it exists.
|
|
*/
|
|
getCached(key: string): T | ILibrary<T>;
|
|
/**
|
|
* Completely clears the lookup cache.
|
|
*/
|
|
clearCache(): void;
|
|
/**
|
|
* Clears the cached entry for a key.
|
|
*
|
|
* @param keyRaw The raw key whose lookup is to be cleared.
|
|
*/
|
|
clearCached(key: string): void;
|
|
/**
|
|
* Retrieves the deepest matching data in the library for a key.
|
|
*
|
|
* @param keyRaw The raw key for data to look up, in String form.
|
|
* @returns The deepest matching data in the library.
|
|
*/
|
|
get(keyRaw: string): T | ILibrary<T>;
|
|
}
|
|
/**
|
|
* A path-based cache for quick loops in nested data structures.
|
|
*/
|
|
class StringFilr<T> implements IStringFilr<T> {
|
|
/**
|
|
* The library of data.
|
|
*/
|
|
private library;
|
|
/**
|
|
* A cache of previously completed lookups.
|
|
*/
|
|
private cache;
|
|
/**
|
|
* Optional default index to check when no suitable option is found.
|
|
*/
|
|
private normal;
|
|
/**
|
|
* Whether to crash when a sub-object in reset has no normal child.
|
|
*/
|
|
private requireNormalKey;
|
|
/**
|
|
* Initializes a new instance of the StringFilr class.
|
|
*
|
|
* @param settings Settings to be used for initialization.
|
|
*/
|
|
constructor(settings: IStringFilrSettings<T>);
|
|
/**
|
|
* @returns The base library of stored information.
|
|
*/
|
|
getLibrary(): ILibrary<T>;
|
|
/**
|
|
* @returns The optional normal class String.
|
|
*/
|
|
getNormal(): string;
|
|
/**
|
|
* @returns The complete cache of previously completed lookups.
|
|
*/
|
|
getCache(): ICache<T>;
|
|
/**
|
|
* @returns A cached value, if it exists.
|
|
*/
|
|
getCached(key: string): any;
|
|
/**
|
|
* Completely clears the lookup cache.
|
|
*/
|
|
clearCache(): void;
|
|
/**
|
|
* Clears the cached entry for a key.
|
|
*
|
|
* @param keyRaw The raw key whose lookup is to be cleared.
|
|
*/
|
|
clearCached(keyRaw: string): void;
|
|
/**
|
|
* Retrieves the deepest matching data in the library for a key.
|
|
*
|
|
* @param keyRaw The raw key for data to look up, in String form.
|
|
* @returns The deepest matching data in the library.
|
|
*/
|
|
get(keyRaw: string): T | ILibrary<T>;
|
|
/**
|
|
* Utility Function to follow a path into the library (this is the driver
|
|
* for searching into the library). For each available key, if it matches
|
|
* a key in current, it is removed from keys and recursion happens on the
|
|
* sub-directory in current.
|
|
*
|
|
* @param keys The currently available keys to search within.
|
|
* @param current The current location being searched within the library.
|
|
* @returns The most deeply matched part of the library.
|
|
*/
|
|
private followClass(keys, current);
|
|
}
|
|
}
|
|
declare var module: any;
|