Merge pull request #237 from moufmouf/definitely_assigned

Switching to definitely assigned parameters
This commit is contained in:
David Négrier 2020-08-09 16:38:12 +02:00 committed by GitHub
commit 4b940a571c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 55 additions and 58 deletions

View File

@ -7,8 +7,6 @@ import {Character} from "../Entity/Character";
*/
export class RemotePlayer extends Character {
userId: string;
previousDirection: string;
wasMoving: boolean;
constructor(
userId: string,

View File

@ -13,8 +13,8 @@ export interface HasMovedEvent {
}
export class GameManager {
private playerName: string;
private characterLayers: string[];
private playerName!: string;
private characterLayers!: string[];
public setPlayerName(name: string): void {
this.playerName = name;

View File

@ -73,31 +73,31 @@ interface DeleteGroupEventInterface {
export class GameScene extends Phaser.Scene {
GameManager : GameManager;
Terrains : Array<Phaser.Tilemaps.Tileset>;
CurrentPlayer: CurrentGamerInterface;
MapPlayers : Phaser.Physics.Arcade.Group;
CurrentPlayer!: CurrentGamerInterface;
MapPlayers!: Phaser.Physics.Arcade.Group;
MapPlayersByKey : Map<string, RemotePlayer> = new Map<string, RemotePlayer>();
Map: Phaser.Tilemaps.Tilemap;
Layers : Array<Phaser.Tilemaps.StaticTilemapLayer>;
Objects : Array<Phaser.Physics.Arcade.Sprite>;
mapFile: ITiledMap;
Map!: Phaser.Tilemaps.Tilemap;
Layers!: Array<Phaser.Tilemaps.StaticTilemapLayer>;
Objects!: Array<Phaser.Physics.Arcade.Sprite>;
mapFile!: ITiledMap;
groups: Map<string, Sprite>;
startX: number;
startY: number;
circleTexture: CanvasTexture;
startX!: number;
startY!: number;
circleTexture!: CanvasTexture;
pendingEvents: Queue<InitUserPositionEventInterface|AddPlayerEventInterface|RemovePlayerEventInterface|UserMovedEventInterface|GroupCreatedUpdatedEventInterface|DeleteGroupEventInterface> = new Queue<InitUserPositionEventInterface|AddPlayerEventInterface|RemovePlayerEventInterface|UserMovedEventInterface|GroupCreatedUpdatedEventInterface|DeleteGroupEventInterface>();
private initPosition: PositionInterface|null = null;
private playersPositionInterpolator = new PlayersPositionInterpolator();
private connection: Connection;
private simplePeer : SimplePeer;
private connectionPromise: Promise<Connection>
private connection!: Connection;
private simplePeer!: SimplePeer;
private connectionPromise!: Promise<Connection>
MapKey: string;
MapUrlFile: string;
RoomId: string;
instance: string;
currentTick: number;
lastSentTick: number; // The last tick at which a position was sent.
currentTick!: number;
lastSentTick!: number; // The last tick at which a position was sent.
lastMoveEventSent: HasMovedEvent = {
direction: '',
moving: false,

View File

@ -18,24 +18,24 @@ enum CustomizeTextures{
export class CustomizeScene extends Phaser.Scene {
private textField: TextField;
private enterField: TextField;
private textField!: TextField;
private enterField!: TextField;
private arrowRight: Image;
private arrowLeft: Image;
private arrowRight!: Image;
private arrowLeft!: Image;
private arrowDown: Image;
private arrowUp: Image;
private arrowDown!: Image;
private arrowUp!: Image;
private Rectangle: Rectangle;
private Rectangle!: Rectangle;
private logo: Image;
private logo!: Image;
private selectedLayers: Array<number> = [0];
private containersRow: Array<Array<Container>> = new Array<Array<Container>>();
private activeRow = 0;
private repositionCallback: (this: Window, ev: UIEvent) => void;
private repositionCallback!: (this: Window, ev: UIEvent) => void;
constructor() {
super({

View File

@ -21,22 +21,22 @@ enum LoginTextures {
}
export class EnableCameraScene extends Phaser.Scene {
private textField: TextField;
private pressReturnField: TextField;
private cameraNameField: TextField;
private logo: Image;
private arrowLeft: Image;
private arrowRight: Image;
private arrowDown: Image;
private arrowUp: Image;
private textField!: TextField;
private pressReturnField!: TextField;
private cameraNameField!: TextField;
private logo!: Image;
private arrowLeft!: Image;
private arrowRight!: Image;
private arrowDown!: Image;
private arrowUp!: Image;
private microphonesList: MediaDeviceInfo[] = new Array<MediaDeviceInfo>();
private camerasList: MediaDeviceInfo[] = new Array<MediaDeviceInfo>();
private cameraSelected: number = 0;
private microphoneSelected: number = 0;
private soundMeter: SoundMeter;
private soundMeterSprite: SoundMeterSprite;
private microphoneNameField: TextField;
private repositionCallback: (this: Window, ev: UIEvent) => void;
private soundMeterSprite!: SoundMeterSprite;
private microphoneNameField!: TextField;
private repositionCallback!: (this: Window, ev: UIEvent) => void;
constructor() {
super({

View File

@ -21,16 +21,16 @@ enum LoginTextures {
export class SelectCharacterScene extends Phaser.Scene {
private readonly nbCharactersPerRow = 4;
private textField: TextField;
private pressReturnField: TextField;
private logo: Image;
private customizeButton: Image;
private customizeButtonSelected: Image;
private textField!: TextField;
private pressReturnField!: TextField;
private logo!: Image;
private customizeButton!: Image;
private customizeButtonSelected!: Image;
private selectedRectangle: Rectangle;
private selectedRectangle!: Rectangle;
private selectedRectangleXPos = 0; // Number of the character selected in the rows
private selectedRectangleYPos = 0; // Number of the character selected in the columns
private selectedPlayer: Phaser.Physics.Arcade.Sprite|null; // null if we are selecting the "customize" option
private selectedPlayer!: Phaser.Physics.Arcade.Sprite|null; // null if we are selecting the "customize" option
private players: Array<Phaser.Physics.Arcade.Sprite> = new Array<Phaser.Physics.Arcade.Sprite>();
constructor() {

View File

@ -13,8 +13,8 @@ export interface CurrentGamerInterface extends Character{
export class Player extends Character implements CurrentGamerInterface {
userInputManager: UserInputManager;
previousDirection: string;
wasMoving: boolean;
previousDirection: string = PlayerAnimationNames.WalkDown;
wasMoving: boolean = false;
constructor(
Scene: GameScene,

View File

@ -10,12 +10,12 @@ enum Textures {
}
export class FourOFourScene extends Phaser.Scene {
private mapNotFoundField: TextField;
private couldNotFindField: TextField;
private fileNameField: Text;
private logo: Image;
private cat: Sprite;
private file: string;
private mapNotFoundField!: TextField;
private couldNotFindField!: TextField;
private fileNameField!: Text;
private logo!: Image;
private cat!: Sprite;
private file!: string;
constructor() {
super({

View File

@ -9,9 +9,8 @@ enum ReconnectingTextures {
}
export class ReconnectingScene extends Phaser.Scene {
private reconnectingField: TextField;
private logo: Image;
private cat: Sprite;
private reconnectingField!: TextField;
private logo!: Image;
constructor() {
super({

View File

@ -10,12 +10,12 @@
"jsx": "react",
"allowJs": true,
"strict": false, /* Enable all strict type-checking options. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* Enable strict null checks. */
"strictFunctionTypes": true, /* Enable strict checking of function types. */
"strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
"strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */