This repository has been archived by the owner on May 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added CheckIfModsAreUpdated and updated SDK
- Loading branch information
1 parent
229dcec
commit 515b085
Showing
14 changed files
with
170 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
Source/modio/Private/AsyncRequest/ModioAsyncRequest_CheckIfModsAreUpdated.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2019 modio. All Rights Reserved. | ||
// Released under MIT. | ||
|
||
#include "AsyncRequest/ModioAsyncRequest_CheckIfModsAreUpdated.h" | ||
#include "ModioUE4Utility.h" | ||
|
||
FModioAsyncRequest_CheckIfModsAreUpdated::FModioAsyncRequest_CheckIfModsAreUpdated( FModioSubsystem *Modio, FModioBooleanDelegate Delegate ) : | ||
FModioAsyncRequest( Modio ), | ||
ResponseDelegate( Delegate ) | ||
{ | ||
} | ||
|
||
void FModioAsyncRequest_CheckIfModsAreUpdated::Response(void *Object, ModioResponse ModioResponse, bool ModsAreUpdated) | ||
{ | ||
FModioResponse Response; | ||
InitializeResponse( Response, ModioResponse ); | ||
|
||
FModioAsyncRequest_CheckIfModsAreUpdated* ThisPointer = (FModioAsyncRequest_CheckIfModsAreUpdated*)Object; | ||
ThisPointer->ResponseDelegate.ExecuteIfBound( Response, ModsAreUpdated ); | ||
|
||
ThisPointer->Done(); | ||
} |
48 changes: 48 additions & 0 deletions
48
Source/modio/Private/BlueprintCallbackProxies/CallbackProxy_CheckIfModsAreUpdated.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2019 modio. All Rights Reserved. | ||
// Released under MIT. | ||
|
||
#include "BlueprintCallbackProxies/CallbackProxy_CheckIfModsAreUpdated.h" | ||
#include "ModioSubsystem.h" | ||
#include "Engine/Engine.h" | ||
|
||
UCallbackProxy_CheckIfModsAreUpdated::UCallbackProxy_CheckIfModsAreUpdated(const FObjectInitializer &ObjectInitializer) | ||
: Super(ObjectInitializer) | ||
{ | ||
} | ||
|
||
UCallbackProxy_CheckIfModsAreUpdated *UCallbackProxy_CheckIfModsAreUpdated::CheckIfModsAreUpdated( UObject *WorldContext, const TArray<int32> &ModIds ) | ||
{ | ||
UCallbackProxy_CheckIfModsAreUpdated *Proxy = NewObject<UCallbackProxy_CheckIfModsAreUpdated>(); | ||
Proxy->SetFlags(RF_StrongRefOnFrame); | ||
Proxy->ModIds = ModIds; | ||
Proxy->WorldContextObject = WorldContext; | ||
return Proxy; | ||
} | ||
|
||
void UCallbackProxy_CheckIfModsAreUpdated::Activate() | ||
{ | ||
UWorld* World = GEngine->GetWorldFromContextObject( WorldContextObject, EGetWorldErrorMode::LogAndReturnNull ); | ||
FModioSubsystemPtr Modio = FModioSubsystem::Get( World ); | ||
if( Modio.IsValid() ) | ||
{ | ||
Modio->CheckIfModsAreUpdated( ModIds, FModioBooleanDelegate::CreateUObject( this, &UCallbackProxy_CheckIfModsAreUpdated::OnCheckIfModsAreUpdatedDelegate ) ); | ||
} | ||
else | ||
{ | ||
// @todonow: Make something more pretty than this | ||
FModioResponse Response; | ||
OnFailure.Broadcast( Response, false ); | ||
} | ||
} | ||
|
||
void UCallbackProxy_CheckIfModsAreUpdated::OnCheckIfModsAreUpdatedDelegate(FModioResponse Response, bool ModsAreUpdated) | ||
{ | ||
if (Response.Code >= 200 && Response.Code < 300) | ||
{ | ||
OnSuccess.Broadcast(Response, ModsAreUpdated); | ||
} | ||
else | ||
{ | ||
OnFailure.Broadcast(Response, ModsAreUpdated); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Source/modio/Public/AsyncRequest/ModioAsyncRequest_CheckIfModsAreUpdated.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2019 modio. All Rights Reserved. | ||
// Released under MIT. | ||
|
||
#pragma once | ||
#include "AsyncRequest/ModioAsyncRequest.h" | ||
#include "Schemas/ModioResponse.h" | ||
|
||
/** | ||
* Callback for when a update check was made | ||
* @param ModioResponse - Response from Modio backend | ||
* @param bool - True if all mods are updated, otherwise returns false | ||
*/ | ||
|
||
class FModioAsyncRequest_CheckIfModsAreUpdated : public FModioAsyncRequest | ||
{ | ||
public: | ||
FModioAsyncRequest_CheckIfModsAreUpdated( FModioSubsystem *Modio, FModioBooleanDelegate Delegate ); | ||
|
||
static void Response(void *Object, ModioResponse ModioResponse, bool ModsAreUpdated ); | ||
|
||
private: | ||
FModioBooleanDelegate ResponseDelegate; | ||
}; |
41 changes: 41 additions & 0 deletions
41
Source/modio/Public/BlueprintCallbackProxies/CallbackProxy_CheckIfModsAreUpdated.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2019 modio. All Rights Reserved. | ||
// Released under MIT. | ||
|
||
#pragma once | ||
|
||
#include "ModioSubsystem.h" | ||
#include "Schemas/ModioResponse.h" | ||
#include "Net/OnlineBlueprintCallProxyBase.h" | ||
#include "CallbackProxy_CheckIfModsAreUpdated.generated.h" | ||
|
||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams( | ||
FCheckIfModsAreUpdatedResult, | ||
FModioResponse, | ||
response, | ||
bool, | ||
mods_are_updated ); | ||
|
||
UCLASS() | ||
class MODIO_API UCallbackProxy_CheckIfModsAreUpdated : public UOnlineBlueprintCallProxyBase | ||
{ | ||
GENERATED_UCLASS_BODY() | ||
|
||
TArray<int32> ModIds; | ||
|
||
// The world context object in which this call is taking place | ||
UPROPERTY() | ||
UObject* WorldContextObject; | ||
|
||
UPROPERTY(BlueprintAssignable) | ||
FCheckIfModsAreUpdatedResult OnSuccess; | ||
|
||
UPROPERTY(BlueprintAssignable) | ||
FCheckIfModsAreUpdatedResult OnFailure; | ||
|
||
UFUNCTION(BlueprintCallable, Category = "mod.io", meta = (BlueprintInternalUseOnly = "true", DefaultToSelf="WorldContext")) | ||
static UCallbackProxy_CheckIfModsAreUpdated *CheckIfModsAreUpdated( UObject *WorldContext, const TArray<int32> &ModIds); | ||
|
||
virtual void Activate() override; | ||
|
||
virtual void OnCheckIfModsAreUpdatedDelegate(FModioResponse Response, bool ModsAreUpdated); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters