-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainClass.cs
40 lines (39 loc) · 1.67 KB
/
MainClass.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using TexasHoldem.communication.Impl;
using TexasHoldem.communication.Interfaces;
using TexasHoldem.Logic.Game_Control;
using TexasHoldem.Logic.GameControl;
using TexasHoldem.Logic.Replay;
namespace TexasHoldem
{
public class MainClass
{
public static void Main()
{
//init instances:
LogControl logControl = new LogControl();
SystemControl sysControl = new SystemControl(logControl);
ReplayManager replayManager = new ReplayManager();
SessionIdHandler sidHandler = new SessionIdHandler();
GameCenter gameCenter = new GameCenter(sysControl, logControl, replayManager, sidHandler);
var commHandler = CommunicationHandler.GetInstance();
MessageEventHandler eventHandler = new MessageEventHandler(gameCenter, sysControl,
logControl, replayManager, sidHandler);
gameCenter.SetMessageHandler(eventHandler);
var webEventHandler = new WebEventHandler(new ServerEventHandler(sidHandler, null,
gameCenter, sysControl, logControl, replayManager, null));
WebCommHandler webCommHandler = new WebCommHandler(webEventHandler);
Task commTask = Task.Factory.StartNew(commHandler.Start);
Task webCommTask = Task.Factory.StartNew(webCommHandler.Start);
Console.WriteLine("starting comm");
Task eventTask = Task.Factory.StartNew(eventHandler.HandleIncomingMsgs);
commTask.Wait();
webCommTask.Wait();
}
}
}