Skip to content

Commit 1caf8eb

Browse files
Stricter typings on managers
1 parent e39c6ec commit 1caf8eb

20 files changed

+197
-222
lines changed

lib/external/effekseer.d.ts

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
declare namespace effekseer {
22

33
/**
4-
* Initialize Effekseer.js.
5-
* This function must be called at first if use WebAssembly
6-
* @param {string} path A file of webassembply
7-
* @param {function=} onload A function that is called at loading complete
8-
* @param {function=} onerror A function that is called at loading error.
9-
*/
4+
* Initialize Effekseer.js.
5+
* This function must be called at first if use WebAssembly
6+
* @param {string} path A file of webassembply
7+
* @param {function=} onload A function that is called at loading complete
8+
* @param {function=} onerror A function that is called at loading error.
9+
*/
1010
export function initRuntime(path, onload, onerror);
1111

1212
/**
13-
* Create a context to render in multiple scenes
14-
* @returns {EffekseerContext} context
15-
*/
13+
* Create a context to render in multiple scenes
14+
* @returns {EffekseerContext} context
15+
*/
1616
export function createContext(): EffekseerContext;
1717

1818
/**
19-
* Release specified context. After that, don't touch a context
20-
* @param {EffekseerContext} context context
21-
*/
19+
* Release specified context. After that, don't touch a context
20+
* @param {EffekseerContext} context context
21+
*/
2222
export function releaseContext(context: EffekseerContext);
2323

2424
/**
25-
* Initialize graphics system.
26-
* @param {WebGLRenderingContext} webglContext WebGL Context
27-
* @param {object} settings Some settings with Effekseer initialization
28-
*/
29-
export function init(webglContext, settings?: object);
25+
* Initialize graphics system.
26+
* @param {WebGLRenderingContext} webglContext WebGL Context
27+
* @param {object} settings Some settings with Effekseer initialization
28+
*/
29+
export function init(webglContext, settings ?: Record<string, unknown>);
3030

3131
/**
3232
* Advance frames.
3333
* @param {number=} deltaFrames number of advance frames
3434
*/
35-
export function update(deltaFrames?: number);
35+
export function update(deltaFrames ? : number);
3636

3737
/**
3838
* Main rendering.
@@ -109,12 +109,12 @@ declare namespace effekseer {
109109
* @param {function=} onerror A function that is called at loading error. First argument is a message. Second argument is an url.
110110
* @returns {EffekseerEffect} The effect data
111111
*/
112-
export function loadEffect(path: string, scale?: number, onload?, onerror?): EffekseerEffect;
112+
export function loadEffect(path: string, scale ? : number, onload ? , onerror ? ): EffekseerEffect;
113113

114114
/**
115-
* Release the specified effect. Don't touch the instance of effect after released.
116-
* @param {EffekseerEffect} effect The loaded effect
117-
*/
115+
* Release the specified effect. Don't touch the instance of effect after released.
116+
* @param {EffekseerEffect} effect The loaded effect
117+
*/
118118
export function releaseEffect(effect: EffekseerEffect);
119119

120120
/**
@@ -139,23 +139,23 @@ declare namespace effekseer {
139139
export function setResourceLoader(loader);
140140

141141
/**
142-
* Get whether VAO is supported
143-
*/
142+
* Get whether VAO is supported
143+
*/
144144
export function isVertexArrayObjectSupported();
145145

146146
export class EffekseerContext {
147147
/**
148-
* Initialize graphics system.
149-
* @param {WebGLRenderingContext} webglContext WebGL Context
150-
* @param {object} settings Some settings with Effekseer initialization
151-
*/
152-
init(webglContext, settings?: object);
148+
* Initialize graphics system.
149+
* @param {WebGLRenderingContext} webglContext WebGL Context
150+
* @param {Record<string, unknown>} settings Some settings with Effekseer initialization
151+
*/
152+
init(webglContext: WebGLRenderingContextBase, settings?: Record<string, unknown>): void;
153153

154154
/**
155155
* Advance frames.
156156
* @param {number=} deltaFrames number of advance frames
157157
*/
158-
update(deltaFrames?: number);
158+
update(deltaFrames?: number): void;
159159

160160
/**
161161
* Main rendering.
@@ -233,12 +233,12 @@ declare namespace effekseer {
233233
* @param {function=} redirect A function to redirect a path. First argument is an url and return redirected url.
234234
* @returns {EffekseerEffect} The effect data
235235
*/
236-
loadEffect(path: string, scale?: number, onload?, onerror?, redirect?): EffekseerEffect;
236+
loadEffect(path: string, scale ? : number, onload ? , onerror ? , redirect ? ): EffekseerEffect;
237237

238238
/**
239-
* Release the specified effect. Don't touch the instance of effect after released.
240-
* @param {EffekseerEffect} effect The loaded effect
241-
*/
239+
* Release the specified effect. Don't touch the instance of effect after released.
240+
* @param {EffekseerEffect} effect The loaded effect
241+
*/
242242
releaseEffect(effect: EffekseerEffect);
243243

244244
/**
@@ -263,8 +263,8 @@ declare namespace effekseer {
263263
setResourceLoader(loader);
264264

265265
/**
266-
* Get whether VAO is supported
267-
*/
266+
* Get whether VAO is supported
267+
*/
268268
isVertexArrayObjectSupported();
269269

270270
/**
@@ -280,7 +280,7 @@ declare namespace effekseer {
280280
* get paths to color images
281281
* @returns {Array<string>} paths to color images
282282
*/
283-
getColorImagePaths(): Array<string>;
283+
getColorImagePaths(): Array < string > ;
284284
}
285285

286286
export class EffekseerHandle {
@@ -343,7 +343,7 @@ declare namespace effekseer {
343343
* @param {number} index slot index
344344
* @returns {number} value
345345
*/
346-
getDynamicInput(index) : number;
346+
getDynamicInput(index): number;
347347

348348
/**
349349
* specfiy a dynamic parameter, which changes effect parameters dynamically while playing
@@ -375,4 +375,4 @@ declare namespace effekseer {
375375

376376
declare module "effekseer" {
377377
export = effekseer;
378-
}
378+
}

lib/rpg_manager/AudioManager.d.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { WebAudio } from "../rpg_core/WebAudio";
22

3-
43
declare interface CurrentAudio {
54
name: string;
65
volume: number;
@@ -10,7 +9,6 @@ declare interface CurrentAudio {
109
}
1110

1211
declare class AudioManager {
13-
1412
private static _bgmVolume: number;
1513
private static _bgsVolume: number;
1614
private static _meVolume: number;
@@ -26,16 +24,16 @@ declare class AudioManager {
2624
private static _path: string;
2725

2826
public static get bgmVolume(): number;
29-
public static set bgmVolume(value: number): number;
27+
public static set bgmVolume(value: number);
3028

3129
public static get bgsVolume(): number;
32-
public static set bgsVolume(value: number): number;
30+
public static set bgsVolume(value: number);
3331

3432
public static get meVolume(): number;
35-
public static set meVolume(value: number): number;
33+
public static set meVolume(value: number);
3634

3735
public static get seVolume(): number;
38-
public static set seVolume(value: number): number;
36+
public static set seVolume(value: number);
3937

4038
public static playBgm(bgm: CurrentAudio, pos: number): void;
4139
public static replayBgm(bgm: CurrentAudio): void;

lib/rpg_manager/BattleManager.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ declare class BattleManager {
2020
private static _targets: unknown[];
2121
private static _logWindow: unknown;
2222
private static _spriteset;
23-
private static _escapeRatio = 0;
24-
private static _escaped = false;
25-
private static _rewards = {};
26-
private static _tpbNeedsPartyCommand = true;
23+
private static _escapeRatio: number;
24+
private static _escaped: boolean;
25+
private static _rewards: Record<string, unknown>;
26+
private static _tpbNeedsPartyCommand: boolean;
2727

2828
}

lib/rpg_manager/ColorManager.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare class ColorManager {
2626
public static tpGaugeColor2(): string;
2727
public static tpCostColor(): string;
2828
public static pendingColor(): string;
29-
public static hpColor(actor: any): string; // TODO : make sure it's an edited as an actor.
29+
public static hpColor(actor: Game_Actor): string;
3030
public static mpColor(): string;
3131
public static tpColor(): string;
3232
public static paramchangeTextColor(change: number): string;

lib/rpg_manager/ConfigManager.d.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,23 @@ declare class ConfigManager {
1717
private static _isLoaded: boolean;
1818

1919
private static _bgmVolume: number;
20-
private static bgsVolume: number;
21-
private static meVolume: number;
22-
private static seVolume: number;
20+
private static _bgsVolume: number;
21+
private static _meVolume: number;
22+
private static _seVolume: number;
2323

2424
constructor();
2525

2626
public static get bgmVolume(): number;
27-
public static set bgmVolume(value: number): number;
27+
public static set bgmVolume(value: number);
28+
2829
public static get bgsVolume(): number;
29-
public static set bgsVolume(value: number): number;
30+
public static set bgsVolume(value: number);
31+
3032
public static get meVolume(): number;
31-
public static set meVolume(value: number): number;
33+
public static set meVolume(value: number);
34+
3235
public static get seVolume(): number;
33-
public static set seVolume(value: number): number;
36+
public static set seVolume(value: number);
3437

3538
public static load(): void;
3639
public static save(): void;

0 commit comments

Comments
 (0)