53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#ifndef GAMESERVER_H
|
|
#define GAMESERVER_H
|
|
|
|
#include <QObject>
|
|
#include <QByteArray>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include "equipmentLib/tcpequipment.h"
|
|
#include "XYComFunc_global.h"
|
|
#include "commonStruct.h"
|
|
//游戏服务器类,等待游戏连入,进行握手,等待游戏就绪,向游戏发送数据
|
|
class XYCOMFUNC_EXPORT GameServer : public TcpEquipment
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
GameServer();
|
|
Q_INVOKABLE void sendValue(int value);
|
|
Q_INVOKABLE bool IsReady();
|
|
Q_INVOKABLE void sendLevel(GameLevel level);
|
|
Q_INVOKABLE void sendLevel(int level);
|
|
Q_INVOKABLE void sendStart();
|
|
Q_INVOKABLE void sendPause();
|
|
Q_INVOKABLE void sendContinue();
|
|
Q_INVOKABLE void sendStop();
|
|
|
|
|
|
private:
|
|
void dealRev(QString strIP,int iPort,QByteArray buffer) override;
|
|
void sendStatus(GameStatus status);
|
|
|
|
signals:
|
|
void gameStartReceived(QString strIP,int iPort);
|
|
void gameStopReceived(QString strIP,int iPort);
|
|
void gameLevelSet(int iLevel);
|
|
void gameScoreReceived(int iScore);
|
|
|
|
public slots:
|
|
|
|
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 // GAMESERVER_H
|