## XIIIMP
Class XIIIMPTeamScoreBoard

source: C:\XIII\XIIIMP\Classes\XIIIMPTeamScoreBoard.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--Engine.ScoreBoard
                |
                +--XIIIMP.XIIIMPScoreBoard
                   |
                   +--XIIIMP.XIIIMPTeamScoreBoard

Direct Known Subclasses:XIIIMPCTFScoreBoard

class XIIIMPTeamScoreBoard
extends XIIIMP.XIIIMPScoreBoard

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`Texture` | `PlayerTex` Icon for drawing waiting player
`color` | `TeamColor[2]`

Function Summary
`void` | `DrawInfoLine2(Canvas C, string Info1, string Info2, string Info3, color LineColor, color BgColor, bool AddBg, int ViewPortNumber, optional bool, optional bool)`
    //____________________________________________________________________
`void` | `DrawTeamScore(Canvas C)`
    //____________________________________________________________________
`void` | `ShowScores(Canvas C, int ViewPortId, int PlayerNumber)`
    //____________________________________________________________________
`simulated` | `SortScores(int N)`
    //____________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIMPTeamScoreBoard extends XIIIMPScoreBoard;
    00005
    00006	var color TeamColor[2];
    00007	var texture PlayerTex;          // Icon for drawing waiting player
    00008
    00009	//____________________________________________________________________
    00010	simulated function SortScores(int N)
    00011	{
    00012	    local int i, j, Max, ts,tsmax;
    00013	    local PlayerReplicationInfo TempPRI;
    00014	    local XIIIGameReplicationInfo TGRI;
    00015
    00016	    TGRI = XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo);
    00017
    00018	    for ( i=0; i<N-1; i++ )
    00019	    {
    00020	      Max = i;
    00021	      for ( j=i+1; j<N; j++ )
    00022	      {
    00023	        ts = TGRI.Teams[Ordered[j].Team.TeamIndex].Score;
    00024	        tsmax = TGRI.Teams[Ordered[Max].Team.TeamIndex].Score;
    00025	        if ( ts > tsmax )
    00026	          Max = j;
    00027	        else if (( ts == tsmax )
    00028	          && ( Ordered[j].Team.TeamIndex < Ordered[Max].Team.TeamIndex ))
    00029	          Max = j;
    00030	        else if (( ts == tsmax )
    00031	          && ( Ordered[j].Team == Ordered[Max].Team )
    00032	          && ( Ordered[j].Score > Ordered[Max].Score ))
    00033	          Max = j;
    00034	        else if (( ts == tsmax )
    00035	          && ( Ordered[j].Team == Ordered[Max].Team )
    00036	          && (Ordered[j].Score == Ordered[Max].Score)
    00037	          && (Ordered[j].Deaths < Ordered[Max].Deaths))
    00038	          Max = j;
    00039	        else if (( ts == tsmax )
    00040	          && ( Ordered[j].Team == Ordered[Max].Team )
    00041	          && (Ordered[j].Score == Ordered[Max].Score)
    00042	          && (Ordered[j].Deaths == Ordered[Max].Deaths)
    00043	          && (Ordered[j].PlayerID < Ordered[Max].Score))
    00044	          Max = j;
    00045	      }
    00046	      TempPRI = Ordered[Max];
    00047	      Ordered[Max] = Ordered[i];
    00048	      Ordered[i] = TempPRI;
    00049	    }
    00050	}
    00051
    00052	//____________________________________________________________________
    00053	function DrawTeamScore( Canvas C )
    00054	{
    00055	    local float W,H, w2;
    00056	    local int XP, Loop;
    00057	    local string score;
    00058
    00059	    C.Font = BigFont;
    00060	    C.SpaceX = 1;
    00061	    YP += 4;
    00062
    00063	    C.StrLen(100, W, H);
    00064
    00065	    for( Loop=0;Loop< 2; Loop++ )
    00066	    {
    00067	        if( Loop == 0)
    00068	            XP = C.CLipX/2 - W - 2*(H-4) -2;
    00069	        else
    00070	            XP = C.CLipX/2 +2;
    00071
    00072	        // BackGround Icon + Text
    00073
    00074	        C.bUseBorder = false;
    00075	        C.Style = ERenderStyle.STY_Alpha;
    00076	        C.DrawColor = TeamColor[Loop]*0.3;
    00077	        C.DrawColor.A = 90;
    00078
    00079	        C.SetPos(XP,YP);
    00080	        OwnerHud.DrawStdBackGround(C, H-4, W);
    00081
    00082	        C.Style = ERenderStyle.STY_Translucent;
    00083
    00084	        C.DrawColor = Teamcolor[Loop];
    00085	        C.DrawColor.A = 200;
    00086
    00087	        C.SetPos(XP,YP);
    00088	        OwnerHud.DrawStdBackGround(C, H-4, W);
    00089
    00090	        // Text
    00091	        score = string( int( OwnerHUD.PlayerOwner.GameReplicationInfo.Teams[loop].Score ) );
    00092	//        score = string( int( HUD(Owner).PlayerOwner.GameReplicationInfo.Teams[loop].Score ) );
    00093	        C.StrLen(score, W2, H);
    00094
    00095	        C.Style=ERenderStyle.STY_Normal;
    00096
    00097	        C.DrawColor = HudBasicColor*0.1;
    00098	        C.SetPos(XP+H-4+w/2-w2/2+2,YP);
    00099	        C.DrawText(score, false);
    00100
    00101	        C.DrawColor = HudBasicColor;
    00102	        C.SetPos(XP+H-4+w/2-w2/2,YP-2);
    00103	        C.DrawText(score, false);
    00104	    }
    00105
    00106	    C.SpaceX = 0;
    00107	}
    00108
    00109	//____________________________________________________________________
    00110	function ShowScores( Canvas C , int ViewPortId , int PlayerNumber )
    00111	{
    00112	    local color BgColor;
    00113	    local int Loop;
    00114	    local string PName,PFrag,PDeath;
    00115	    local bool IsMe;
    00116	    local XIIIGameReplicationInfo TGRI;
    00117
    00118	    if ( PlayerOwner.GameReplicationInfo == none )
    00119	      return;
    00120
    00121	    TGRI = XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo);
    00122
    00123	    if( (TGRI.iGameState==1) && ( Level.NetMode == NM_Standalone ) )
    00124	    {
    00125	        if( PlayerNumber == 1 )
    00126	            C.Font = BigFont;
    00127	        else
    00128	            C.Font = SmallFont;
    00129
    00130	        GetDownMargin( C , ViewPortId , PlayerNumber );
    00131	        DrawTrailer(C);
    00132	        return;
    00133	    }
    00134
    00135	    UpdatePlayerList();
    00136
    00137	    GetUpMargin( C , ViewPortId , PlayerNumber );
    00138
    00139	    // Header
    00140
    00141	    DrawInfoLine( C,PlayerString,FragsString,DeathsString,HudBasicColor,HudBasicColor,false , PlayerNumber );
    00142	    YP += 8;
    00143
    00144	    //Players ...
    00145
    00146	    for ( Loop=0; Loop<PlayerCount; Loop++ )
    00147	    {
    00148	        IsMe = ( Ordered[Loop] == PlayerOwner.PlayerReplicationInfo );
    00149	        BgColor = Teamcolor[Ordered[Loop].Team.TeamIndex];
    00150
    00151	        PName = Ordered[Loop].PlayerName;
    00152	        PFrag = string( int(Ordered[Loop].Score));
    00153	        PDeath = string( int(Ordered[Loop].Deaths));
    00154
    00155	        DrawInfoLine2( C, PName,PFrag,PDeath,HudBasicColor,BgColor,IsMe , PlayerNumber, Ordered[Loop].bWaitingPlayer, !Ordered[Loop].bReadyToPlay  );
    00156	    }
    00157
    00158	    if (TGRI.iGameState==3)
    00159	        DrawTeamScore(C);
    00160
    00161	    // Trail
    00162
    00163	    GetDownMargin( C , ViewPortId , PlayerNumber );
    00164
    00165	    DrawTrailer(C);
    00166	}
    00167	//____________________________________________________________________
    00168	function DrawInfoLine2(Canvas C, string Info1, string Info2, string Info3, color LineColor, color BgColor , bool AddBg, int ViewPortNumber, optional bool bDrawReadyToPlay, optional bool bNotReadyToPlay  )
    00169	{
    00170	    local float W,H, IconSize, Temp;
    00171	    local int XP;
    00172
    00173	    if( ViewPortNumber == 1 )
    00174	        C.Font = BigFont;
    00175	    else
    00176	        C.Font = SmallFont;
    00177
    00178	    C.SpaceX = 1;
    00179	    C.StrLen(Info1, W, H);
    00180	//    IconSize = (H) / SkullTex.VSize;
    00181	    XP = C.CLipX*0.15;
    00182
    00183	    // BackGround Icon + Text
    00184	    C.bUseBorder = false;
    00185	    C.Style = ERenderStyle.STY_Alpha;
    00186	    C.DrawColor = BgColor*0.3;
    00187	    C.DrawColor.A = 60;
    00188
    00189	    C.SetPos(XP,YP);
    00190	    OwnerHud.DrawStdBackGround(C, H-4, C.CLipX*0.7 - 2*(H-4));
    00191
    00192	    C.Style = ERenderStyle.STY_Translucent;
    00193
    00194	    C.DrawColor = BgColor;
    00195	    C.DrawColor.A = 200;
    00196
    00197	    C.SetPos(XP,YP);
    00198	    OwnerHud.DrawStdBackGround(C, H-4, C.CLipX*0.7 - 2*(H-4));
    00199
    00200	    // Text
    00201	    C.Style=ERenderStyle.STY_Normal;
    00202
    00203	    C.DrawColor = LineColor*0.3;
    00204	    C.SetPos(XP+H+4+1,YP-1);
    00205	    C.DrawText(Info1, false);
    00206
    00207	    C.DrawColor = LineColor;
    00208	    C.SetPos(XP+H+4,YP-2);
    00209	    C.DrawText(Info1, false);
    00210
    00211	    C.StrLen(Info2, W, H);
    00212
    00213	    C.DrawColor = LineColor*0.3;
    00214	    C.SetPos(C.ClipX*0.58 + 1 - W/2,YP-1);
    00215	    C.DrawText(Info2, false);
    00216
    00217	    C.DrawColor = LineColor;
    00218	    C.SetPos(C.ClipX*0.58 - W/2,YP-2);
    00219	    C.DrawText(Info2, false);
    00220
    00221	    C.StrLen(Info3, W, H);
    00222
    00223	    C.DrawColor = LineColor*0.3;
    00224	    C.SetPos(C.ClipX*0.75 + 1 - W/2,YP-1);
    00225	    C.DrawText(Info3, false);
    00226
    00227	    C.DrawColor = LineColor;
    00228	    C.SetPos(C.ClipX*0.75 - W/2,YP-2);
    00229	    C.DrawText(Info3, false);
    00230
    00231	    // Player Ready ?
    00232	    if ( (Level.NetMode != NM_StandAlone) && bDrawReadyToPlay && XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).iGameState != 2 )
    00233	    {
    00234	      C.Style = ERenderStyle.STY_Alpha;
    00235	      if ( bNotReadyToPlay )
    00236	        C.DrawColor = WhiteColor * 0.5;
    00237	      else
    00238	        C.DrawColor = GoldColor;
    00239	      C.SetPos(XP-H/4,YP-3);
    00240	      C.DrawIcon(NotReadyTex, (H+3)/NotReadyTex.VSize);
    00241	      bDrawReadyToPlay = true;
    00242	    }
    00243	    else
    00244	      bDrawReadyToPlay = false;
    00245
00246 if( AddBg ) 00247 { 00248 C.Style=ERenderStyle.STY_Normal; 00249 C.DrawColor = HudBasicColor; 00250 C.DrawColor.A = 255; 00251 00252 IconSize = H; 00253 IconSize *= sin((Level.TimeSeconds*0.9-int(Level.TimeSeconds*0.9))*3.14); 00254 00255 if ( bDrawReadyToPlay ) 00256 C.SetPos(XP-(IconSize)/2+(h-4)/2-H-3,YP-2); 00257 else 00258 C.SetPos(XP-(IconSize)/2+(h-4)/2,YP-2); 00259 C.DrawTile( PlayerTex,IconSize,H,0,0,PlayerTex.USize,PlayerTex.VSize); 00260 C.bUseBorder = false; 00261 } 00262 00263 YP += H; 00264 00265 C.SpaceX = 0; 00266 } 00267 00268 //____________________________________________________________________ 00269 // SkullTex=texture'XIIIMenu.6sense' 00270 00271 00272 defaultproperties 00273 { 00274 TeamColor(0)=(R=200,A=255) 00275 TeamColor(1)=(B=255,G=159,R=64,A=255) 00276 PlayerTex=Texture'XIIIMenu.HUD.6sense' 00277 }

End Source Code