home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / GUI / Classes / MyMainMenu.uc < prev    next >
Text File  |  2003-06-30  |  2KB  |  113 lines

  1. // ====================================================================
  2. //  (c) 2003, Epic Games, Inc.  All Rights Reserved
  3. // ====================================================================
  4.  
  5. class MyMainMenu extends GUIPage;
  6.  
  7. #exec OBJ LOAD FILE=GUIContent.utx
  8.  
  9. var automated     GUIButton    TestButton1;
  10. var automated     GUIButton    TestButton2;
  11. var automated     GUIButton    QuitButton;
  12.  
  13. var bool    AllowClose;
  14.  
  15. function bool MyKeyEvent(out byte Key,out byte State,float delta)
  16. {
  17.     if(Key == 0x1B && State == 1)    // Escape pressed
  18.     {
  19.         AllowClose = true;
  20.         return true;
  21.     }
  22.     else
  23.         return false;
  24. }
  25.  
  26. function bool CanClose(optional Bool bCancelled)
  27. {
  28.     if(AllowClose)
  29.         Controller.OpenMenu("GUI.MyQuitPage");
  30.  
  31.     return false;
  32. }
  33.  
  34.  
  35. function bool ButtonClick(GUIComponent Sender)
  36. {
  37.     local GUIButton Selected;
  38.  
  39.     if (GUIButton(Sender) != None)
  40.         Selected = GUIButton(Sender);
  41.  
  42.     if (Selected == None) return false;
  43.  
  44.     switch (Selected)
  45.     {
  46.         case TestButton1:
  47.             return Controller.OpenMenu("GUI.MyTest2Page"); break;
  48.         case TestButton2:
  49.             return Controller.OpenMenu("GUI.MyTestPage"); break;
  50.         case QuitButton:
  51.             return Controller.OpenMenu("GUI.MyQuitPage"); break;
  52.     }
  53.     return false;
  54. }
  55.  
  56. defaultproperties
  57. {
  58.     OnCanClose=CanClose
  59.     OnKeyEvent=MyKeyEvent
  60.  
  61.  
  62.     Begin Object Class=GUIButton Name=cTestButton1
  63.         StyleName="TextButton"
  64.         Caption="Test 1"
  65.         Hint="The First Test"
  66.         OnClick=ButtonClick
  67.         WinWidth=0.500000
  68.         WinHeight=0.075000
  69.         WinLeft=0.250000
  70.         WinTop=0.334635
  71.         TabOrder=0
  72.         bFocusOnWatch=true
  73.     End Object
  74.  
  75.     Begin Object Class=GUIButton Name=cTestButton2
  76.         StyleName="TextButton"
  77.         Caption="Test 2"
  78.         Hint="More Tests"
  79.         OnClick=ButtonClick
  80.         WinWidth=0.500000
  81.         WinHeight=0.075000
  82.         WinLeft=0.250000
  83.         WinTop=0.506251
  84.         bFocusOnWatch=true
  85.         TabOrder=1
  86.     End Object
  87.  
  88.     Begin Object Class=GUIButton Name=cQuitButton
  89.         Caption="QUIT"
  90.         Hint="Exit"
  91.         OnClick=ButtonClick
  92.         StyleName="TextButton"
  93.         WinWidth=0.205078
  94.         WinHeight=0.042773
  95.         WinLeft=0.391602
  96.         WinTop=0.905725
  97.         bFocusOnWatch=true
  98.         TabOrder=5
  99.     End Object
  100.  
  101.     TestButton1=cTestButton1
  102.     TestButton2=cTestButton2
  103.     QuitButton=cQuitButton
  104.  
  105.     Background=Material'GUIContent.EpicLogo'
  106.     WinWidth=1.0
  107.     WinHeight=1.0
  108.     WinTop=0.0
  109.     WinLeft=0.0
  110.     AllowClose=False
  111.     bAllowedAsLast=true
  112.     bDisconnectOnOpen=true
  113. }