Newer
Older
SkyFrontier-Project-IADE-UE4-3D / Source / SkyFrontier / Public / MatchmakingJob.h
@Genexuz Genexuz on 10 Jan 2023 1 KB Cleanup
  1. #pragma once
  2. #include "CoreMinimal.h"
  3. // Bool if it did it's job correctly and the ip:port to connect to.
  4. DECLARE_MULTICAST_DELEGATE_TwoParams(FOnMatchMakerThreadCompleted, bool, FString);
  5. // Declaration Of All The Messages The Clients Are Allowed To Send AKA The Message ID's
  6. #define CLIENT_MESSAGE_REQUESTCONNECTION 1
  7. #define CLIENT_MESSAGE_CONFIRMDONE 2
  8. class SKYFRONTIER_API MatchmakingJob : public FRunnable
  9. {
  10. public:
  11. // Dissalow default construction of this objects
  12. // Simple example, but you could control the copy/move contructors and copy/move operators too!
  13. MatchmakingJob();
  14. explicit MatchmakingJob(FString& stateToWriteInto);
  15. private:
  16. // Do your setup here, allocate memory, ect.
  17. virtual bool Init() override;
  18. // Main data processing happens here
  19. virtual uint32 Run() override;
  20. // Called when thread is done
  21. virtual void Exit() override;
  22. // Clean up any memory you allocated here happens when a stop is requested
  23. virtual void Stop() override;
  24. void SleepThread();
  25. // Reference To Strings That Exist In The Matchmaking System, Thread Writes Directly Into Them!
  26. FString& currentState;
  27. // Pointer To Our Current Socket Object
  28. FSocket* ConnectionSocket;
  29. public:
  30. FOnMatchMakerThreadCompleted JobCompletedEvent;
  31. };