# SpatialFear.SFGameMenu

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 00154 00155 00156 00157 00158 |
    //=============================================================================
    // Spatial Fear
    // Class: SFGameMenu
    // Descripton: Customized GameMenu class, to only allow
    //				SpatialFear releated menu items.
    //
    // Author: Markus Nuebel
    //=============================================================================
    class SFGameMenu extends UWindowPulldownMenu;

    var UWindowPulldownMenuItem NewGame, LoadGame, SaveGame, Practice, Quit, ReturnToGame, ConvHistory, Training ;

    var localized string NewGameName;
    var localized string NewGameHelp;
    var localized string LoadGameName;
    var localized string LoadGameHelp;
    var localized string SaveGameName;
    var localized string SaveGameHelp;
    var localized string ReturnToGameName;
    var localized string ReturnToGameHelp;
    var localized string QuitName;
    var localized string QuitHelp;
    var localized string QuitTitle;
    var localized string QuitText;
    var localized string DemoQuitText;

    var UWindowMessageBox ConfirmQuit;

    function Created()
    {
    	Super.Created();

    	// Add menu items.
    	NewGame = AddMenuItem(NewGameName, None);
    	AddMenuItem("-", None);
    	LoadGame = AddMenuItem(LoadGameName, None);
    	SaveGame = AddMenuItem(SaveGameName, None);
    	ReturnToGame = AddMenuItem(ReturnToGameName, None);
    	AddMenuItem("-", None);
    	Training = AddMenuItem("&Training", None);
    	AddMenuItem("-", None);

    	Quit = AddMenuItem(QuitName, None);
    }

    function ShowWindow()
    {
    	Super.ShowWindow();
    	ReturnToGame.bDisabled = GetLevel().Game != None && GetLevel().Game.IsA('UTIntro');
    }

    function MessageBoxDone(UWindowMessageBox W, MessageBoxResult Result)
    {
    	if(class'SFGameInfo'.Default.DemoBuild == 1)
    	{
    		if(W == ConfirmQuit)
    		{
    			switch(Result)
    			{
    			case MR_Yes:
    				GetPlayerOwner().ConsoleCommand("start http://www.planetunreal.com/le");
    				GetPlayerOwner().ConsoleCommand("exit");
    				break;
    			case MR_No:
    				Root.QuitGame();
    				break;
    			}
    		}
    	}
    	else
    	{
    		if(W == ConfirmQuit && Result == MR_Yes)
    			Root.QuitGame();
    	}
    }

    function ExecuteItem(UWindowPulldownMenuItem I)
    {
    	local string StartMap;
    	local int EmptySlot, j;
    	local UWindowWindow wnd;

    	switch(I)
    	{
    	case NewGame:
    		GetPlayerOwner().ClientTravel( "SPF-JourneysEnd.sfp", TRAVEL_Absolute, False );
    		Root.Console.CloseUWindow();
    		break;
    	case LoadGame:
    		wnd = Root.CreateWindow(class'SFLoadGameWindow', 50, 50, 100, 100);
    		wnd.bLeaveOnScreen = true;
    		break;
    	case SaveGame:
    		wnd = Root.CreateWindow(class'SFSaveGameWindow', 50, 50, 100, 100);
    		wnd.bLeaveOnScreen = true;
    		break;
    	case Training:
    		// Create practice game dialog.
    		GetPlayerOwner().ClientTravel( "SPF-Training.sfp", TRAVEL_Absolute, False );
    		Root.Console.CloseUWindow();
    		break;
    	case Quit:
    		if(class'SFGameInfo'.Default.DemoBuild == 1)
    			ConfirmQuit = MessageBox(QuitTitle, DemoQuitText, MB_YesNoCancel, MR_Cancel, MR_No);
    		else
    			ConfirmQuit = MessageBox(QuitTitle, QuitText, MB_YesNo, MR_No, MR_Yes);
    		break;
    	case ReturnToGame:
    		Root.Console.CloseUWindow();
    		break;
    	}

    	Super.ExecuteItem(I);
    }

    function Select(UWindowPulldownMenuItem I)
    {
    	switch(I)
    	{
    	case NewGame:
    		SFMenuMenuBar(GetMenuBar()).SetHelp(NewGameHelp);
    		return;
    	case LoadGame:
    		SFMenuMenuBar(GetMenuBar()).SetHelp(LoadGameHelp);
    		return;
    	case Quit:
    		SFMenuMenuBar(GetMenuBar()).SetHelp(QuitHelp);
    		break;
    	case ReturnToGame:
    		SFMenuMenuBar(GetMenuBar()).SetHelp(ReturnToGameHelp);
    		break;
    	case Training:
    		SFMenuMenuBar(GetMenuBar()).SetHelp("Select to begin basic training.");
    		break;
    	}

    	Super.Select(I);
    }
    //     BotmatchName="Start &Practice Session"
    //     BotmatchHelp="Select to begin a practice game against bots."

    defaultproperties
    {
         NewGameName="Start Spatial &Fear"
         NewGameHelp="Select to start a new Spatial Fear game!"
         LoadGameName="&Load Game"
         LoadGameHelp="Select to resume a saved Spatial Fear game."
         SaveGameName="&Save Game"
         SaveGameHelp="Select to save the current Spatial Fear game."
         ReturnToGameName="Return to &Current Game"
         ReturnToGameHelp="Leave the menus and return to your current game.  Pressing the ESC key also returns you to the current game."
         QuitName="&Quit"
         QuitHelp="Select to save preferences and exit Unreal."
         QuitTitle="Confirm Quit"
         QuitText="Are you sure you want to Quit?"
         DemoQuitText="Thank you for playing the Spatial Fear Demo.  Visit our website for information on the game"
    }

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX