RMenu
Class RuneMenuLoadClientWindow

source: c:\runehov\RMenu\Classes\RuneMenuLoadClientWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--RMenu.RuneMenuPageWindow
                     |
                     +--RMenu.RuneMenuSlotClientWindow
                        |
                        +--RMenu.RuneMenuLoadClientWindow
Direct Known Subclasses:None

class RuneMenuLoadClientWindow
extends RMenu.RuneMenuSlotClientWindow


Variables
 RuneMenuRaisedButton RestartButton
 string RestartHelp
 string RestartText


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void Notify(UWindowDialogControl C, byte E)



Source Code


00001	class RuneMenuLoadClientWindow extends RuneMenuSlotClientWindow;
00002	
00003	var RuneMenuRaisedButton RestartButton;
00004	var localized string RestartText;
00005	var localized string RestartHelp;
00006	
00007	function Created()
00008	{
00009		local int ButtonWidth, ButtonLeft, ButtonTop, I;
00010	
00011		Super.Created();
00012	
00013		ButtonWidth = WinWidth - 60;
00014		ButtonLeft = (WinWidth - ButtonWidth)/2;
00015	
00016		ButtonTop = 25 + 25*10;
00017		RestartButton = RuneMenuRaisedButton(CreateControl(class'RuneMenuRaisedButton', ButtonLeft, ButtonTop, ButtonWidth, 1));
00018		RestartButton.SetHelpText(RestartHelp);
00019	
00020		if (Root != None && RuneRootWindow(Root) != None)
00021		{
00022			RuneRootWindow(Root).LoadClient = self;
00023		}
00024	}
00025	
00026	function BeforePaint(Canvas C, float X, float Y)
00027	{
00028		local int ButtonWidth, ButtonLeft, I;
00029	
00030		Super.BeforePaint(C, X, Y);
00031	
00032		ButtonWidth = WinWidth - 60;
00033		ButtonLeft = (WinWidth - ButtonWidth)/2;
00034	
00035		RestartButton.SetSize(ButtonWidth, 1);
00036		RestartButton.WinLeft = ButtonLeft;
00037		RestartButton.SetText(RestartText@GetLevel().Title);
00038	}
00039	
00040	function Notify(UWindowDialogControl C, byte E)
00041	{
00042		local int I;
00043		local int Selection;
00044	
00045		Super.Notify(C, E);
00046	
00047		switch(E)
00048		{
00049		case DE_Click:
00050			if ( C == RestartButton )
00051			{
00052				Root.GetPlayerOwner().ReStartLevel();
00053				Root.Console.CloseUWindow();
00054				return;
00055			}
00056	
00057			if ( RuneMenuRaisedButton(C).Text ~= "..Empty.." )
00058			{
00059				return;
00060			}
00061	
00062			for (I=0; I<9; I++)
00063			{
00064				if (C == Slots[I])
00065				{
00066					Selection = I;
00067				}
00068			}
00069	
00070			// Only load single-player levels if in singleplayer and vice-versa
00071			if(Left(RuneMenuRaisedButton(C).Text, 4) == "Net:")
00072			{
00073				if((GetLevel().NetMode != NM_Standalone || GetLevel().Game.bDeathMatch))
00074				{
00075					GetLevel().ServerTravel("?load="$Selection, false);
00076				}
00077			}
00078			else if(GetLevel().NetMode == NM_Standalone && !GetLevel().Game.bDeathMatch)
00079			{
00080				GetPlayerOwner().ClientTravel( "?load="$Selection, TRAVEL_Absolute, false);
00081			}
00082	
00083			Root.Console.CloseUWindow();
00084			break;
00085		}
00086	}
00087	
00088	defaultproperties
00089	{
00090	     RestartText="Restart"
00091	     RestartHelp="Press to restart the current level."
00092	}

End Source Code