-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from khasanovbi/board_plugin
[Feature] Add declaration files for board plugin
- Loading branch information
Showing
221 changed files
with
2,810 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module 'phaser3-rex-plugins/plugins/bank' { | ||
import Bank from 'phaser3-rex-plugins/plugins/data/bank/Bank'; | ||
export default Bank; | ||
} |
43 changes: 43 additions & 0 deletions
43
@types/phaser3-rex-plugins/plugins/behaviors/moveto/MoveTo.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
declare module 'phaser3-rex-plugins/plugins/behaviors/moveto/MoveTo' { | ||
import TickTask, {TickTaskConfig} from 'phaser3-rex-plugins/plugins/utils/ticktask/TickTask'; | ||
|
||
export interface MoveToConfig extends TickTaskConfig { | ||
isRunning?: boolean; | ||
enable?: boolean; | ||
timeScale?: number; | ||
speed?: number; | ||
rotateToTarget?: boolean; | ||
targetX?: number; | ||
targetY?: number; | ||
} | ||
|
||
export default class MoveTo<T extends Phaser.Events.EventEmitter = any> extends TickTask<T> { | ||
gameObject: any; | ||
scene: any; | ||
timeScale: any; | ||
targetX: any; | ||
targetY: any; | ||
enable: any; | ||
speed: any; | ||
rotateToTarget: any; | ||
|
||
constructor(gameObject: any, config: MoveToConfig); | ||
|
||
resetFromJSON(config: MoveToConfig): this; | ||
|
||
toJSON(): MoveToConfig; | ||
|
||
destroy(): void; | ||
|
||
setEnable(e?: boolean): this; | ||
|
||
setSpeed(speed: number): this; | ||
|
||
setRotateToTarget(rotateToTarget: boolean): this; | ||
|
||
moveTo(x: number, y: number): this; | ||
moveTo(config: {x: number; y: number}): this; | ||
|
||
update(time: number, delta: number): this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
declare module 'phaser3-rex-plugins/plugins/board-components' { | ||
import Board from 'phaser3-rex-plugins/plugins/board/board/Board'; | ||
import HexagonGrid from 'phaser3-rex-plugins/plugins/board/grid/hexagon/Hexagon'; | ||
import QuadGrid from 'phaser3-rex-plugins/plugins/board/grid/quad/Quad'; | ||
import Shape from 'phaser3-rex-plugins/plugins/board/shape/Shape'; | ||
import Match from 'phaser3-rex-plugins/plugins/board/match/Match'; | ||
import MoveTo from 'phaser3-rex-plugins/plugins/board/moveto/MoveTo'; | ||
import PathFinder from 'phaser3-rex-plugins/plugins/board/pathfinder/PathFinder'; | ||
import FieldOfView from 'phaser3-rex-plugins/plugins/board/fieldofview/FieldOfView'; | ||
import Monopoly from 'phaser3-rex-plugins/plugins/board/monopoly/Monopoly'; | ||
import MiniBoard from 'phaser3-rex-plugins/plugins/board/miniboard/MiniBoard'; | ||
import HexagonMap from 'phaser3-rex-plugins/plugins/board/hexagonmap'; | ||
|
||
export { | ||
Board, | ||
HexagonGrid, | ||
QuadGrid, | ||
Shape, | ||
Match, | ||
MoveTo, | ||
PathFinder, | ||
FieldOfView, | ||
Monopoly, | ||
MiniBoard, | ||
HexagonMap, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare module 'phaser3-rex-plugins/plugins/board-plugin' { | ||
import * as Phaser from 'phaser'; | ||
import HexagonMap from 'phaser3-rex-plugins/plugins/board/hexagonmap'; | ||
import ObjectFactory from 'phaser3-rex-plugins/plugins/board/ObjectFactory'; | ||
|
||
export default class BoardPlugin extends Phaser.Plugins.ScenePlugin { | ||
add: ObjectFactory; | ||
hexagonMap: typeof HexagonMap; | ||
|
||
constructor(scene: Phaser.Scene, pluginManager: Phaser.Plugins.PluginManager); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
@types/phaser3-rex-plugins/plugins/board/ObjectFactory.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
declare module 'phaser3-rex-plugins/plugins/board/ObjectFactory' { | ||
import * as Phaser from 'phaser'; | ||
import Board from 'phaser3-rex-plugins/plugins/board/board/Board'; | ||
import ChessData from 'phaser3-rex-plugins/plugins/board/chess/ChessData'; | ||
|
||
export default class ObjectFactory { | ||
scene: Phaser.Scene; | ||
displayList: Phaser.GameObjects.DisplayList; | ||
updateList: Phaser.GameObjects.UpdateList; | ||
|
||
constructor(scene: Phaser.Scene); | ||
|
||
static register(type: string, callback: Function): void; | ||
|
||
// TODO: Move outside and use declaration merging. | ||
board(boardSettings: { | ||
width?: number; | ||
height?: number; | ||
grid?: { | ||
gridType?: 'hexagonGrid' | 'quadGrid'; | ||
x?: number; | ||
y?: number; | ||
cellWidth?: number; | ||
cellHeight?: number; | ||
staggeraxis?: 'x' | 'y'; | ||
staggerindex?: 'odd' | 'even'; | ||
type?: 'orthogonal' | 'isometric'; | ||
size?: number; | ||
}; | ||
}): Board; | ||
|
||
shape( | ||
board?: Board, | ||
tileX?: number, | ||
tileY?: number, | ||
tileZ?: number, | ||
fillColor?: any, | ||
fillAlpha?: number, | ||
addToBoard?: boolean, | ||
): ChessData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare module 'phaser3-rex-plugins/plugins/board/board/Board' { | ||
import LogicBoard from 'phaser3-rex-plugins/plugins/board/board/LogicBoard'; | ||
|
||
// NOTE: setInteractive assigned to LogicBoard.prototype as side effect | ||
type Board = LogicBoard; | ||
export default Board; | ||
} |
210 changes: 210 additions & 0 deletions
210
@types/phaser3-rex-plugins/plugins/board/board/LogicBoard.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
declare module 'phaser3-rex-plugins/plugins/board/board/LogicBoard' { | ||
import * as Phaser from 'phaser'; | ||
import EE from 'phaser3-rex-plugins/plugins/utils/eventemitter/EventEmitter'; | ||
import BoardData from 'phaser3-rex-plugins/plugins/board/board/boarddata/BoardData'; | ||
import LogicMethods from 'phaser3-rex-plugins/plugins/board/board/LogicMethods'; | ||
import GetTileXYAtDirection from 'phaser3-rex-plugins/plugins/board/board/neighbors/GetTileXYAtDirection'; | ||
import {SetInteractiveType} from 'phaser3-rex-plugins/plugins/board/board/input/SetInteractive'; | ||
|
||
export interface BoardConfig { | ||
isBoard?: boolean; | ||
grid?: any; | ||
wrap?: boolean; | ||
infinity?: boolean; | ||
width?: number; | ||
height?: number; | ||
} | ||
|
||
interface SetInteractive { | ||
setInteractive: SetInteractiveType<this>; | ||
} | ||
|
||
type LogicMethodsType = typeof LogicMethods; | ||
|
||
export default class Board extends EE implements LogicMethodsType, SetInteractive { | ||
scene: Phaser.Scene; | ||
boardData: BoardData; | ||
isBoard: boolean; | ||
grid: any; | ||
wrapMode: boolean; | ||
infinityMode: boolean; | ||
|
||
constructor(scene: Phaser.Scene, config: BoardConfig); | ||
|
||
resetFromJSON(o: BoardConfig): this; | ||
|
||
boot(): void; | ||
|
||
setGrid(grid: any): this; | ||
|
||
setWrapMode(mode?: boolean): this; | ||
|
||
setInfinityMode(mode?: boolean): this; | ||
|
||
setBoardSize(width: number, height: number): this; | ||
|
||
exists(gameObject: any): boolean; | ||
|
||
get chessCount(): number; | ||
|
||
clear(destroy?: boolean): this; | ||
|
||
TileXYToKey(tileX: any, tileY: any, separator: any): string; | ||
|
||
addChess(gameObject: any, tileX: number, tileY: number, tileZ?: number, align?: boolean): this; | ||
|
||
angleBetween(tileA: any, tileB: any): number; | ||
|
||
angleSnapToDirection(tileXY: any, angle: number): number | undefined; | ||
|
||
angleToward(tileXY: any, direction: any): number; | ||
|
||
areNeighbors(chessA: any, chessB: any): boolean; | ||
|
||
chessToTileXYZ(chess: any): any; | ||
|
||
circleToTileXYArray(circle: any, out?: any[]): any[]; | ||
|
||
contains(tileX: number, tileY: number, tileZ?: number): boolean; | ||
|
||
directionBetween(chessA: any, chessB: any, round?: boolean): number; | ||
|
||
ellipseToTileXYArray(ellipse: any, out?: any[]): any[]; | ||
|
||
filledRingToTileXYArray(centerTileXY: any, radius: number, nearToFar?: boolean | any[], out?: any[]): any[]; | ||
|
||
fit(tileXYArray: any[]): any[]; | ||
|
||
forEachTileXY(callback: Function, scope: any, order?: 0 | 1 | 2 | 3): this; | ||
|
||
getAllChess(out?: any[]): any[]; | ||
|
||
getChessData(gameObject: any): any; | ||
|
||
getChessUID(gameObject: any): any; | ||
|
||
getDistance(tileA: any, tileB: any, roughMode: any): number; | ||
|
||
getEmptyTileXYArray(tileZ?: number, out?: any[]): any[]; | ||
|
||
getGridPoints(tileX: number, tileY: number, points: any): any; | ||
|
||
getNeighborChess( | ||
chess: any, | ||
directions: number | string | number[], | ||
neighborTileZ: any, | ||
out?: any[], | ||
): any[] | null; | ||
|
||
getNeighborChessDirection(chess: any, neighborChess: any): number; | ||
|
||
getNeighborTileDirection(srcTileXY: any, neighborTileXY: any): number; | ||
|
||
getNeighborTileXY( | ||
srcTileXY: any, | ||
directions: any[] | string | number, | ||
out?: any[], | ||
): ReturnType<typeof GetTileXYAtDirection>; | ||
|
||
getNeighborTileXYAtAngle(srcTileXY: any, angle: number, out?: any[]): ReturnType<typeof GetTileXYAtDirection>; | ||
|
||
getOppositeDirection(tileX: number, tileY: number, direction: number): boolean; | ||
|
||
getRandomEmptyTileXY(tileZ?: number, out?: any[] | true): any[] | null; | ||
|
||
getTileXYAtDirection( | ||
chess: any, | ||
directions: any[] | string | number, | ||
distance: number | {start: number; end: number; step: number} | number[], | ||
out?: any[], | ||
): any[] | null; | ||
|
||
getWrapTileXY(tileX: number, tileY: number, out: any): any; | ||
|
||
gridAlign(gameObject: any, tileX: number, tileY: number): this; | ||
|
||
hasBlocker(tileX: number, tileY: number, tileZ?: number): boolean; | ||
|
||
hasEdgeBlocker(tileX: number, tileY: number, tileZ?: number, direction?: number): boolean; | ||
|
||
isAngleInCone(chessA: any, chessB: any, face: number, cone: number): boolean; | ||
|
||
isDirectionInCone(chessA: any, chessB: any, face: number, cone: number): boolean; | ||
|
||
isOverlappingPoint(worldX: number, worldY: number, tileZ?: number): boolean; | ||
|
||
keyToTileXYZ(key: any, out: any, separator: any): any; | ||
|
||
lineToTileXYArray(startX: any, startY: any, endX: any, endY: any, out?: any[]): any[]; | ||
|
||
mirror(tileXY: any, mode: any, originTileXY: any, out: any): any; | ||
|
||
moveChess(gameObject: any, tileX: number, tileY: number, tileZ?: number, align?: boolean): this; | ||
|
||
offset(tileXY: any, OffsetTileX: number, OffsetTileY: number, out: any): any; | ||
|
||
polygonToTileXYArray(polygon: any, out?: any[]): any[]; | ||
|
||
rectangleToTileXYArray(rectangle: any, out?: any[]): any[]; | ||
|
||
removeAllChess(destroy?: boolean, fromBoardRemove?: boolean): this; | ||
|
||
removeChess( | ||
gameObject: any, | ||
tileX: number, | ||
tileY: number, | ||
tileZ: number, | ||
destroy?: boolean, | ||
fromBoardRemove?: boolean, | ||
): this; | ||
|
||
ringToTileXYArray(centerTileXY: any, radius: number, out?: any[]): any[]; | ||
|
||
rotate(tileXY: any, direction: any, originTileXY: number, out: any): any; | ||
|
||
setBoardHeight(height: number): this; | ||
|
||
setBoardWidth(width: number): this; | ||
|
||
shapeToTileXYArray(shape: any, containsCallback: Function, out?: any[]): any[]; | ||
|
||
swapChess(gameObjectA: any, gameObjectB: any, align?: boolean): this; | ||
|
||
tileXYArrayToChessArray(tileXYArray: any[], tileZ: any, out?: any[]): any[]; | ||
|
||
tileXYArrayToWorldXYArray(tileXYArray: any[], out?: any[]): any[]; | ||
|
||
tileXYToChessArray(tileX: number, tileY: number, out?: any[]): any[]; | ||
|
||
tileXYToWorldX(tileX: number, tileY: number): number; | ||
|
||
tileXYToWorldXY(tileX: number, tileY: number, out: any): any; | ||
|
||
tileXYToWorldY(tileX: number, tileY: number): number; | ||
|
||
tileXYZToChess(tileX: number, tileY: number, tileZ?: number): any; | ||
|
||
tileXYZToKey(tileX: any, tileY: any, tileZ: any, separator: any): string; | ||
|
||
tileZToChessArray(tileZ: number, out?: any[]): any[]; | ||
|
||
triangleToTileXYArray(triangle: any, out?: any[]): any[]; | ||
|
||
uidToChess(uid: any): any; | ||
|
||
worldXYSnapToGrid(worldX: number, worldY: number, out: any): any; | ||
|
||
worldXYToChess(worldX: number, worldY: number, tileZ?: number): any; | ||
|
||
worldXYToChessArray(worldX: number, worldY: number, out?: any[]): any[]; | ||
|
||
worldXYToTileX(worldX: number, worldY: number): number; | ||
|
||
worldXYToTileXY(worldX: number, worldY: number, out: any): any; | ||
|
||
worldXYToTileY(worldX: number, worldY: number): number; | ||
|
||
// NOTE: setInteractive assigned at Board.js as side effect | ||
setInteractive(enable?: boolean): this; | ||
} | ||
} |
Oops, something went wrong.