Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Content/G2I_Game/UI/DA_WidgetsCatalog.uasset
Binary file not shown.
Binary file modified Content/G2I_Game/UI/Elements/DT_RichTextStyles.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/G2I_Game/UI/Menu/Options/WB_Options.uasset
Binary file not shown.
Binary file modified Content/G2I_Game/UI/StringsRu/ST_Creators.uasset
Binary file not shown.
16 changes: 16 additions & 0 deletions Source/G2I/Private/UI/G2IUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Components/WidgetSwitcher.h"
#include "Gameplay/G2IKeyHintWidget.h"
#include "HUD/G2IAimingWidget.h"
#include "Menu/G2ICreatorsWidget.h"
#include "Menu/Elements/NumericalRow/G2INumericalMultiValuePropertyRow.h"
#include "Menu/Elements/G2IControlListItem.h"
#include "Menu/Elements/G2IControlRow.h"
Expand Down Expand Up @@ -501,6 +502,21 @@ void UG2IUIManager::SetupOptionsWidget(const TFunction<void()>& NewBackAction) c
}
}

void UG2IUIManager::SetupCreatorsWidget(const TFunction<void()>& NewBackAction) const
{
if (!ensure(DisplayManager))
{
UE_LOG(LogG2I, Error, TEXT("%s: Couldn't find %s"), *GetName(),
*UG2IUIDisplayManager::StaticClass()->GetName());
return;
}
if (UG2ICreatorsWidget *Widget = Cast<UG2ICreatorsWidget>(
DisplayManager->GetWidget(EG2IWidgetNames::Creators)))
{
Widget->OnBack = NewBackAction;
}
}

void UG2IUIManager::SetPropertyRow(UG2ITextMultiValuePropertyRow* PropertySelector, const FString& PropertyNameStringID,
TArray<FString>& ValuesNamesStringID, const int32 DefaultValueIndex) const
{
Expand Down
44 changes: 44 additions & 0 deletions Source/G2I/Private/UI/Widgets/Menu/G2ICreatorsWidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "Menu/G2ICreatorsWidget.h"
#include "G2I.h"
#include "G2IUIManager.h"
#include "G2IWidgetNames.h"
#include "Components/Button.h"

void UG2ICreatorsWidget::InitializeAfterManagerLoading()
{
Super::InitializeAfterManagerLoading();

BindDelegates();
}

void UG2ICreatorsWidget::BindDelegates()
{
if (ensure(BackButton))
{
BackButton->OnClicked.AddDynamic(this, &ThisClass::OnBackButtonClicked);
}
else
{
UE_LOG(LogG2I, Error, TEXT("%s: Couldn't find BackButton"), *GetName());
}
}

void UG2ICreatorsWidget::OnBackButtonClicked()
{
if (ensure(OnBack))
{
OnBack();
}
else
{
UE_LOG(LogG2I, Warning, TEXT("Back function is undefined in %s"), *GetName());
}

if (!ensure(UIManager))
{
UE_LOG(LogG2I, Error, TEXT("%s: Couldn't find %s"), *GetName(),
*UG2IUIManager::StaticClass()->GetName());
return;
}
UIManager->CloseWidget(EG2IWidgetNames::Creators);
}
16 changes: 15 additions & 1 deletion Source/G2I/Private/UI/Widgets/Menu/G2IMainMenuWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void UG2IMainMenuWidget::BindDelegates()
}
if (ensure(CreatorsButton))
{
CreatorsButton->SetIsEnabled(false);
CreatorsButton->OnClicked.AddDynamic(this, &ThisClass::OnCreatorsButtonClicked);
}
else
{
Expand Down Expand Up @@ -122,6 +122,20 @@ void UG2IMainMenuWidget::OnOptionsButtonClicked()
UIManager->SetupOptionsWidget(GetShowCurrentWidgetFunction());
}

void UG2IMainMenuWidget::OnCreatorsButtonClicked()
{
if (!ensure(UIManager))
{
UE_LOG(LogG2I, Error, TEXT("%s: Couldn't find %s"), *GetName(),
*UG2IUIManager::StaticClass()->GetName());
return;
}
UIManager->HideWidget(EG2IWidgetNames::MainMenu);
UIManager->OpenWidget(EG2IWidgetNames::Creators);

UIManager->SetupCreatorsWidget(GetShowCurrentWidgetFunction());
}

void UG2IMainMenuWidget::OnQuitGameButtonClicked()
{
if (!ensure(UIManager))
Expand Down
3 changes: 3 additions & 0 deletions Source/G2I/Public/UI/G2IUIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ class G2I_API UG2IUIManager : public UGameInstanceSubsystem
// ==================== LOADING WIDGET ====================
void SetLoadingProgressPercent(float Percent) const;

// ==================== CREATORS WIDGET ====================
void SetupCreatorsWidget(const TFunction<void()>& NewBackAction) const;

// ==================== OPTIONS WIDGETS ====================
void SetupOptionsWidget(const TFunction<void()>& NewBackAction) const;
void SetupControlsWidget(UWidgetSwitcher* CharacterControlsSwitcher) const;
Expand Down
34 changes: 34 additions & 0 deletions Source/G2I/Public/UI/Widgets/Menu/G2ICreatorsWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include "CoreMinimal.h"
#include "G2IUserWidget.h"
#include "G2ICreatorsWidget.generated.h"

class UButton;

UCLASS()
class G2I_API UG2ICreatorsWidget : public UG2IUserWidget
{
GENERATED_BODY()

public:

UPROPERTY(meta = (BindWidget))
TObjectPtr<UButton> BackButton;

public:

TFunction<void()> OnBack;

protected:

virtual void InitializeAfterManagerLoading() override;

UFUNCTION()
void OnBackButtonClicked();

private:

void BindDelegates();

};
3 changes: 3 additions & 0 deletions Source/G2I/Public/UI/Widgets/Menu/G2IMainMenuWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class G2I_API UG2IMainMenuWidget : public UG2IUserWidget
UFUNCTION()
void OnOptionsButtonClicked();

UFUNCTION()
void OnCreatorsButtonClicked();

UFUNCTION()
void OnQuitGameButtonClicked();

Expand Down