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;
|
||||
|
||||
if(auto WM = AMainGameModeBase::GetWidgetsManager())
|
||||
WM->ShowJournal();
|
||||
WM->SwitchJournal();
|
||||
}
|
||||
|
||||
void APlayerBase::ShowMenu()
|
||||
|
@ -9,7 +9,8 @@
|
||||
void UAutohideWidget::Show()
|
||||
{
|
||||
SetVisibility(ESlateVisibility::Visible);
|
||||
if(!showTimer.IsValid())
|
||||
if(showTimer.IsValid())
|
||||
return;
|
||||
PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Forward, 1, false);
|
||||
GetWorld()->GetTimerManager().SetTimer(showTimer, this, &UAutohideWidget::Hide, showDuration, false);
|
||||
}
|
||||
|
@ -6,6 +6,43 @@
|
||||
#include "Components/TextBlock.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)
|
||||
{
|
||||
text->ClearChildren();
|
||||
@ -17,3 +54,8 @@ void UJournalWidget::Update(TArray<FText> items)
|
||||
text->AddChild(obj);
|
||||
}
|
||||
}
|
||||
|
||||
bool UJournalWidget::IsShown()
|
||||
{
|
||||
return state != State::Hidden;
|
||||
}
|
||||
|
@ -13,8 +13,13 @@ class UJournalWidget : public UAutohideWidget
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Show() override;
|
||||
void ShowTimed();
|
||||
virtual void Hide() override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void Update(TArray<FText> items);
|
||||
bool IsShown();
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
class UVerticalBox* text;
|
||||
@ -22,4 +27,11 @@ public:
|
||||
protected:
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
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)
|
||||
{
|
||||
mainMenuWidget->Show(pause);
|
||||
journalWidget->Hide();
|
||||
}
|
||||
|
||||
void UWidgetsManager::HideMainMenu()
|
||||
@ -274,13 +275,24 @@ void UWidgetsManager::SetInventorySecondItem(FText item)
|
||||
inventoryWidget->secondItemDescriptionText->SetText(item);
|
||||
}
|
||||
|
||||
void UWidgetsManager::SwitchJournal()
|
||||
{
|
||||
if(journalWidget->IsShown())
|
||||
HideJournal();
|
||||
else
|
||||
ShowJournal();
|
||||
}
|
||||
|
||||
void UWidgetsManager::ShowJournal()
|
||||
{
|
||||
journalWidget->Show();
|
||||
}
|
||||
|
||||
void UWidgetsManager::HideJournal()
|
||||
{
|
||||
journalWidget->Hide();
|
||||
}
|
||||
void UWidgetsManager::UpdateJournal(TArray<FText> text)
|
||||
{
|
||||
journalWidget->Update(text);
|
||||
ShowJournal();
|
||||
journalWidget->ShowTimed();
|
||||
}
|
||||
|
@ -57,7 +57,9 @@ public:
|
||||
void SetInventoryFirstItem(FText item);
|
||||
void SetInventorySecondItem(FText item);
|
||||
|
||||
void SwitchJournal();
|
||||
void ShowJournal();
|
||||
void HideJournal();
|
||||
void UpdateJournal(TArray<FText> text);
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user