Files
TheracUE/Source/MyProject/Private/ModeInputTextBox.cpp
2025-05-16 16:44:27 +01:00

60 lines
1.3 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "ModeInputTextBox.h"
#include <Logging/StructuredLog.h>
void UModeInputTextBox::HandleOnTextChanged(FText const & inText) {
/*
if (GetText().IsEmpty()) {
return;
}
SetText(FText());
*/
Text = FText();
auto & s = inText.ToString();
// 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));
if (!lastChar.IsEmpty()) {
switch (myTarget) {
case THSModeTarget::Energy:
switch (lastChar[lastChar.Len() - 1]) {
case 'E':
break;
case 'X':
break;
default:
lastChar[lastChar.Len() - 1] = '\0';
break;
}
break;
case THSModeTarget::OpMode:
switch (lastChar[lastChar.Len() - 1]) {
case 'T':
break;
case 'R':
break;
case 'P':
break;
default:
lastChar = "";
}
break;
default:
break;
}
}
// UE_LOGFMT(LogTemp, Warning, "wat {lastChar}", lastChar);
SetText(FText::FromString(lastChar));
// SetText(FText::FromString(FString::Printf(TEXT("%c"), lastChar)));
}