// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "ResComPoint.h" #include "Engine/Texture2DDynamic.h" #include "CoreMinimal.h" //#include "GameFramework/Actor.h" #include "ResComApartmentManager.generated.h" USTRUCT(BlueprintType) struct FApartmentLocation { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 locHouse = 0; UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 locEntrance = 0; UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 locFloor = 0; UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 locApartment = 0; bool operator==(FApartmentLocation& loc) const { return (loc.locHouse == locHouse) && (loc.locFloor == locFloor) && (loc.locEntrance == locEntrance) && (loc.locApartment == locApartment); } int32 AsNum() const { return (locHouse * 10000 + locEntrance * 1000 + locFloor * 100 + locApartment); } }; USTRUCT(BlueprintType) struct FApartmentQuantities { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 rooms = 0; UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 toilets = 0; UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 bedrooms = 0; }; UENUM(BlueprintType) enum RoomType { room UMETA(DisplayName = "room"), bedroom UMETA(DisplayName = "bedroom"), toilet UMETA(DisplayName = "toilet"), bathroom UMETA(DisplayName = "bathroom"), wardrobe UMETA(DisplayName = "wardrobe"), hallway UMETA(DisplayName = "hallway"), balcony UMETA(DisplayName = "balcony"), kitchen UMETA(DisplayName = "kitchen"), livingRoom UMETA(DisplayName = "livingRoom"), kitchen_livingRoom UMETA(DisplayName = "kitchen_livingRoom"), }; UENUM(BlueprintType) enum ApartmentType { default UMETA(DisplayName = "default"), studio UMETA(DisplayName = "studio"), duplex UMETA(DisplayName = "duplex"), }; USTRUCT(BlueprintType) struct FRoomArea { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) TEnumAsByte type = RoomType::room; UPROPERTY(EditAnywhere, BlueprintReadWrite) float meters = 0.0f; }; USTRUCT(BlueprintType) struct FApartmentAreas { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) float full = 0.0f; UPROPERTY(EditAnywhere, BlueprintReadWrite) TArray rooms; }; USTRUCT(BlueprintType) struct FApartmentCosts { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) float full = 0.0f; UPROPERTY(EditAnywhere, BlueprintReadWrite) float month = 0.0f; UPROPERTY(EditAnywhere, BlueprintReadWrite) float meter = 0.0f; }; USTRUCT(BlueprintType) struct FApartmentReferences { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) TArray textures; UPROPERTY(EditAnywhere, BlueprintReadWrite) AResComPoint* point = nullptr; }; USTRUCT(BlueprintType) struct FApartment { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 id = -1; UPROPERTY(EditAnywhere, BlueprintReadWrite) FString nameRC; UPROPERTY(EditAnywhere, BlueprintReadWrite) FApartmentLocation loc; UPROPERTY(EditAnywhere, BlueprintReadWrite) bool favorite = false; UPROPERTY(EditAnywhere, BlueprintReadWrite) TEnumAsByte type; UPROPERTY(EditAnywhere, BlueprintReadWrite) FApartmentReferences references; UPROPERTY(EditAnywhere, BlueprintReadWrite) FApartmentQuantities quantities; UPROPERTY(EditAnywhere, BlueprintReadWrite) FApartmentAreas areas; UPROPERTY(EditAnywhere, BlueprintReadWrite) FApartmentCosts costs; UPROPERTY(EditAnywhere, BlueprintReadWrite) TArray properties; UPROPERTY(EditAnywhere, BlueprintReadWrite) FString description; }; UCLASS(BlueprintType) class FORTIS_TAKTIKA_API UResComApartmentManager : public UObject { GENERATED_BODY() private: TArray apartments; FApartment notValid; public: UResComApartmentManager(); // valid UFUNCTION(BlueprintCallable = "valid") bool IsValid(FApartment apartment) const; //modify UFUNCTION(BlueprintCallable = "modify") void Push(FApartment apartment); UFUNCTION(BlueprintCallable = "modify") void ClearFavorites(); // get UFUNCTION(BlueprintCallable, Category = "get") FApartment& GetByID(int32 id); UFUNCTION(BlueprintCallable, Category = "get") FApartment& GetByLoc(FApartmentLocation loc); UFUNCTION(BlueprintCallable, Category = "get") TArray GetFavorites(); //sort UFUNCTION(BlueprintCallable, Category = "sort") void SortByLoc(); UFUNCTION(BlueprintCallable, Category = "sort") void SortByID(); };