UBrowser
Class UBrowserPlayerGrid

source: c:\runehov\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 FragsText
 string IDText
 string MeshText
 string NameText
 string PingText
 string SkinText
 string TeamText


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	
00015	function Created() 
00016	{
00017		Super.Created();
00018	
00019		RowHeight = 12;
00020	
00021		AddColumn(NameText, 60);
00022		AddColumn(FragsText, 30);
00023		AddColumn(PingText, 30);
00024		AddColumn(TeamText, 30);
00025		AddColumn(MeshText, 80);
00026		AddColumn(SkinText, 80);
00027	//	AddColumn(FaceText, 60);
00028		AddColumn(IDText, 30);
00029	}
00030	
00031	function PaintColumn(Canvas C, UWindowGridColumn Column, float MouseX, float MouseY) 
00032	{
00033		local UBrowserServerList Server;
00034		local UBrowserPlayerList PlayerList, l;
00035		local int Visible;
00036		local int Count;
00037		local int Skipped;
00038		local int Y;
00039		local int TopMargin;
00040		local int BottomMargin;
00041		
00042		if(bShowHorizSB)
00043			BottomMargin = LookAndFeel.Size_ScrollbarWidth;
00044		else
00045			BottomMargin = 0;
00046	
00047		TopMargin = LookAndFeel.ColumnHeadingHeight;
00048	
00049		Server = UBrowserInfoClientWindow(GetParent(class'UBrowserInfoClientWindow')).Server;
00050		if(Server == None)
00051			return;
00052		PlayerList = Server.PlayerList;
00053		if(PlayerList == None)
00054			return;
00055		Count = PlayerList.Count();
00056	
00057		C.Font = Root.Fonts[F_Normal];
00058		Visible = int((WinHeight - (TopMargin + BottomMargin))/RowHeight);
00059		
00060		VertSB.SetRange(0, Count+1, Visible);
00061		TopRow = VertSB.Pos;
00062	
00063		Skipped = 0;
00064	
00065		Y = 1;
00066		l = UBrowserPlayerList(PlayerList.Next);
00067		while((Y < RowHeight + WinHeight - RowHeight - (TopMargin + BottomMargin)) && (l != None))
00068		{
00069			if(Skipped >= VertSB.Pos)
00070			{
00071				switch(Column.ColumnNum)
00072				{
00073				case 0:
00074					Column.ClipText( C, 2, Y + TopMargin, l.PlayerName );
00075					break;
00076				case 1:
00077					Column.ClipText( C, 2, Y + TopMargin, l.PlayerFrags );
00078					break;
00079				case 2:
00080					Column.ClipText( C, 2, Y + TopMargin, l.PlayerPing);
00081					break;
00082				case 3:
00083					Column.ClipText( C, 2, Y + TopMargin, l.PlayerTeam );
00084					break;
00085				case 4:
00086					Column.ClipText( C, 2, Y + TopMargin, l.PlayerMesh );
00087					break;
00088				case 5:
00089					Column.ClipText( C, 2, Y + TopMargin, l.PlayerSkin );
00090					break;
00091	//			case 6:
00092	//				Column.ClipText( C, 2, Y + TopMargin, l.PlayerFace );
00093					break;
00094				case 7:
00095					Column.ClipText( C, 2, Y + TopMargin, l.PlayerID );
00096					break;
00097				}
00098	
00099				Y = Y + RowHeight;			
00100			} 
00101			Skipped ++;
00102			l = UBrowserPlayerList(l.Next);
00103		}
00104	}
00105	
00106	function RightClickRow(int Row, float X, float Y)
00107	{
00108		local UBrowserInfoMenu Menu;
00109		local float MenuX, MenuY;
00110		local UWindowWindow W;
00111	
00112		W = GetParent(class'UBrowserInfoWindow');
00113		if(W == None)
00114			return;
00115		Menu = UBrowserInfoWindow(W).Menu;
00116	
00117		WindowToGlobal(X, Y, MenuX, MenuY);
00118		Menu.WinLeft = MenuX;
00119		Menu.WinTop = MenuY;
00120	
00121		Menu.ShowWindow();
00122	}
00123	
00124	function SortColumn(UWindowGridColumn Column) 
00125	{
00126		UBrowserInfoClientWindow(GetParent(class'UBrowserInfoClientWindow')).Server.PlayerList.SortByColumn(Column.ColumnNum);
00127	}
00128	
00129	function SelectRow(int Row) 
00130	{
00131	}
00132	
00133	defaultproperties
00134	{
00135	     NameText="Name"
00136	     FragsText="Frags"
00137	     PingText="Ping"
00138	     TeamText="Team"
00139	     MeshText="Mesh"
00140	     SkinText="Skin"
00141	     IDText="ID"
00142	     bNoKeyboard=True
00143	}

End Source Code