-
Notifications
You must be signed in to change notification settings - Fork 0
/
CGameRoomManager.cs
45 lines (38 loc) · 1.13 KB
/
CGameRoomManager.cs
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
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GameServer
{
/// <summary>
/// 게임방들을 관리하는 룸매니저.
/// </summary>
public class CGameRoomManager
{
List<CGameRoom> rooms;
public CGameRoomManager()
{
this.rooms = new List<CGameRoom>();
}
/// <summary>
/// 매칭을 요청한 유저들을 넘겨 받아 게임 방을 생성한다.
/// </summary>
/// <param name="user1"></param>
/// <param name="user2"></param>
public void create_room(CGameUser user1, CGameUser user2)
{
// 게임 방을 생성하여 입장 시킴.
CGameRoom battleroom = new CGameRoom(this);
this.rooms.Add(battleroom);
user1.enter_room(battleroom, 0);
user2.enter_room(battleroom, 1);
battleroom.enter_gameroom(user1.player, user2.player);
}
public void remove_room(CGameRoom room)
{
room.destroy();
this.rooms.Remove(room);
}
}
}