Skip to content
Open
Binary file modified Content/Characters/NonPlayer/testNPC2_JS.uasset
Binary file not shown.
Binary file modified Content/Characters/Player/BP_MJNewPlayerCharacter.uasset
Binary file not shown.
Binary file modified Content/Core/Controller/BP_MJPlayerController.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/DataTable/Dialogue/MJDataTableTest.uasset
Binary file not shown.
Binary file modified Content/DataTable/Dialogue/MJDataTableTest2.uasset
Binary file not shown.
Binary file modified Content/Input/IMC_Default.uasset
Binary file not shown.
Binary file modified Content/Input/IMC_Dialogue.uasset
Binary file not shown.
Binary file added Content/Maps/Tutorial_StartStory.umap
Binary file not shown.
Binary file modified Content/TG/TestWBP/WBP_MainMenu.uasset
Binary file not shown.
Binary file added Content/UI/Texture/Campanue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/UI/Texture/Campanue.uasset
Binary file not shown.
Binary file added Content/UI/Texture/NPCMug1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/UI/Texture/NPCMug1.uasset
Binary file not shown.
Binary file added Content/UI/Texture/PlayerMug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/UI/Texture/PlayerMug2.uasset
Binary file not shown.
Binary file added Content/UI/Texture/PlayerMug3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/UI/Texture/PlayerMug3.uasset
Binary file not shown.
Binary file added Content/UI/Texture/PlayerMug4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/UI/Texture/PlayerMug4.uasset
Binary file not shown.
Binary file modified Content/UI/WBP/Dialogue/BP_MJDialogueWidget.uasset
Binary file not shown.
Binary file modified Content/UI/WBP/HUD/WBP_HUD.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/UI/WBP/Tutorial/WBP_Detection.uasset
Binary file not shown.
Binary file added Content/UI/WBP/Tutorial/WBP_Mouse.uasset
Binary file not shown.
Binary file added Content/UI/WBP/Tutorial/WBP_RightMouse.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/UI/WBP/Tutorial/WBP_Shift.uasset
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions Source/ProjectMJ/Character/MJPlayerCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Component/MJPlayerStatComponent.h"
#include "Perception/AISense_Damage.h"
#include "Perception/AISense_Hearing.h"
#include "UI/Tutorial/MJTutorialStartDialogueComponent.h"


class UMJSaveGameSubsystem;
Expand Down Expand Up @@ -79,6 +80,7 @@ AMJPlayerCharacter::AMJPlayerCharacter()
UITrigger->SetHiddenInGame(true);

InventoryComponent = CreateDefaultSubobject<UMJInventoryComponent>(TEXT("InventoryComponent"));
TutorialDialogueComp = CreateDefaultSubobject<UMJTutorialStartDialogueComponent>(TEXT("TutorialDialogueComponent"));
// Skill Component
SkillComponent = CreateDefaultSubobject<UMJPlayerSkillComponent>(TEXT("SkillComponent"));
// Stat Component
Expand Down
4 changes: 4 additions & 0 deletions Source/ProjectMJ/Character/MJPlayerCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "UI/Inventory/MJInventoryInterface.h"
#include "MJPlayerCharacter.generated.h"

class UMJTutorialStartDialogueComponent;
class UMJPlayerEffectComponent;
class UMJPlayerStatComponent;
class UMJPlayerSkillComponent;
Expand Down Expand Up @@ -66,6 +67,9 @@ class PROJECTMJ_API AMJPlayerCharacter : public AMJCharacterBase, public IMJInve
UPROPERTY()
TObjectPtr<AActor> UITarget;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Tutorial")
TObjectPtr<UMJTutorialStartDialogueComponent> TutorialDialogueComp;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Inventory")
TObjectPtr<UMJInventoryComponent> InventoryComponent;

Expand Down
102 changes: 86 additions & 16 deletions Source/ProjectMJ/Controller/MJPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "DataTable/MJSkillDataRow.h"
#include "UI/Inventory/MJInventoryComponent.h"
#include "Item/MJItemBase.h"
#include "Kismet/GameplayStatics.h"
#include "TG/UI/MJGameFlowHUDWidget.h"
#include "UI/MJHUDWidget.h"
#include "UI/Component/MJInteractComponent.h"
Expand All @@ -32,6 +33,8 @@
#include "UI/Store/MJStoreComponent.h"
#include "UI/Store/MJStoreWidget.h"
#include "UI/Skill/MJSkillSlotWidget.h"
#include "UI/Tutorial/MJTutorialCollision.h"
#include "UI/Tutorial/MJTutorialStartDialogueComponent.h"


// TODO: Input 관련한 로직들 Component로 따로 빼기 - 동민 -
Expand Down Expand Up @@ -120,8 +123,20 @@ void AMJPlayerController::BeginPlay()
UIManager->GetHUDWidget()->GetSkillWidget()->GetSkillSlots()[i]->OnClickedEquipButton.AddDynamic(this,&AMJPlayerController::UpdateEquipedSkillWidget);
UIManager->GetHUDWidget()->GetSkillWidget()->GetSkillSlots()[i]->GetEquipButton()->OnClicked.AddDynamic(this,&ThisClass::GetOwnedSkill);
}



const FString CurrentLevel = UGameplayStatics::GetCurrentLevelName(this, true);
if (CurrentLevel.Equals(TEXT("Tutorial_StartStory")))
{
ChangeToIMCDialogue();
bIsTutorialMode = true;
UMJTutorialStartDialogueComponent* TutorialStartDialogue = MJChar->FindComponentByClass<UMJTutorialStartDialogueComponent>();
if (!TutorialStartDialogue)
{
return;
}
TutorialStartDialogue->FloatLine();
TutorialStartDialogue->OnTutorialStartDialogueEnd.AddDynamic(this,&ThisClass::TutorialDialogueEnd);
}
}

void AMJPlayerController::SetupInputComponent()
Expand All @@ -143,6 +158,8 @@ void AMJPlayerController::SetupInputComponent()
//Dialogue Input
MJInputComponent->BindAction(ChangeIMCAction, ETriggerEvent::Triggered, this, &ThisClass::StartDialogue);
MJInputComponent->BindAction(NextDialogueAction, ETriggerEvent::Triggered, this, &ThisClass::ProceedDialogue);


MJInputComponent->BindAction(ShowBacklogAction, ETriggerEvent::Triggered, this, &ThisClass::ShowBacklog);

// UI Input
Expand Down Expand Up @@ -420,8 +437,7 @@ void AMJPlayerController::StartDialogue()// x키를 눌렀을 때 실행되는
if (!MyChar) return;

if (UMJInteractComponent* InteractComp = MyChar->GetUITarget()->FindComponentByClass<UMJInteractComponent>())
{

{
InteractComp->StartInteraction();
switch (InteractComp->CurrentType)
{
Expand All @@ -438,7 +454,12 @@ void AMJPlayerController::StartDialogue()// x키를 눌렀을 때 실행되는
default:
break;
}
}
}

if (bIsTutorialMode)
{
UIManager->GetHUDWidget()->SetInstructionWidgetVisibility();
}
}

void AMJPlayerController::ChangeToIMCDialogue()
Expand Down Expand Up @@ -467,23 +488,42 @@ void AMJPlayerController::ProceedDialogue()
{
return;
}
if (!MyChar->GetUITarget())
if (MyChar->GetUITarget())
{
return;
UMJInteractComponent* InteractComp = MyChar->GetUITarget()->FindComponentByClass<UMJInteractComponent>();
if (InteractComp)
{
InteractComp->ProceedInteraction();
return;
}
}

UMJInteractComponent* InteractComp = MyChar->GetUITarget()->FindComponentByClass<UMJInteractComponent>();
if (!InteractComp)
if (bIsTutorialMode)
{
return;
UMJTutorialStartDialogueComponent* TutorialStartDialogue = MyChar->FindComponentByClass<UMJTutorialStartDialogueComponent>();
TutorialStartDialogue->ProceedStory();
}
InteractComp->ProceedInteraction();
}

void AMJPlayerController::SetDialogueVisibility()
void AMJPlayerController::DialogueEnd()
{
ChangeToIMCDefault();
UIManager->SetDialogueVisibility();
if (bIsTutorialMode)
{
UIManager->GetHUDWidget()->SetMouseVisibility();
UIManager->GetHUDWidget()->SetInstructionWidgetVisibility();
UIManager->GetHUDWidget()->ShowShift();
UIManager->GetHUDWidget()->SetInstructionText("Move right and defeat the monster. Hold Shift and left-click to execute a basic attack.");
}
}

void AMJPlayerController::TutorialDialogueEnd() // Tutorial 시작 다이어로그가 끝나면
{
ChangeToIMCDefault();
UIManager->SetDialogueVisibility();
UIManager->GetHUDWidget()->SetLeftMouse();
UIManager->GetHUDWidget()->SetInstructionWidgetVisibility();
UIManager->GetHUDWidget()->SetInstructionText("Click the left mouse button to move the map. Move to your sister.");
}

void AMJPlayerController::ShowStore()
Expand Down Expand Up @@ -547,7 +587,6 @@ void AMJPlayerController::GetOwnedSkill()
AMJPlayerCharacter* MJChar = Cast<AMJPlayerCharacter>(GetPawn());
if (UMJPlayerSkillComponent* SkillComponent = MJChar->FindComponentByClass<UMJPlayerSkillComponent>())
{

SkillComponent->EquipSkill(TempTag);
UE_LOG(LogTemp,Error,TEXT("AMJPlayerController::GetOwnedSkill, %s"),*TempTag.ToString());
}
Expand All @@ -564,8 +603,8 @@ void AMJPlayerController::OnTriggeredIn(UPrimitiveComponent* Overlapped, AActor*
IsInteracted = true;
InteractComp->OnBeginInteract();

InteractComp->OndialogueEnd.RemoveDynamic(this, &AMJPlayerController::SetDialogueVisibility);
InteractComp->OndialogueEnd.AddDynamic(this, &AMJPlayerController::SetDialogueVisibility);
InteractComp->OndialogueEnd.RemoveDynamic(this, &AMJPlayerController::DialogueEnd);
InteractComp->OndialogueEnd.AddDynamic(this, &AMJPlayerController::DialogueEnd);

InteractComp->OnstoreOpen.RemoveDynamic(this, &AMJPlayerController::ShowStore);
InteractComp->OnstoreOpen.AddDynamic(this, &AMJPlayerController::ShowStore);
Expand All @@ -581,6 +620,37 @@ void AMJPlayerController::OnTriggeredIn(UPrimitiveComponent* Overlapped, AActor*
InteractComp->GetStoreComponent()->SetItemData(MJChar->GetInventoryComponent()->GetItemTags(),MJChar->GetInventoryComponent()->GetItemTags().Num(),MJChar->GetInventoryComponent());
}
}

if (bIsTutorialMode && !UIManager->GetbHasRun())
{
UIManager->GetHUDWidget()->SetMouseVisibility(); // OFF
UIManager->GetHUDWidget()->SetInstructionText("Interaction is possible with F key. Press F key to talk with your sister.");
UIManager->SetbHasRun(true);
}
}

if (AMJTutorialCollision* TutorialCollision = Cast<AMJTutorialCollision>(Other))
{
// if (TutorialCollision->GetCollisionType() == ECollisionType::AttackTutorial)
// {
// UIManager->GetHUDWidget()->ShowShift();
// UIManager->GetHUDWidget()->SetInstructionText(TutorialCollision->GetInstructionText());
// }

if (TutorialCollision->GetCollisionType() == ECollisionType::InstantSkillTutorial)
{
UIManager->GetHUDWidget()->HideShift();
UIManager->GetHUDWidget()->SetRightMouse();
UIManager->GetHUDWidget()->SetInstructionText(TutorialCollision->GetInstructionText());
TutorialCollision->Hide();
}

if (TutorialCollision->GetCollisionType() == ECollisionType::ChargeSkillTutorial)
{
UIManager->GetHUDWidget()->SetRightPressMouse();
UIManager->GetHUDWidget()->SetInstructionText(TutorialCollision->GetInstructionText());
TutorialCollision->Hide();
}
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion Source/ProjectMJ/Controller/MJPlayerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class PROJECTMJ_API AMJPlayerController : public APlayerController
TObjectPtr<UInputAction> ShiftAction;
#pragma region UIPart
private:
bool bIsTutorialMode = false;

bool IsInteracted = false;
FGameplayTag PurchaseItemTag;
int32 ItemPrice;
Expand Down Expand Up @@ -125,7 +127,11 @@ class PROJECTMJ_API AMJPlayerController : public APlayerController
void ProceedDialogue();

UFUNCTION()
void SetDialogueVisibility();
void DialogueEnd();

UFUNCTION()
void TutorialDialogueEnd();

// Store
UFUNCTION()
void ShowStore();
Expand Down
27 changes: 13 additions & 14 deletions Source/ProjectMJ/Dialogue/MJBacklogWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,33 @@
#include "Dialogue/MJDialogueRow.h"
#include "Fonts/SlateFontInfo.h"

void UMJBacklogWidget::AddLine(const FMJDialogueRow& Row) // 함수명 수정하기 > AddLine으로
void UMJBacklogWidget::AddLine(const FMJDialogueRow& Row)
{
if (!BacklogScrollBox) return;

FString Line = Row.Speaker + TEXT(" : ") + Row.Script;
UTextBlock* NewTextBlock = NewObject<UTextBlock>(BacklogScrollBox);
NewTextBlock = NewObject<UTextBlock>(BacklogScrollBox);

if (NewTextBlock)
{
// 폰트 변경
// 폰트 변경 // 런타임 내에서 텍스트블록이 형성되므로 에디터 상에서 변경이 어려울 듯 하여
FSlateFontInfo FontInfo;
FontInfo.FontObject = LoadObject<UObject>(nullptr, TEXT("/Game/UI/Font/CookieRun_Regular_Font.CookieRun_Regular_Font"));
FontInfo.FontObject = LoadObject<UObject>(nullptr, TEXT("/Game/UI/Font/CookieRun_Regular_Font.CookieRun_Regular_Font")); //
FontInfo.Size = 15;
NewTextBlock->SetFont(FontInfo);

// 텍스트 색 변경
FSlateColor SetColor = FSlateColor(FLinearColor::White);
NewTextBlock->SetColorAndOpacity(SetColor);

// 대사 행 간격
if (UScrollBoxSlot* ScrollSlot = Cast<UScrollBoxSlot>(NewTextBlock->Slot))
{
ScrollSlot->SetPadding(FMargin(20, 5, 20, 5));
}

NewTextBlock->SetText(FText::FromString(Line));
BacklogScrollBox->AddChild(NewTextBlock);

// 텍스트 색 변경
FSlateColor SetColor = FSlateColor(FLinearColor::White);
NewTextBlock->SetColorAndOpacity(SetColor);

// 대사 행 간격
if (UScrollBoxSlot* ScrollSlot = Cast<UScrollBoxSlot>(NewTextBlock->Slot))
{
ScrollSlot->SetPadding(FMargin(20, 5, 20, 5));
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion Source/ProjectMJ/Dialogue/MJBacklogWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
#include "Blueprint/UserWidget.h"
#include "MJBacklogWidget.generated.h"


/*
* Class Description: Backlog를 띄우는 위젯 클래스
* Author: 이지수
* Created Date: 2025.06.17
* Last Modified By: 이지수
* Last Modified Date: 2025.06.17
*/

struct FMJDialogueRow;
class UTextBlock;
class UScrollBox;
UCLASS()
class PROJECTMJ_API UMJBacklogWidget : public UUserWidget
Expand All @@ -21,7 +25,10 @@ class PROJECTMJ_API UMJBacklogWidget : public UUserWidget

protected:
UPROPERTY(meta = (BindWidget))
class UScrollBox* BacklogScrollBox;
TObjectPtr<UScrollBox> BacklogScrollBox;

UPROPERTY()
TObjectPtr<UTextBlock> NewTextBlock;

public:
UFUNCTION()
Expand Down
2 changes: 2 additions & 0 deletions Source/ProjectMJ/Dialogue/MJDialogueComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ void UMJDialogueComponent::FloatLine()
GetDialogueWidget()->SetTextBlock(GetCurrentRow()->Script, GetCurrentRow()->Speaker);
GetDialogueWidget()->StartTyping(GetCurrentRow()->Script,0.05);
GetDialogueWidget()->SetImageOpacity(GetCurrentRow()->Speaker);
GetDialogueWidget()->SetPlayerImage(GetCurrentRow()->PlayerMugImage);
GetDialogueWidget()->SetNPCImage(GetCurrentRow()->NPCMugImage);
}

const FMJDialogueRow* UMJDialogueComponent::GetCurrentRow() const
Expand Down
5 changes: 5 additions & 0 deletions Source/ProjectMJ/Dialogue/MJDialogueRow.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ struct FMJDialogueRow : public FTableRowBase
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString ScriptForExit;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D* PlayerMugImage;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D* NPCMugImage;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FDialogueChoice> Choices; // 선택지는 여러개니까 배열?
};
23 changes: 22 additions & 1 deletion Source/ProjectMJ/Dialogue/MJDialogueWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "MJBacklogWidget.h"
#include "Components/TextBlock.h"
#include "Components/Image.h"
#include "Kismet/GameplayStatics.h"

void UMJDialogueWidget::NativeConstruct()
{
Expand All @@ -30,6 +31,26 @@ void UMJDialogueWidget::SetTextBlock(const FString& InText,const FString& speake
}
}

void UMJDialogueWidget::SetNPCImage(UTexture2D* InNPCImage)
{
if (NPCImage)
{
FSlateBrush Brush;
Brush.SetResourceObject(InNPCImage);
NPCImage->SetBrush(Brush);
}
}

void UMJDialogueWidget::SetPlayerImage(UTexture2D* InPlayerImage)
{
if (PlayerImage)
{
FSlateBrush Brush;
Brush.SetResourceObject(InPlayerImage);
PlayerImage->SetBrush(Brush);
}
}

void UMJDialogueWidget::StartTyping(const FString& InText, float TypingSpeed)
{
FullText = InText;
Expand Down Expand Up @@ -86,7 +107,7 @@ void UMJDialogueWidget::SetImageOpacity(const FString& SpeakerName)
if (!NPCImage)
return;

if (SpeakerName == TEXT("Player"))
if (SpeakerName == TEXT("A la Mode"))
{
PlayerImage->SetOpacity(1.0f);
NPCImage->SetOpacity(0.3f);
Expand Down
2 changes: 2 additions & 0 deletions Source/ProjectMJ/Dialogue/MJDialogueWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class PROJECTMJ_API UMJDialogueWidget : public UUserWidget
virtual void NativeConstruct() override;

void SetTextBlock(const FString& InText, const FString& Speaker);
void SetNPCImage(UTexture2D* InNPCImage);
void SetPlayerImage(UTexture2D* InPlayerImage);

void ShowBacklog();

Expand Down
Loading