mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
38 lines
1,010 B
JavaScript
38 lines
1,010 B
JavaScript
"use strict";
|
|
|
|
import Vector from './Utilities/Vector';
|
|
import Rectangle from './Utilities/Rectangle';
|
|
|
|
class OtherClient
|
|
{
|
|
constructor()
|
|
{
|
|
// The unique id of this client.
|
|
this.Id = -1;
|
|
// The name of this client.
|
|
this.Name = "";
|
|
// The colour the server assigned to this client.
|
|
this.Colour = "green";
|
|
// The position of this clients' cursor.
|
|
this.CursorPosition = new Vector(0, 0);
|
|
// The position and dimensions of this client's viewport.
|
|
this.Viewport = Rectangle.Zero.clone();
|
|
}
|
|
|
|
update(data) {
|
|
// Update our local copy of this clients' name and colour (just in case)
|
|
this.Name = data.Name;
|
|
this.Colour = data.Colour;
|
|
// Update the cursor position
|
|
this.CursorPosition.x = data.CursorPosition.X;
|
|
this.CursorPosition.y = data.CursorPosition.Y;
|
|
// Update the viewport
|
|
this.Viewport.x = data.Viewport.X;
|
|
this.Viewport.y = data.Viewport.X;
|
|
this.Viewport.width = data.Viewport.Width;
|
|
this.Viewport.height = data.Viewport.Height;
|
|
}
|
|
}
|
|
|
|
export default OtherClient;
|