UBrowser
Class UBrowserUpdateServerWindow

source: e:\games\UnrealTournament\UBrowser\Classes\UBrowserUpdateServerWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--UBrowser.UBrowserUpdateServerWindow
Direct Known Subclasses:UTBrowserUpdateServerWindow

class UBrowserUpdateServerWindow
extends UWindow.UWindowPageWindow


Variables
 string FailureText
 UBrowserUpdateServerLink Link
 class LinkClass
 int NumTries
 string QueryText
 string StatusBarText
 UBrowserUpdateServerTextArea TextArea
 class TextAreaClass
 int Tries
 bool bGotMOTD
 bool bHadInitialQuery


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void Failure()
 void KeyDown(int Key, float X, float Y)
 void Paint(Canvas C, float X, float Y)
 void Query()
 void SetIRCServer(string Value)
 void SetMOTD(string MOTD)
 void SetMasterServer(string Value)
 void Success()



Source Code


00001	class UBrowserUpdateServerWindow expands UWindowPageWindow;
00002	
00003	var UBrowserUpdateServerLink Link;
00004	var UBrowserUpdateServerTextArea TextArea;
00005	
00006	var localized string QueryText;
00007	var localized string FailureText;
00008	var class<UBrowserUpdateServerLink> LinkClass;
00009	var class<UBrowserUpdateServerTextArea> TextAreaClass;
00010	var bool bGotMOTD;
00011	var string StatusBarText;
00012	var bool bHadInitialQuery;
00013	var int Tries;
00014	var int NumTries;
00015	
00016	function Created()
00017	{
00018		Super.Created();
00019		TextArea = UBrowserUpdateServerTextArea(CreateControl(TextAreaClass, 0, 0, WinWidth, WinHeight, Self));
00020	
00021		SetAcceptsFocus();
00022	}
00023	
00024	function Query()
00025	{
00026		bHadInitialQuery = True;
00027		StatusBarText = QueryText;
00028		if(Link != None)
00029		{
00030			Link.UpdateWindow = None;
00031			Link.Destroy();
00032		}
00033		Link = GetEntryLevel().Spawn(LinkClass);
00034		Link.UpdateWindow = Self;
00035		Link.QueryUpdateServer();
00036		bGotMOTD = False;
00037	}
00038	
00039	function BeforePaint(Canvas C, float X, float Y)
00040	{
00041		local UBrowserMainWindow W;
00042	
00043		if(!bHadInitialQuery)
00044			Query();
00045	
00046		Super.BeforePaint(C, X, Y);
00047		TextArea.SetSize(WinWidth, WinHeight);
00048	
00049		W = UBrowserMainWindow(GetParent(class'UBrowserMainWindow'));
00050		if(StatusBarText == "")
00051			W.DefaultStatusBarText(TextArea.StatusURL);
00052		else
00053			W.DefaultStatusBarText(StatusBarText);
00054	}
00055	
00056	function Paint(Canvas C, float X, float Y)
00057	{
00058		DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'BlackTexture');
00059	}
00060	
00061	function SetMOTD(string MOTD)
00062	{
00063		TextArea.SetHTML(MOTD);
00064	}
00065	
00066	function SetMasterServer(string Value)
00067	{
00068		ReplaceText(Value, Chr(10), "");
00069		if(Value != "")
00070			UBrowserMainClientWindow(UBrowserMainWindow(GetParent(class'UBrowserMainWindow')).ClientArea).NewMasterServer(Value);
00071	}
00072	
00073	function SetIRCServer(string Value)
00074	{
00075		StripCRLF(Value);
00076	
00077		if(Value != "")
00078			UBrowserMainClientWindow(UBrowserMainWindow(GetParent(class'UBrowserMainWindow')).ClientArea).NewIRCServer(Value);
00079	}
00080	
00081	function Failure()
00082	{
00083		Link.UpdateWindow = None;
00084		Link.Destroy();
00085		Link = None;
00086		Tries++;
00087		if(Tries < NumTries)
00088		{
00089			Query();
00090			return;
00091		}
00092	
00093		StatusBarText = FailureText;
00094		Tries = 0;
00095	}
00096	
00097	function Success()
00098	{
00099		StatusBarText = "";
00100	
00101		Link.UpdateWindow = None;
00102		Link.Destroy();
00103		Link = None;
00104		Tries = 0;
00105	}
00106	
00107	function KeyDown(int Key, float X, float Y) 
00108	{
00109		switch(Key)
00110		{
00111		case 0x74: // IK_F5;
00112			TextArea.Clear();
00113			Query();
00114			break;
00115		}
00116	}
00117	
00118	defaultproperties
00119	{
00120	     QueryText="Querying Server..."
00121	     FailureText="The server did not respond."
00122	     LinkClass=Class'UBrowser.UBrowserUpdateServerLink'
00123	     TextAreaClass=Class'UBrowser.UBrowserUpdateServerTextArea'
00124	     NumTries=3
00125	}

End Source Code