Newer
Older
SkyFrontier-Project-IADE-UE4-3D / Source / SkyFrontier / Private / MatchmakingSubsystem.cpp
@Genexuz Genexuz on 9 Jan 2023 781 bytes Matchmakingstuff
// Fill out your copyright notice in the Description page of Project Settings.


#include "MatchmakingSubsystem.h"


void UMatchmakingSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
	// Force the intiialization of any other dependency you might have
	//Collection.InitializeDependency();
	Super::Initialize(Collection);
}

void UMatchmakingSubsystem::RequestGame()
{
	FindMatchJob = new MatchmakingJob(CurrentState);
	FindMatchJob->JobCompletedEvent.AddUFunction(this, "OnMatchmakerThreadDone");
		
	FRunnableThread::Create(FindMatchJob, TEXT("FindMatchJob"));
}

void UMatchmakingSubsystem::OnMatchmakerThreadDone(bool CompletionState, FString ServerIP)
{
	if(CompletionState)
		MatchFoundEvent.Broadcast(ServerIP);
	else ServerToConnectTo = "Failed To Connect!";
}