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

91 lines
2.7 KiB
Ucode
Raw Normal View History

Class UIP_PerkSelectionLobby extends UIP_PerkSelection;
var localized string LevelText;
var localized string PointsText;
var localized string NoPerkSelectedText;
function Timer()
{
local int i;
CurrentManager = ExtPlayerController(GetPlayer()).ActivePerkManager;
2020-11-28 20:12:58 +00:00
if (CurrentManager!=None)
{
2020-11-28 20:12:58 +00:00
if (PrevPendingPerk!=None)
{
PendingPerk = CurrentManager.FindPerk(PrevPendingPerk);
PrevPendingPerk = None;
}
PerkList.ChangeListSize(CurrentManager.UserPerks.Length);
2020-11-28 20:12:58 +00:00
if (PendingPerk!=None && !PendingPerk.bPerkNetReady)
return;
// Huge code block to handle stat updating, but actually pretty well optimized.
2020-11-28 20:12:58 +00:00
if (PendingPerk!=OldUsedPerk)
{
OldUsedPerk = PendingPerk;
2020-11-28 20:12:58 +00:00
if (PendingPerk!=None)
{
OldPerkPoints = -1;
2020-11-28 20:12:58 +00:00
if (StatsList.ItemComponents.Length!=PendingPerk.PerkStats.Length)
{
2020-11-28 20:12:58 +00:00
if (StatsList.ItemComponents.Length<PendingPerk.PerkStats.Length)
{
2020-11-28 20:12:58 +00:00
for (i=StatsList.ItemComponents.Length; i<PendingPerk.PerkStats.Length; ++i)
{
2020-11-28 20:12:58 +00:00
if (i>=StatBuyers.Length)
{
StatBuyers[StatBuyers.Length] = UIR_PerkStat(StatsList.AddListComponent(class'UIR_PerkStat'));
StatBuyers[i].StatIndex = i;
StatBuyers[i].InitMenu();
}
else
{
StatsList.ItemComponents.Length = i+1;
StatsList.ItemComponents[i] = StatBuyers[i];
}
}
}
2020-11-28 20:12:58 +00:00
else if (StatsList.ItemComponents.Length>PendingPerk.PerkStats.Length)
{
2020-11-28 20:12:58 +00:00
for (i=PendingPerk.PerkStats.Length; i<StatsList.ItemComponents.Length; ++i)
StatBuyers[i].CloseMenu();
StatsList.ItemComponents.Length = PendingPerk.PerkStats.Length;
}
}
OldPerkPoints = PendingPerk.CurrentSP;
PerkLabel.SetText(LevelText$PendingPerk.GetLevelString()@PendingPerk.PerkName@"("$PointsText@PendingPerk.CurrentSP$")");
2020-11-28 20:12:58 +00:00
for (i=0; i<StatsList.ItemComponents.Length; ++i) // Just make sure perk stays the same.
{
StatBuyers[i].SetActivePerk(PendingPerk);
StatBuyers[i].CheckBuyLimit();
}
UpdateTraits();
}
else // Empty out if needed.
{
2020-11-28 20:12:58 +00:00
for (i=0; i<StatsList.ItemComponents.Length; ++i)
StatBuyers[i].CloseMenu();
StatsList.ItemComponents.Length = 0;
PerkLabel.SetText(NoPerkSelectedText);
}
}
2020-11-28 20:12:58 +00:00
else if (PendingPerk!=None && OldPerkPoints!=PendingPerk.CurrentSP)
{
OldPerkPoints = PendingPerk.CurrentSP;
PerkLabel.SetText(LevelText$PendingPerk.GetLevelString()@PendingPerk.PerkName@"("$PointsText@PendingPerk.CurrentSP$")");
2020-11-28 20:12:58 +00:00
for (i=0; i<StatsList.ItemComponents.Length; ++i) // Just make sure perk stays the same.
StatBuyers[i].CheckBuyLimit();
// Update traits list.
UpdateTraits();
}
}
}
defaultproperties
{
Components.Remove(UnloadPerkButton)
Components.Remove(PrestigePerkButton)
Components.Remove(ResetPerkButton)
}