more readability
This commit is contained in:
parent
8b15531abd
commit
bb8452fa0b
5
ScoreboardExt/Classes/CustomRanks.uc
Normal file
5
ScoreboardExt/Classes/CustomRanks.uc
Normal file
@ -0,0 +1,5 @@
|
||||
class CustomRanks extends Object
|
||||
dependson(Types)
|
||||
config(ScoreboardExt);
|
||||
|
||||
var config array<RankInfo> Rank;
|
@ -18,8 +18,8 @@ var Color PingColor;
|
||||
var float PingBars,IdealPing,MaxPing;
|
||||
|
||||
// Ranks
|
||||
var array<RankInfo> PlayerRanks;
|
||||
var array<UIDRankRelation> PlayerInfos;
|
||||
var array<RankInfo> CustomRanks;
|
||||
var array<UIDRankRelation> PlayerRankRelations;
|
||||
|
||||
var string SystemAdminRank;
|
||||
var ColorRGB SystemAdminColor;
|
||||
@ -333,14 +333,14 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
|
||||
KFPRI = KFPRIArray[Index];
|
||||
|
||||
HasRank = false;
|
||||
PlayerInfoIndex = PlayerInfos.Find('UID', KFPRI.UniqueId);
|
||||
PlayerInfoIndex = PlayerRankRelations.Find('UID', KFPRI.UniqueId);
|
||||
if (PlayerInfoIndex != INDEX_NONE )
|
||||
{
|
||||
PlayerRankIndex = PlayerRanks.Find('ID', PlayerInfos[PlayerInfoIndex].RankID);
|
||||
PlayerRankIndex = CustomRanks.Find('ID', PlayerRankRelations[PlayerInfoIndex].RankID);
|
||||
if (PlayerRankIndex != INDEX_NONE)
|
||||
{
|
||||
HasRank = true;
|
||||
CurrentRank = PlayerRanks[PlayerRankIndex];
|
||||
CurrentRank = CustomRanks[PlayerRankIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
class PlayerInfos extends Object
|
||||
dependson(Types)
|
||||
config(ScoreboardExt);
|
||||
|
||||
var config array<PlayerRankRelation> PlayerInfo;
|
5
ScoreboardExt/Classes/PlayerRankRelations.uc
Normal file
5
ScoreboardExt/Classes/PlayerRankRelations.uc
Normal file
@ -0,0 +1,5 @@
|
||||
class PlayerRankRelations extends Object
|
||||
dependson(Types)
|
||||
config(ScoreboardExt);
|
||||
|
||||
var config array<PlayerRankRelation> Relation;
|
@ -1,5 +0,0 @@
|
||||
class PlayerRanks extends Object
|
||||
dependson(Types)
|
||||
config(ScoreboardExt);
|
||||
|
||||
var config array<RankInfo> PlayerRank;
|
@ -1,5 +1,5 @@
|
||||
class ScoreboardExtMut extends KFMutator
|
||||
dependson(PlayerRanks, PlayerInfos)
|
||||
dependson(CustomRanks, PlayerRankRelations)
|
||||
config(ScoreboardExt);
|
||||
|
||||
const SteamIDLen = 17;
|
||||
@ -16,26 +16,25 @@ struct SClient
|
||||
};
|
||||
|
||||
var private array<SClient> RepClients;
|
||||
|
||||
var private array<UIDRankRelation> UIDInfos;
|
||||
var private array<UIDRankRelation> UIDRelations;
|
||||
|
||||
function PostBeginPlay()
|
||||
{
|
||||
Super.PostBeginPlay();
|
||||
WorldInfo.Game.HUDType = class'ScoreboardExtHUD';
|
||||
InitConfig();
|
||||
LoadGroupPlayers();
|
||||
LoadPlayerRelations();
|
||||
}
|
||||
|
||||
function NotifyLogin(Controller C)
|
||||
{
|
||||
AddPlayerInfo(C);
|
||||
AddPlayer(C);
|
||||
Super.NotifyLogin(C);
|
||||
}
|
||||
|
||||
function NotifyLogout(Controller C)
|
||||
{
|
||||
RemovePlayerInfo(C);
|
||||
RemovePlayer(C);
|
||||
Super.NotifyLogout(C);
|
||||
}
|
||||
|
||||
@ -70,12 +69,12 @@ private function InitConfig()
|
||||
ExampleRank.TextColor.G = 250;
|
||||
ExampleRank.TextColor.B = 235;
|
||||
ExampleRank.OverrideAdminRank = true;
|
||||
class'PlayerRanks'.default.PlayerRank.AddItem(ExampleRank);
|
||||
class'CustomRanks'.default.Rank.AddItem(ExampleRank);
|
||||
|
||||
// Example player
|
||||
ExamplePlayer.PlayerID = "76561198001617867"; // GenZmeY SteamID64
|
||||
ExamplePlayer.RankID = ExampleRank.ID;
|
||||
class'PlayerInfos'.default.PlayerInfo.AddItem(ExamplePlayer);
|
||||
class'PlayerRankRelations'.default.Relation.AddItem(ExamplePlayer);
|
||||
|
||||
// Example rank for steam group members
|
||||
ExampleRank.ID = 1;
|
||||
@ -84,18 +83,18 @@ private function InitConfig()
|
||||
ExampleRank.TextColor.G = 250;
|
||||
ExampleRank.TextColor.B = 130;
|
||||
ExampleRank.OverrideAdminRank = false;
|
||||
class'PlayerRanks'.default.PlayerRank.AddItem(ExampleRank);
|
||||
class'CustomRanks'.default.Rank.AddItem(ExampleRank);
|
||||
|
||||
// Example steam group
|
||||
ExampleSteamGroup.SteamGroupID = "103582791465384046"; // MSK-GS SteamID64
|
||||
ExampleSteamGroup.RankID = ExampleRank.ID;
|
||||
class'SteamGroups'.default.SteamGroup.AddItem(ExampleSteamGroup);
|
||||
class'SteamGroupRankRelations'.default.Relation.AddItem(ExampleSteamGroup);
|
||||
|
||||
class'SystemAdminRank'.static.StaticSaveConfig();
|
||||
class'SystemPlayerRank'.static.StaticSaveConfig();
|
||||
class'PlayerRanks'.static.StaticSaveConfig();
|
||||
class'PlayerInfos'.static.StaticSaveConfig();
|
||||
class'SteamGroups'.static.StaticSaveConfig();
|
||||
class'CustomRanks'.static.StaticSaveConfig();
|
||||
class'PlayerRankRelations'.static.StaticSaveConfig();
|
||||
class'SteamGroupRankRelations'.static.StaticSaveConfig();
|
||||
|
||||
case 2147483647:
|
||||
`log("[ScoreboardExt] Config updated to version"@CurrentVersion);
|
||||
@ -117,7 +116,7 @@ private function InitConfig()
|
||||
}
|
||||
}
|
||||
|
||||
private function LoadGroupPlayers()
|
||||
private function LoadPlayerRelations()
|
||||
{
|
||||
local PlayerRankRelation Player;
|
||||
local OnlineSubsystem steamworks;
|
||||
@ -125,24 +124,24 @@ private function LoadGroupPlayers()
|
||||
|
||||
steamworks = class'GameEngine'.static.GetOnlineSubsystem();
|
||||
|
||||
foreach class'PlayerInfos'.default.PlayerInfo(Player)
|
||||
foreach class'PlayerRankRelations'.default.Relation(Player)
|
||||
{
|
||||
UIDInfo.RankID = Player.RankID;
|
||||
if (Len(Player.PlayerID) == UniqueIDLen && steamworks.StringToUniqueNetId(Player.PlayerID, UIDInfo.UID))
|
||||
{
|
||||
if (UIDInfos.Find('Uid', UIDInfo.UID) == INDEX_NONE)
|
||||
UIDInfos.AddItem(UIDInfo);
|
||||
if (UIDRelations.Find('Uid', UIDInfo.UID) == INDEX_NONE)
|
||||
UIDRelations.AddItem(UIDInfo);
|
||||
}
|
||||
else if (Len(Player.PlayerID) == SteamIDLen && steamworks.Int64ToUniqueNetId(Player.PlayerID, UIDInfo.UID))
|
||||
{
|
||||
if (UIDInfos.Find('Uid', UIDInfo.UID) == INDEX_NONE)
|
||||
UIDInfos.AddItem(UIDInfo);
|
||||
if (UIDRelations.Find('Uid', UIDInfo.UID) == INDEX_NONE)
|
||||
UIDRelations.AddItem(UIDInfo);
|
||||
}
|
||||
else `Log("[ScoreboardExt] WARN: Can't add player:"@Player.PlayerID);
|
||||
}
|
||||
}
|
||||
|
||||
function AddPlayerInfo(Controller C)
|
||||
function AddPlayer(Controller C)
|
||||
{
|
||||
local KFPlayerController KFPC;
|
||||
local SClient RepClient;
|
||||
@ -156,8 +155,8 @@ function AddPlayerInfo(Controller C)
|
||||
|
||||
RepClients.AddItem(RepClient);
|
||||
|
||||
RepClient.RepInfo.PlayerInfos = UIDInfos;
|
||||
RepClient.RepInfo.PlayerRanks = class'PlayerRanks'.default.PlayerRank;
|
||||
RepClient.RepInfo.PlayerRankRelations = UIDRelations;
|
||||
RepClient.RepInfo.CustomRanks = class'CustomRanks'.default.Rank;
|
||||
RepClient.RepInfo.SystemAdminRank = class'SystemAdminRank'.default.Rank;
|
||||
RepClient.RepInfo.SystemAdminColor = class'SystemAdminRank'.default.TextColor;
|
||||
RepClient.RepInfo.SystemAdminApplyColorToFields = class'SystemAdminRank'.default.ApplyColorToFields;
|
||||
@ -168,7 +167,7 @@ function AddPlayerInfo(Controller C)
|
||||
RepClient.RepInfo.ClientStartReplication();
|
||||
}
|
||||
|
||||
function RemovePlayerInfo(Controller C)
|
||||
function RemovePlayer(Controller C)
|
||||
{
|
||||
local KFPlayerController KFPC;
|
||||
local int Index;
|
||||
|
@ -1,7 +1,7 @@
|
||||
class ScoreboardExtRepInfo extends ReplicationInfo;
|
||||
|
||||
var public array<UIDRankRelation> PlayerInfos;
|
||||
var public array<RankInfo> PlayerRanks;
|
||||
var public array<UIDRankRelation> PlayerRankRelations;
|
||||
var public array<RankInfo> CustomRanks;
|
||||
|
||||
var public string SystemAdminRank;
|
||||
var public ColorRGB SystemAdminColor;
|
||||
@ -34,9 +34,9 @@ public function ClientStartReplication()
|
||||
|
||||
public function ClientReplicateRanks()
|
||||
{
|
||||
if (RanksReplicateProgress < PlayerRanks.Length)
|
||||
if (RanksReplicateProgress < CustomRanks.Length)
|
||||
{
|
||||
ClientAddPlayerRank(PlayerRanks[RanksReplicateProgress]);
|
||||
ClientAddPlayerRank(CustomRanks[RanksReplicateProgress]);
|
||||
++RanksReplicateProgress;
|
||||
}
|
||||
else
|
||||
@ -48,9 +48,9 @@ public function ClientReplicateRanks()
|
||||
|
||||
public function ClientReplicateInfos()
|
||||
{
|
||||
if (InfosReplicateProgress < PlayerInfos.Length)
|
||||
if (InfosReplicateProgress < PlayerRankRelations.Length)
|
||||
{
|
||||
ClientAddPlayerInfo(PlayerInfos[InfosReplicateProgress]);
|
||||
ClientAddPlayerInfo(PlayerRankRelations[InfosReplicateProgress]);
|
||||
++InfosReplicateProgress;
|
||||
}
|
||||
else
|
||||
@ -74,12 +74,12 @@ private reliable client function GetScoreboard()
|
||||
|
||||
private reliable client function ClientAddPlayerRank(RankInfo Rank)
|
||||
{
|
||||
PlayerRanks.AddItem(Rank);
|
||||
CustomRanks.AddItem(Rank);
|
||||
}
|
||||
|
||||
private reliable client function ClientAddPlayerInfo(UIDRankRelation PlayerInfo)
|
||||
{
|
||||
PlayerInfos.AddItem(PlayerInfo);
|
||||
PlayerRankRelations.AddItem(PlayerInfo);
|
||||
}
|
||||
|
||||
private reliable client function RankReplicationFinished()
|
||||
@ -139,7 +139,7 @@ private reliable client function ClientRanksApply()
|
||||
return;
|
||||
}
|
||||
|
||||
SC.PlayerRanks = PlayerRanks;
|
||||
SC.CustomRanks = CustomRanks;
|
||||
RanksFinished = true;
|
||||
Finished();
|
||||
}
|
||||
@ -152,7 +152,7 @@ private reliable client function ClientInfosApply()
|
||||
return;
|
||||
}
|
||||
|
||||
SC.PlayerInfos = PlayerInfos;
|
||||
SC.PlayerRankRelations = PlayerRankRelations;
|
||||
RanksFinished = true;
|
||||
Finished();
|
||||
}
|
||||
|
10
ScoreboardExt/Classes/SteamGroupRankRelations.uc
Normal file
10
ScoreboardExt/Classes/SteamGroupRankRelations.uc
Normal file
@ -0,0 +1,10 @@
|
||||
class SteamGroupRankRelations extends Object
|
||||
dependson(Types)
|
||||
config(ScoreboardExt);
|
||||
|
||||
var config array<SteamGroupRankRelation> Relation;
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
class SteamGroups extends Object
|
||||
dependson(Types)
|
||||
config(ScoreboardExt);
|
||||
|
||||
var config array<SteamGroupRankRelation> SteamGroup;
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user