feat: trait buy localization

This commit is contained in:
GenZmeY 2020-09-01 07:02:33 +03:00
parent a67c3f577b
commit c74aa02086
2 changed files with 16 additions and 6 deletions

Binary file not shown.

View File

@ -2,18 +2,32 @@ Class UIR_TraitInfoPopup extends KFGUI_FloatingWindow;
var KFGUI_TextField TraitInfo; var KFGUI_TextField TraitInfo;
var KFGUI_Button YesButton; var KFGUI_Button YesButton;
var KFGUI_Button NoButton;
var class<Ext_TraitBase> MyTrait; var class<Ext_TraitBase> MyTrait;
var int TraitIndex; var int TraitIndex;
var Ext_PerkBase MyPerk; var Ext_PerkBase MyPerk;
var int OldPoints,OldLevel; var int OldPoints,OldLevel;
var localized string ButtonBuyText;
var localized string ButtonBuyDisabledText;
var localized string ButtonBuyTooltip;
var localized string ButtonCancelText;
var localized string ButtonCancelTooltip;
function InitMenu() function InitMenu()
{ {
TraitInfo = KFGUI_TextField(FindComponentID('Info')); TraitInfo = KFGUI_TextField(FindComponentID('Info'));
YesButton = KFGUI_Button(FindComponentID('Yes')); YesButton = KFGUI_Button(FindComponentID('Yes'));
NoButton = KFGUI_Button(FindComponentID('No'));
NoButton.ButtonText=ButtonCancelText;
NoButton.Tooltip=ButtonCancelTooltip;
YesButton.Tooltip=ButtonBuyTooltip;
Super.InitMenu(); Super.InitMenu();
} }
function CloseMenu() function CloseMenu()
{ {
Super.CloseMenu(); Super.CloseMenu();
@ -45,12 +59,12 @@ function Timer()
OldLevel = MyPerk.PerkTraits[TraitIndex].CurrentLevel; OldLevel = MyPerk.PerkTraits[TraitIndex].CurrentLevel;
if( OldLevel>=MyTrait.Default.NumLevels ) if( OldLevel>=MyTrait.Default.NumLevels )
{ {
YesButton.ButtonText = "Max level"; YesButton.ButtonText = ButtonBuyDisabledText;
YesButton.SetDisabled(true); YesButton.SetDisabled(true);
return; return;
} }
Cost = MyTrait.Static.GetTraitCost(OldLevel); Cost = MyTrait.Static.GetTraitCost(OldLevel);
YesButton.ButtonText = "Buy ("$Cost$")"; // TODO: localize YesButton.ButtonText = ButtonBuyText$" ("$Cost$")";
if( Cost>OldPoints || !MyTrait.Static.MeetsRequirements(OldLevel,MyPerk) ) if( Cost>OldPoints || !MyTrait.Static.MeetsRequirements(OldLevel,MyPerk) )
YesButton.SetDisabled(true); YesButton.SetDisabled(true);
else YesButton.SetDisabled(false); else YesButton.SetDisabled(false);
@ -78,7 +92,6 @@ defaultproperties
bAlwaysTop=true bAlwaysTop=true
bOnlyThisFocus=true bOnlyThisFocus=true
// TODO: localize
Begin Object Class=KFGUI_TextField Name=TraitInfoLbl Begin Object Class=KFGUI_TextField Name=TraitInfoLbl
ID="Info" ID="Info"
XPosition=0.05 XPosition=0.05
@ -88,7 +101,6 @@ defaultproperties
End Object End Object
Begin Object Class=KFGUI_Button Name=BuyButten Begin Object Class=KFGUI_Button Name=BuyButten
ID="Yes" ID="Yes"
Tooltip="Purchase this trait (you can not undo this action!)"
XPosition=0.3 XPosition=0.3
YPosition=0.91 YPosition=0.91
XSize=0.19 XSize=0.19
@ -99,8 +111,6 @@ defaultproperties
End Object End Object
Begin Object Class=KFGUI_Button Name=CancelButten Begin Object Class=KFGUI_Button Name=CancelButten
ID="No" ID="No"
ButtonText="Cancel"
Tooltip="Abort without doing anything"
XPosition=0.5 XPosition=0.5
YPosition=0.91 YPosition=0.91
XSize=0.19 XSize=0.19