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