2017-10-20 02:00:49 +00:00
|
|
|
Class UIR_TraitInfoPopup extends KFGUI_FloatingWindow;
|
|
|
|
|
|
|
|
var KFGUI_TextField TraitInfo;
|
|
|
|
var KFGUI_Button YesButton;
|
2020-09-01 04:02:33 +00:00
|
|
|
var KFGUI_Button NoButton;
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
var class<Ext_TraitBase> MyTrait;
|
|
|
|
var int TraitIndex;
|
|
|
|
var Ext_PerkBase MyPerk;
|
|
|
|
var int OldPoints,OldLevel;
|
|
|
|
|
2020-09-01 04:02:33 +00:00
|
|
|
var localized string ButtonBuyText;
|
|
|
|
var localized string ButtonBuyDisabledText;
|
|
|
|
var localized string ButtonBuyTooltip;
|
|
|
|
var localized string ButtonCancelText;
|
|
|
|
var localized string ButtonCancelTooltip;
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
TraitInfo = KFGUI_TextField(FindComponentID('Info'));
|
|
|
|
YesButton = KFGUI_Button(FindComponentID('Yes'));
|
2020-09-01 04:02:33 +00:00
|
|
|
NoButton = KFGUI_Button(FindComponentID('No'));
|
|
|
|
|
|
|
|
NoButton.ButtonText=ButtonCancelText;
|
|
|
|
NoButton.Tooltip=ButtonCancelTooltip;
|
|
|
|
YesButton.Tooltip=ButtonBuyTooltip;
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
Super.InitMenu();
|
|
|
|
}
|
2020-09-01 04:02:33 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function CloseMenu()
|
|
|
|
{
|
|
|
|
Super.CloseMenu();
|
|
|
|
MyPerk = None;
|
|
|
|
MyTrait = None;
|
|
|
|
SetTimer(0,false);
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function ShowTraitInfo(int Index, Ext_PerkBase Perk)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
MyTrait = Perk.PerkTraits[Index].TraitType;
|
|
|
|
WindowTitle = MyTrait.Default.TraitName;
|
|
|
|
TraitInfo.SetText(MyTrait.Static.GetPerkDescription());
|
|
|
|
|
|
|
|
OldPoints = -1;
|
|
|
|
OldLevel = -1;
|
|
|
|
TraitIndex = Index;
|
|
|
|
MyPerk = Perk;
|
|
|
|
Timer();
|
|
|
|
SetTimer(0.2,true);
|
|
|
|
}
|
|
|
|
function Timer()
|
|
|
|
{
|
|
|
|
local int Cost;
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
if(OldPoints!=MyPerk.CurrentSP || OldLevel!=MyPerk.PerkTraits[TraitIndex].CurrentLevel)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
OldPoints = MyPerk.CurrentSP;
|
|
|
|
OldLevel = MyPerk.PerkTraits[TraitIndex].CurrentLevel;
|
2020-11-28 20:04:55 +00:00
|
|
|
if(OldLevel>=MyTrait.Default.NumLevels)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-09-01 04:02:33 +00:00
|
|
|
YesButton.ButtonText = ButtonBuyDisabledText;
|
2017-10-20 02:00:49 +00:00
|
|
|
YesButton.SetDisabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Cost = MyTrait.Static.GetTraitCost(OldLevel);
|
2020-09-01 04:02:33 +00:00
|
|
|
YesButton.ButtonText = ButtonBuyText$" ("$Cost$")";
|
2020-11-28 20:04:55 +00:00
|
|
|
if(Cost>OldPoints || !MyTrait.Static.MeetsRequirements(OldLevel,MyPerk))
|
2017-10-20 02:00:49 +00:00
|
|
|
YesButton.SetDisabled(true);
|
|
|
|
else YesButton.SetDisabled(false);
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
function ButtonClicked(KFGUI_Button Sender)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
switch(Sender.ID)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
case 'Yes':
|
|
|
|
ExtPlayerController(GetPlayer()).BoughtTrait(MyPerk.Class,MyTrait);
|
|
|
|
break;
|
|
|
|
case 'No':
|
|
|
|
DoClose();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
XPosition=0.3
|
|
|
|
YPosition=0.15
|
|
|
|
XSize=0.4
|
|
|
|
YSize=0.7
|
|
|
|
bAlwaysTop=true
|
|
|
|
bOnlyThisFocus=true
|
|
|
|
|
|
|
|
Begin Object Class=KFGUI_TextField Name=TraitInfoLbl
|
|
|
|
ID="Info"
|
|
|
|
XPosition=0.05
|
|
|
|
YPosition=0.1
|
|
|
|
XSize=0.9
|
|
|
|
YSize=0.8
|
|
|
|
End Object
|
|
|
|
Begin Object Class=KFGUI_Button Name=BuyButten
|
|
|
|
ID="Yes"
|
|
|
|
XPosition=0.3
|
|
|
|
YPosition=0.91
|
|
|
|
XSize=0.19
|
|
|
|
YSize=0.07
|
|
|
|
ExtravDir=1
|
|
|
|
OnClickLeft=ButtonClicked
|
|
|
|
OnClickRight=ButtonClicked
|
|
|
|
End Object
|
|
|
|
Begin Object Class=KFGUI_Button Name=CancelButten
|
|
|
|
ID="No"
|
|
|
|
XPosition=0.5
|
|
|
|
YPosition=0.91
|
|
|
|
XSize=0.19
|
|
|
|
YSize=0.07
|
|
|
|
OnClickLeft=ButtonClicked
|
|
|
|
OnClickRight=ButtonClicked
|
|
|
|
End Object
|
|
|
|
|
|
|
|
Components.Add(TraitInfoLbl)
|
|
|
|
Components.Add(BuyButten)
|
|
|
|
Components.Add(CancelButten)
|
|
|
|
}
|