UBrowser
Class UBrowserPlayerList

source: e:\games\UnrealTournament\UBrowser\Classes\UBrowserPlayerList.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowList
         |
         +--UBrowser.UBrowserPlayerList
Direct Known Subclasses:None

class UBrowserPlayerList
extends UWindow.UWindowList

//============================================================================= // UBrowserPlayerList - The player list returned by the server. //=============================================================================
Variables
 string PlayerFace
 int PlayerFrags
 int PlayerID
 string PlayerMesh
 string PlayerName
 int PlayerPing
 string PlayerSkin
 string PlayerStats
 string PlayerTeam
 int SortColumn
 bool bDescending


Function Summary
 int Compare(UWindowList T, UWindowList B)
 UBrowserPlayerList FindID(int ID)
 void SortByColumn(int Column)



Source Code


00001	//=============================================================================
00002	// UBrowserPlayerList - The player list returned by the server.
00003	//=============================================================================
00004	class UBrowserPlayerList extends UWindowList;
00005	
00006	var string			PlayerName;
00007	var string			PlayerMesh;
00008	var string			PlayerSkin;
00009	var string			PlayerFace;
00010	var string			PlayerTeam;
00011	var int				PlayerFrags;
00012	var int				PlayerPing;
00013	var int				PlayerID;
00014	var string			PlayerStats;
00015	
00016	// Sentinel Only
00017	var int				SortColumn;
00018	var bool			bDescending;
00019	
00020	
00021	function SortByColumn(int Column)
00022	{
00023		if(SortColumn == Column)
00024		{
00025			bDescending = !bDescending;
00026		}
00027		else
00028		{
00029			SortColumn = Column;
00030			bDescending = False;
00031		}
00032	
00033		Sort();
00034	}
00035	
00036	function int Compare(UWindowList T, UWindowList B)
00037	{
00038		local int Result;
00039		local UBrowserPlayerList PT, PB;
00040	
00041		if(B == None) return -1; 
00042	
00043		PT = UBrowserPlayerList(T);
00044		PB = UBrowserPlayerList(B);
00045	
00046		switch(UBrowserPlayerList(Sentinel).SortColumn)
00047		{
00048		case 0:
00049			if(Caps(PT.PlayerName) < Caps(PB.PlayerName))
00050				Result = -1;
00051			else
00052			if(PT.PlayerName > PB.PlayerName)
00053				Result = 1;
00054			else
00055				Result = (PT.PlayerPing - PB.PlayerPing);
00056			break;
00057		case 1:
00058			if(PT.PlayerFrags > PB.PlayerFrags)
00059				Result = -1;
00060			else
00061			if(PT.PlayerFrags < PB.PlayerFrags)
00062				Result = 1;
00063			else
00064			{
00065				if(PT.PlayerName < PB.PlayerName)
00066					Result = -1;
00067				else
00068					Result = 1;
00069			}
00070			break;
00071		case 2:
00072			if(PT.PlayerPing < PB.PlayerPing)
00073				Result = -1;
00074			else
00075			if(PT.PlayerPing > PB.PlayerPing)
00076				Result = 1;
00077			else
00078			{
00079				if(PT.PlayerName < PB.PlayerName)
00080					Result = -1;
00081				else
00082					Result = 1;
00083			}
00084			break;
00085		case 3:
00086			if(PT.PlayerTeam > PB.PlayerTeam)
00087				Result = -1;
00088			else if(PT.PlayerTeam < PB.PlayerTeam)
00089				Result = 1;
00090			else
00091			{
00092				if(PT.PlayerName < PB.PlayerName)
00093					Result = -1;
00094				else
00095					Result = 1;
00096			}
00097			break;
00098		case 4:
00099			if(PT.PlayerMesh < PB.PlayerMesh)
00100				Result = -1;
00101			else
00102			if(PT.PlayerMesh > PB.PlayerMesh)
00103				Result = 1;
00104			else
00105			{
00106				if(PT.PlayerName < PB.PlayerName)
00107					Result = -1;
00108				else
00109					Result = 1;
00110			}
00111			break;
00112		case 5:
00113			if(PT.PlayerSkin < PB.PlayerSkin)
00114				Result = -1;
00115			else
00116			if(PT.PlayerSkin > PB.PlayerSkin)
00117				Result = 1;
00118			else
00119			{
00120				if(PT.PlayerName < PB.PlayerName)
00121					Result = -1;
00122				else
00123					Result = 1;
00124			}
00125			break;
00126		case 6:
00127			if(PT.PlayerFace < PB.PlayerFace)
00128				Result = -1;
00129			else
00130			if(PT.PlayerFace > PB.PlayerFace)
00131				Result = 1;
00132			else
00133			{
00134				if(PT.PlayerSkin < PB.PlayerSkin)
00135					Result = -1;
00136				else
00137				if(PT.PlayerSkin > PB.PlayerSkin)
00138					Result = 1;
00139				else
00140				{
00141					if(PT.PlayerName < PB.PlayerName)
00142						Result = -1;
00143					else
00144						Result = 1;
00145				}
00146			}
00147			break;
00148		case 7:
00149			if(PT.PlayerID < PB.PlayerID)
00150				Result = -1;
00151			else
00152			if(PT.PlayerID > PB.PlayerID)
00153				Result = 1;
00154			else
00155			{
00156				if(PT.PlayerName < PB.PlayerName)
00157					Result = -1;
00158				else
00159					Result = 1;
00160			}
00161			break;
00162		case 8:
00163			if(PT.PlayerStats < PB.PlayerStats)
00164				Result = -1;
00165			else if(PT.PlayerStats > PB.PlayerStats)
00166				Result = 1;
00167			else
00168			{
00169				if(PT.PlayerName < PB.PlayerName)
00170					Result = -1;
00171				else
00172					Result = 1;
00173			}
00174			break;
00175		}
00176	
00177		if(UBrowserPlayerList(Sentinel).bDescending) Result = -Result;
00178	
00179		return Result;
00180	}
00181	
00182	function UBrowserPlayerList FindID(int ID)
00183	{
00184		local UBrowserPlayerList l;
00185	
00186		l = UBrowserPlayerList(Next);
00187		while(l != None)
00188		{
00189			if(l.PlayerID == ID) return l;
00190			l = UBrowserPlayerList(l.Next);
00191		}
00192		return None;
00193	}
00194	
00195	defaultproperties
00196	{
00197	     SortColumn=1
00198	}

End Source Code