UBrowser
Class UBrowserPlayerGrid

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

class UBrowserPlayerGrid
extends UWindow.UWindowGrid

//============================================================================= // UBrowserPlayerGrid //=============================================================================
Variables
 string BotText
 string DisabledText
 string EnabledText
 string FaceText
 string FragsText
 string IDText
 string MeshText
 string NameText
 string PingText
 string SkinText
 string TeamText
 UWindowGridColumn ngSecretColumn
 string ngSecretText
 int ngSecretWidth


Function Summary
 void Created()
 void PaintColumn(Canvas C, UWindowGridColumn Column, float MouseX, float MouseY)
 void RightClickRow(int Row, float X, float Y)
 void SelectRow(int Row)
 void SortColumn(UWindowGridColumn Column)



Source Code


00001	//=============================================================================
00002	// UBrowserPlayerGrid
00003	//=============================================================================
00004	class UBrowserPlayerGrid extends UWindowGrid;
00005	
00006	var localized string NameText;
00007	var localized string FragsText;
00008	var localized string PingText;
00009	var localized string TeamText;
00010	var localized string MeshText;
00011	var localized string SkinText;
00012	var localized string FaceText;
00013	var localized string IDText;
00014	var localized string ngSecretText;
00015	var localized string EnabledText;
00016	var localized string DisabledText;
00017	var localized string BotText;
00018	var int ngSecretWidth;
00019	var UWindowGridColumn ngSecretColumn;
00020	
00021	function Created() 
00022	{
00023		Super.Created();
00024	
00025		RowHeight = 12;
00026	
00027		AddColumn(NameText, 60);
00028		AddColumn(FragsText, 30);
00029		AddColumn(PingText, 30);
00030		AddColumn(TeamText, 30);
00031		AddColumn(MeshText, 80);
00032		AddColumn(SkinText, 80);
00033		AddColumn(FaceText, 60);
00034		AddColumn(IDText, 30);
00035		ngSecretColumn = AddColumn(ngSecretText, 100);
00036		ngSecretWidth = 100;
00037	}
00038	
00039	function PaintColumn(Canvas C, UWindowGridColumn Column, float MouseX, float MouseY) 
00040	{
00041		local UBrowserServerList Server;
00042		local UBrowserPlayerList PlayerList, l;
00043		local int Visible;
00044		local int Count;
00045		local int Skipped;
00046		local int Y;
00047		local int TopMargin;
00048		local int BottomMargin;
00049	
00050		if(bShowHorizSB)
00051			BottomMargin = LookAndFeel.Size_ScrollbarWidth;
00052		else
00053			BottomMargin = 0;
00054	
00055		TopMargin = LookAndFeel.ColumnHeadingHeight;
00056	
00057		Server = UBrowserInfoClientWindow(GetParent(class'UBrowserInfoClientWindow')).Server;
00058		if(Server == None)
00059			return;
00060		PlayerList = Server.PlayerList;
00061	
00062		if(PlayerList == None)
00063			return;
00064		Count = PlayerList.Count();
00065		if( Server.GameVer >= 406 )
00066		{
00067			if( ngSecretColumn.WinWidth <= 1 )
00068			{
00069				ngSecretColumn.ShowWindow();
00070				ngSecretColumn.WinWidth = ngSecretWidth;
00071			}
00072		}
00073		else
00074		{
00075			if( ngSecretColumn.WinWidth > 1 )
00076			{
00077				ngSecretWidth = ngSecretColumn.WinWidth;
00078				ngSecretColumn.WinWidth = 0;
00079				ngSecretColumn.HideWindow();
00080			}
00081		}
00082	
00083		C.Font = Root.Fonts[F_Normal];
00084		Visible = int((WinHeight - (TopMargin + BottomMargin))/RowHeight);
00085		
00086		VertSB.SetRange(0, Count+1, Visible);
00087		TopRow = VertSB.Pos;
00088	
00089		Skipped = 0;
00090	
00091		Y = 1;
00092		l = UBrowserPlayerList(PlayerList.Next);
00093		while((Y < RowHeight + WinHeight - RowHeight - (TopMargin + BottomMargin)) && (l != None))
00094		{
00095			if(Skipped >= VertSB.Pos)
00096			{
00097				switch(Column.ColumnNum)
00098				{
00099				case 0:
00100					Column.ClipText( C, 2, Y + TopMargin, l.PlayerName );
00101					break;
00102				case 1:
00103					Column.ClipText( C, 2, Y + TopMargin, l.PlayerFrags );
00104					break;
00105				case 2:
00106					Column.ClipText( C, 2, Y + TopMargin, l.PlayerPing);
00107					break;
00108				case 3:
00109					Column.ClipText( C, 2, Y + TopMargin, l.PlayerTeam );
00110					break;
00111				case 4:
00112					Column.ClipText( C, 2, Y + TopMargin, l.PlayerMesh );
00113					break;
00114				case 5:
00115					Column.ClipText( C, 2, Y + TopMargin, l.PlayerSkin );
00116					break;
00117				case 6:
00118					Column.ClipText( C, 2, Y + TopMargin, l.PlayerFace );
00119					break;
00120				case 7:
00121					Column.ClipText( C, 2, Y + TopMargin, l.PlayerID );
00122					break;
00123				case 8:
00124					if( l.PlayerStats ~= "bot" )
00125						Column.ClipText( C, 2, Y + TopMargin, BotText );
00126					else
00127					if( l.PlayerStats ~= "true" )
00128						Column.ClipText( C, 2, Y + TopMargin, EnabledText );
00129					else
00130						Column.ClipText( C, 2, Y + TopMargin, DisabledText );
00131					break;
00132				}
00133	
00134				Y = Y + RowHeight;			
00135			} 
00136			Skipped ++;
00137			l = UBrowserPlayerList(l.Next);
00138		}
00139	}
00140	
00141	function RightClickRow(int Row, float X, float Y)
00142	{
00143		local UBrowserInfoMenu Menu;
00144		local float MenuX, MenuY;
00145		local UWindowWindow W;
00146	
00147		W = GetParent(class'UBrowserInfoWindow');
00148		if(W == None)
00149			return;
00150		Menu = UBrowserInfoWindow(W).Menu;
00151	
00152		WindowToGlobal(X, Y, MenuX, MenuY);
00153		Menu.WinLeft = MenuX;
00154		Menu.WinTop = MenuY;
00155	
00156		Menu.ShowWindow();
00157	}
00158	
00159	function SortColumn(UWindowGridColumn Column) 
00160	{
00161		UBrowserInfoClientWindow(GetParent(class'UBrowserInfoClientWindow')).Server.PlayerList.SortByColumn(Column.ColumnNum);
00162	}
00163	
00164	function SelectRow(int Row) 
00165	{
00166	}
00167	
00168	defaultproperties
00169	{
00170	     NameText="Name"
00171	     FragsText="Frags"
00172	     PingText="Ping"
00173	     TeamText="Team"
00174	     MeshText="Mesh"
00175	     SkinText="Skin"
00176	     FaceText="Face"
00177	     IDText="ID"
00178	     ngSecretText="ngWorldStats Status"
00179	     EnabledText="Registered"
00180	     DisabledText="Unregistered"
00181	     BotText="Bot"
00182	     bNoKeyboard=True
00183	}

End Source Code