Spaces:
Sleeping
Sleeping
File size: 1,038 Bytes
8cbe088 dfed11c 8cbe088 99fce26 8cbe088 3d154c7 8cbe088 3d154c7 8cbe088 3d154c7 8cbe088 d17b44c 8cbe088 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import { ObjectType, v } from 'convex/values';
import { GameId, parseGameId, playerId } from './ids';
export const serializedPlayerDescription = {
playerId,
name: v.string(),
description: v.string(),
character: v.string(),
role:v.string()
};
export type SerializedPlayerDescription = ObjectType<typeof serializedPlayerDescription>;
export class PlayerDescription {
playerId: GameId<'players'>;
name: string;
description: string;
character: string;
role:string;
constructor(serialized: SerializedPlayerDescription) {
const { playerId, name, description, character,role } = serialized;
this.playerId = parseGameId('players', playerId);
this.name = name;
this.description = description;
this.character = character;
this.character=role;
}
serialize(): SerializedPlayerDescription {
const { playerId, name, description, character, role} = this;
return {
playerId,
name,
description,
character,
role
};
}
}
|