KF2-Server-Extension/ServerExt/Classes/KFGUI_NumericBox.uc

54 lines
887 B
Ucode
Raw Permalink Normal View History

2017-10-20 02:00:49 +00:00
Class KFGUI_NumericBox extends KFGUI_EditBox;
var() float MaxValue,MinValue;
var() bool bFloatValue;
function InitMenu()
{
Super.InitMenu();
ValidateValue();
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
final function int GetValueInt()
{
return int(Value);
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
final function float GetValueFloat()
{
return float(Value);
}
2020-11-28 20:04:55 +00:00
function ChangeValue(string V)
2017-10-20 02:00:49 +00:00
{
Super.ChangeValue(V);
ValidateValue();
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
final function ValidateValue()
{
2020-11-28 20:12:58 +00:00
if (bFloatValue)
2017-10-20 02:00:49 +00:00
Value = string(FClamp(float(Value),MinValue,MaxValue));
else Value = string(Clamp(int(Value),MinValue,MaxValue));
}
2020-11-28 20:04:55 +00:00
function bool NotifyInputChar(int ControllerId, string Unicode)
2017-10-20 02:00:49 +00:00
{
ControllerId = Asc(Unicode);
2020-11-28 20:12:58 +00:00
if ((ControllerId>=48 && ControllerId<=57) || ControllerId==46)
2017-10-20 02:00:49 +00:00
Super.NotifyInputChar(ControllerId,Unicode);
return true;
}
function LostKeyFocus()
{
ValidateValue();
Super.LostKeyFocus();
}
defaultproperties
{
MaxValue=9999999
MaxTextLength=7
2023-05-14 02:49:12 +00:00
}