// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 #pragma once // GameKit forward declarations #include // Unreal #include "Containers/UnrealString.h" #include "Dom/JsonObject.h" #include "Dom/JsonValue.h" #include "Templates/SharedPointer.h" // Unreal forward declarations class SScrollBox; class SExpandableArea; class SEditableTextBox; class SImage; class SButton; class SCheckBox; enum class Synced : uint8 { Unknown, Synchronized, Unsynchronized }; class AwsGameKitAchievementUI { private: AwsGameKitAchievementsLayoutDetails* parent; TSharedPtr representation; TSharedPtr titleText; TSharedPtr trashIconButton; void Initialize(AwsGameKitAchievementsLayoutDetails* layout, int32 points, int32 max, int32 sortOrder); FReply DeleteAchievement(); void OnIdChanged(const FText& newText); public: AwsGameKitAchievementUI(AwsGameKitAchievementsLayoutDetails* layout, int32 points = 0, int32 max = 1, int32 sortOrder = 0); AwsGameKitAchievementUI(AwsGameKitAchievementsLayoutDetails* layout, const AdminAchievement& adminAchievement); AwsGameKitAchievementUI() = default; ~AwsGameKitAchievementUI(); bool markedForDeletion; Synced status; FString idString; bool localLockedIcon; bool localUnlockedIcon; TSharedPtr expandableArea; TSharedPtr id; TSharedPtr title; TSharedPtr lockedDescription; TSharedPtr unlockedDescription; TSharedPtr lockedIcon; TSharedPtr lockedIconImg; TSharedPtr unlockedIcon; TSharedPtr unlockedIconImg; TSharedPtr secret; TSharedPtr hidden; TSharedPtr idValidationWarning; int32 Points; int32 MaxValue; int32 SortOrder; void ToAchievement(AdminAchievement& result); void ToJsonObject(TSharedPtr& result); TSharedRef GetRepresentation() { return this->representation.ToSharedRef(); } bool IsSynchronized(TSharedPtr other) const { return id->GetText().CompareTo(other->id->GetText()) == 0 && title->GetText().CompareTo(other->title->GetText()) == 0 && Points == other->Points && lockedDescription->GetText().CompareTo(other->lockedDescription->GetText()) == 0 && unlockedDescription->GetText().CompareTo(other->unlockedDescription->GetText()) == 0 && MaxValue == other->MaxValue && SortOrder == other->SortOrder && secret->IsChecked() == other->secret->IsChecked() && hidden->IsChecked() == other->hidden->IsChecked() && lockedIcon->GetText().CompareTo(other->lockedIcon->GetText()) == 0 && unlockedIcon->GetText().CompareTo(other->unlockedIcon->GetText()) == 0; } };