Binato/server/MultiplayerManager.ts

28 lines
940 B
TypeScript
Raw Normal View History

2022-11-20 23:37:39 +00:00
import { SharedContent } from "./BanchoServer";
2022-11-19 01:06:03 +00:00
import { DataStream } from "./objects/DataStream";
import { DataStreamArray } from "./objects/DataStreamArray";
import { FunkyArray } from "./objects/FunkyArray";
2022-11-20 23:37:39 +00:00
import { Match, MatchData } from "./objects/Match";
2022-11-19 01:06:03 +00:00
import { User } from "./objects/User";
export class MultiplayerManager {
2022-11-20 23:37:39 +00:00
private readonly sharedContent:SharedContent;
2022-11-19 01:06:03 +00:00
private matches:FunkyArray<Match> = new FunkyArray<Match>();
private readonly lobbyStream:DataStream;
2022-11-20 23:37:39 +00:00
public constructor(sharedContent:SharedContent) {
this.sharedContent = sharedContent;
this.lobbyStream = sharedContent.streams.CreateStream("multiplayer:lobby", false);
2022-11-19 01:06:03 +00:00
}
public JoinLobby(user:User) {
if (user.currentMatch != null) {
}
}
2022-11-20 23:37:39 +00:00
public async CreateMatch(user:User, matchData:MatchData) {
const match = await Match.createMatch(user, matchData, this.sharedContent);
this.matches.add(match.matchId.toString(), match);
}
2022-11-17 00:29:07 +00:00
}