UTMenu
Class UTMultiplayerMenu

source: e:\games\UnrealTournament\UTMenu\Classes\UTMultiplayerMenu.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowDialogControl
            |
            +--UWindow.UWindowListControl
               |
               +--UWindow.UWindowPulldownMenu
                  |
                  +--UMenu.UMenuMultiplayerMenu
                     |
                     +--UTMenu.UTMultiplayerMenu
Direct Known Subclasses:None

class UTMultiplayerMenu
extends UMenu.UMenuMultiplayerMenu


Variables
 string OnlineServiceCmdAction[10]
 string OnlineServiceCmdType[10]
 int OnlineServiceCount
 string OnlineServiceHelp[10]
 UWindowPulldownMenuItem OnlineServiceItems[10]
 string OnlineServices[10]


Function Summary
 void Created()
 void ExecuteItem(UWindowPulldownMenuItem I)
 string ParseOption(string Input, int Pos)
     
//www.unrealtournament.net/forum
 */
 void Select(UWindowPulldownMenuItem I)



Source Code


00001	class UTMultiplayerMenu expands UMenuMultiplayerMenu;
00002	
00003	var config string OnlineServices[10];
00004	
00005	var UWindowPulldownMenuItem OnlineServiceItems[10];
00006	var string OnlineServiceCmdType[10];
00007	var string OnlineServiceCmdAction[10];
00008	var string OnlineServiceHelp[10];
00009	var int OnlineServiceCount;
00010	
00011	/* Examples:
00012	 * [UTMenu.UTMultiplayerMenu]
00013	 * OnlineServices[0]=Play online for FREE with mplayer.com!,Select this option to play online at mplayer!,CMD,mplayer
00014	 * OnlineServices[1]=Go to the UT messageboard,Select this option to go to the UT messageboard,CMD,start http://www.unrealtournament.net/forum
00015	 */
00016	
00017	
00018	function string ParseOption(string Input, int Pos)
00019	{
00020		local int i;
00021	
00022		while(True)
00023		{
00024			if(Pos == 0)
00025			{
00026				i = InStr(Input, ",");
00027				if(i != -1)
00028					Input = Left(Input, i);
00029				return Input;
00030			}
00031	
00032			i = InStr(Input, ",");
00033			if(i == -1)
00034				return "";
00035	
00036			Input = Mid(Input, i+1);
00037			Pos--;
00038		}
00039	}
00040	
00041	function Created()
00042	{
00043		local int i;
00044		local string S;
00045	
00046		Super.Created();
00047		
00048		if(OnlineServices[0] != "")
00049			AddMenuItem("-", None);
00050	
00051		for(i=0;i<10;i++)
00052		{
00053			if(OnlineServices[i] == "")
00054				break;
00055		
00056			if(ParseOption(OnlineServices[i], 0) == "LOCALIZE")
00057				S = Localize("OnlineServices", ParseOption(OnlineServices[i], 1), "UTMenu");
00058			else
00059				S = OnlineServices[i];
00060	
00061			OnlineServiceItems[i] = AddMenuItem(ParseOption(S, 0), None);
00062			OnlineServiceHelp[i] = ParseOption(S, 1);
00063			OnlineServiceCmdType[i] = ParseOption(S, 2);
00064			OnlineServiceCmdAction[i] = ParseOption(S, 3);
00065		}
00066	
00067		OnlineServiceCount = i;
00068	}
00069	
00070	function ExecuteItem(UWindowPulldownMenuItem I) 
00071	{
00072		local int j;
00073		local string S;
00074	
00075		for(j=0;j<OnlineServiceCount;j++)
00076		{
00077			if(I == OnlineServiceItems[j])
00078			{
00079				switch(OnlineServiceCmdType[j])
00080				{
00081				case "URL":
00082					S = GetPlayerOwner().ConsoleCommand("start "$OnlineServiceCmdAction[j]);
00083					break;
00084				case "CMD":
00085					S = GetPlayerOwner().ConsoleCommand(OnlineServiceCmdAction[j]);
00086					if(S != "")
00087						MessageBox(OnlineServiceItems[j].Caption, S, MB_OK, MR_OK);
00088					break;
00089				case "CMDQUIT":
00090					S = GetPlayerOwner().ConsoleCommand(OnlineServiceCmdAction[j]);
00091					if(S != "")
00092						MessageBox(OnlineServiceItems[j].Caption, S, MB_OK, MR_OK);
00093					else
00094						GetPlayerOwner().ConsoleCommand("exit");
00095					break;
00096				}
00097			}
00098		}
00099	
00100		Super.ExecuteItem(I);
00101	}
00102	
00103	function Select(UWindowPulldownMenuItem I)
00104	{
00105		local int j;
00106	
00107		for(j=0;j<OnlineServiceCount;j++)
00108		{
00109			if(I == OnlineServiceItems[j])
00110			{
00111				UMenuMenuBar(GetMenuBar()).SetHelp(OnlineServiceHelp[j]);
00112			}
00113		}
00114	
00115		Super.Select(I);
00116	}
00117	
00118	defaultproperties
00119	{
00120	     OnlineServices(0)="LOCALIZE,MPlayer"
00121	     OnlineServices(1)="LOCALIZE,Heat"
00122	     OnlineServices(2)="LOCALIZE,WON"
00123	     UBrowserClassName="UTBrowser.UTBrowserMainWindow"
00124	     StartGameClassName="UTMenu.UTStartGameWindow"
00125	}

End Source Code