UnrealShare
Class UnrealMenu

source: e:\games\UnrealTournament\UnrealShare\Classes\UnrealMenu.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Menu
         |
         +--UnrealShare.UnrealMenu
Direct Known Subclasses:InfoMenu, UnrealInfoMenu, UnrealListMenu, UnrealLongMenu, UnrealShortMenu

class UnrealMenu
extends Engine.Menu

//============================================================================= // UnrealMenu // // Master class of all UnrealI menus. Contains nonstyle specific utilities // for all menu types (Info/Long/Short). //=============================================================================

Function Summary
 void DrawList(Canvas Canvas, bool bLargeFont, int Spacing, int StartX, int StartY)
 void DrawSlider(Canvas Canvas, int StartX, int StartY, int Value, int sMin, int StepSize)
 void DrawTitle(Canvas Canvas)
 
simulated
PlayEnterSound()
 
simulated
PlayModifySound()
 
simulated
PlaySelectSound()



Source Code


00001	//=============================================================================
00002	// UnrealMenu
00003	//
00004	// Master class of all UnrealI menus.  Contains nonstyle specific utilities
00005	// for all menu types (Info/Long/Short).
00006	//=============================================================================
00007	class UnrealMenu extends Menu;
00008	
00009	#exec TEXTURE IMPORT NAME=IconSkull FILE=TEXTURES\HUD\i_skull.PCX GROUP="Icons" MIPS=OFF
00010	#exec TEXTURE IMPORT NAME=TranslatorHUD3 FILE=models\TRANHUD3.PCX GROUP="Icons" FLAGS=2 MIPS=OFF
00011	
00012	#exec Font Import File=Textures\TinyFont.pcx Name=TinyFont
00013	#exec Font Import File=Textures\TinyFon3.pcx Name=TinyWhiteFont
00014	#exec Font Import File=Textures\TinyFon2.pcx Name=TinyRedFont
00015	
00016	#exec Texture Import File=Textures\dot.pcx Name=Dot MIPS=OFF
00017	#exec Texture Import File=Textures\Slide1.pcx Name=Slide1 MIPS=OFF
00018	#exec Texture Import File=Textures\Slide2.pcx Name=Slide2 MIPS=OFF
00019	#exec Texture Import File=Textures\Slide3.pcx Name=Slide3 MIPS=OFF
00020	#exec Texture Import File=Textures\Slide4.pcx Name=Slide4 MIPS=OFF
00021	#exec Texture Import File=Textures\ex.pcx Name=ex MIPS=OFF
00022	#exec Texture Import File=Textures\check.pcx Name=Check MIPS=OFF
00023	
00024	#exec OBJ LOAD FILE=textures\menugr.utx PACKAGE=UNREALSHARE.MenuGfx
00025	
00026	#exec AUDIO IMPORT FILE="Sounds\Menu\Select4.WAV" NAME="Select4" GROUP="Menu"
00027	#exec AUDIO IMPORT FILE="Sounds\Menu\updown3.WAV" NAME="Updown3" GROUP="Menu"
00028	#exec AUDIO IMPORT FILE="Sounds\Menu\side1b.WAV" NAME="side1b" GROUP="Menu"
00029	
00030	simulated function PlaySelectSound()
00031	{
00032		PlayerOwner.PlaySound(sound'updown3');
00033	}
00034	
00035	simulated function PlayModifySound()
00036	{
00037		PlayerOwner.PlaySound(sound'Select4',,2.0);
00038	}
00039	
00040	simulated function PlayEnterSound() 
00041	{
00042		PlayerOwner.PlaySound(sound'Select4',,2.0);
00043	}
00044	
00045	function DrawTitle(canvas Canvas)
00046	{
00047		if ( Canvas.ClipY < 300 )
00048		{
00049			Canvas.Font = Canvas.BigFont;
00050			Canvas.SetPos(Max(8, 0.5 * Canvas.ClipX - 4 * Len(MenuTitle)), 4 );
00051		}
00052		else
00053		{
00054			Canvas.Font = Canvas.LargeFont;
00055			Canvas.SetPos(Max(8, 0.5 * Canvas.ClipX - 8 * Len(MenuTitle)), 4 );
00056		}
00057		Canvas.DrawText(MenuTitle, False);
00058	}
00059	
00060	function DrawList(canvas Canvas, bool bLargeFont, int Spacing, int StartX, int StartY)
00061	{
00062		local int i;
00063	
00064		if ( bLargeFont )
00065		{
00066			if ( Spacing < 30 )
00067			{
00068				StartX += 0.5 * ( 0.5 * Canvas.ClipX - StartX);
00069				Canvas.Font = Canvas.BigFont;
00070			}
00071			else
00072				Canvas.Font = Canvas.LargeFont;
00073		}
00074		else
00075			Canvas.Font = Canvas.MedFont;
00076	
00077		for (i=0; i< (MenuLength); i++ )
00078		{
00079			SetFontBrightness(Canvas, (i == Selection - 1) );
00080			Canvas.SetPos(StartX, StartY + Spacing * i);
00081			Canvas.DrawText(MenuList[i + 1], false);
00082		}
00083		Canvas.DrawColor = Canvas.Default.DrawColor;
00084	}
00085	
00086	function DrawSlider( canvas Canvas, int StartX, int StartY, int Value, int sMin, int StepSize )
00087	{
00088		local bool bFoundValue;
00089		local int i;
00090	
00091		Canvas.SetPos( StartX, StartY );
00092		Canvas.DrawIcon(Texture'Slide1',1.0);	
00093		Canvas.Style = 2;
00094		bFoundValue = false;
00095		For ( i=1; i<8; i++ )
00096		{
00097			if ( !bFoundValue && ( StepSize * i + sMin > Value) )
00098			{
00099				bFoundValue = true; 
00100				Canvas.DrawIcon(Texture'Slide2',1.0);
00101			}
00102			else
00103				Canvas.DrawIcon(Texture'Slide4',1.0);
00104		}
00105		if ( bFoundValue )
00106			Canvas.DrawIcon(Texture'Slide4',1.0);
00107		else
00108			Canvas.DrawIcon(Texture'Slide2',1.0);
00109	
00110		Canvas.DrawIcon(Texture'Slide3',1.0);							
00111		Canvas.Style = 1;	
00112	}
00113	
00114	defaultproperties
00115	{
00116	}

End Source Code