Files
TheracUE/Source/MyProject/Private/ModeInputTextBox.cpp

54 lines
1.2 KiB
C++
Raw Normal View History

// Fill out your copyright notice in the Description page of Project Settings.
#include "ModeInputTextBox.h"
2025-05-15 19:28:04 +01:00
#include <Logging/StructuredLog.h>
2025-05-09 16:02:07 +01:00
void UModeInputTextBox::HandleOnTextChanged(FText const & inText) {
2025-05-15 19:28:04 +01:00
Text = Text.GetEmpty();
2025-05-09 16:02:07 +01:00
auto & s = inText.ToString();
2025-05-15 19:28:04 +01:00
// UE_LOGFMT(LogTemp, Warning, "kill me {inText}", s);
auto lastChar = s.ToUpper().Right(1);
// UE_LOGFMT(LogTemp, Warning, "fucking {lastChar}", lastChar);
SetText(FText::FromString(lastChar));
2025-05-10 21:31:54 +01:00
if (!lastChar.IsEmpty()) {
switch (myTarget) {
case THSModeTarget::Energy:
2025-05-15 19:28:04 +01:00
switch (lastChar[lastChar.Len() - 1]) {
2025-05-10 21:31:54 +01:00
case 'E':
2025-05-15 19:28:04 +01:00
2025-05-10 21:31:54 +01:00
break;
case 'X':
2025-05-15 19:28:04 +01:00
2025-05-10 21:31:54 +01:00
break;
default:
2025-05-15 19:28:04 +01:00
lastChar[lastChar.Len() - 1] = '\0';
2025-05-10 21:31:54 +01:00
break;
}
break;
case THSModeTarget::OpMode:
2025-05-15 19:28:04 +01:00
switch (lastChar[lastChar.Len() - 1]) {
2025-05-10 21:31:54 +01:00
case 'T':
2025-05-15 19:28:04 +01:00
2025-05-10 21:31:54 +01:00
break;
case 'R':
2025-05-15 19:28:04 +01:00
2025-05-10 21:31:54 +01:00
break;
case 'P':
2025-05-15 19:28:04 +01:00
2025-05-10 21:31:54 +01:00
break;
2025-05-15 19:28:04 +01:00
default:
lastChar = "";
2025-05-10 21:31:54 +01:00
}
break;
default:
break;
}
}
2025-05-15 19:28:04 +01:00
// UE_LOGFMT(LogTemp, Warning, "wat {lastChar}", lastChar);
2025-05-09 16:02:07 +01:00
SetText(FText::FromString(lastChar));
2025-05-15 19:28:04 +01:00
// SetText(FText::FromString(FString::Printf(TEXT("%c"), lastChar)));
2025-05-09 16:02:07 +01:00
}