This commit is contained in:
2025-11-15 00:48:13 +01:00
parent 0ecd846183
commit 331258692b
4 changed files with 1377 additions and 1452 deletions
+7 -38
View File
@@ -3,6 +3,7 @@
#include "sad_DetectedServer.hpp"
#include "spit_object.hpp"
#include "spit_player.hpp"
#include "spit_processor.hpp"
#include "spit_socket.hpp"
#include "spit_type.hpp"
#include "spit_message.hpp"
@@ -21,42 +22,11 @@ class SClient : ISadClient {
/** Maximal length of a SPITMessage*/
static const int MAXSPITMESSAGEBYTECOUNT = 512;
enum class ProjUpdate {
ServerLoaded,
StartTransfer,
EndTransfer,
ServerClosed,
};
enum class ServerEvent {
Detect,
Lost,
Changed,
};
enum class ObjectEvent {
Created,
Changed,
Deleted
};
enum class Connection {
None = 0, // No Connection established.<br>Either no connect tried or disconnected
NoneServer = 1, // Server has disconnected
Lost = 2, // The connection is lost<br>Either because of a network crash or because the server no longer responds.
Ok = 3, // Connection to the serv er is established.
TryConnection = 4, // A connection to the server is tried.
};
struct Callbacks {
function<void(ServerEvent event, const SadDetectedServer &detectedServer)> onServerEvent;
function<void(string serverID, string serverComputerName, string serverName, int serverStepTime, Connection connectionStatus, Connection oldConnectionStatus)> onConnectionStatus;
function<void(ProjUpdate state, string projectId)> onProjectUpdate;
function<void(ObjectEvent event, bool isRemote, const SType &spitType)> onSpitType;
function<void(ObjectEvent event, bool isRemote, const SType &spitType, const SObject &spitObject)> onSpitObject;
function<void(string playerID, string playerName, char playerType, bool playerIsRunning, uint64_t timeFrames)> onPlay;
function<void(string playerID, string spitTypeID, bool playerIsRunning, bool started, bool ended, double value)> onPlaySpitType;
function<void(const SType &spitType, const SObject &spitObject, uint64_t p_FrameInsideObject, int value)> onPlayRemoteObjectStatus;
function<bool(bool knownType, bool createdByClient)> onCheckSpitTypeVeto;
function<bool(bool knownType)> onCheckSpitObjectVeto;
};
using Callbacks = SProcessor::Callbacks;
using ProjUpdate = SProcessor::ProjUpdate;
using ServerEvent = SProcessor::ServerEvent;
using ObjectEvent = SProcessor::ObjectEvent;
using Connection = SProcessor::Connection;
//------ PlayerType ------
public:
@@ -96,6 +66,7 @@ class SClient : ISadClient {
string mName;
string mProjName;
string mComputerName;
SProcessor mProcessor;
string mClientProjectName;
@@ -327,8 +298,6 @@ class SClient : ISadClient {
SpitRepo<SObject> mSpitObjects;
SpitRepo<SObject> mRemoteSpitObjects;
SpitRepo<SType> mSpitTypes;
SpitRepo<SType> mRemoteSpitTypes;
};
}