Newer
Older
SkyFrontier-Project-IADE-UE4-3D / Source / SkyFrontier / Public / MatchmakingSubsystem.h
@Genexuz Genexuz on 10 Jan 2023 1 KB more stuff idk anymore
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "MatchmakingJob.h"
  5. #include "Subsystems/GameInstanceSubsystem.h"
  6. #include "MatchmakingSubsystem.generated.h"
  7. DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMatchFound, FString, ServerIP, FString, LevelName);
  8. UCLASS()
  9. class SKYFRONTIER_API UMatchmakingSubsystem : public UGameInstanceSubsystem
  10. {
  11. GENERATED_BODY()
  12. public:
  13. virtual void Initialize(FSubsystemCollectionBase& Collection) override;
  14. // Start Requesting A Game Launch the thread and the widget can poll the string value for an update till the threads done.
  15. UFUNCTION(BlueprintCallable)
  16. void RequestGame(FString LevelName);
  17. // Callback From The Thread When It's Done
  18. UFUNCTION()
  19. void OnMatchmakerThreadDone(bool CompletionState, FString ServerIP, FString LevelName);
  20. // String the blueprint widget will look at
  21. UPROPERTY(BlueprintReadOnly)
  22. FString CurrentState;
  23. UPROPERTY(BlueprintReadOnly)
  24. FString ServerToConnectTo;
  25. // Actual Threaded Job
  26. MatchmakingJob* FindMatchJob;
  27. // Event To Let Someone Else Handle The Level Loading Stuff
  28. UPROPERTY(BlueprintAssignable)
  29. FOnMatchFound MatchFoundEvent;
  30. };