2008-12-21 14:23:40 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2008 by Lothar May *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of pokerth_console. *
|
|
|
|
|
* pokerth_console is free software: you can redistribute it and/or *
|
|
|
|
|
* modify it under the terms of the GNU Affero General Public License *
|
|
|
|
|
* as published by the Free Software Foundation, either version 3 of *
|
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* pokerth_console is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the *
|
|
|
|
|
* GNU Affero General Public License along with pokerth_console. *
|
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2008-12-25 21:12:59 +00:00
|
|
|
using System.Threading;
|
|
|
|
|
|
2008-12-21 14:23:40 +00:00
|
|
|
|
2008-12-23 17:24:31 +00:00
|
|
|
namespace pokerth_lib
|
2008-12-21 14:23:40 +00:00
|
|
|
{
|
2008-12-23 17:24:31 +00:00
|
|
|
public class PokerTHData
|
2008-12-21 14:23:40 +00:00
|
|
|
{
|
2008-12-23 02:15:49 +00:00
|
|
|
public PokerTHData(string name)
|
2008-12-21 14:23:40 +00:00
|
|
|
{
|
|
|
|
|
m_gameInfoList = new GameInfoList();
|
|
|
|
|
m_playerInfoList = new PlayerInfoList();
|
2008-12-22 23:03:15 +00:00
|
|
|
m_mutex = new Object();
|
|
|
|
|
m_myPlayerId = 0;
|
|
|
|
|
m_myGameId = 0;
|
2008-12-23 02:15:49 +00:00
|
|
|
m_myName = name;
|
2008-12-25 21:12:59 +00:00
|
|
|
m_joinGameEvent = new AutoResetEvent(false);
|
|
|
|
|
m_startGameEvent = new AutoResetEvent(false);
|
2008-12-21 14:23:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GameInfoList GameList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return m_gameInfoList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PlayerInfoList PlayerList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return m_playerInfoList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-23 14:24:37 +00:00
|
|
|
public Hand CurHand
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
lock (m_mutex)
|
|
|
|
|
{
|
|
|
|
|
return m_curHand;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
lock (m_mutex)
|
|
|
|
|
{
|
|
|
|
|
m_curHand = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-23 02:15:49 +00:00
|
|
|
public string MyName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return m_myName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-22 23:03:15 +00:00
|
|
|
public uint MyPlayerId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
lock (m_mutex)
|
|
|
|
|
{
|
|
|
|
|
return m_myPlayerId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
lock (m_mutex)
|
|
|
|
|
{
|
|
|
|
|
m_myPlayerId = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public uint MyGameId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
lock (m_mutex)
|
|
|
|
|
{
|
|
|
|
|
return m_myGameId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
lock (m_mutex)
|
|
|
|
|
{
|
|
|
|
|
m_myGameId = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-25 21:12:59 +00:00
|
|
|
public EventWaitHandle JoinGameEvent
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return m_joinGameEvent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EventWaitHandle StartGameEvent
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return m_startGameEvent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-21 14:23:40 +00:00
|
|
|
private GameInfoList m_gameInfoList;
|
|
|
|
|
private PlayerInfoList m_playerInfoList;
|
2008-12-23 14:24:37 +00:00
|
|
|
private Hand m_curHand;
|
2008-12-22 23:03:15 +00:00
|
|
|
private Object m_mutex;
|
|
|
|
|
private uint m_myPlayerId;
|
|
|
|
|
private uint m_myGameId;
|
2008-12-23 02:15:49 +00:00
|
|
|
private string m_myName;
|
2008-12-25 21:12:59 +00:00
|
|
|
private EventWaitHandle m_joinGameEvent;
|
|
|
|
|
private EventWaitHandle m_startGameEvent;
|
2008-12-21 14:23:40 +00:00
|
|
|
}
|
|
|
|
|
}
|