Improving typings of VirtualJoystick
This commit is contained in:
parent
fa2e583d48
commit
98d3a58861
@ -1,8 +1,8 @@
|
|||||||
import type { Direction } from "../../types";
|
|
||||||
import type { GameScene } from "../Game/GameScene";
|
import type { GameScene } from "../Game/GameScene";
|
||||||
import { touchScreenManager } from "../../Touch/TouchScreenManager";
|
import { touchScreenManager } from "../../Touch/TouchScreenManager";
|
||||||
import { MobileJoystick } from "../Components/MobileJoystick";
|
import { MobileJoystick } from "../Components/MobileJoystick";
|
||||||
import { enableUserInputsStore } from "../../Stores/UserInputStore";
|
import { enableUserInputsStore } from "../../Stores/UserInputStore";
|
||||||
|
import type { Direction } from "phaser3-rex-plugins/plugins/virtualjoystick.js";
|
||||||
|
|
||||||
interface UserInputManagerDatum {
|
interface UserInputManagerDatum {
|
||||||
keyInstance: Phaser.Input.Keyboard.Key;
|
keyInstance: Phaser.Input.Keyboard.Key;
|
||||||
|
37
front/src/rex-plugins.d.ts
vendored
37
front/src/rex-plugins.d.ts
vendored
@ -1,6 +1,39 @@
|
|||||||
|
//import Phaser from "phaser";
|
||||||
|
|
||||||
declare module "phaser3-rex-plugins/plugins/virtualjoystick.js" {
|
declare module "phaser3-rex-plugins/plugins/virtualjoystick.js" {
|
||||||
const content: any; // eslint-disable-line
|
/*const content: any; // eslint-disable-line
|
||||||
export default content;
|
export default content;*/
|
||||||
|
import GameObject = Phaser.GameObjects.GameObject;
|
||||||
|
import { Scene } from "phaser";
|
||||||
|
|
||||||
|
type CursorKey = {
|
||||||
|
isDown: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Direction = "left" | "right" | "up" | "down";
|
||||||
|
|
||||||
|
interface CursorKeys extends Record<Direction, CursorKey> {
|
||||||
|
left: CursorKey;
|
||||||
|
right: CursorKey;
|
||||||
|
up: CursorKey;
|
||||||
|
down: CursorKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VirtualJoystick extends GameObject {
|
||||||
|
constructor(scene: Scene, config: unknown);
|
||||||
|
enable: boolean;
|
||||||
|
base: GameObjects.Image;
|
||||||
|
thumb: GameObjects.Image;
|
||||||
|
setRadius: (radius: number) => void;
|
||||||
|
y: number;
|
||||||
|
x: number;
|
||||||
|
forceX: number;
|
||||||
|
forceY: number;
|
||||||
|
visible: boolean;
|
||||||
|
createCursorKeys: () => CursorKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default VirtualJoystick;
|
||||||
}
|
}
|
||||||
declare module "phaser3-rex-plugins/plugins/gestures-plugin.js" {
|
declare module "phaser3-rex-plugins/plugins/gestures-plugin.js" {
|
||||||
const content: any; // eslint-disable-line
|
const content: any; // eslint-disable-line
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import type Phaser from "phaser";
|
|
||||||
|
|
||||||
export type CursorKey = {
|
|
||||||
isDown: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Direction = "left" | "right" | "up" | "down";
|
|
||||||
|
|
||||||
export interface CursorKeys extends Record<Direction, CursorKey> {
|
|
||||||
left: CursorKey;
|
|
||||||
right: CursorKey;
|
|
||||||
up: CursorKey;
|
|
||||||
down: CursorKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IVirtualJoystick extends Phaser.GameObjects.GameObject {
|
|
||||||
y: number;
|
|
||||||
x: number;
|
|
||||||
forceX: number;
|
|
||||||
forceY: number;
|
|
||||||
visible: boolean;
|
|
||||||
createCursorKeys: () => CursorKeys;
|
|
||||||
}
|
|
@ -36,7 +36,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/CatsMiaow/node-grpc-typescript.git"
|
"url": "https://github.com/CatsMiaow/node-grpc-typescript.git#grpc_tools_node_protoc_ts"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Node.js",
|
"Node.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user