Skip to content

Commit f549a31

Browse files
Merge branch '5.3' into 5.4_dev
2 parents 598bbce + dcbcc91 commit f549a31

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

Source/MounteaDialogueSystem/Private/Components/MounteaDialogueManager.cpp

+13-9
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,8 @@ void UMounteaDialogueManager::SetDialogueWidgetClass_Server_Implementation(TSubc
974974

975975
bool UMounteaDialogueManager::InvokeDialogueUI_Implementation(FString& Message)
976976
{
977+
RefreshDialogueWidgetHelper(this, MounteaDialogueWidgetCommands::CreateDialogueWidget);
978+
977979
if (UMounteaDialogueSystemBFC::GetDialogueSystemSettings_Internal() == nullptr)
978980
{
979981
Message = TEXT("Cannot find Dialogue Settings!");
@@ -1034,17 +1036,17 @@ bool UMounteaDialogueManager::InvokeDialogueUI_Implementation(FString& Message)
10341036

10351037
bool UMounteaDialogueManager::UpdateDialogueUI_Implementation(FString& Message, const FString& Command)
10361038
{
1039+
OnDialogueWidgetCommandRequested.Broadcast(this, Command);
1040+
10371041
if (!DialogueWidgetPtr)
10381042
{
10391043
LOG_ERROR(TEXT("[Dialogue Command Request] Invalid Dialogue Widget!"))
10401044

10411045
return false;
10421046
}
1043-
10441047

10451048
LOG_INFO(TEXT("[Dialogue Command Requested] %s"), *Command)
1046-
1047-
OnDialogueWidgetCommandRequested.Broadcast(this, Command);
1049+
10481050

10491051
if (DialogueWidgetPtr)
10501052
{
@@ -1057,6 +1059,8 @@ bool UMounteaDialogueManager::UpdateDialogueUI_Implementation(FString& Message,
10571059

10581060
bool UMounteaDialogueManager::CloseDialogueUI_Implementation()
10591061
{
1062+
OnDialogueWidgetCommandRequested.Broadcast(this, MounteaDialogueWidgetCommands::CloseDialogueWidget);
1063+
10601064
APlayerController* playerController = UMounteaDialogueSystemBFC::FindPlayerController(GetOwner());
10611065
if (playerController == nullptr)
10621066
{
@@ -1098,15 +1102,19 @@ void UMounteaDialogueManager::ExecuteWidgetCommand_Implementation(const FString&
10981102
{
10991103
FString resultMessage;
11001104
Execute_UpdateDialogueUI(this, resultMessage, Command);
1105+
1106+
RefreshDialogueWidgetHelper(this, Command);
11011107
}
11021108
else
11031109
{
11041110
UpdateDialogueUI_Client(Command);
1111+
RefreshDialogueWidgetHelper(this, Command);
11051112
}
11061113
}
11071114
else
11081115
{
11091116
UpdateDialogueUI_Client(Command);
1117+
RefreshDialogueWidgetHelper(this, Command);
11101118
}
11111119
}
11121120

@@ -1359,10 +1367,7 @@ void UMounteaDialogueManager::RefreshDialogueWidgetHelper(const TScriptInterface
13591367
{
13601368
if (dialogueObject)
13611369
{
1362-
if ( const TScriptInterface<IMounteaDialogueWBPInterface> dialogueInterface = dialogueObject.Get() )
1363-
{
1364-
IMounteaDialogueWBPInterface::Execute_RefreshDialogueWidget(dialogueObject, DialogueManager, WidgetCommand);
1365-
}
1370+
IMounteaDialogueWBPInterface::Execute_RefreshDialogueWidget(dialogueObject, DialogueManager, WidgetCommand);
13661371
}
13671372
}
13681373
}
@@ -1375,8 +1380,7 @@ bool UMounteaDialogueManager::AddDialogueUIObject_Implementation(UObject* NewDia
13751380
return false;
13761381
}
13771382

1378-
const TScriptInterface<IMounteaDialogueWBPInterface> dialogueObject = NewDialogueObject;
1379-
if (dialogueObject.GetInterface() == nullptr || dialogueObject.GetObject() == nullptr)
1383+
if (!NewDialogueObject->Implements<UMounteaDialogueWBPInterface>())
13801384
{
13811385
LOG_WARNING(TEXT("[AddDialogueUIObject] Input parameter does not implement 'IMounteaDialogueWBPInterface'!"));
13821386
return false;

Source/MounteaDialogueSystem/Public/Interfaces/MounteaDialogueWBPInterface.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ class MOUNTEADIALOGUESYSTEM_API IMounteaDialogueWBPInterface
3434
* @param DialogueManager Dialogue Manager Interface reference. Request 'GetDialogueContext' to retrieve data to display.
3535
* @param Command String command. All commands are defined in ProjectSettings/MounteaFramework/MounteaDialogueSystem.
3636
*/
37-
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category="Mountea|Dialogue|UserInterface|Dialogue", meta=(CustomTag="MounteaK2Setter"))
37+
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category="Mountea|Dialogue|UserInterface|Dialogue")
3838
void RefreshDialogueWidget(const TScriptInterface<IMounteaDialogueManagerInterface>& DialogueManager, const FString& Command);
3939

4040
/**
4141
* Called when an option has been selected.
4242
*
4343
* @param SelectionGUID The GUID of the selected option.
4444
*/
45-
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category="Mountea|Dialogue|UserInterface|Dialogue", meta=(CustomTag="MounteaK2Setter"))
45+
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category="Mountea|Dialogue|UserInterface|Dialogue")
4646
void OnOptionSelected(const FGuid& SelectionGUID);
4747
};

0 commit comments

Comments
 (0)