Journal UI rework
This commit is contained in:
parent
1ea3f9cbb4
commit
99df4782c8
BIN
UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/UI_Journal.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/UI_Journal.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_Journal_Text.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_Journal_Text.uasset
(Stored with Git LFS)
Binary file not shown.
@ -342,7 +342,7 @@ void APlayerBase::ShowJournal()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(auto WM = AMainGameModeBase::GetWidgetsManager())
|
if(auto WM = AMainGameModeBase::GetWidgetsManager())
|
||||||
WM->ShowJournal();
|
WM->SwitchJournal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void APlayerBase::ShowMenu()
|
void APlayerBase::ShowMenu()
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
void UAutohideWidget::Show()
|
void UAutohideWidget::Show()
|
||||||
{
|
{
|
||||||
SetVisibility(ESlateVisibility::Visible);
|
SetVisibility(ESlateVisibility::Visible);
|
||||||
if(!showTimer.IsValid())
|
if(showTimer.IsValid())
|
||||||
PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Forward, 1, false);
|
return;
|
||||||
|
PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Forward, 1, false);
|
||||||
GetWorld()->GetTimerManager().SetTimer(showTimer, this, &UAutohideWidget::Hide, showDuration, false);
|
GetWorld()->GetTimerManager().SetTimer(showTimer, this, &UAutohideWidget::Hide, showDuration, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,43 @@
|
|||||||
#include "Components/TextBlock.h"
|
#include "Components/TextBlock.h"
|
||||||
#include "Components/VerticalBox.h"
|
#include "Components/VerticalBox.h"
|
||||||
|
|
||||||
|
void UJournalWidget::Show()
|
||||||
|
{
|
||||||
|
if(state == State::Visible)
|
||||||
|
return;
|
||||||
|
state = State::Visible;
|
||||||
|
|
||||||
|
SetVisibility(ESlateVisibility::Visible);
|
||||||
|
PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Forward, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UJournalWidget::ShowTimed()
|
||||||
|
{
|
||||||
|
if(state != State::Hidden)
|
||||||
|
return;
|
||||||
|
state = State::VisibleAutoHide;
|
||||||
|
|
||||||
|
Super::Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UJournalWidget::Hide()
|
||||||
|
{
|
||||||
|
if(state == State::Hidden)
|
||||||
|
return;
|
||||||
|
state = State::Hidden;
|
||||||
|
|
||||||
|
if(state == State::VisibleAutoHide)
|
||||||
|
{
|
||||||
|
Super::Hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(showTimer.IsValid())
|
||||||
|
GetWorld()->GetTimerManager().ClearTimer(showTimer);
|
||||||
|
|
||||||
|
PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Reverse, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
void UJournalWidget::Update(TArray<FText> items)
|
void UJournalWidget::Update(TArray<FText> items)
|
||||||
{
|
{
|
||||||
text->ClearChildren();
|
text->ClearChildren();
|
||||||
@ -17,3 +54,8 @@ void UJournalWidget::Update(TArray<FText> items)
|
|||||||
text->AddChild(obj);
|
text->AddChild(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UJournalWidget::IsShown()
|
||||||
|
{
|
||||||
|
return state != State::Hidden;
|
||||||
|
}
|
||||||
|
@ -13,8 +13,13 @@ class UJournalWidget : public UAutohideWidget
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual void Show() override;
|
||||||
|
void ShowTimed();
|
||||||
|
virtual void Hide() override;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void Update(TArray<FText> items);
|
void Update(TArray<FText> items);
|
||||||
|
bool IsShown();
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
class UVerticalBox* text;
|
class UVerticalBox* text;
|
||||||
@ -22,4 +27,11 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
TSubclassOf<class UTextBlock> textStyleClass;
|
TSubclassOf<class UTextBlock> textStyleClass;
|
||||||
|
|
||||||
|
enum State : uint8
|
||||||
|
{
|
||||||
|
Hidden,
|
||||||
|
Visible,
|
||||||
|
VisibleAutoHide
|
||||||
|
} state = State::Hidden;
|
||||||
};
|
};
|
||||||
|
@ -154,6 +154,7 @@ void UWidgetsManager::UpdateWidgetsOwner()
|
|||||||
void UWidgetsManager::ShowMainMenu(bool pause)
|
void UWidgetsManager::ShowMainMenu(bool pause)
|
||||||
{
|
{
|
||||||
mainMenuWidget->Show(pause);
|
mainMenuWidget->Show(pause);
|
||||||
|
journalWidget->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UWidgetsManager::HideMainMenu()
|
void UWidgetsManager::HideMainMenu()
|
||||||
@ -274,13 +275,24 @@ void UWidgetsManager::SetInventorySecondItem(FText item)
|
|||||||
inventoryWidget->secondItemDescriptionText->SetText(item);
|
inventoryWidget->secondItemDescriptionText->SetText(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UWidgetsManager::SwitchJournal()
|
||||||
|
{
|
||||||
|
if(journalWidget->IsShown())
|
||||||
|
HideJournal();
|
||||||
|
else
|
||||||
|
ShowJournal();
|
||||||
|
}
|
||||||
|
|
||||||
void UWidgetsManager::ShowJournal()
|
void UWidgetsManager::ShowJournal()
|
||||||
{
|
{
|
||||||
journalWidget->Show();
|
journalWidget->Show();
|
||||||
}
|
}
|
||||||
|
void UWidgetsManager::HideJournal()
|
||||||
|
{
|
||||||
|
journalWidget->Hide();
|
||||||
|
}
|
||||||
void UWidgetsManager::UpdateJournal(TArray<FText> text)
|
void UWidgetsManager::UpdateJournal(TArray<FText> text)
|
||||||
{
|
{
|
||||||
journalWidget->Update(text);
|
journalWidget->Update(text);
|
||||||
ShowJournal();
|
journalWidget->ShowTimed();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,9 @@ public:
|
|||||||
void SetInventoryFirstItem(FText item);
|
void SetInventoryFirstItem(FText item);
|
||||||
void SetInventorySecondItem(FText item);
|
void SetInventorySecondItem(FText item);
|
||||||
|
|
||||||
|
void SwitchJournal();
|
||||||
void ShowJournal();
|
void ShowJournal();
|
||||||
|
void HideJournal();
|
||||||
void UpdateJournal(TArray<FText> text);
|
void UpdateJournal(TArray<FText> text);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user