refactored + code doc
This commit is contained in:
parent
2694c4b072
commit
d29c2f6a21
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "JournalPage.h"
|
#include "JournalPage.h"
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "JournalWidget.h"
|
#include "JournalWidget.h"
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "MyActor.h"
|
|
||||||
|
|
||||||
// Sets default values
|
|
||||||
AMyActor::AMyActor()
|
|
||||||
{
|
|
||||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
|
||||||
void AMyActor::BeginPlay()
|
|
||||||
{
|
|
||||||
Super::BeginPlay();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every frame
|
|
||||||
void AMyActor::Tick(float DeltaTime)
|
|
||||||
{
|
|
||||||
Super::Tick(DeltaTime);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "MyUserWidget.h"
|
|
||||||
|
|
||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
#include "SURREALISM.h"
|
#include "SURREALISM.h"
|
||||||
#include "Modules/ModuleManager.h"
|
#include "Modules/ModuleManager.h"
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "utils_functions.h"
|
#include "utils_functions.h"
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -6,6 +8,9 @@
|
|||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "Item.generated.h"
|
#include "Item.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This class is the base class for all items in the game.
|
||||||
|
*/
|
||||||
UCLASS(Blueprintable)
|
UCLASS(Blueprintable)
|
||||||
class SURREALISM_API AItem : public AActor
|
class SURREALISM_API AItem : public AActor
|
||||||
{
|
{
|
||||||
@ -23,24 +28,48 @@ public:
|
|||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The name of the item.
|
||||||
|
*/
|
||||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Item")
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Item")
|
||||||
FString item_name = "Item name";
|
FString item_name = "Item name";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The description of the item.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
|
||||||
FString item_description = "Item description";
|
FString item_description = "Item description";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the name of the item.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable,CallInEditor , Category = "Item")
|
UFUNCTION(BlueprintCallable,CallInEditor , Category = "Item")
|
||||||
FString get_item_name();
|
FString get_item_name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the description of the item.
|
||||||
|
* @return The description of the item.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
||||||
FString get_item_description();
|
FString get_item_description();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the name of the item.
|
||||||
|
* @param new_name The new name of the item.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
||||||
void set_item_name(FString new_name);
|
void set_item_name(FString new_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the description of the item.
|
||||||
|
* @param new_description The new description of the item.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
||||||
void set_item_description(FString new_description);
|
void set_item_description(FString new_description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sends the item to the journal.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
UFUNCTION(BlueprintCallable,CallInEditor, Category = "Item")
|
||||||
void send_item_to_journal();
|
void send_item_to_journal();
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "JournalPage.generated.h"
|
#include "JournalPage.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This struct represents a journal entry.
|
||||||
|
*/
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
struct FJournalEntry
|
struct FJournalEntry
|
||||||
{
|
{
|
||||||
@ -16,30 +22,65 @@ struct FJournalEntry
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @brief This class represents a journal page.
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class SURREALISM_API UJournalPage : public UObject
|
class SURREALISM_API UJournalPage : public UObject
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UJournalPage();
|
UJournalPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Array containing all the entries of the journal page.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
||||||
TArray<FJournalEntry> page_entries;
|
TArray<FJournalEntry> page_entries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The maximum number of entries that the journal page can contain.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
||||||
int32 max_page_entries;
|
int32 max_page_entries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds an entry to the journal page.
|
||||||
|
* @param entry_name The name of the entry to add.
|
||||||
|
* @param entry_description The description of the entry to add.
|
||||||
|
*/
|
||||||
void add_entry(FString entry_name, FString entry_description);
|
void add_entry(FString entry_name, FString entry_description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function removes an entry from the journal page.
|
||||||
|
* @param entry_name The name of the entry to remove.
|
||||||
|
*/
|
||||||
void remove_entry(FString entry_name);
|
void remove_entry(FString entry_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the name of all the entries of the journal page.
|
||||||
|
* @return An array containing the names of all the entries of the journal page.
|
||||||
|
*/
|
||||||
TArray<FString> get_all_entries_names();
|
TArray<FString> get_all_entries_names();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the description of all the entries of the journal page.
|
||||||
|
* @return An array containing the descriptions of all the entries of the journal page.
|
||||||
|
*/
|
||||||
TArray<FString> get_all_entries_descriptions();
|
TArray<FString> get_all_entries_descriptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the number of entries of the journal page.
|
||||||
|
* @return The number of entries of the journal page.
|
||||||
|
*/
|
||||||
int32 get_number_of_entries();
|
int32 get_number_of_entries();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the description of an entry of the journal page selected by its name.
|
||||||
|
* @param entry_name The name of the entry to get.
|
||||||
|
* @return The description of the entry.
|
||||||
|
*/
|
||||||
FString get_entry_description(FString entry_name);
|
FString get_entry_description(FString entry_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -10,6 +12,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @brief This class represents the journal widget.
|
||||||
*/
|
*/
|
||||||
UCLASS(Blueprintable)
|
UCLASS(Blueprintable)
|
||||||
class SURREALISM_API UJournalWidget : public UUserWidget
|
class SURREALISM_API UJournalWidget : public UUserWidget
|
||||||
@ -18,58 +21,117 @@ class SURREALISM_API UJournalWidget : public UUserWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Array containing all the journal pages.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
||||||
TArray<UJournalPage*> journal_pages;
|
TArray<UJournalPage*> journal_pages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The maximum number of pages that the journal can contain.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
||||||
int max_pages = 10;
|
int max_pages = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current number of pages of the journal.
|
||||||
|
*/
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Journal")
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Journal")
|
||||||
int current_number_of_pages = 0;
|
int current_number_of_pages = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current page number.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Journal")
|
||||||
int current_page_number = 0;
|
int current_page_number = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief returns the current number of pages.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
int get_current_number_of_page();
|
int get_current_number_of_page();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function changes the current page to the next one.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void next_page();
|
void next_page();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function changes the current page to the previous one.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void previous_page();
|
void previous_page();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function changes the current page to the one with the specified number.
|
||||||
|
* @param page_number The number of the page to go to.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void go_to_page(int page_number);
|
void go_to_page(int page_number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function removes a page from the journal selected by its number.
|
||||||
|
* @param page_number The number of the page to remove.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void remove_page(int page_number);
|
void remove_page(int page_number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function gets all the item name from the current page.
|
||||||
|
* @return An array containing all the item names from the current page.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
TArray<FString> get_current_page_entries_names();
|
TArray<FString> get_current_page_entries_names();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function gets the description from the item oin the current page selected by its name.
|
||||||
|
* @return The description of the item.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
FString get_entry_description(FString entry_name);
|
FString get_entry_description(FString entry_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a page to the journal.
|
||||||
|
* @return The number of the page added.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
int add_page();
|
int add_page();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds an item to the journal.
|
||||||
|
* @param item_name The name of the item to add.
|
||||||
|
* @param item_description The description of the item to add.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void add_to_journal(FString item_name, FString item_description);
|
void add_to_journal(FString item_name, FString item_description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function resets the journal.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void clear_journal();
|
void clear_journal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function prints the current page. (ONLY FOR DEBUG)
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
void print_current_page();
|
void print_current_page();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the current page number.
|
||||||
|
* @return The current page number.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
int get_current_pages_number();
|
int get_current_pages_number();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the number of entries in the current page.
|
||||||
|
* @return The number of entries in the current page.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Journal")
|
||||||
int get_number_of_entries_in_current_page();
|
int get_number_of_entries_in_current_page();
|
||||||
|
|
||||||
|
|
||||||
virtual void NativeConstruct() override;
|
virtual void NativeConstruct() override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "GameFramework/Actor.h"
|
|
||||||
#include "MyActor.generated.h"
|
|
||||||
|
|
||||||
UCLASS()
|
|
||||||
class SURREALISM_API AMyActor : public AActor
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Sets default values for this actor's properties
|
|
||||||
AMyActor();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Called when the game starts or when spawned
|
|
||||||
virtual void BeginPlay() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Called every frame
|
|
||||||
virtual void Tick(float DeltaTime) override;
|
|
||||||
|
|
||||||
};
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "Blueprint/UserWidget.h"
|
|
||||||
#include "MyUserWidget.generated.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
|
||||||
class SURREALISM_API UMyUserWidget : public UUserWidget
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
};
|
|
||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
/*!
|
||||||
|
* @author SIMAILA Djalim
|
||||||
|
*/
|
||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user