feat: UnloadPerk localization

This commit is contained in:
GenZmeY 2020-08-12 14:16:23 +03:00
parent 502cda2cec
commit f02a77156d
2 changed files with 35 additions and 19 deletions

Binary file not shown.

View File

@ -1,22 +1,43 @@
Class UI_UnloadInfo extends KFGUI_FloatingWindow; Class UI_UnloadInfo extends KFGUI_FloatingWindow;
var class<Ext_PerkBase> PerkToReset; var class<Ext_PerkBase> PerkToReset;
var KFGUI_Button YesButten; var KFGUI_Button UnloadPerkYesButton, UnloadPerkNoButton;
var KFGUI_TextField InfoLabel; var KFGUI_TextField InfoLabel;
var byte CurCallCode; var byte CurCallCode;
var localized string ResetPerkNotice;
var localized string PleaseWait;
var localized string ResetDisabledWarn;
var localized string ResetMinLevelWarnPart1;
var localized string ResetMinLevelWarnPart2;
var localized string ResetAttentionPart1;
var localized string ResetAttentionPart2;
var localized string ResetAttentionPart3;
var localized string ButtonYesText;
var localized string ButtonNoText;
var localized string ButtonYesToolTip;
var localized string ButtonNoToolTip;
function InitMenu() function InitMenu()
{ {
YesButten = KFGUI_Button(FindComponentID('Yes')); UnloadPerkYesButton = KFGUI_Button(FindComponentID('Yes'));
UnloadPerkNoButton = KFGUI_Button(FindComponentID('No'));
UnloadPerkYesButton.ButtonText=ButtonYesText;
UnloadPerkNoButton.ButtonText=ButtonNoText;
UnloadPerkYesButton.ToolTip=ButtonYesToolTip;
UnloadPerkNoButton.ToolTip=ButtonNoToolTip;
InfoLabel = KFGUI_TextField(FindComponentID('Info')); InfoLabel = KFGUI_TextField(FindComponentID('Info'));
Super.InitMenu(); Super.InitMenu();
} }
final function SetupTo( class<Ext_PerkBase> P ) final function SetupTo( class<Ext_PerkBase> P )
{ {
PerkToReset = P; PerkToReset = P;
WindowTitle = "NOTICE: Unload stats for "$P.Default.PerkName; // TODO: localize WindowTitle = ResetPerkNotice$" "$P.Default.PerkName;
YesButten.SetDisabled(true); UnloadPerkYesButton.SetDisabled(true);
InfoLabel.SetText("Please wait..."); // TODO: localize InfoLabel.SetText(PleaseWait);
++CurCallCode; ++CurCallCode;
ExtPlayerController(GetPlayer()).OnClientGetResponse = ReceivedInfo; ExtPlayerController(GetPlayer()).OnClientGetResponse = ReceivedInfo;
ExtPlayerController(GetPlayer()).ServerGetUnloadInfo(CurCallCode,PerkToReset,false); ExtPlayerController(GetPlayer()).ServerGetUnloadInfo(CurCallCode,PerkToReset,false);
@ -45,18 +66,18 @@ function ReceivedInfo( byte CallID, byte Code, int DataA, int DataB )
{ {
if( CurCallCode!=CallID ) if( CurCallCode!=CallID )
return; return;
// TODO: localize
switch( Code ) switch( Code )
{ {
case 0: case 0:
InfoLabel.SetText("ERROR: Perk unloading is disabled on this server!"); InfoLabel.SetText(ResetDisabledWarn);
break; break;
case 1: case 1:
InfoLabel.SetText("ERROR: You need to be at least on level #{FFFF00}"$DataA$"#{DEF} before you can use this feature!"); InfoLabel.SetText(ResetMinLevelWarnPart1$DataA$ResetMinLevelWarnPart2);
break; break;
case 2: case 2:
InfoLabel.SetText("#{FF0000}WARNING:#{DEF} By using this feature you will lose #{FFFF00}"$DataA$"#{DEF} XP points, and by that you will drop down #{FF0000}"$DataB$"#{DEF} levels!|In addition you will be forced to suicide to reset specific stats.||Are you sure you want to continue?"); InfoLabel.SetText(ResetAttentionPart1$DataA$ResetAttentionPart2$DataB$ResetAttentionPart3);
YesButten.SetDisabled(false); UnloadPerkYesButton.SetDisabled(false);
break; break;
} }
} }
@ -78,11 +99,8 @@ defaultproperties
YSize=0.775 YSize=0.775
End Object End Object
// TODO: localize Begin Object Class=KFGUI_Button Name=UnloadPerkYesButton
Begin Object Class=KFGUI_Button Name=YesButten
ID="Yes" ID="Yes"
ButtonText="YES"
Tooltip="Reset the perk (you can not undo this action!)"
XPosition=0.2 XPosition=0.2
YPosition=0.9 YPosition=0.9
XSize=0.29 XSize=0.29
@ -91,10 +109,8 @@ defaultproperties
OnClickLeft=ButtonClicked OnClickLeft=ButtonClicked
OnClickRight=ButtonClicked OnClickRight=ButtonClicked
End Object End Object
Begin Object Class=KFGUI_Button Name=NoButten Begin Object Class=KFGUI_Button Name=UnloadPerkNoButton
ID="No" ID="No"
ButtonText="ABORT"
Tooltip="Abort without doing anything"
XPosition=0.5 XPosition=0.5
YPosition=0.9 YPosition=0.9
XSize=0.29 XSize=0.29
@ -104,6 +120,6 @@ defaultproperties
End Object End Object
Components.Add(WarningLabel) Components.Add(WarningLabel)
Components.Add(YesButten) Components.Add(UnloadPerkYesButton)
Components.Add(NoButten) Components.Add(UnloadPerkNoButton)
} }