#ifndef GAMECLIENT_H #define GAMECLIENT_H #include #include #include "equipmentLib/tcpclientequipment.h" #include "XYComFunc_global.h" #include "commonStruct.h" //游戏通讯客户端类,连接游戏服务器,握手确定就绪,发送游戏数据 class XYCOMFUNC_EXPORT GameClient : public TcpClientEquipment { Q_OBJECT public: GameClient(); Q_INVOKABLE bool setValue(int iValue); Q_INVOKABLE bool IsReady(); Q_INVOKABLE void sendReady(); Q_INVOKABLE void sendStart(); Q_INVOKABLE void sendStop(); Q_INVOKABLE void sendLevelHard(); Q_INVOKABLE void sendLevelMiddle(); Q_INVOKABLE void sendLevelEasy(); Q_INVOKABLE void sendScore(int iValue); signals: void valueReceived(int iValue); void allReady(); void gameLevel(GameLevel level); void gameStatus(GameStatus status); public slots: void onDataReceived() override; private: bool isReady; const QString readyCheckString="XYYLGameReady"; const QString gameStartString="XYYLGameStart"; const QString gameStopString="XYYLGameStop"; const QString gamePauseString="XYYLGamePause"; const QString gameContinueString="XYYLGameContinue"; const QString gameLevelHard="XYYLLevelHard"; const QString gameLevelMiddle="XYYLLevelMiddle"; const QString gameLevelEasy="XYYLLevelEasy"; const QString gameScore="XYYLGameScore"; }; #endif // GAMECLIENT_H