Cleanup: renaming "frame" to "character"

The "frame" variable actually contains a string pointing to the character selected.
It has nothing to do with a frame which is usually a particular image in an animation.

I'm renaming the variable accross the application to avoid confusion.
This commit is contained in:
David Négrier 2020-05-08 15:18:22 +02:00
parent ddbd4f4c06
commit 492196b333
9 changed files with 47 additions and 47 deletions

View file

@ -216,7 +216,7 @@ export class IoSocketController {
socket.roomId = message.roomId;
socket.userId = message.userId;
socket.name = message.name;
socket.frame = message.frame;
socket.character = message.character;
}
refreshUserPosition() {

View file

@ -7,6 +7,6 @@ export interface ExSocketInterface extends Socket {
webRtcRoomId: string;
userId: string;
name: string;
frame: string;
character: string;
position: PointInterface;
}
}

View file

@ -25,7 +25,7 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
roomId: socket.roomId,
position: socket.position,
name: socket.name,
frame: socket.frame,
character: socket.character,
};
let dataArray = <any>[];
if (mapPositionUserByRoom.get(data.roomId)) {
@ -41,4 +41,4 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
export {
RefreshUserPositionFunction
}
}

View file

@ -2,7 +2,7 @@ export class Message {
userId: string;
roomId: string;
name: string;
frame: string;
character: string;
constructor(data: any) {
if (!data.userId || !data.roomId) {
@ -11,7 +11,7 @@ export class Message {
this.userId = data.userId;
this.roomId = data.roomId;
this.name = data.name;
this.frame = data.frame;
this.character = data.character;
}
toJson() {
@ -19,7 +19,7 @@ export class Message {
userId: this.userId,
roomId: this.roomId,
name: this.name,
frame: this.frame
character: this.character
}
}
}
}

View file

@ -8,7 +8,7 @@ describe("Message Model", () => {
expect(messageObject.userId).toBe("test1");
expect(messageObject.roomId).toBe("test2");
expect(messageObject.name).toBe("foo");
expect(messageObject.frame).toBe("user");
expect(messageObject.character).toBe("user");
})
it("should expose a toJson method", () => {
@ -37,4 +37,4 @@ describe("Message Model", () => {
let messageObject = new Message(message);
}).toThrow(new Error("userId or roomId cannot be null"));
});
})
})