222 lines
7.4 KiB
C++
222 lines
7.4 KiB
C++
#ifndef TABLE_FRAME_SINK_HEAD_FILE
|
|
#define TABLE_FRAME_SINK_HEAD_FILE
|
|
|
|
#pragma once
|
|
|
|
#include "Stdafx.h"
|
|
#include "DlgCustomRule.h"
|
|
#include "GameLogic.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//游戏桌子类;
|
|
class CTableFrameSink : public ITableFrameSink, public ITableUserAction
|
|
{
|
|
//组件变量;
|
|
protected:
|
|
CGameLogic m_GameLogic; //游戏逻辑;
|
|
ITableFrame * m_pITableFrame; //框架接口;
|
|
const tagGameServiceOption * m_pGameServiceOption; //配置参数;
|
|
tagCustomRule * m_pGameCustomRule; //自定规则;
|
|
|
|
//游戏变量;
|
|
protected:
|
|
bool m_arySendAniOver[GAME_PLAYER]; //发牌完成;
|
|
bool m_aryCompareOver[GAME_PLAYER]; //比牌完成;
|
|
BYTE m_aryHandStatus[GAME_PLAYER]; //手牌状态;
|
|
|
|
bool m_aryShowCard[GAME_PLAYER]; //摊牌;
|
|
bool m_aryResponse[GAME_PLAYER]; //响应;
|
|
BYTE m_aryRobStatus[GAME_PLAYER]; //抢庄状态;
|
|
|
|
LONG m_lTableScore[GAME_PLAYER]; //下注数目;
|
|
|
|
BYTE m_aryFrontCard[GAME_PLAYER][3]; //前墩扑克;
|
|
BYTE m_aryMidCard[GAME_PLAYER][5]; //中墩扑克;
|
|
BYTE m_aryBackCard[GAME_PLAYER][5]; //后墩扑克;
|
|
WORD m_arySpecialType[GAME_PLAYER]; //是否是特殊牌;
|
|
|
|
BYTE m_aryNormalResult[GAME_PLAYER][3];
|
|
BYTE m_arySpecialResult[GAME_PLAYER];
|
|
|
|
int m_aryThreeKillResult[GAME_PLAYER]; //全垒打加减分;
|
|
int m_aryToltalWinDaoShu[GAME_PLAYER]; //总共道数;
|
|
int m_aryCompareDouble[GAME_PLAYER]; //打枪的道数;
|
|
int m_aryShootDaoShu[GAME_PLAYER][GAME_PLAYER]; //用来计算一家和另一家打枪要加的水数;
|
|
BYTE m_aryShootState[6][2]; //打枪(0赢的玩家,1输的玩家);
|
|
BYTE m_cbShootCount; //几家打枪;
|
|
SCORE m_aryGameScore[GAME_PLAYER]; //游戏积分;
|
|
|
|
BYTE m_aryHandCardData[GAME_PLAYER][HAND_CARD_COUNT]; //玩家手牌;
|
|
BYTE m_arySaveHandCard[GAME_PLAYER][HAND_CARD_COUNT]; //玩家手牌;
|
|
WORD m_aryHandCardType[GAME_PLAYER][3]; //玩家手牌类型;
|
|
int m_arySpecialCompareResult[GAME_PLAYER]; //特殊牌型比较结果;
|
|
int m_aryCompareResult[GAME_PLAYER][3]; //每一道比较结果;
|
|
bool m_aryDaoShui[GAME_PLAYER]; //倒水;
|
|
|
|
BYTE m_aryBankerCmpResult[GAME_PLAYER][3];
|
|
BYTE m_aryOtherCmResult[GAME_PLAYER][3];
|
|
|
|
WORD m_wWinAllUser; //全垒打玩家位置号;
|
|
|
|
BYTE m_cbRobBankerCount; //抢庄玩家数量;
|
|
WORD m_wRobBankerUser[GAME_PLAYER]; //抢庄玩家位置;
|
|
|
|
WORD m_wBankerUser; //庄家用户;
|
|
WORD m_wPlayCount; //游戏局数;
|
|
bool m_bClassicRule; //经典规则;
|
|
|
|
CMD_S_Private_End_Info m_PrivateEndInfo; //私有场信息;
|
|
|
|
//函数定义;
|
|
public:
|
|
//构造函数;
|
|
CTableFrameSink();
|
|
//析构函数;
|
|
virtual ~CTableFrameSink();
|
|
|
|
//基础接口;
|
|
public:
|
|
//释放对象;
|
|
virtual VOID Release() { delete this; }
|
|
//是否有效;
|
|
virtual bool IsValid() { return AfxIsValidAddress(this,sizeof(CTableFrameSink))?true:false; }
|
|
//接口查询;
|
|
virtual VOID * QueryInterface(REFGUID Guid, DWORD dwQueryVer);
|
|
|
|
//管理接口;
|
|
public:
|
|
//初始化;
|
|
virtual bool Initialization(IUnknownEx * pIUnknownEx);
|
|
//复位桌子;
|
|
virtual VOID RepositionSink();
|
|
|
|
//信息接口;
|
|
public:
|
|
//游戏状态;
|
|
virtual bool IsUserPlaying(WORD wChairID) { return (HAND_STATUS_NULL != m_aryHandStatus[wChairID]); }
|
|
|
|
//查询接口;
|
|
public:
|
|
//查询限额;
|
|
virtual SCORE QueryConsumeQuota(IServerUserItem * pIServerUserItem){return 0;}
|
|
//最少积分;
|
|
virtual SCORE QueryLessEnterScore(WORD wChairID, IServerUserItem * pIServerUserItem){return 0;}
|
|
//查询服务费;
|
|
virtual bool QueryBuckleServiceCharge(WORD wChairID){return true;}
|
|
|
|
//游戏事件;
|
|
public:
|
|
//游戏开始;
|
|
virtual bool OnEventGameStart();
|
|
//游戏结束;
|
|
virtual bool OnEventGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason);
|
|
//发送场景;
|
|
virtual bool OnEventSendGameScene(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE bGameStatus, bool bSendSecret);
|
|
|
|
//事件接口;
|
|
public:
|
|
//定时器事件;
|
|
virtual bool OnTimerMessage(DWORD wTimerID, WPARAM wBindParam);
|
|
//游戏消息处理;
|
|
virtual bool OnGameMessage(WORD wSubCmdID, VOID * pDataBuffer, WORD wDataSize, IServerUserItem * pIServerUserItem);
|
|
//框架消息处理;
|
|
virtual bool OnFrameMessage(WORD wSubCmdID, VOID * pDataBuffer, WORD wDataSize, IServerUserItem * pIServerUserItem);
|
|
//数据事件;
|
|
virtual bool OnDataBaseMessage(WORD wRequestID, VOID * pData, WORD wDataSize);
|
|
//积分事件;
|
|
virtual bool OnUserScroeNotify(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason);
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//用户事件;
|
|
public:
|
|
//用户断线;
|
|
virtual bool OnActionUserOffLine(WORD wChairID, IServerUserItem * pIServerUserItem);
|
|
//用户重入;
|
|
virtual bool OnActionUserConnect(WORD wChairID, IServerUserItem * pIServerUserItem);
|
|
//用户坐下;
|
|
virtual bool OnActionUserSitDown(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser);
|
|
//用户起立;
|
|
virtual bool OnActionUserStandUp(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser);
|
|
//用户同意;
|
|
virtual bool OnActionUserOnReady(WORD wChairID, IServerUserItem * pIServerUserItem, VOID * pData, WORD wDataSize) { return true; }
|
|
//用户发送喇叭消息;
|
|
virtual bool OnSendTrumpetChat(VOID * pData, WORD wDataSize) { return true; }
|
|
//用户下注;
|
|
virtual bool OnActionUserPour(WORD wChairID, IServerUserItem * pIServerUserItem){return true;}
|
|
//用户开始游戏
|
|
virtual bool OnActionUserOnStart(WORD wChairID, IServerUserItem * pIServerUserItem, VOID * pData, WORD wDataSize) { return true; }
|
|
//用户开始游戏
|
|
virtual bool OnActionUserStartGame(WORD wChairID, IServerUserItem * pIServerUserItem, VOID * pData, WORD wDataSize) { return true; }
|
|
private:
|
|
//设置基数;
|
|
virtual void SetGameBaseScore(SCORE lBaseScore){}
|
|
|
|
//是否支持规则;
|
|
virtual bool IsHaveRule(DWORD dwGameRule);
|
|
|
|
virtual void SetPrivateInfo(BYTE bGameTypeIdex, DWORD bGameRuleIdex){ ; }
|
|
//重置私人场结束信息;
|
|
virtual void ResetPrivateEndInfo();
|
|
//获得私人场结束信息流;
|
|
virtual void GetPrivateEndInfo(DataStream &kDataStream, bool bSend);
|
|
//判断私人场是否结束;
|
|
virtual bool IsPrivateEnd();
|
|
//真实椅子数量
|
|
virtual WORD GetRealChairCount() { return GAME_PLAYER; }
|
|
|
|
virtual bool OnActionUserFangKaCheck(WORD wChairID, IServerUserItem * pIServerUserItem, SCORE lUserInsure){ return true; }
|
|
|
|
//过程函数;
|
|
private:
|
|
//玩家摊牌;
|
|
void ShowCard(WORD wChairID);
|
|
//经典玩法比牌;
|
|
void GameClassicCompare();
|
|
//带庄家玩法比牌;
|
|
void GameBankerCompare();
|
|
//初始化经典玩法结构;
|
|
void InitClassicCompareStatus(CMD_S_ClassicCompareCard* pCompareStatus);
|
|
//初始化带庄家玩法结构;
|
|
void InitBankerCompareStatus(CMD_S_BankerCompareCard* pCompareStatus);
|
|
|
|
//消息处理;
|
|
private:
|
|
//发牌动画结束;
|
|
bool OnSendCardOver(WORD wChairID);
|
|
//玩家摊牌;
|
|
bool OnUserShowCard(WORD wChairID, CMD_C_OpenCard *pShowCard);
|
|
//比牌完成消息;
|
|
bool OnCompareCardOver(WORD wChairID);
|
|
//叫庄事件;
|
|
bool OnUserRobBanker(WORD wChairID, bool bRob);
|
|
//加注事件;
|
|
bool OnUserChipScore(WORD wChairID, LONG lScore);
|
|
|
|
//功能函数;
|
|
private:
|
|
//计算每一道的道数;
|
|
void ComputeChout();
|
|
//玩家比道;
|
|
void GetCompareResult();
|
|
//自动摆牌;
|
|
void AutoShowCard(WORD wChairID);
|
|
//获取在线玩家;
|
|
WORD GetOnlineCount();
|
|
|
|
// 录像事件
|
|
public:
|
|
// 游戏开始
|
|
void starGameRecord();
|
|
// 玩家操作提示;
|
|
void addGameRecordAction(WORD wSubCmdID, void* pSubMessage, int nMessageSize);
|
|
|
|
//录像
|
|
public:
|
|
tagGameRecord m_kGameRecord;
|
|
};
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#endif |