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

78 lines
2.0 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
class ExtMenu_Perks extends KFGFxMenu_Perks;
var ExtPlayerController ExtKFPC;
var Ext_PerkBase ExtPrevPerk;
function OnOpen()
{
2020-11-28 20:04:55 +00:00
KFPC = KFPlayerController(GetPC());
2020-11-28 20:12:58 +00:00
if (ExtKFPC == none)
2017-10-20 02:00:49 +00:00
ExtKFPC = ExtPlayerController(KFPC);
2020-11-28 20:12:58 +00:00
if (ExtKFPC.ActivePerkManager==None)
2017-10-20 02:00:49 +00:00
{
ExtKFPC.SetTimer(0.25,true,'OnOpen',Self);
return;
}
ExtKFPC.ClearTimer('OnOpen',Self);
2020-11-28 20:12:58 +00:00
if (ExtPrevPerk==None)
2017-10-20 02:00:49 +00:00
ExtPrevPerk = ExtKFPC.ActivePerkManager.CurrentPerk;
ExUpdateContainers(ExtPrevPerk);
2020-11-28 20:04:55 +00:00
SetBool("locked", true);
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
final function ExUpdateContainers(Ext_PerkBase PerkClass)
2017-10-20 02:00:49 +00:00
{
LastPerkLevel = PerkClass.CurrentLevel;
2020-11-28 20:04:55 +00:00
if (ExtPerksContainer_Header(HeaderContainer)!=none)
ExtPerksContainer_Header(HeaderContainer).ExUpdatePerkHeader(PerkClass);
if (ExtPerksContainer_Details(DetailsContainer)!=none)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:04:55 +00:00
ExtPerksContainer_Details(DetailsContainer).ExUpdateDetails(PerkClass);
ExtPerksContainer_Details(DetailsContainer).ExUpdatePassives(PerkClass);
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
if (SelectionContainer != none)
2017-10-20 02:00:49 +00:00
SelectionContainer.UpdatePerkSelection(ExtKFPC.ActivePerkManager.UserPerks.Find(PerkClass));
}
function CheckTiersForPopup();
event OnClose()
{
ExtPrevPerk = None;
2020-11-28 20:04:55 +00:00
if (ExtKFPC != none)
2017-10-20 02:00:49 +00:00
ExtKFPC.ClearTimer('OnOpen',Self);
super.OnClose();
}
2020-11-28 20:04:55 +00:00
function PerkChanged(byte NewPerkIndex, bool bClickedIndex)
2017-10-20 02:00:49 +00:00
{
ExUpdateContainers(ExtPrevPerk);
}
function OneSecondLoop()
{
2020-11-28 20:12:58 +00:00
if (ExtPrevPerk!=None && LastPerkLevel!=ExtPrevPerk.CurrentLevel)
2017-10-20 02:00:49 +00:00
ExUpdateContainers(ExtPrevPerk);
}
function UpdateLock();
function SavePerkData();
function Callback_PerkSelected(byte NewPerkIndex, bool bClickedIndex)
{
ExtPrevPerk = ExtKFPC.ActivePerkManager.UserPerks[NewPerkIndex];
ExUpdateContainers(ExtPrevPerk);
ExtKFPC.PendingPerkClass = ExtPrevPerk.Class;
ExtKFPC.SwitchToPerk(ExtPrevPerk.Class);
}
function Callback_SkillSelectionOpened();
defaultproperties
{
SubWidgetBindings(0)=(WidgetClass=Class'ExtPerksContainer_Selection')
SubWidgetBindings(1)=(WidgetClass=Class'ExtPerksContainer_Header')
SubWidgetBindings(3)=(WidgetClass=Class'ExtPerksContainer_Details')
}