196 lines
5.9 KiB
C++
196 lines
5.9 KiB
C++
#ifndef TABLE_FRAME_SINK_HEAD_FILE
|
|
#define TABLE_FRAME_SINK_HEAD_FILE
|
|
|
|
#pragma once
|
|
|
|
#include "Stdafx.h"
|
|
#include "GameLogic.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//游戏桌子类
|
|
class CTableFrameSink : public ITableFrameSink, public ITableUserAction
|
|
{
|
|
//游戏变量
|
|
protected:
|
|
bool m_bNobodyCallScore; //没人叫分;
|
|
WORD m_wFirstUser; //首叫用户;
|
|
WORD m_wBankerUser; //庄家用户
|
|
WORD m_wCurrentUser; //当前玩家
|
|
bool m_bTrustee[GAME_PLAYER]; //是否托管
|
|
WORD m_wFriendChairID[GAME_PLAYER]; //伙伴椅子号
|
|
GAME_END_TYPE m_etGameEndType; //结束类型;
|
|
|
|
//叫分信息;
|
|
protected:
|
|
BYTE m_cbScoreInfo[GAME_PLAYER]; //叫分信息;
|
|
|
|
//胜利信息
|
|
protected:
|
|
WORD m_wWinCount; //胜利人数
|
|
WORD m_wWinOrder[GAME_PLAYER]; //胜利列表
|
|
BYTE m_cbGongxian[GAME_PLAYER][BOMB_TYPE_COUNT]; //炸弹计数 用于算贡献分普通双扣最多11星
|
|
SCORE m_lBombScore[GAME_PLAYER]; //炸弹奖罚;
|
|
|
|
//出牌信息
|
|
protected:
|
|
WORD m_wTurnWiner; //胜利玩家
|
|
CMD_C_OutCard m_TurnOutCard; //上家出牌;
|
|
|
|
//扑克信息
|
|
protected:
|
|
BYTE m_cbHandCardCount[GAME_PLAYER]; //扑克数目
|
|
BYTE m_cbHandCardData[GAME_PLAYER][MAX_COUNT];//手上扑克
|
|
|
|
//组件变量
|
|
protected:
|
|
CGameLogic m_GameLogic; //游戏逻辑
|
|
|
|
//组件接口
|
|
protected:
|
|
ITableFrame * m_pITableFrame; //框架接口
|
|
tagGameServiceOption * m_pGameServiceOption; //游戏配置
|
|
tagGameServiceAttrib * m_pGameServiceAttrib; //游戏属性
|
|
|
|
//属性变量
|
|
protected:
|
|
static const WORD m_wPlayerCount; //游戏人数
|
|
|
|
//私人场结算信息
|
|
public:
|
|
CMD_S_Private_End_Info m_PrivateEndInfo;
|
|
tagGameRecord m_kGameRecord;
|
|
|
|
//函数定义
|
|
public:
|
|
//构造函数
|
|
CTableFrameSink();
|
|
//析构函数
|
|
virtual ~CTableFrameSink();
|
|
|
|
//基础接口
|
|
public:
|
|
//释放对象
|
|
virtual VOID Release() { delete this; }
|
|
//接口查询
|
|
virtual VOID * QueryInterface(REFGUID Guid, DWORD dwQueryVer);
|
|
|
|
//管理接口
|
|
public:
|
|
//复位桌子
|
|
virtual VOID RepositionSink();
|
|
//配置桌子
|
|
virtual bool Initialization(IUnknownEx * pIUnknownEx);
|
|
|
|
//查询接口
|
|
public:
|
|
//查询限额
|
|
virtual SCORE QueryConsumeQuota(IServerUserItem * pIServerUserItem){ return 0L; }
|
|
//最少积分
|
|
virtual SCORE QueryLessEnterScore(WORD wChairID, IServerUserItem * pIServerUserItem){ return 0L; }
|
|
//查询是否扣服务费
|
|
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 cbGameStatus, bool bSendSecret);
|
|
|
|
//事件接口
|
|
public:
|
|
//时间事件
|
|
virtual bool OnTimerMessage(DWORD wTimerID, WPARAM wBindParam);
|
|
//数据事件
|
|
virtual bool OnDataBaseMessage(WORD wRequestID, VOID * pData, WORD wDataSize);
|
|
//积分事件
|
|
virtual bool OnUserScroeNotify(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason);
|
|
|
|
//网络接口
|
|
public:
|
|
//游戏消息
|
|
virtual bool OnGameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize, IServerUserItem * pIServerUserItem);
|
|
//框架消息
|
|
virtual bool OnFrameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize, IServerUserItem * pIServerUserItem);
|
|
|
|
//比赛接口
|
|
public:
|
|
//设置基数
|
|
virtual void SetGameBaseScore(LONG lBaseScore){ ; }
|
|
|
|
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; }
|
|
|
|
//私人场辅助函数;
|
|
public:
|
|
//是否有相应规则;
|
|
bool IsHasGameRule(eDZRuleEnum eType);
|
|
//是否记录游戏记录服务器类型;
|
|
bool IsRecordServerType();
|
|
|
|
//用户事件
|
|
public:
|
|
//用户断线
|
|
virtual bool OnActionUserOffLine(WORD wChairID, IServerUserItem * pIServerUserItem){ return true; }
|
|
//用户重入
|
|
virtual bool OnActionUserConnect(WORD wChairID, IServerUserItem * pIServerUserItem){ return true; }
|
|
//用户坐下
|
|
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 OnActionUserFangKaCheck(WORD wChairID, IServerUserItem * pIServerUserItem, SCORE lUserInsure) { 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; }
|
|
//游戏事件
|
|
protected:
|
|
//用户叫分;
|
|
bool OnUserCallScore(WORD wChairID, BYTE cbCallScore);
|
|
//用户出牌
|
|
bool OnUserOutCard(WORD wChairID, CMD_C_OutCard * pOutCard);
|
|
//用户放弃
|
|
bool OnUserPassCard(WORD wChairID);
|
|
//搜索伙伴;
|
|
BYTE SearchFriendChairID();
|
|
//计算炸弹积分;
|
|
void GetBombScore(WORD wChairID, BYTE cbCardData, int nCardType);
|
|
//打独结束统计炸弹分;
|
|
void GetBombScore(WORD wChairID, BYTE cbHandCardData[], BYTE cbHandCardCount);
|
|
//炸弹升级;
|
|
int AddBombScore(int nCardType, bool bList = true);
|
|
//是否有炸弹;
|
|
bool IsHasBomb(BYTE cbHandCardData[], BYTE cbHandCardCount);
|
|
//是否8炸弹;
|
|
bool IsHas8Bomb(BYTE cbHandCardData[], BYTE cbHandCardCount);
|
|
//正常结束;
|
|
bool NormalGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem);
|
|
//打二结束;
|
|
bool ToTwoGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem);
|
|
|
|
// 录像事件
|
|
public:
|
|
// 游戏开始
|
|
void starGameRecord();
|
|
// 玩家操作提示;
|
|
void addGameRecordAction(WORD wSubCmdID, void* pSubMessage, int nMessageSize);
|
|
|
|
void MyLog(TCHAR *szLog, ...);
|
|
};
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#endif |