KF2-YetAnotherScoreboard/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc

174 lines
4.1 KiB
Ucode
Raw Normal View History

2021-05-31 01:46:53 +00:00
class ScoreboardExtRepInfo extends ReplicationInfo;
2021-05-31 04:04:26 +00:00
var public array<UIDInfoEntry> PlayerInfos;
var public array<PlayerGroupEntry> PlayerGroups;
2021-05-31 01:46:53 +00:00
2021-05-31 04:04:26 +00:00
var public string SystemAdminRank;
2021-06-07 01:42:49 +00:00
var public ColorRGB SystemAdminColor;
2021-05-31 04:04:26 +00:00
var public Fields SystemAdminApplyColorToFields;
2021-05-31 01:46:53 +00:00
2021-05-31 04:04:26 +00:00
var public string SystemPlayerRank;
2021-06-07 01:42:49 +00:00
var public ColorRGB SystemPlayerColor;
2021-05-31 04:04:26 +00:00
var public Fields SystemPlayerApplyColorToFields;
2021-05-31 01:46:53 +00:00
2021-05-31 04:04:26 +00:00
var private bool SystemFinished, GroupsFinished, InfosFinished;
var private int InfosReplicateProgress, GroupsReplicateProgress;
var private KFScoreBoard SC;
public final function ClientStartReplication()
{
GetScoreboard();
ClientInitSystem(
SystemAdminRank,
SystemAdminColor,
SystemAdminApplyColorToFields,
SystemPlayerRank,
SystemPlayerColor,
SystemPlayerApplyColorToFields);
SetTimer(0.01f, true, nameof(ClientReplicateGroups));
SetTimer(0.01f, true, nameof(ClientReplicateInfos));
}
public final function ClientReplicateGroups()
{
if (GroupsReplicateProgress < PlayerGroups.Length)
{
ClientAddPlayerGroup(PlayerGroups[GroupsReplicateProgress]);
++GroupsReplicateProgress;
}
else
{
ClearTimer(nameof(ClientReplicateGroups));
GroupReplicationFinished();
}
}
public final function ClientReplicateInfos()
{
if (InfosReplicateProgress < PlayerInfos.Length)
{
ClientAddPlayerInfo(PlayerInfos[InfosReplicateProgress]);
++InfosReplicateProgress;
}
else
{
ClearTimer(nameof(ClientReplicateInfos));
InfosReplicationFinished();
}
}
private reliable client final function GetScoreboard()
{
if (SC != None)
{
ClearTimer(nameof(GetScoreboard));
return;
}
SC = ScoreboardExtHUD(GetALocalPlayerController().myHUD).Scoreboard;
SetTimer(0.1f, false, nameof(GetScoreboard));
}
private reliable client final function ClientAddPlayerGroup(PlayerGroupEntry Group)
{
PlayerGroups.AddItem(Group);
}
private reliable client final function ClientAddPlayerInfo(UIDInfoEntry PlayerInfo)
{
PlayerInfos.AddItem(PlayerInfo);
}
private reliable client final function GroupReplicationFinished()
{
GroupsFinished = true;
ClientGroupsApply();
}
private reliable client final function InfosReplicationFinished()
{
InfosFinished = true;
ClientInfosApply();
}
private reliable client final function ClientInitSystem(
2021-05-31 01:46:53 +00:00
string _SystemAdminRank,
2021-06-07 01:42:49 +00:00
ColorRGB _SystemAdminColor,
2021-05-31 01:46:53 +00:00
Fields _SystemAdminApplyColorToFields,
string _SystemPlayerRank,
2021-06-07 01:42:49 +00:00
ColorRGB _SystemPlayerColor,
2021-05-31 01:46:53 +00:00
Fields _SystemPlayerApplyColorToFields)
{
SystemAdminRank = _SystemAdminRank;
SystemAdminColor = _SystemAdminColor;
SystemAdminApplyColorToFields = _SystemAdminApplyColorToFields;
SystemPlayerRank = _SystemPlayerRank;
SystemPlayerColor = _SystemPlayerColor;
SystemPlayerApplyColorToFields = _SystemPlayerApplyColorToFields;
2021-05-31 04:04:26 +00:00
ClientSystemApply();
2021-05-31 01:46:53 +00:00
}
2021-05-31 04:04:26 +00:00
private reliable client final function ClientSystemApply()
2021-05-31 01:46:53 +00:00
{
if (SC == None)
{
2021-05-31 04:04:26 +00:00
SetTimer(0.1f, false, nameof(ClientSystemApply));
2021-05-31 01:46:53 +00:00
return;
}
SC.SystemAdminRank = SystemAdminRank;
SC.SystemAdminColor = SystemAdminColor;
SC.SystemAdminApplyColorToFields = SystemAdminApplyColorToFields;
SC.SystemPlayerRank = SystemPlayerRank;
SC.SystemPlayerColor = SystemPlayerColor;
SC.SystemPlayerApplyColorToFields = SystemPlayerApplyColorToFields;
2021-05-31 04:04:26 +00:00
SystemFinished = true;
Finished();
}
private reliable client final function ClientGroupsApply()
{
if (SC == None)
{
SetTimer(0.1f, false, nameof(ClientGroupsApply));
return;
}
SC.PlayerGroups = PlayerGroups;
GroupsFinished = true;
Finished();
}
private reliable client final function ClientInfosApply()
{
if (SC == None)
{
SetTimer(0.1f, false, nameof(ClientInfosApply));
return;
}
SC.PlayerInfos = PlayerInfos;
GroupsFinished = true;
Finished();
}
private reliable client final function Finished()
{
if (SystemFinished && GroupsFinished && InfosFinished)
Destroy();
2021-05-31 01:46:53 +00:00
}
defaultproperties
{
2021-05-31 04:04:26 +00:00
InfosReplicateProgress=0
GroupsReplicateProgress=0
2021-05-31 01:46:53 +00:00
2021-05-31 04:04:26 +00:00
SystemFinished=false
GroupsFinished=false
InfosFinished=false
2021-05-31 01:46:53 +00:00
}