## XIDInterf
Class XIIIMenuChooseMap

source: C:\XIII\XIDInterf\Classes\XIIIMenuChooseMap.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIIMenuChooseMap

Direct Known Subclasses:None

class XIIIMenuChooseMap
extends XIDInterf.XIIIWindow

Variables
`GhostText,` | `GoText`
`Ghostbutton,` | `Gobutton`
`color` | `MapColor`
`string` | `MapList[64]`
`string` | `MapText`
`MaxMaps,` | `onMap`

Function Summary
`void` | `Created()`
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `IterateMaps(string DefaultMap)`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `ShowWindow()`
`void` | `StartMap()`

Source Code

    00001	class XIIIMenuChooseMap extends XIIIWindow;
    00002
    00003	var string MapList[64];
    00004	var int MaxMaps, onMap;
    00005	var localized string MapText;
    00006	var color MapColor;
    00007
    00008	var XIIIbutton DndButton, GodButton, FlyButton, EquipButton, NeuButton, Ghostbutton, Gobutton;
    00009	var localized string DndText, GodText, FlyText, EquipText, NeuText, GhostText, GoText;
    00010
    00011
    00012	function Created()
    00013	{
    00014	     Super.Created();
    00015
    00016	     IterateMaps("");
    00017
    00018	/*
    00019	     Gobutton = XIIIbutton(CreateControl(class'XIIIbutton', 230, 160, 200, 30));
    00020	     Gobutton.Text=GoText;
    00021	     Gobutton.bNoBg =true;
    00022	     FlyButton = XIIIbutton(CreateControl(class'XIIIbutton', 230, 220, 200, 30));
    00023	     FlyButton.Text = FlyText;
    00024	     FlyButton.bNoBg =true;
    00025	     EquipButton = XIIIbutton(CreateControl(class'XIIIbutton', 230, 250, 200, 30));
    00026	     EquipButton.Text=EquipText;
    00027	     EquipButton.bNoBg =true;
    00028	     DndButton = XIIIbutton(CreateControl(class'XIIIbutton', 230, 280, 200, 30));
    00029	     DndButton.Text=NeuText;
    00030	     DndButton.bNoBg =true;
    00031	     Ghostbutton = XIIIbutton(CreateControl(class'XIIIbutton', 230, 310, 200, 30));
    00032	     Ghostbutton.Text=GhostText;
    00033	     Ghostbutton.bNoBg =true;
    00034	     GodButton = XIIIbutton(CreateControl(class'XIIIbutton', 230, 330, 200, 30));
    00035	     GodButton.Text=GodText;
    00036	     GodButton.bNoBg =true;
    00037
    00038	Controls[0] = Gobutton;
    00039	    Controls[5] = GodButton; Controls[1] = FlyButton;
    00040	    Controls[2] = EquipButton; Controls[3] = DndButton; Controls[4] = GhostButton;
    00041	*/
    00042	}
    00043
    00044
    00045	function IterateMaps(string DefaultMap)
    00046	{
    00047	     local string FirstMap, NextMap, TestMap;
    00048	     local int Selected;
    00049
    00050	     FirstMap = GetPlayerOwner().GetMapName("", "", 0);
    00051
    00052	     NextMap = FirstMap;
    00053	     MaxMaps = 0;
    00054	     while (!(FirstMap ~= TestMap))
    00055	     {
    00056	          if(!(Left(NextMap, 7) ~= "mapmenu") && !(Left(NextMap, 5) ~= "entry"))
    00057	          {
    00058	               if(!(Left(NextMap, 2) ~= "DM") && !(Left(NextMap, 2) ~= "CM") && !(Left(NextMap, 2) ~= "CT")) //Len(NextMap) -
    00059	               {
    00060	                    if (!(Left(NextMap, 4) ~= "auto") && !(Left(NextMap, 4) ~= "cine"))
    00061	                    {
    00062	                    log("NextMap: "$NextMap);
    00063	                    MapList[MaxMaps] = left(NextMap, Len(NextMap) - 4);
    00064	                    MaxMaps++;
    00065	                    }
    00066	               }
    00067	          }
    00068
    00069	          // Get the map.
    00070	          NextMap = GetPlayerOwner().GetMapName("", NextMap, 1);
    00071	          // Text to see if this is the last.
    00072	          TestMap = NextMap;
    00073	     }
    00074	}
    00075
    00076
    00077	function ShowWindow()
    00078	{
    00079	     OnMenu = 0; myRoot.bFired = false;
    00080	     Super.ShowWindow();
    00081	     bShowBCK = true;
    00082	     bShowRUN = true;
    00083	}
    00084
    00085
    00086	function Paint(Canvas C, float X, float Y)
    00087	{
    00088	     local float fScale;
    00089
    00090	     Super.Paint(C, X, Y);
    00091
    00092	     C.Style = 1;
    00093	     C.DrawColor = GoldColor;
    00094	     C.SetPos( 32, 50); C.DrawText(Caps("Load a map"), false);
    00095
    00096	     MapColor = HighlightColor;
    00097	     C.SetPos(32, 100);
    00098	     C.DrawColor = MapColor;
    00099	     C.DrawText(Caps(MapText)$"        "$Caps(MapList[OnMap]), false);
    00100	     C.DrawColor = WhiteColor;
    00101	}
    00102
    00103
    00104	function StartMap()
    00105	{
    00106	     local string URL, Checksum;
    00107
    00108	     URL = MapList[OnMap] $ "?Game=XIII.XIIIGameInfo";
    00109	     myRoot.bCloseAfterLoading = true;
    00110	     myRoot.CloseAll(true);
    00111	     myRoot.gotostate('');
    00112	     GetPlayerOwner().ConsoleCommand("SetViewPortNumberForNextMap 1");
    00113	     GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false);
    00114	}
    00115
    00116
    00117	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00118	{
    00119	    if ((State==1) || (state==2))// IST_Press // to avoid auto-repeat
    00120	    {
    00121	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
    00122		    {
    00123	            StartMap();
    00124	        /*switch(FindComponentIndex(FocusedControl))
    00125	            {
    00126	               case 0: StartMap();
    00127	               break;
    00128	               case 1: GetPlayerOwner().ConsoleCommand("TeleportNext");
    00129	               break;
    00130	               case 2: GetPlayerOwner().ConsoleCommand("EquipMe");
    00131	               break;
    00132	               case 3: GetPlayerOwner().ConsoleCommand("DAndD");
    00133	               break;
    00134	               case 4: GetPlayerOwner().ConsoleCommand("Ghost");
    00135	               break;
    00136	               case 5: GetPlayerOwner().ConsoleCommand("God");
    00137	               break;
    00138
    00139	            }
    00140	            */
    00141	            return true;
    00142		    }
    00143		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
    00144		    {
    00145		        myRoot.CloseMenu(true);
    00146	    	    return true;
    00147		    }
    00148		    if (Key==0x25/*IK_Left*/)
    00149		    {
    00150		        OnMap--;
    00151		        if (OnMap < 0) OnMap = 0;
    00152	    	    return true;
    00153		    }
    00154		    if (Key==0x27/*IK_Right*/)
    00155		    {
    00156	            OnMap++;
    00157		        if (OnMap > MaxMaps-1) OnMap = MaxMaps-1;
    00158	    	    return true;
    00159		    }
    00160	    }
    00161	    return super.InternalOnKeyEvent(Key, state, delta);
    00162	}
    00163
    00164
    00165
    00166
    00167	defaultproperties
    00168	{
    00169	     MapText="Map Name:"
    00170	     DndText="Deaf & Dumb"
    00171	     GodText="God"
    00172	     FlyText="Teleport"
    00173	     EquipText="EquipMe"
    00174	     NeuText="Neu neu"
    00175	     GhostText="Ghost"
    00176	     GoText="Go!"
    00177	}

End Source Code