173 lines
3.7 KiB
C++
173 lines
3.7 KiB
C++
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
/*
|
|
* File: SPITPLayer.h
|
|
* Author: Hagi
|
|
*
|
|
* Created on 30. April 2019, 11:44
|
|
*/
|
|
|
|
#ifndef SPITPLAYER_H
|
|
#define SPITPLAYER_H
|
|
|
|
#include "SPITObject.h"
|
|
#include <unordered_map>
|
|
|
|
class SPITPlayer {
|
|
|
|
//----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------
|
|
public:
|
|
class PlayObject {
|
|
public:
|
|
PlayObject();
|
|
PlayObject(SPITPlayer* p_SPITPlayer, string p_SPITObjectID);
|
|
PlayObject(const PlayObject& orig);
|
|
|
|
string getSPITObjectID() const {
|
|
return m_SPITObjectID;
|
|
}
|
|
|
|
void startPlaySequence();
|
|
bool getIsNew() const {
|
|
return m_IsNew;
|
|
}
|
|
void setIsNew(bool p_IsNew) {
|
|
m_IsNew = p_IsNew;
|
|
}
|
|
bool getIsPlayed() const {
|
|
return m_IsPlayed;
|
|
}
|
|
void setIsPlayed(bool p_IsFound) {
|
|
m_IsPlayed = p_IsFound;
|
|
}
|
|
|
|
|
|
string getPlayerID() const {
|
|
return m_PlayerID;
|
|
}
|
|
string getPlayerName() const {
|
|
return m_PlayerName;
|
|
}
|
|
bool getPlayerIsRunning() const {
|
|
return m_PlayerRuns;
|
|
}
|
|
void setPlayerIsRunning(bool p_PlayerRuns) {
|
|
m_PlayerRuns = p_PlayerRuns;
|
|
}
|
|
|
|
void setValue(int p_Value, bool p_PlayPrePosition) {
|
|
if (p_PlayPrePosition) m_ValuePrePosition = p_Value;
|
|
else m_Value = p_Value;
|
|
}
|
|
|
|
int getValue() const {
|
|
return m_ValuePrePosition + m_Value;
|
|
}
|
|
int getValueFadePrePosition() const {
|
|
return m_ValuePrePosition;
|
|
}
|
|
int getValueFade() const {
|
|
return m_Value;
|
|
}
|
|
void setValueFactor(int p_ValueFactor) {
|
|
m_ValueFactor = p_ValueFactor;
|
|
}
|
|
void setValueFlag(char p_ValueFlag) {
|
|
m_ValueFlag = p_ValueFlag;
|
|
}
|
|
int getValueFactor() const {
|
|
return m_ValueFactor;
|
|
}
|
|
char getValueFlag() const {
|
|
return m_ValueFlag;
|
|
}
|
|
void setFrameInside(long long p_FrameInside, bool p_PlayPrePosition) {
|
|
if (p_PlayPrePosition) m_FrameInsidePrePosition = p_FrameInside;
|
|
else m_FrameInside = p_FrameInside;
|
|
}
|
|
long long getFrameInside() const {
|
|
return m_FrameInside;
|
|
}
|
|
long long getFrameInsidePrePosition() const {
|
|
return m_FrameInsidePrePosition;
|
|
}
|
|
|
|
|
|
private:
|
|
string m_PlayerID;
|
|
string m_PlayerName;
|
|
bool m_PlayerRuns;
|
|
string m_SPITObjectID;
|
|
bool m_IsPlayed;
|
|
bool m_IsNew;
|
|
|
|
int m_Value;
|
|
int m_ValuePrePosition;
|
|
int m_ValueFactor;
|
|
char m_ValueFlag;
|
|
long long m_FrameInsidePrePosition;
|
|
long long m_FrameInside;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//----- SPITPlayer ------
|
|
public:
|
|
//list the SPITPlayers
|
|
static unordered_map<string, SPITPlayer*> s_SPITPlayers; //all actual played objects
|
|
static SPITPlayer* getSPITPlayer(string p_PlayerID); //if a player does not exist creates a new one
|
|
static void clearPlayers();
|
|
|
|
|
|
|
|
SPITPlayer(string p_PlayerID);
|
|
virtual ~SPITPlayer();
|
|
|
|
|
|
void startPlaySequence(); //called by SPIT_Client::parsePlaySPITStart
|
|
PlayObject* addSPITObject_Playing (string p_SPITObjectID); //called by SPIT_Client::parsePlaySPITStart
|
|
void endPlaySequence(); //called by SPIT_Client::parsePlaySPITEnd
|
|
|
|
string getID() {
|
|
return m_ID;
|
|
}
|
|
|
|
unordered_map<string, PlayObject*>* getPlayObjects();
|
|
|
|
void setIsRunning(bool p_IsRunning);
|
|
bool getIsRunning() {
|
|
return m_IsRunning;
|
|
}
|
|
void setName(string p_Name);
|
|
string getName() {
|
|
return m_Name;
|
|
}
|
|
void setType(char p_Type);
|
|
char getType() {
|
|
return m_Type;
|
|
}
|
|
void setTime(long long p_Frames);
|
|
long long getTime() {
|
|
return m_TimeFrames;
|
|
}
|
|
|
|
PlayObject* getPlayObject(string p_SPITObjectID);
|
|
|
|
private:
|
|
string m_ID;
|
|
string m_Name;
|
|
char m_Type;
|
|
unordered_map<string, PlayObject*> m_PlayObjects;
|
|
bool m_IsRunning;
|
|
long long m_TimeFrames;
|
|
};
|
|
|
|
#endif /* SPITPLAYER_H */
|
|
|