Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.Menu


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
//=============================================================================
// Menu: An in-game menu.
// This is a built-in Unreal class and it shouldn't be modified.
//
// Serves as a generic menu master class.  Can be used with any style
// of menu implementation.  Offers menu services such as reading input.
// Not dependent on any visual style.
//=============================================================================
class Menu extends Actor
    native;

var Menu    ParentMenu;
var int     Selection;
var() int   MenuLength;
var bool    bConfigChanged;
var bool    bExitAllMenus;
var PlayerPawn PlayerOwner;

var() localized string HelpMessage[24];
var() localized string MenuList[24];
var() localized string LeftString;
var() localized string RightString;
var() localized string CenterString;
var() localized string EnabledString;
var() localized string DisabledString;
var() localized string MenuTitle;
var() localized string YesString;
var() localized string NoString;

function bool ProcessSelection();
function bool ProcessLeft();
function bool ProcessRight();
function bool ProcessYes();
function bool ProcessNo();
function SaveConfigs();
function PlaySelectSound();
function PlayModifySound();
function PlayEnterSound();
function ProcessMenuInput( coerce string InputString );
function ProcessMenuUpdate( coerce string InputString );
function ProcessMenuEscape();
function ProcessMenuKey( int KeyNo, string KeyName );
function MenuTick( float DeltaTime );
function MenuInit();

function DrawMenu(canvas Canvas);

function ExitAllMenus()
{
    while ( Hud(Owner).MainMenu != None )
        Hud(Owner).MainMenu.ExitMenu();
}

function Menu ExitMenu()
{
    Hud(Owner).MainMenu = ParentMenu;
    if ( bConfigChanged )
        SaveConfigs();
    if ( ParentMenu == None )
    {
        PlayerOwner.bShowMenu = false;
        PlayerOwner.Player.Console.GotoState('');
        if( Level.Netmode == NM_Standalone )
            PlayerOwner.SetPause(False);
    }

    Destroy();
}

function SetFontBrightness(canvas Canvas, bool bBright)
{
    if ( bBright )
    {
        Canvas.DrawColor.R = 255;
        Canvas.DrawColor.G = 255;
        Canvas.DrawColor.B = 255;
    }
    else 
        Canvas.DrawColor = Canvas.Default.DrawColor;
}

function MenuProcessInput( byte KeyNum, byte ActionNum )
{
    if ( KeyNum == EInputKey.IK_Escape )
    {
        PlayEnterSound();
        ExitMenu();
        return;
    }   
    else if ( KeyNum == EInputKey.IK_Up )
    {
        PlaySelectSound();
        Selection--;
        if ( Selection < 1 )
            Selection = MenuLength;
    }
    else if ( KeyNum == EInputKey.IK_Down )
    {
        PlaySelectSound();
        Selection++;
        if ( Selection > MenuLength )
            Selection = 1;
    }
    else if ( KeyNum == EInputKey.IK_Enter )
    {
        bConfigChanged=true;
        if ( ProcessSelection() )
            PlayEnterSound();
    }
    else if ( KeyNum == EInputKey.IK_Left )
    {
        bConfigChanged=true;
        if ( ProcessLeft() )
            PlayModifySound();
    }
    else if ( KeyNum == EInputKey.IK_Right )
    {
        bConfigChanged=true;
        if ( ProcessRight() )
            PlayModifySound();
    }
    else if ( Chr(KeyNum) ~= left(YesString, 1) ) 
    {
        bConfigChanged=true;
        if ( ProcessYes() )
            PlayModifySound();
    }
    else if ( Chr(KeyNum) ~= left(NoString, 1) )
    {
        bConfigChanged=true;
        if ( ProcessNo() )
            PlayModifySound();
    }

    if ( bExitAllMenus )
        ExitAllMenus(); 
    
}

defaultproperties
{
     Selection=1
     HelpMessage(1)="This menu has not yet been implemented."
     LeftString="Left"
     RightString="Right"
     CenterString="Center"
     EnabledString="Enabled"
     DisabledString="Disabled"
     YesString="yes"
     NoString="no"
     bHidden=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: za 22-4-2006 13:00:12.000 - Creation time: za 22-4-2006 13:01:32.687 - Created with UnCodeX