## XIDInterf
Class XIIIMenuLiveScoreboardView

source: C:\XIII\XIDInterf\Classes\XIIIMenuLiveScoreboardView.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIILiveWindow
                         |
                         +--XIDInterf.XIIIMenuLiveScoreboardView

Direct Known Subclasses:None

class XIIIMenuLiveScoreboardView
extends XIDInterf.XIIILiveWindow

Variables
`string` | `TitleText`
`Texture` | `WhiteTex`
`XboxLiveManager.eGameType` | `gameType` so we can see whether it's user stats or overall stats
`bool` | `isUserStats` so we can see whether it's user stats or overall stats
`int` | `leaderboardsize`
`int` | `pageMode` 0 and 1 so we can fit all the stats we want
`int` | `statDeaths[12]`
`int` | `statFlagsCaptured[12]`
`int` | `statFlagsReturned[12]`
`int` | `statGamesWon[12]`
`int` | `statGames[12]`
`int` | `statKills[12]`
`int` | `statMinutes[12]`
`string` | `statNames[12]`
`int` | `statRank[12]`
`int` | `statReady[12]`
`int` | `statSuicide[12]`
`string` | `strDeaths`
`string` | `strFetching` so we can see whether it's user stats or overall stats
`string` | `strFlagsCaptured`
`string` | `strFlagsReturned`
`string` | `strGames`
`string` | `strGamesWon`
`string` | `strKills`
`string` | `strMinutes`
`string` | `strName`
`string` | `strSuicide`
`string` | `strTitle[5]` so we can see whether it's user stats or overall stats
`int` | `toprankvalue`

Function Summary
`void` | `Created()`
`void` | `InitComponent(GUIController MyController, GUIComponent MyOwner)`
`bool` | `InternalOnClick(GUIComponent Sender)`
    // Called when a button is clicked
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `ScrollStatsPage(bool scrollUp)`
`void` | `ShowWindow()`

Source Code

    00001	class XIIIMenuLiveScoreboardView extends XIIILiveWindow;
    00002
    00003	var string TitleText;
    00004	//var XIIIGUIMultiListBox listbox;
    00005	var int leaderboardsize;
    00006
    00007	var int toprankvalue;
    00008
    00009	var texture WhiteTex;
    00010
    00011	var int    statReady[12];
    00012	var string statNames[12];
    00013	var int    statKills[12];
    00014	var int    statDeaths[12];
    00015	var int    statGames[12];
    00016	var int    statGamesWon[12];
    00017	var int    statMinutes[12];
    00018	var int    statFlagsCaptured[12];
    00019	var int    statFlagsReturned[12];
    00020	var int    statSuicide[12];
    00021	var int	   statRank[12];
    00022
    00023	var localized string strName;
    00024	var localized string strKills;
    00025	var localized string strDeaths;
    00026	var localized string strGames;
    00027	var localized string strGamesWon;
    00028	var localized string strMinutes;
    00029	var localized string strFlagsCaptured;
    00030	var localized string strFlagsReturned;
    00031	var localized string strSuicide;
    00032
    00033	var int pageMode; // 0 and 1 so we can fit all the stats we want
    00034	var bool isUserStats; //so we can see whether it's user stats or overall stats
    00035
    00036	var localized string strFetching;
    00037
    00038	var localized string strTitle[5];
    00039
    00040	var XboxLiveManager.eGameType  gameType;
    00041
    00042
    00043	function Created()
    00044	{
    00045	  local int i;
    00046	  Super.Created();
    00047	}
    00048
    00049
    00050	function InitComponent(GUIController MyController,GUIComponent MyOwner)
    00051	{
    00052	  local int i,j;
    00053
    00054	  Super.InitComponent(MyController, MyOwner);
    00055		OnClick = InternalOnClick;
    00056	}
    00057
    00058	event HandleParameters(string Param1, string Param2)
    00059	{
    00060		if ( Param1=="user" )
    00061		{
    00062	          isUserStats = true;
    00063		}
    00064		else
    00065		  isUserStats = false;
    00066	}
    00067
    00068	function ShowWindow()
    00069	{
    00070	  local int q;
    00071
    00072	  OnMenu = 0; myRoot.bFired = false;
    00073	  Super.ShowWindow();
    00074	  bShowBCK = true;
    00075	  bShowRUN = false;
    00076	  bShowSEL = false;
    00077
    00078	  pageMode = 0;
    00079
    00080	  leaderboardsize = xboxlive.StatsGetLeaderboardSize();
    00081	  if (leaderboardsize != -1)
    00082	  {
    00083	    toprankvalue    = xboxlive.StatsGetActiveUserRank();
    00084	    //xboxlive.StatsSetRequestedRank(toprankvalue);
    00085	  }
    00086	  for (q=0; q<12; q++)
    00087	    statReady[q] = 0;
    00088
    00089	  gameType = xboxlive.GetStatisticsType();
    00090
    00091	  if (gameType == GT_DM)
    00092	  {
    00093	    TitleText = strTitle[0];
    00094	  }
    00095	  else if (gameType == GT_TeamDM)
    00096	  {
    00097	    TitleText = strTitle[1];
    00098	  }
    00099	  else if (gameType == GT_CTF)
    00100	  {
    00101	    TitleText = strTitle[2];
    00102	  }
    00103	  else if (gameType == GT_Sabotage)
    00104	  {
    00105	    TitleText = strTitle[3];
    00106	  }
    00107	  else if (gameType == GT_Ladder)
    00108	  {
    00109	    TitleText = strTitle[4];
    00110	  }
    00111	  else  // Must never happen!
    00112	    TitleText = "";
    00113
    00114	}
    00115
    00116	function ScrollStatsPage(bool scrollUp)
    00117	{
    00118	  local int q;
    00119
    00120	  if (leaderboardsize < 1)
    00121	    return;
    00122
    00123	  for (q=0; q<12; q++)
    00124	    statReady[q] = 0;
    00125
    00126	  if (scrollUp)
    00127	  {
    00128	    toprankvalue -= 12;
    00129	    if (toprankvalue < 1)
    00130	      toprankvalue = 1;
    00131	    //else if (toprankvalue == 0)
    00132	      //toprankvalue = 1;
    00133	  }
    00134	  else
    00135	  {
    00136	    if((toprankvalue + 12) <= leaderboardsize)
    00137	    {
    00138	      toprankvalue += 12;
    00139	      //don't really need this check now do we
    00140	      if(toprankvalue > leaderboardsize)
    00141	        toprankvalue = leaderboardsize;
    00142	    }
    00143	    //else
    00144	    //{
    00145	    //  if((leaderboardsize - 12) > 1)
    00146	    //	toprankvalue = leaderboardsize - 12;
    00147	    //  else if(leaderboardsize < 12)
    00148	    //    toprankvalue = 12 - leaderboardsize;
    00149
    00150	    //  if(toprankvalue > leaderboardsize)
    00151	    //    toprankvalue = leaderboardsize;
    00152	    //}
    00153	  }
    00154
    00155	  xboxlive.StatsSetRequestedRank(toprankvalue);
    00156	}
    00157
    00158	function Paint(Canvas C, float X, float Y)
    00159	{
    00160	local int q;
    00161	local int userpos;
    00162
    00163	  Super.Paint(C, X, Y);
    00164	  PaintStandardBackground(C, X, Y, TitleText);
    00165
    00166
    00167	  C.bUseBorder = true;
    00168
    00169	  C.DrawColor = WhiteColor;
    00170
    00171	  C.DrawColor.A = 210;
    00172	  C.Style = 5; //ERenderStyle.STY_Alpha;
    00173
    00174	  C.SetPos(45, 100);
    00175	  C.DrawTile( WhiteTex, 550, 26, 0, 0, 8, 8 );
    00176
    00177	  //C.DrawColor.A = 128;
    00178
    00179	  C.SetPos(45, 130);
    00180	  C.DrawTile( WhiteTex, 550, 250, 0, 0, 8, 8 );
    00181
    00182	  C.Style = 1; //ERenderStyle.STY_Normal;
    00183
    00184
    00185
    00186	  C.DrawColor = BlackColor;
    00187
    00188	  //C.SetPos(50, 100);
    00189	  //C.DrawText("", false);
    00190
    00191	//  C.Font = font'XIIIFonts.XIIISmallFont';
    00192
    00193
    00194	  C.SetPos(130, 100);
    00195	  C.DrawText(strName, false);
    00196
    00197	  if (gameType == GT_CTF)
    00198	  {
    00199	    if (pageMode == 0)
    00200	    {
    00201	      C.SetPos(350, 100);
    00202	      C.DrawText(strFlagsCaptured$" / "$strFlagsReturned, false);
    00203
    00204	      C.SetPos(510, 100);
    00205	      C.DrawText(strSuicide, false);
    00206	    }
    00207	    else
    00208	    if (pageMode == 1)
    00209	    {
    00210	      C.SetPos(350, 100);
    00211	      //C.DrawText(strGames$" / "$strGamesWon, false);
    00212	      C.DrawText(strGames, false);
    00213
    00214	      C.SetPos(510, 100);
    00215	      C.DrawText(strMinutes, false);
    00216	    }
    00217	    else
    00218	    if (pageMode == 2)
    00219	    {
    00220	      C.SetPos(350, 100);
    00221	      C.DrawText(strKills$" / "$strDeaths, false);
    00222	    }
    00223
    00224	  }
    00225	  else //if (gameType == GT_DM || gameType == GT_TeamDM || gameType == GT_Sabotage)
    00226	  {
    00227
    00228	    if (pageMode == 0)
    00229	    {
    00230	      C.SetPos(350, 100);
    00231	      C.DrawText(strKills$" / "$strDeaths, false);
    00232
    00233	      C.SetPos(510, 100);
    00234	      C.DrawText(strSuicide, false);
    00235	    }
    00236	    else
    00237	    {
    00238	      C.SetPos(350, 100);
    00239	      //C.DrawText(strGames$" / "$strGamesWon, false);
    00240	      C.DrawText(strGames, false);
    00241
    00242	      C.SetPos(510, 100);
    00243	      C.DrawText(strMinutes, false);
    00244	    }
    00245
00246 // C.SetPos(420, 100); 00247 // C.DrawText(strFlagsCaptured$" / "$strFlagsReturned, false); 00248 } 00249 // C.Font = font'XIIIFonts.PoliceF16'; 00250 00251 00252 if (leaderboardsize == -1) 00253 { 00254 leaderboardsize = xboxlive.StatsGetLeaderboardSize(); 00255 if (leaderboardsize < 1) 00256 { 00257 C.DrawColor = WhiteColor; 00258 return; 00259 } 00260 toprankvalue = xboxlive.StatsGetActiveUserRank(); 00261 //xboxlive.StatsSetRequestedRank(toprankvalue); 00262 } 00263 00264 if (leaderboardsize == 0) 00265 { 00266 C.DrawColor = WhiteColor; 00267 return; 00268 } 00269 00270 for (q=0; q<12; q++) 00271 { 00272 00273 if (toprankvalue+q >= leaderboardsize) 00274 break; 00275 00276 if (statReady[q] == 0 && xboxlive.StatsIsRankReady(toprankvalue+q)) 00277 { 00278 statNames[q] = xboxlive.StatsGetResultName(toprankvalue+q); 00279 00280 statKills[q] = xboxlive.StatsGetResultKills(toprankvalue+q); 00281 statDeaths[q] = xboxlive.StatsGetResultDeaths(toprankvalue+q); 00282 statSuicide[q] = xboxlive.StatsGetResultSuicides(toprankvalue+q); 00283 statGames[q] = xboxlive.StatsGetResultGames(toprankvalue+q); 00284 statGamesWon[q]= xboxlive.StatsGetResultGamesWon(toprankvalue+q); 00285 statMinutes[q] = xboxlive.StatsGetResultMinutes(toprankvalue+q); 00286 00287 statFlagsCaptured[q] = xboxlive.StatsGetResultFlagsCap(toprankvalue+q); 00288 statFlagsReturned[q] = xboxlive.StatsGetResultFlagsRet(toprankvalue+q); 00289 00290 statRank[q] = xboxlive.StatsGetResultPosition(toprankvalue+q); 00291 00292 statReady[q] = 1; 00293 } 00294 00295 if (statReady[q] == 1) 00296 { 00297 if(isUserStats == true) 00298 { 00299 userpos = xboxlive.StatsGetActiveUserRank(); 00300 if((userpos >= toprankvalue) && (userpos <= toprankvalue+12) && (userpos == statRank[q])) 00301 { 00302 C.bUseBorder = false; 00303 C.Style = 5; 00304 C.DrawColor = WhiteColor; 00305 C.SetPos(45, 133 + q*20); 00306 C.DrawTile( WhiteTex, 550, 19, 0, 0, 8, 8 ); 00307 C.DrawColor = BlackColor; 00308 C.Style = 1; 00309 C.bUseBorder = true; 00310 } 00311 } 00312 00313 C.SetPos(50, 131 + q*20); 00314 C.DrawText(statRank[q], false); 00315 //C.DrawText(q + toprankvalue, false); 00316 00317 C.SetPos(130, 131 + q*20); 00318 C.DrawText(statNames[q], false); 00319 00320 if (pageMode == 0) 00321 { 00322 C.SetPos(350, 131 + q*20); 00323 if (gameType == GT_CTF) 00324 C.DrawText(statFlagsCaptured[q] $"/"$statFlagsReturned[q], false); 00325 else 00326 C.DrawText(statKills[q] $"/"$statDeaths[q], false); 00327 00328 C.SetPos(510, 131 + q*20); 00329 C.DrawText(statSuicide[q], false); 00330 } 00331 else 00332 if (pageMode == 1) 00333 { 00334 C.SetPos(350, 131 + q*20); 00335 //C.DrawText(statGames[q]$"/"$statGamesWon[q], false); 00336 C.DrawText(statGames[q], false); 00337 00338 C.SetPos(510, 131 + q*20); 00339 C.DrawText(statMinutes[q], false); 00340 } 00341 else 00342 if (pageMode == 2) 00343 { 00344 C.SetPos(350, 131 + q*20); 00345 //don't really need this check as only ctf can have pagemode2...but ya 00346 if (gameType == GT_CTF) 00347 C.DrawText(statKills[q] $"/"$statDeaths[q], false); 00348 } 00349 00350 } 00351 else 00352 { 00353 C.SetPos(50, 131 + q*20); 00354 C.DrawText(q + toprankvalue, false); 00355 00356 C.SetPos(100, 131 + q*20); 00357 C.DrawText(strFetching, false); 00358 00359 } 00360 } 00361 00362 00363 //C.SetPos(48, 382); 00364 //C.SetPos(230, 412); 00365 //C.DrawText(strUpDown, false); 00366 00367 00368 C.DrawColor = WhiteColor; 00369 00370 } 00371 00372 00373 // Called when a button is clicked 00374 function bool InternalOnClick(GUIComponent Sender) 00375 { 00376 local int i; 00377 return true; 00378 } 00379 00380 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00381 { 00382 if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat 00383 { 00384 if ((Key==0x0D/*IK_Enter*/) || (Key==0x01)) 00385 { 00386 //Controller.FocusedControl.OnClick(Self); 00387 InternalOnClick(Controller.FocusedControl); 00388 return true; 00389 } 00390 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 00391 { 00392 xboxlive.StatsStopCachingLeaderboard(); 00393 myRoot.CloseMenu(true); 00394 return true; 00395 } 00396 if (Key==0x26/*IK_Up*/) 00397 { 00398 ScrollStatsPage(true); 00399 return true; 00400 } 00401 if (Key==0x28/*IK_Down*/) 00402 { 00403 ScrollStatsPage(false); 00404 return true; 00405 } 00406 if (Key==0x25/*IK_Left*/) 00407 { 00408 if (gameType == GT_CTF) 00409 { 00410 pageMode--; 00411 if(pageMode < 0) 00412 pageMode = 2; 00413 } 00414 else 00415 { 00416 if (pageMode == 0) 00417 pageMode = 1; 00418 else 00419 pageMode = 0; 00420 } 00421 00422 return true; 00423 } 00424 if (Key==0x27/*IK_Right*/) 00425 { 00426 if (gameType == GT_CTF) 00427 { 00428 pageMode++; 00429 if(pageMode > 2) 00430 pageMode = 0; 00431 } 00432 else 00433 { 00434 if (pageMode == 0) 00435 pageMode = 1; 00436 else 00437 pageMode = 0; 00438 } 00439 00440 return true; 00441 } 00442 } 00443 return super.InternalOnKeyEvent(Key, state, delta); 00444 } 00445 00446 00447

End Source Code