Code:
class PHGFxUIScoreboard extends UTGFxTweenableMoviePlayer;
var GFxObject RootMC;
var GFxObject ScoreboardMC, OverlayMC, TitleMC, BlueTeamMC, RedTeamMC;
var GFxObject TimeMC, TimeTF, Title_TitleGMC, TitleTF, TitleGMC;
var GFxObject BlueHeaderMC, BlueScoreTF, BlueTitleTF;
var GFxObject RedHeaderMC, RedScoreTF, RedTitleTF;
//var GFxObject FooterMC, FooterItemMC;
var byte RedTeamIndex, BlueTeamIndex;
var GFxObject PlayerRow;
var bool bPlayerRowTween;
var bool bTeamGame;
var GFxObject MapNameTF, Title_TitleNMC;
var WorldInfo ThisWorld;
struct ScoreEntry
{
var string PlayerName;
var int PlayerScore;
var int PlayerDeaths;
var bool bHasFlag;
var int PlayerKills;
var int PlayerFlags;
var int PlayerFlagReturn;
};
/**
Cached version of data being displayed by scoreboard - used to avoid querying/updating Flash UI unnecessarily (for performance)
*/
var ScoreEntry RedEntries[12], BlueEntries[12];
struct ScoreboardState
{
var int RemainingTime;
var int RedScore;
var int BlueScore;
var String PlayerName;
var byte PlayerPlace;
var float PlayerScore;
var int PlayerDeaths;
var int PlayerKills;
var int PlayerFlags;
var int PlayerFlagReturn;
};
var ScoreboardState PreviousState;
struct ScoreRow
{
var GFxObject MovieClip;
var GFxObject InnerMovieClip;
var GFxObject DeathsTF;
var GFxObject ScoreTF;
var GFxObject NameTF;
var GFxObject KillsTF;
var GFxObject FlagsTF;
var GFxObject FlagReturnTF;
};
var array<ScoreRow> BlueItems, RedItems;
var transient int NameCnt;
/**
var GFxObject Footer_NameTF;
var GFxObject Footer_PlaceLabelTF;
var GFxObject Footer_PlaceTF;
var GFxObject Footer_ScoreLabelTF;
var GFxObject Footer_ScoreTF;
var GFxObject Footer_DeathsLabelTF;
var GFxObject Footer_DeathsTF;
*/
var bool bInitialized;
var string MapName;
function bool Start(optional bool StartPaused = false)
{
super.Start();
Advance(0);
if (!bInitialized)
{
ConfigScoreboard();
}
Draw();
return true;
}
function PlayOpenAnimation()
{
TitleMC.GotoAndPlay("open");
//FooterMC.GotoAndPlay("open");
OverlayMC.GotoAndPlay("open");
}
function PlayCloseAnimation()
{
TitleMC.GotoAndPlay("close");
//FooterMC.GotoAndPlay("close");
OverlayMC.GotoAndPlay("close");
}
/*
* Cache references to Scoreboard's MovieClips for later use.
*/
function ConfigScoreboard()
{
local PlayerController PC;
ThisWorld = GetPC().WorldInfo;
MapName = ThisWorld.GetMapName(false);
`log(MapName);
RootMC = GetVariableObject("_root");
ScoreboardMC = RootMC.GetObject("scoreboard");
// Scale and shift for 16:9. Last minute hack.
RootMC.SetFloat("_xscale", 95);
RootMC.SetFloat("_yscale", 95);
RootMC.SetFloat("_y", RootMC.GetFloat("_y")+25);
PC = GetPC();
if (PC != none)
{
bTeamGame = True;
//CTFGame = ThisWorld.Game.UTCTFFlag != None;
//bTeamGame = UTGFxTeamHUDWrapper(PC.MyHUD) != None;
if (MapName == "Map4")
{
ScoreboardMC.GotoAndPlay("dm");
OverlayMC = ScoreboardMC.GetObject("dm");
BlueTeamMC = OverlayMC.GetObject("blue_team");
RedTeamMC = OverlayMC.GetObject("red_team");
`log(" deathmatch config scoreboard called");
}
else
{
ScoreboardMC.GotoAndPlay("team");
OverlayMC = ScoreboardMC.GetObject("team");
BlueTeamMC = OverlayMC.GetObject("blue_team");
RedTeamMC = OverlayMC.GetObject("red_team");
`log(" CTF Config scoreboard called");
}
}
TitleMC = ScoreboardMC.GetObject("title");
TimeMC = TitleMC.GetObject("time");
Title_TitleGMC = TitleMC.GetObject("title_g");
TimeTF = TimeMC.GetObject("textField");
TitleTF = Title_TitleGMC.GetObject("textField");
Title_TitleNMC = TitleMC.GetObject("title_n");
MapNameTF = Title_TitleNMC.GetObject("textField");
MapNameTF.SetString("text", ThisWorld.GetMapName(false));
PreviousState.PlayerDeaths = -1;
PreviousState.PlayerScore = -1.0;
PreviousState.PlayerPlace = -1;
PreviousState.PlayerKills = -1;
if (MapName == "Map5")
{
PreviousState.PlayerFlags = -1;
PreviousState.PlayerFlagReturn = -1;
}
if (MapName == "Map4")
{
SetupRedTeamTDM();
SetupBlueTeamTDM();
}
else
{
SetupRedTeam();
SetupBlueTeam();
}
//FloatScoreboardAnimationX(true);
//FloatScoreboardAnimationY(true);
bInitialized = true;
}
/*
* Cache references to MovieClips used for the Blue Team.
*/
function SetupBlueTeam()
{
local byte i;
local ScoreRow sr;
local ASDisplayInfo dI;
`log("Blue team CTF called");
for (i = 0; i < 12; i++)
{
BlueItems[i] = sr;
BlueItems[i].MovieClip = BlueTeamMC.GetObject("item"$(i+1));
BlueItems[i].MovieClip.SetFloat("_z", 200);
// Give 50% Alpha blend to all rows.
// Non-empty rows will be corrected to 100% later.
dI = BlueItems[i].MovieClip.GetDisplayInfo();
dI.Alpha = 50.0;
BlueItems[i].MovieClip.SetDisplayInfo(dI);
BlueItems[i].InnerMovieClip = BlueItems[i].MovieClip.GetObject("item_g");
BlueItems[i].DeathsTF = BlueItems[i].InnerMovieClip.GetObject("deaths");
BlueItems[i].ScoreTF = BlueItems[i].InnerMovieClip.GetObject("score");
BlueItems[i].NameTF = BlueItems[i].InnerMovieClip.GetObject("name");
BlueItems[i].KillsTF = BlueItems[i].InnerMovieClip.GetObject("kills");
BlueItems[i].FlagsTF = BlueItems[i].InnerMovieClip.GetObject("flag");
BlueItems[i].FlagReturnTF = BlueItems[i].InnerMovieClip.GetObject("flagReturn");
}
BlueHeaderMC = BlueTeamMC.GetObject("header");
//BlueHeaderMC.GetObject("header1").SetFloat("_z", 200);
BlueScoreTF = BlueHeaderMC.GetObject("score").GetObject("textField");
BlueTitleTF = BlueHeaderMC.GetObject("title").GetObject("textField");
}
function SetupBlueTeamTDM()
{
local byte i;
local ScoreRow sr;
local ASDisplayInfo dI;
`log("Blue team TDM called");
for (i = 0; i < 12; i++)
{
BlueItems[i] = sr;
BlueItems[i].MovieClip = BlueTeamMC.GetObject("item"$(i+1));
BlueItems[i].MovieClip.SetFloat("_z", 200);
// Give 50% Alpha blend to all rows.
// Non-empty rows will be corrected to 100% later.
dI = BlueItems[i].MovieClip.GetDisplayInfo();
dI.Alpha = 50.0;
BlueItems[i].MovieClip.SetDisplayInfo(dI);
BlueItems[i].InnerMovieClip = BlueItems[i].MovieClip.GetObject("item_g");
BlueItems[i].DeathsTF = BlueItems[i].InnerMovieClip.GetObject("deaths");
BlueItems[i].ScoreTF = BlueItems[i].InnerMovieClip.GetObject("score");
BlueItems[i].NameTF = BlueItems[i].InnerMovieClip.GetObject("name");
BlueItems[i].KillsTF = BlueItems[i].InnerMovieClip.GetObject("kills");
}
BlueHeaderMC = BlueTeamMC.GetObject("header");
//BlueHeaderMC.GetObject("header1").SetFloat("_z", 200);
BlueScoreTF = BlueHeaderMC.GetObject("score").GetObject("textField");
BlueTitleTF = BlueHeaderMC.GetObject("title").GetObject("textField");
}
/*
* Cache references to MovieClips used for the Red Team.
*/
function SetupRedTeam()
{
local byte i;
local ScoreRow sr;
local ASDisplayInfo dI;
`log("Red team CTF called");
for (i = 0; i < 12; i++)
{
RedItems[i] = sr;
RedItems[i].MovieClip = RedTeamMC.GetObject("item"$(i+1));
RedItems[i].MovieClip.SetFloat("_z", 200);
// Give 50% Alpha blend to all rows.
// Non-empty rows will be corrected to 100% later.
dI = RedItems[i].MovieClip.GetDisplayInfo();
dI.Alpha = 50.0f;
RedItems[i].MovieClip.SetDisplayInfo(dI);
RedItems[i].InnerMovieClip = RedItems[i].MovieClip.GetObject("item_g");
RedItems[i].DeathsTF = RedItems[i].InnerMovieClip.GetObject("deaths");
RedItems[i].ScoreTF = RedItems[i].InnerMovieClip.GetObject("score");
RedItems[i].NameTF = RedItems[i].InnerMovieClip.GetObject("name");
RedItems[i].KillsTF = RedItems[i].InnerMovieClip.GetObject("kills");
RedItems[i].FlagsTF = RedItems[i].InnerMovieClip.GetObject("flag");
RedItems[i].FlagReturnTF = RedItems[i].InnerMovieClip.GetObject("flagReturn");
}
RedHeaderMC = RedTeamMC.GetObject("header");
//RedHeaderMC.GetObject("header1").SetFloat("_z", 200);
RedScoreTF = RedHeaderMC.GetObject("score").GetObject("textField");
RedTitleTF = RedHeaderMC.GetObject("title").GetObject("textField");
}
function SetupRedTeamTDM()
{
local byte i;
local ScoreRow sr;
local ASDisplayInfo dI;
`log("Red team TDM called");
for (i = 0; i < 12; i++)
{
RedItems[i] = sr;
RedItems[i].MovieClip = RedTeamMC.GetObject("item"$(i+1));
RedItems[i].MovieClip.SetFloat("_z", 200);
// Give 50% Alpha blend to all rows.
// Non-empty rows will be corrected to 100% later.
dI = RedItems[i].MovieClip.GetDisplayInfo();
dI.Alpha = 50.0f;
RedItems[i].MovieClip.SetDisplayInfo(dI);
RedItems[i].InnerMovieClip = RedItems[i].MovieClip.GetObject("item_g");
RedItems[i].DeathsTF = RedItems[i].InnerMovieClip.GetObject("deaths");
RedItems[i].ScoreTF = RedItems[i].InnerMovieClip.GetObject("score");
RedItems[i].NameTF = RedItems[i].InnerMovieClip.GetObject("name");
RedItems[i].KillsTF = RedItems[i].InnerMovieClip.GetObject("kills");
}
RedHeaderMC = RedTeamMC.GetObject("header");
//RedHeaderMC.GetObject("header1").SetFloat("_z", 200);
RedScoreTF = RedHeaderMC.GetObject("score").GetObject("textField");
RedTitleTF = RedHeaderMC.GetObject("title").GetObject("textField");
}
/*
* Initial setup of Scoreboard.
*/
function Draw()
{
local UTGameReplicationInfo GRI;
local PlayerController PC;
PC = GetPC();
if (PC != none)
{
GRI = UTGameReplicationInfo(PC.WorldInfo.GRI);
}
if ( GRI != None )
{
TitleTF.SetText(GRI.GameClass.default.GameName);
UpdateHeaders(GRI);
UpdatePreviousState(GRI);
}
}
/**
* Make sure the PRI lists reflect current player state
*/
function UpdatePRIListsTDM(UTGameReplicationInfo GRI)
{
local int i, redPlayers, bluePlayers;
local UTPlayerReplicationInfo PRI;
local GFxObject NewPlayerRow;
redPlayers = 0;
bluePlayers = 0;
// Set up lists of Red/Blue players - each list only has 12 slots.
for ( i=0; i<GRI.PRIArray.Length; i++ )
{
PRI = UTPlayerReplicationInfo(GRI.PRIArray[i]);
if ( PRI != none && IsValidScoreboardPlayer(PRI) )
{
NewPlayerRow = None;
if ( (PRI.Team == None) || (PRI.Team.TeamIndex == RedTeamIndex) )
{
if ( !PRI.bOnlySpectator && (redPlayers < 12) )
{
NewPlayerRow = RedItems[redPlayers].MovieClip;
UpdateRowTDM(RedItems[redPlayers], RedEntries[redPlayers], PRI);
//`log("Update Row Red Called");
redPlayers++;
}
}
else if ( (PRI.Team.TeamIndex == BlueTeamIndex) && (bluePlayers < 12) )
{
NewPlayerRow = BlueItems[BluePlayers].MovieClip;
UpdateRowTDM(BlueItems[BluePlayers], BlueEntries[BluePlayers], PRI);
//`log("Update Row Blue Called");
bluePlayers++;
}
if ( PRI.IsLocalPlayerPRI() )
{
if ( PlayerRow != NewPlayerRow )
{
SetPlayerRow(NewPlayerRow);
}
UpdateFooter(GRI, PRI, i);
}
}
}
// clear now empty rows
for ( i=RedPlayers; i<12; i++ )
{
if ( RedEntries[i].PlayerName != "" )
{
RedEntries[i].PlayerName = "";
ClearRow(RedItems[i]);
}
}
for ( i=BluePlayers; i<12; i++ )
{
if ( BlueEntries[i].PlayerName != "" )
{
BlueEntries[i].PlayerName = "";
ClearRow(BlueItems[i]);
}
}
}
function UpdatePRILists(UTGameReplicationInfo GRI)
{
local int i, redPlayers, bluePlayers;
local UTPlayerReplicationInfo PRI;
local GFxObject NewPlayerRow;
redPlayers = 0;
bluePlayers = 0;
// Set up lists of Red/Blue players - each list only has 12 slots.
for ( i=0; i<GRI.PRIArray.Length; i++ )
{
PRI = UTPlayerReplicationInfo(GRI.PRIArray[i]);
if ( PRI != none && IsValidScoreboardPlayer(PRI) )
{
NewPlayerRow = None;
if ( (PRI.Team == None) || (PRI.Team.TeamIndex == RedTeamIndex) )
{
if ( !PRI.bOnlySpectator && (redPlayers < 12) )
{
NewPlayerRow = RedItems[redPlayers].MovieClip;
UpdateRow(RedItems[redPlayers], RedEntries[redPlayers], PRI);
//`log("Update Row Red Called");
redPlayers++;
}
}
else if ( (PRI.Team.TeamIndex == BlueTeamIndex) && (bluePlayers < 12) )
{
NewPlayerRow = BlueItems[BluePlayers].MovieClip;
UpdateRow(BlueItems[BluePlayers], BlueEntries[BluePlayers], PRI);
//`log("Update Row Blue Called");
bluePlayers++;
}
if ( PRI.IsLocalPlayerPRI() )
{
if ( PlayerRow != NewPlayerRow )
{
SetPlayerRow(NewPlayerRow);
}
UpdateFooter(GRI, PRI, i);
}
}
}
// clear now empty rows
for ( i=RedPlayers; i<12; i++ )
{
if ( RedEntries[i].PlayerName != "" )
{
RedEntries[i].PlayerName = "";
ClearRow(RedItems[i]);
}
}
for ( i=BluePlayers; i<12; i++ )
{
if ( BlueEntries[i].PlayerName != "" )
{
BlueEntries[i].PlayerName = "";
ClearRow(BlueItems[i]);
}
}
}
function ClearRow(ScoreRow ThisRow)
{
local ASDisplayInfo displayInfo;
displayInfo = ThisRow.MovieClip.GetDisplayInfo();
displayInfo.Alpha = 50.0;
ThisRow.MovieClip.SetDisplayInfo(displayInfo);
ThisRow.ScoreTF.SetText("");
ThisRow.DeathsTF.SetText("");
ThisRow.NameTF.SetString("htmlText", "");
ThisRow.KillsTF.SetText("");
}
/**
* Check if current and cached version of score info matches, if not update Flash UI.
* Avoid updating Flash UI unnecessarily because of performance cost.
* @PARAM ThisRow is the GFx object holding this row of scoreboard info
* @PARAM ThisEntry is the cached info about the current settings of ThisRow
* @PARAM ThisPRI is the PRI whose state needs to be reflected in ThisRow
*/
function UpdateRow(ScoreRow ThisRow, out ScoreEntry ThisEntry, UTPlayerReplicationInfo ThisPRI)
{
local ASDisplayInfo displayInfo;
local bool bUpdateItemRenderer;
local String NameAndFlagText;
//local array<ASValue> args;
bUpdateItemRenderer = false;
// update row if it has changed
if ( (ThisPRI.PlayerName != ThisEntry.PlayerName) || (ThisPRI.bHasFlag != ThisEntry.bHasFlag) )
{
if ( ThisEntry.PlayerName == "" )
{
// need to initialize the row's displayinfo since wasn't displayed
displayInfo = thisRow.MovieClip.GetDisplayInfo();
displayInfo.Alpha = 100.0;
ThisRow.MovieClip.SetDisplayInfo(displayInfo);
// force update score and deaths (so 0s will be displayed)
ThisRow.ScoreTF.SetText(string(int(ThisPRI.Score)));
ThisEntry.PlayerScore = ThisPRI.Score;
ThisRow.DeathsTF.SetText(string(ThisPRI.Deaths));
ThisEntry.PlayerDeaths = ThisPRI.Deaths;
ThisRow.KillsTF.SetText(string(ThisPRI.KillCount));
ThisEntry.PlayerKills = ThisPRI.KillCount;
ThisRow.FlagsTF.SetText(string(ThisPRI.FlagCaptureCount));
ThisEntry.PlayerFlags = ThisPRI.FlagCaptureCount;
ThisRow.FlagReturnTF.SetText(string(ThisPRI.FlagReturnCount));
ThisEntry.PlayerFlagReturn = ThisPRI.FlagReturnCount;
`log("Force update score & deaths CTF");
}
NameAndFlagText = "";
if (ThisPRI.bHasFlag)
{
NameAndFlagText $= "<img src=\"flag_noglow\"> ";
}
NameAndFlagText $= ThisPRI.PlayerName;
ThisEntry.PlayerName = ThisPRI.PlayerName;
bUpdateItemRenderer = true;
}
if ( ThisPRI.Score != ThisEntry.PlayerScore )
{
ThisEntry.PlayerScore = ThisPRI.Score;
bUpdateItemRenderer = true;
`log("Score Updated CTF");
}
if ( ThisPRI.Deaths != ThisEntry.PlayerDeaths )
{
ThisEntry.PlayerDeaths = ThisPRI.Deaths;
bUpdateItemRenderer = true;
`log("Death Updated CTF");
}
if ( ThisPRI.KillCount != ThisEntry.PlayerKills )
{
ThisEntry.PlayerKills = ThisPRI.KillCount;
bUpdateItemRenderer = true;
`log("Kills Updated CTF");
}
ThisEntry.bHasFlag = ThisPRI.bHasFlag;
if ( ThisPRI.FlagCaptureCount != ThisEntry.PlayerFlags )
{
ThisEntry.PlayerFlags = ThisPRI.FlagCaptureCount;
bUpdateItemRenderer = true;
`log("Flag Capture Updated CTF");
}
if ( ThisPRI.FlagReturnCount != ThisEntry.PlayerFlags )
{
ThisEntry.PlayerFlagReturn = ThisPRI.FlagReturnCount;
bUpdateItemRenderer = true;
`log("Flag Return Updated CTF");
}
if (bUpdateItemRenderer)
{
//args.length = 0;
ThisRow.InnerMovieClip.SetString("PlayerName", NameAndFlagText);
ThisRow.InnerMovieClip.SetString("PlayerScore", String(ThisEntry.PlayerScore));
ThisRow.InnerMovieClip.SetString("PlayerDeaths", String(ThisEntry.PlayerDeaths));
ThisRow.InnerMovieClip.SetString("PlayerKills", String(ThisEntry.PlayerKills));
ThisRow.InnerMovieClip.SetString("PlayerFlags", String(ThisEntry.PlayerFlags));
ThisRow.InnerMovieClip.SetString("PlayerFlagReturn", String(ThisEntry.PlayerFlagReturn));
//ThisRow.InnerMovieClip.Invoke("UpdateAfterStateChange", args);
ThisRow.InnerMovieClip.ActionScriptVoid("UpdateAfterStateChange2");
`log("Strings Updated");
}
}
function UpdateRowTDM(ScoreRow ThisRow, out ScoreEntry ThisEntry, UTPlayerReplicationInfo ThisPRI)
{
local ASDisplayInfo displayInfo;
local bool bUpdateItemRenderer;
local String NameAndFlagText;
//local array<ASValue> args;
bUpdateItemRenderer = false;
// update row if it has changed
if ( (ThisPRI.PlayerName != ThisEntry.PlayerName) || (ThisPRI.bHasFlag != ThisEntry.bHasFlag) )
{
if ( ThisEntry.PlayerName == "" )
{
// need to initialize the row's displayinfo since wasn't displayed
displayInfo = thisRow.MovieClip.GetDisplayInfo();
displayInfo.Alpha = 100.0;
ThisRow.MovieClip.SetDisplayInfo(displayInfo);
// force update score and deaths (so 0s will be displayed)
ThisRow.ScoreTF.SetText(string(int(ThisPRI.Score)));
ThisEntry.PlayerScore = ThisPRI.Score;
ThisRow.DeathsTF.SetText(string(ThisPRI.Deaths));
ThisEntry.PlayerDeaths = ThisPRI.Deaths;
ThisRow.KillsTF.SetText(string(ThisPRI.KillCount));
ThisEntry.PlayerKills = ThisPRI.KillCount;
`log("Force update score & deaths TDM");
}
NameAndFlagText = "";
if (ThisPRI.bHasFlag)
{
NameAndFlagText $= "<img src=\"flag_noglow\"> ";
}
NameAndFlagText $= ThisPRI.PlayerName;
ThisEntry.PlayerName = ThisPRI.PlayerName;
bUpdateItemRenderer = true;
}
if ( ThisPRI.Score != ThisEntry.PlayerScore )
{
ThisEntry.PlayerScore = ThisPRI.Score;
bUpdateItemRenderer = true;
`log("Score Updated TDM");
}
if ( ThisPRI.Deaths != ThisEntry.PlayerDeaths )
{
ThisEntry.PlayerDeaths = ThisPRI.Deaths;
bUpdateItemRenderer = true;
`log("Death Updated TDM");
}
if ( ThisPRI.KillCount != ThisEntry.PlayerKills )
{
ThisEntry.PlayerKills = ThisPRI.KillCount;
bUpdateItemRenderer = true;
`log("Kills Updated TDM");
}
if (bUpdateItemRenderer)
{
//args.length = 0;
ThisRow.InnerMovieClip.SetString("PlayerName", NameAndFlagText);
ThisRow.InnerMovieClip.SetString("PlayerScore", String(ThisEntry.PlayerScore));
ThisRow.InnerMovieClip.SetString("PlayerDeaths", String(ThisEntry.PlayerDeaths));
ThisRow.InnerMovieClip.SetString("PlayerKills", String(ThisEntry.PlayerKills));
//ThisRow.InnerMovieClip.Invoke("UpdateAfterStateChange", args);
ThisRow.InnerMovieClip.ActionScriptVoid("UpdateAfterStateChange2");
`log("Strings Updated");
}
}
function Tick(Float DeltaTime)
{
local UTGameReplicationInfo GRI;
GRI = UTGameReplicationInfo(GetPC().WorldInfo.GRI);
if ( GRI != None )
{
if (MapName == "Map4")
{
UpdatePRIListsTDM(GRI);
}
else
{
UpdatePRILists(GRI);
}
UpdateHeaders(GRI);
UpdatePreviousState(GRI);
}
super.Tick(DeltaTime);
}
/*
* Manage this player's row. The this row will have a 3D Tween
* and yellow text. Revert the previous player's row to default
* if necessary.
*/
function SetPlayerRow(GFxObject UpdatedPlayerRow)
{
if (PlayerRow != none)
{
ClearsTweensOnMovieClip(PlayerRow);
PlayerRow.SetFloat("_z", 200); // Force the Z change if the TweenManager refuses to behave.
PlayerRow.GetObject("item_g").GotoAndStop("default");
}
PlayerRow = UpdatedPlayerRow;
if ( PlayerRow != None )
{
TweenPlayerRow(UpdatedPlayerRow);
PlayerRow.GetObject("item_g").GotoAndStop("player");
}
}
/*
* Store the current Game State. Data is used for checking if an update
* to the view is necessary.
*/
function UpdatePreviousState(UTGameReplicationInfo GRI)
{
PreviousState.RemainingTime = GRI.RemainingTime;
PreviousState.RedScore = GRI.Teams[RedTeamIndex].Score;
PreviousState.BlueScore = GRI.Teams[BlueTeamIndex].Score;
}
static function string FormatTime(int Seconds)
{
local int Hours, Mins;
local string NewTimeString;
Hours = Seconds / 3600;
Seconds -= Hours * 3600;
Mins = Seconds / 60;
Seconds -= Mins * 60;
if (Hours > 0)
NewTimeString = ( Hours > 9 ? String(Hours) : "0"$String(Hours)) $ ":";
NewTimeString = NewTimeString $ ( Mins > 9 ? String(Mins) : "0"$String(Mins)) $ ":";
NewTimeString = NewTimeString $ ( Seconds > 9 ? String(Seconds) : "0"$String(Seconds));
return NewTimeString;
}
/*
* Updates the following text fields:
* Red Team's Score
* Blue Team's Score
* Remaining Time
*/
function UpdateHeaders(UTGameReplicationInfo GRI)
{
if (PreviousState.RedScore != GRI.Teams[RedTeamIndex].Score)
RedScoreTF.SetText(Min(GRI.Teams[RedTeamIndex].Score, 9999));
if (PreviousState.BlueScore != GRI.Teams[BlueTeamIndex].Score)
BlueScoreTF.SetText(Min(GRI.Teams[BlueTeamIndex].Score, 9999));
if (GRI.RemainingTime != PreviousState.RemainingTime)
TimeTF.SetText(FormatTime(GRI.TimeLimit != 0 ? GRI.RemainingTime : GRI.ElapsedTime));
}
/*
* Updates the footer with information relevant to the player.
*/
function UpdateFooter(UTGameReplicationInfo GRI, UTPlayerReplicationInfo LocalPlayerPRI, optional byte PRIIndex)
{
}
/*
* Tween for constant _xrotation of Scoreboard.
*/
function FloatScoreboardAnimationX(bool direction)
{
}
/*
* Tween for constant _yrotation of Scoreboard.
*/
function FloatScoreboardAnimationY(bool direction)
{
}
/*
* Z tween for the player's row.
*/
function TweenPlayerRow(GFxObject RowMC)
{
}
/*
* Callback processor for TweenManager. Interface from UTGFxTweenableMoviePlayer.
*/
function ProcessTweenCallback(String Callback, GFxObject TargetMC)
{
}
/**
* Tests a PRI to see if we should display it on the scoreboard
*
* @Param PRI The PRI to test
* @returns TRUE if we should display it, returns FALSE if we shouldn't
*/
function bool IsValidScoreboardPlayer( UTPlayerReplicationInfo PRI)
{
if ( !PRI.bIsInactive && PRI.WorldInfo.NetMode != NM_Client &&
(PRI.Owner == None || (PlayerController(PRI.Owner) != None && PlayerController(PRI.Owner).Player == None)) )
{
return false;
}
return true;
}
/**
* Returns the time online as a string
*/
function string GetTimeOnline(UTPlayerReplicationInfo PRI)
{
return ""@ class'UTHUD'.static.FormatTime( PRI.WorldInfo.GRI.ElapsedTime );
}
defaultproperties
{
BlueTeamIndex = 1
RedTeamIndex = 0
bPlayerRowTween = false
bDisplayWithHudOff=TRUE
bEnableGammaCorrection=FALSE
bTeamGame=TRUE
MovieInfo=SwfMovie'PHHUD.PH_Scoreboard'
}
Bookmarks