XIDInterf
Class XIIIMenuLiveCreateWindow

source: C:\XIII\XIDInterf\Classes\XIIIMenuLiveCreateWindow.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
               |
               +--XIDInterf.XIIIWindow
                  |
                  +--XIDInterf.XIIILiveWindow
                     |
                     +--XIDInterf.XIIIMenuLiveCreateWindow
Direct Known Subclasses:None

class XIIIMenuLiveCreateWindow
extends XIDInterf.XIIILiveWindow


Variables
 string AboveAverageString
 string AllString
 string Anystring
 string AverageString
 string BeginnerString
 string BelowAverageString
 bool CycleLevels
 string DutchString
 string EliteString
 string EnglishString
 int FragLimit
 XIIIGUIButton FragLimitButton
 string FrenchString
 bool FriendlyFire
 XIIIGUIButton FriendlyFireButton
 class GameClass
 string GameType
 XIIIGUIButton GameTypeButton
 string GameTypeList[64]
 string Games[64]
 string GermanString
 string ItalianString
 string LabelNames[10]
 GUILabel Labels[10]
 XboxLiveManager.eLanguage Language
 XIIIGUIButton LanguageButton
 string Map
 XIIIGUIButton MapNameButton
 string Maps[64]
 int MaxGames
 XboxLiveManager.eSkill MaxSkill
 XboxLiveManager.eSkill MinSkill
 int OnGame
 int PrivateSlots
 XIIIGUIButton PrivateSlotsButton
 string ProString
 int PublicSlots
 XIIIGUIButton PublicSlotsButton
 string SkilledString
 string SpanishString
 string SwedishString
 int TimeLimit
 XIIIGUIButton TimeLimitButton
 string TitleText
 bool WaitForStart
 string WarningString
 string WarningTooManyPlayers
 string YesString,NoString
 bool gameCreated
 GUIListBox listbox
 MaxMaps, onMap
 bool processMe
 float starttime
 bool waitForDelete


Function Summary
 void Created()
 void CycleLevelsChanged()
 void FragLimitChanged()
 void FriendlyFireChanged()
 void GameChanged()
 String GetLanguageString()
 void InitComponent(GUIController MyController, GUIComponent MyOwner)
 bool InternalOnClick(GUIComponent Sender)
     
// Called when a button is clicked
 bool InternalOnKeyEvent(out byte, out byte, float delta)
 void IterateGames()
     
*/
 void IterateMaps(int DefaultMap)
 void LanguageChanged()
 void MapChanged()
 void MaxSkillChanged()
 void MinSkillChanged()
 void MsgBoxBtnClicked(byte bButton)
 void NextValue(GUIComponent c)
 void Paint(Canvas C, float X, float Y)
 void PrevValue(GUIComponent c)
 void PrivateSlotsChanged()
 void Process()
     
/*
 void ProcessWait()
     
//msg = xboxlive.GetLastError();
      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
      msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
      msgbox.OnButtonClick=MsgBoxBtnClicked;
    }
  }
}
*/
 void PublicSlotsChanged()
 void ResetButtons()
 void SaveConfigs()
 void ShowWindow()
 void StartPressed()
 void TimeLimitChanged()
 void UpdateDelete()
     
/*



Source Code


00001	class XIIIMenuLiveCreateWindow extends XIIILiveWindow;
00002	
00003	var localized string TitleText;
00004	
00005	var XIIIGUIButton GameTypeButton;
00006	var XIIIGUIButton MapNameButton;
00007	var XIIIGUIButton PublicSlotsButton;
00008	var XIIIGUIButton PrivateSlotsButton;
00009	var XIIIGUIButton FragLimitButton;
00010	var XIIIGUIButton TimeLimitButton;
00011	var XIIIGUIButton FriendlyFireButton;
00012	
00013	//var XIIIGUIButton CycleLevelsButton;
00014	
00015	//var XIIIGUIButton MinSkillButton;
00016	//var XIIIGUIButton MaxSkillButton;
00017	var XIIIGUIButton LanguageButton;
00018	
00019	var localized string EnglishString;
00020	var localized string FrenchString;
00021	var localized string GermanString;
00022	var localized string SpanishString;
00023	var localized string SwedishString;
00024	var localized string DutchString;
00025	var localized string ItalianString;
00026	
00027	var localized string Anystring;
00028	
00029	var localized string AllString;
00030	var localized string BeginnerString;
00031	var localized string BelowAverageString;
00032	var localized string AverageString;
00033	var localized string AboveAverageString;
00034	var localized string SkilledString;
00035	var localized string ProString;
00036	var localized string EliteString;
00037	
00038	var localized string WarningString;
00039	var localized string WarningTooManyPlayers;
00040	
00041	var localized string LabelNames[10];
00042	var GUILabel Labels[10];
00043	
00044	// Variables for GameType selection
00045	var class<GameInfo> GameClass;
00046	var string Games[64];
00047	var int MaxGames;
00048	var config string Map;
00049	var config string GameType;
00050	var localized string GameTypeList[64];
00051	var int OnGame;
00052	var int PublicSlots;
00053	var int PrivateSlots;
00054	var int FragLimit;
00055	var int TimeLimit;
00056	var bool FriendlyFire;
00057	var bool CycleLevels;
00058	var localized string YesString,NoString;
00059	var string Maps[64];
00060	var int MaxMaps, onMap;
00061	
00062	var XboxLiveManager.eSkill MinSkill;
00063	var XboxLiveManager.eSkill MaxSkill;
00064	var XboxLiveManager.eLanguage Language;
00065	
00066	var float starttime;
00067	
00068	var bool WaitForStart;
00069	
00070	// temp lobby
00071	/*
00072	var GUIListBox listbox;
00073	var bool processMe;
00074	var bool gameCreated;
00075	var bool waitForDelete;
00076	*/
00077	
00078	const SETID_C_ONGAME      = 6;
00079	const SETID_C_ONMAP       = 7;
00080	const SETID_C_PUBLIC      = 8;
00081	const SETID_C_PRIVATE     = 9;
00082	const SETID_C_FRAGS       = 10;
00083	const SETID_C_TIME        = 11;
00084	const SETID_C_FFIRE       = 12;
00085	const SETID_C_LANGUAGE    = 13;
00086	
00087	function IterateGames()
00088	{
00089	  local int i;
00090	  local class<GameInfo> TempClass;
00091	
00092	  MaxGames = 0;
00093	
00094	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_DM);
00095	  MaxGames++;
00096	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_TeamDM);
00097	  MaxGames++;
00098	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_CTF);
00099	  MaxGames++;
00100	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_Sabotage);
00101	  MaxGames++;
00102	  //Games[MaxGames] = xboxlive.GetGameTypeString(GT_Duel);
00103	  //MaxGames++;
00104	
00105	  OnGame = xboxlive.GetSetting(SETID_C_ONGAME);
00106	  GameType = Games[OnGame];
00107	  GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameType, class'Class'));
00108	
00109	  if (string(GameClass) != "XIIIMP.XIIIMPGameInfo" && string(GameClass) != "XIIIMP.XIIIRocketArena")
00110	  {
00111	    FriendlyFireButton.bNeverFocus = false;
00112	    FriendlyFireButton.MenuState = MSAT_Blurry;
00113	    //FriendlyFire = bool(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale);
00114	    FriendlyFire = bool(xboxlive.GetSetting(SETID_C_FFIRE));
00115	  }
00116	  else
00117	  {
00118	    FriendlyFireButton.bNeverFocus = true;
00119	    FriendlyFireButton.MenuState = MSAT_Disabled;
00120	  }
00121	
00122	  GameTypeButton.Caption = GameTypeList[OnGame];
00123	
00124	  if (GetGameType() == GT_Sabotage)
00125	  {
00126	    FragLimitButton.bNeverFocus = true;
00127	    FragLimitButton.MenuState = MSAT_Disabled;
00128	    TimeLimitButton.bNeverFocus = true;
00129	    TimeLimitButton.MenuState = MSAT_Disabled;
00130	  }
00131	  else
00132	  {
00133	    FragLimitButton.bNeverFocus = false;
00134	    FragLimitButton.MenuState = MSAT_Blurry;
00135	    TimeLimitButton.bNeverFocus = false;
00136	    TimeLimitButton.MenuState = MSAT_Blurry;
00137	  }
00138	
00139	
00140	     /*
00141	     local int i, j, Selection;
00142	     local class<GameInfo> TempClass;
00143	     local string TempGame;
00144	     local string NextGame;
00145	     local string TempGames[64];
00146	     local bool bFoundSavedGameClass;
00147	
00148	     // Compile a list of all gametypes.
00149	     NextGame = GetPlayerOwner().GetNextInt("GameInfo", 0);
00150	     while (NextGame != "")
00151	     {
00152	          TempGames[i++] = NextGame;
00153	          NextGame = GetPlayerOwner().GetNextInt("GameInfo", i);
00154	     }
00155	
00156	      // Fill the control.
00157	     for (i=0; i<64; i++)
00158	     {
00159	          if (TempGames[i] != "")
00160	          {
00161	               Games[MaxGames] = TempGames[i];
00162	               if ( !bFoundSavedGameClass && (Games[MaxGames] ~= GameType) )
00163	               {
00164	                    bFoundSavedGameClass = true;
00165	                    Selection = MaxGames;
00166	               }
00167	               log("Found gametype: "$Games[MaxGames]);
00168	               TempClass = Class<GameInfo>(DynamicLoadObject(Games[MaxGames], class'Class'));
00169	               //GameCombo.AddItem(TempClass.Default.GameName);
00170	               GameTypeList[MaxGames] = (TempClass.Default.GameName);
00171	               MaxGames++;
00172	          }
00173	     }
00174	
00175	     //GameCombo.SetSelectedIndex(Selection);
00176	     OnGame = Selection;
00177	     GameType = Games[Selection];
00178	     GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameType, class'Class'));
00179	
00180	     if (string(GameClass) != "XIIIMP.XIIIMPGameInfo" && string(GameClass) != "XIIIMP.XIIIRocketArena")
00181	     {
00182	        FriendlyFireButton.bNeverFocus = false;
00183	        FriendlyFireButton.MenuState = MSAT_Blurry;
00184	        //MapCombo.bNeverFocus = false;
00185	        FriendlyFire = bool(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale);
00186	     }
00187	     else
00188	     {
00189	        FriendlyFireButton.bNeverFocus = true;
00190	        FriendlyFireButton.MenuState = MSAT_Disabled;
00191	     }
00192	     GameTypeButton.Caption = GameTypeList[Selection];
00193	     */
00194	
00195	}
00196	
00197	function IterateMaps(int DefaultMap)
00198	{
00199	  local XboxLiveManager.eGameType gt;
00200	  local string map;
00201	
00202	  gt = GetGameType();
00203	  map = xboxlive.GetFirstMap(gt);
00204	  MaxMaps = 0;
00205	  while (map != "")
00206	  {
00207	    // Add the map.
00208	    Maps[MaxMaps] = map;//Left(map, Len(map) - 4);
00209	    MaxMaps++;
00210	    map = xboxlive.GetNextMap(gt);
00211	  }
00212	  if (DefaultMap>=MaxMaps)
00213	    OnMap = 0;
00214	  else
00215	    OnMap = DefaultMap;
00216	  xboxlive.SetSetting(SETID_C_ONMAP, OnMap);
00217	  MapNameButton.Caption = "["$xboxlive.GetRecommendedPlayers(Maps[OnMap])$"] "$xboxlive.GetNiceName(Maps[OnMap]);
00218	
00219	     /*
00220	     local string FirstMap, NextMap, TestMap;
00221	     local int Selected;
00222	     local bool bFoundSavedMap;
00223	
00224	     FirstMap = GetPlayerOwner().GetMapName(GameClass.Default.MapPrefix, "", 0);
00225	
00226	     NextMap = FirstMap;
00227	     MaxMaps = -1;
00228	
00229	     while (!(FirstMap ~= TestMap))
00230	     {
00231	         MaxMaps++;
00232	
00233	         if ( !bFoundSavedMap && (NextMap ~= Map) )
00234	         {
00235	            bFoundSavedMap = true;
00236	            Selected = MaxMaps;
00237	         }
00238	         // Add the map.
00239	         //MapCombo.AddItem(Left(NextMap, Len(NextMap) - 4)); //, NextMap);
00240	         Maps[MaxMaps] = Left(NextMap, Len(NextMap) - 4);
00241	         NextMap = GetPlayerOwner().GetMapName(GameClass.Default.MapPrefix, NextMap, 1);
00242	
00243	         // Test to see if this is the last.
00244	         TestMap = NextMap;
00245	     }
00246	
00247	     if (bFoundSavedMap)
00248	     {
00249	        OnMap = Selected;
00250	        //MapCombo.SetSelectedIndex(Selected);
00251	     }
00252	//     MapCombo.SetSelectedIndex(Max(MapCombo.FindItemIndex(Map, True), 0));
00253	  MapNameButton.Caption = Maps[Selected];
00254	  */
00255	}
00256	
00257	function xboxlivemanager.eLanguage GetLanguage(int index)
00258	{
00259	  switch (index)
00260	  {
00261	    case 0:
00262	      return LANG_All;
00263	    case 1:
00264	      return LANG_EnglishOnly;
00265	    case 2:
00266	      return LANG_FrenchOnly;
00267	    case 3:
00268	      return LANG_GermanOnly;
00269	    case 4:
00270	      return LANG_SpanishOnly;
00271	    case 5:
00272	      return LANG_SwedishOnly;
00273	    case 6:
00274	      return LANG_DutchOnly;
00275	    case 7:
00276	      return LANG_ItalianOnly;
00277	  }
00278	  return LANG_Invalid;
00279	}
00280	
00281	function ResetButtons()
00282	{
00283	  language = GetLanguage(xboxlive.GetSetting(SETID_C_LANGUAGE));
00284	
00285	  //FriendlyFire = bool(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale);
00286	  FriendlyFire = bool(xboxlive.GetSetting(SETID_C_FFIRE));
00287	  CycleLevels = false;
00288	
00289	  MinSkill = SKILL_Beginner;
00290	  MaxSkill = SKILL_Elite;
00291	  //Language = LANG_All;
00292	
00293	  IterateGames();
00294	  IterateMaps(xboxlive.GetSetting(SETID_C_ONMAP));
00295	
00296	  GameTypeButton.Caption  = GameTypeList[OnGame];
00297	  MapNameButton.Caption = "["$xboxlive.GetRecommendedPlayers(Maps[OnMap])$"] "$xboxlive.GetNiceName(Maps[OnMap]);
00298	
00299	  PrivateSlots = 0;
00300	  PrivateSlotsButton.Caption = string(PrivateSlots);
00301	
00302	  //PublicSlots = class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers;
00303	  //PublicSlots = xboxlive.GetSetting(SETID_C_PUBLIC);
00304	  PublicSlots = xboxlive.GetRecommendedPlayers(Maps[OnMap])-1;
00305	  if (PublicSlots > xboxlive.GetRecommendedPlayers(Maps[OnMap])-1) PublicSlots = xboxlive.GetRecommendedPlayers(Maps[OnMap])-1;
00306	  if (PublicSlots <= 0) PublicSlots = 1;
00307	  PublicSlotsButton.Caption = string(PublicSlots);
00308	  xboxlive.SetSetting(SETID_C_PUBLIC, PublicSlots);
00309	
00310	  FragLimit = xboxlive.GetSetting(SETID_C_FRAGS);
00311	  //FragLimit = class<XIIIMPGameInfo>(GameClass).Default.WinningScore;
00312	  FragLimitButton.Caption = string(FragLimit);
00313	  if (FragLimit == 0) FragLimitButton.Caption ="-";
00314	
00315	  if (string(GameClass) == "XIIIMP.XIIIRocketArena")
00316	  {
00317	    //TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime;
00318	    TimeLimit = xboxlive.GetSetting(SETID_C_TIME);
00319	    TimeLimitButton.Caption = string(TimeLimit)@"sec";
00320	    if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00321	  }
00322	  else
00323	  {
00324	    //TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime / 60;
00325	    TimeLimit = xboxlive.GetSetting(SETID_C_TIME);
00326	    TimeLimitButton.Caption = string(TimeLimit);
00327	    if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00328	  }
00329	
00330	  if (FriendlyFire)
00331	    FriendlyFireButton.Caption  = YesString;
00332	  else
00333	    FriendlyFireButton.Caption  = NoString;
00334	  //if (CycleLevels)
00335	  //  CycleLevelsButton.Caption   = YesString;
00336	  //else
00337	  //  CycleLevelsButton.Caption  = NoString;
00338	
00339	  //MinSkillButton.Caption = GetSkillString(MinSkill);
00340	  //MaxSkillButton.Caption = GetSkillString(MaxSkill);
00341	  LanguageButton.Caption = GetLanguageString();
00342	}
00343	
00344	function string GetSkillString(XboxLiveManager.eSkill skill)
00345	{
00346	  switch (skill)
00347	  {
00348	    case SKILL_All:
00349	    return AllString;
00350	    case SKILL_Beginner:
00351	    return BeginnerString;
00352	    case SKILL_BelowAverage:
00353	    return BelowAverageString;
00354	    case SKILL_Average:
00355	    return AverageString;
00356	    case SKILL_AboveAverage:
00357	    return AboveAverageString;
00358	    case SKILL_Skilled:
00359	    return SkilledString;
00360	    case SKILL_Pro:
00361	    return ProString;
00362	    case SKILL_Elite:
00363	    return EliteString;
00364	  }
00365	}
00366	
00367	function String GetLanguageString()
00368	{
00369	  switch (Language)
00370	  {
00371	    case LANG_All:
00372	    return AnyString;
00373	    case LANG_EnglishOnly:
00374	    return EnglishString;
00375	    case LANG_FrenchOnly:
00376	    return FrenchString;
00377	    case LANG_GermanOnly:
00378	    return GermanString;
00379	    case LANG_SpanishOnly:
00380	    return SpanishString;
00381	    case LANG_SwedishOnly:
00382	    return SwedishString;
00383	    case LANG_DutchOnly:
00384	    return DutchString;
00385	    case LANG_ItalianOnly:
00386	    return ItalianString;
00387	  }
00388	  return AnyString;
00389	}
00390	
00391	function PrevValue(GUIComponent c)
00392	{
00393	  if (c == GameTypeButton)
00394	  {
00395	    OnGame--;
00396	    if (OnGame<0)
00397	      OnGame = MaxGames-1;
00398	    GameTypeButton.Caption = GameTypeList[OnGame];
00399	    GameChanged();
00400	  }
00401	  else if (c==MapNameButton)
00402	  {
00403	    OnMap--;
00404	    if (OnMap<0)
00405	      OnMap = MaxMaps-1;
00406	    MapNameButton.Caption = "["$xboxlive.GetRecommendedPlayers(Maps[OnMap])$"] "$xboxlive.GetNiceName(Maps[OnMap]);
00407	    MapChanged();
00408	  }
00409	  else if (c==PublicSlotsButton)
00410	  {
00411	    if (PublicSlots>0 && PublicSlots+PrivateSlots>1)
00412	      PublicSlots--;
00413	    class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = PublicSlots+PrivateSlots+1;
00414	    PublicSlotsButton.Caption = string(PublicSlots);
00415	    PublicSlotsChanged();
00416	  }
00417	  else if (c==PrivateSlotsButton)
00418	  {
00419	    if ((PublicSlots>=1 && PrivateSlots>0) || (PublicSlots==0 && PrivateSlots>=2))
00420	      PrivateSlots--;
00421	    class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = PublicSlots+PrivateSlots+1;
00422	    PrivateSlotsButton.Caption = string(PrivateSlots);
00423	    PrivateSlotsChanged();
00424	  }
00425	  else if (c==FragLimitButton)
00426	  {
00427	    FragLimit-=5;
00428	    if (FragLimit<0)
00429	      FragLimit = 0;
00430	    //class<XIIIMPGameInfo>(GameClass).Default.WinningScore = FragLimit;
00431	    FragLimitButton.Caption = string(FragLimit);
00432	    if (FragLimit==0)
00433	      FragLimitButton.Caption = "-";
00434	    FragLimitChanged();
00435	  }
00436	  else if (c==TimeLimitButton)
00437	  {
00438	    if (string(GameClass) == "XIIIMP.XIIIRocketArena")
00439	    {
00440	      TimeLimit -= 30;
00441	      if (TimeLimit<0)
00442	        TimeLimit = 0;
00443	      //class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit;
00444	      TimeLimitButton.Caption = string(TimeLimit)@"sec";
00445	      if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00446	    }
00447	    else
00448	    {
00449	      TimeLimit -= 5;
00450	      if (TimeLimit<0)
00451	        TimeLimit = 0;
00452	      //class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit*60;
00453	      TimeLimitButton.Caption = string(TimeLimit);
00454	      if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00455	    }
00456	    TimeLimitChanged();
00457	  }
00458	  else if (c==FriendlyFireButton)
00459	  {
00460	    if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena")
00461	    {
00462	      FriendlyFire = !FriendlyFire;
00463	      //class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale = float(FriendlyFire);
00464	      if (FriendlyFire)
00465	        FriendlyFireButton.Caption  = YesString;
00466	      else
00467	        FriendlyFireButton.Caption  = NoString;
00468	    }
00469	    FriendlyFireChanged();
00470	  }
00471	  /*else if (c==CycleLevelsButton)
00472	  {
00473	    CycleLevels = !CycleLevels;
00474	    if (CycleLevels)
00475	      CycleLevelsButton.Caption   = YesString;
00476	    else
00477	      CycleLevelsButton.Caption  = NoString;
00478	    CycleLevelsChanged();
00479	  }*/
00480	  else if (c==LanguageButton)
00481	  {
00482	    switch (Language)
00483	    {
00484	      case LANG_All:
00485	        Language = LANG_ItalianOnly;
00486	      break;
00487	      case LANG_EnglishOnly:
00488	        Language = LANG_All;
00489	      break;
00490	      case LANG_FrenchOnly:
00491	        Language = LANG_EnglishOnly;
00492	      break;
00493	      case LANG_GermanOnly:
00494	        Language = LANG_FrenchOnly;
00495	      break;
00496	      case LANG_SpanishOnly:
00497	        Language = LANG_GermanOnly;
00498	      break;
00499	      case LANG_SwedishOnly:
00500	        Language = LANG_SpanishOnly;
00501	      break;
00502	      case LANG_DutchOnly:
00503	        Language = LANG_SwedishOnly;
00504	      break;
00505	      case LANG_ItalianOnly:
00506	        Language = LANG_DutchOnly;
00507	      break;
00508	    }
00509	    LanguageButton.Caption   = GetLanguageString();
00510	    LanguageChanged();
00511	  }
00512	}
00513	
00514	function NextValue(GUIComponent c)
00515	{
00516	  if (c == GameTypeButton)
00517	  {
00518	    OnGame++;
00519	    if (OnGame>=MaxGames)
00520	      OnGame = 0;
00521	    GameTypeButton.Caption = GameTypeList[OnGame];
00522	    GameChanged();
00523	  }
00524	  else if (c==MapNameButton)
00525	  {
00526	    OnMap++;
00527	    if (OnMap>=MaxMaps)
00528	      OnMap = 0;
00529	    MapNameButton.Caption = "["$xboxlive.GetRecommendedPlayers(Maps[OnMap])$"] "$xboxlive.GetNiceName(Maps[OnMap]);
00530	    MapChanged();
00531	  }
00532	  else if (c==PublicSlotsButton)
00533	  {
00534	    if (PublicSlots<xboxlive.GetRecommendedPlayers(Maps[OnMap])-1-PrivateSlots)
00535	      PublicSlots++;
00536	    class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = PublicSlots+PrivateSlots+1;
00537	    PublicSlotsButton.Caption = string(PublicSlots);
00538	    PublicSlotsChanged();
00539	  }
00540	  else if (c==PrivateSlotsButton)
00541	  {
00542	    if (PrivateSlots<xboxlive.GetRecommendedPlayers(Maps[OnMap])-1-PublicSlots)
00543	      PrivateSlots++;
00544	    class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = PublicSlots+PrivateSlots+1;
00545	    PrivateSlotsButton.Caption = string(PrivateSlots);
00546	    PrivateSlotsChanged();
00547	  }
00548	  else if (c==FragLimitButton)
00549	  {
00550	    FragLimit+=5;
00551	    if (FragLimit>100)
00552	      FragLimit = 100;
00553	    //class<XIIIMPGameInfo>(GameClass).Default.WinningScore = FragLimit;
00554	    FragLimitButton.Caption = string(FragLimit);
00555	    if (FragLimit==0)
00556	      FragLimitButton.Caption = "-";
00557	    FragLimitChanged();
00558	  }
00559	  else if (c==TimeLimitButton)
00560	  {
00561	    if (string(GameClass) == "XIIIMP.XIIIRocketArena")
00562	    {
00563	      TimeLimit += 30;
00564	      if (TimeLimit>300)
00565	        TimeLimit = 300;
00566	      //class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit;
00567	      TimeLimitButton.Caption = string(TimeLimit)@"sec";
00568	      if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00569	    }
00570	    else
00571	    {
00572	      TimeLimit += 5;
00573	      if (TimeLimit>60)
00574	        TimeLimit = 60;
00575	      //class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit*60;
00576	      TimeLimitButton.Caption = string(TimeLimit);
00577	      if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00578	    }
00579	    TimeLimitChanged();
00580	  }
00581	  else if (c==FriendlyFireButton)
00582	  {
00583	    if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena")
00584	    {
00585	      FriendlyFire = !FriendlyFire;
00586	      //class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale = float(FriendlyFire);
00587	      if (FriendlyFire)
00588	        FriendlyFireButton.Caption  = YesString;
00589	      else
00590	        FriendlyFireButton.Caption  = NoString;
00591	    }
00592	    FriendlyFireChanged();
00593	  }
00594	  /*else if (c==CycleLevelsButton)
00595	  {
00596	    CycleLevels = !CycleLevels;
00597	    if (CycleLevels)
00598	      CycleLevelsButton.Caption   = YesString;
00599	    else
00600	      CycleLevelsButton.Caption  = NoString;
00601	    CycleLevelsChanged();
00602	  }*/
00603	  else if (c==LanguageButton)
00604	  {
00605	    switch (Language)
00606	    {
00607	      case LANG_All:
00608	        Language = LANG_EnglishOnly;
00609	      break;
00610	      case LANG_EnglishOnly:
00611	        Language = LANG_FrenchOnly;
00612	      break;
00613	      case LANG_FrenchOnly:
00614	        Language = LANG_GermanOnly;
00615	      break;
00616	      case LANG_GermanOnly:
00617	        Language = LANG_SpanishOnly;
00618	      break;
00619	      case LANG_SpanishOnly:
00620	        Language = LANG_SwedishOnly;
00621	      break;
00622	      case LANG_SwedishOnly:
00623	        Language = LANG_DutchOnly;
00624	      break;
00625	      case LANG_DutchOnly:
00626	        Language = LANG_ItalianOnly;
00627	      break;
00628	      case LANG_ItalianOnly:
00629	        Language = LANG_All;
00630	      break;
00631	    }
00632	    LanguageButton.Caption   = GetLanguageString();
00633	    LanguageChanged();
00634	  }
00635	}
00636	
00637	function GameChanged()
00638	{
00639	  local int msg;
00640	  
00641	  xboxlive.SetSetting(SETID_C_ONGAME, OnGame);
00642	
00643	  GameType = Games[OnGame];
00644	  GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameType, class'Class'));
00645	
00646	  IterateMaps(0);
00647	  MapChanged();
00648	  
00649	  if (string(GameClass) != "XIIIMP.XIIIMPGameInfo" && string(GameClass) != "XIIIMP.XIIIRocketArena")
00650	  {
00651	    FriendlyFireButton.bNeverFocus = false;
00652	    FriendlyFireButton.MenuState = MSAT_Blurry;
00653	    //MapCombo.bNeverFocus = false;
00654	    FriendlyFire = bool(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale);
00655	    if (FriendlyFire)
00656	      FriendlyFireButton.Caption  = YesString;
00657	    else
00658	      FriendlyFireButton.Caption  = NoString;
00659	  }
00660	  else
00661	  {
00662	    FriendlyFireButton.bNeverFocus = true;
00663	    FriendlyFireButton.MenuState = MSAT_Disabled;
00664	  }
00665	
00666	  //PublicSlots = class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers;
00667	  //PublicSlotsButton.Caption = string(PublicSlots);
00668	
00669	  //PrivateSlots = 0;
00670	  //PrivateSlotsButton.Caption = string(PrivateSlots);
00671	
00672	  //FragLimit = class<XIIIMPGameInfo>(GameClass).Default.WinningScore;
00673	  FragLimitButton.Caption = string(FragLimit);
00674	  if (FragLimit == 0) FragLimitButton.Caption ="-";
00675	
00676	  if (string(GameClass) == "XIIIMP.XIIIRocketArena")
00677	  {
00678	    //TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime;
00679	    TimeLimitButton.Caption = string(TimeLimit)@"sec";
00680	    if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00681	    FragLimitButton.bNeverFocus = false;
00682	    FragLimitButton.MenuState = MSAT_Blurry;
00683	    TimeLimitButton.bNeverFocus = false;
00684	    TimeLimitButton.MenuState = MSAT_Blurry;
00685	  }
00686	  else if (GetGameType() == GT_Sabotage)
00687	  {
00688	    TimeLimit = 0;
00689	    FragLimit = 0;
00690	    FragLimitChanged();
00691	    TimeLimitChanged();
00692	    FragLimitButton.bNeverFocus = true;
00693	    FragLimitButton.MenuState = MSAT_Disabled;
00694	    TimeLimitButton.bNeverFocus = true;
00695	    TimeLimitButton.MenuState = MSAT_Disabled;
00696	    TimeLimitButton.Caption ="-";
00697	    FragLimitButton.Caption ="-";
00698	  }
00699	  else
00700	  {
00701	    //TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime / 60;
00702	    TimeLimitButton.Caption = string(TimeLimit);
00703	    if (TimeLimit == 0) TimeLimitButton.Caption ="-";
00704	    FragLimitButton.bNeverFocus = false;
00705	    FragLimitButton.MenuState = MSAT_Blurry;
00706	    TimeLimitButton.bNeverFocus = false;
00707	    TimeLimitButton.MenuState = MSAT_Blurry;
00708	  }
00709	
00710	  xboxlive.SessionSetGameType(GetGameType());
00711	  xboxlive.SessionSetMapName(Maps[OnMap]);
00712	  xboxlive.SessionSetTimeLimit(TimeLimit);
00713	  xboxlive.SessionSetFragLimit(FragLimit);
00714	  xboxlive.SessionSetPublicSlots(PublicSlots+1);
00715	  xboxlive.SessionSetPrivateSlots(PrivateSlots);
00716	  xboxlive.SessionSetFriendlyFire(FriendlyFire);
00717	  xboxlive.SessionSetCycleLevels(CycleLevels);
00718	  xboxlive.SessionSetMinSkill(MinSkill);
00719	  xboxlive.SessionSetMaxSkill(MaxSkill);
00720	  xboxlive.SessionSetLanguage(Language);
00721	
00722	  // temp lobby
00723	  /*
00724	  if (!xboxlive.SessionUpdate())
00725	  {
00726	    msg = xboxlive.GetLastError();
00727	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00728	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00729	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00730	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00731	  }
00732	  */
00733	}
00734	
00735	function MapChanged()
00736	{
00737	  local int msg;
00738	  
00739	  PublicSlots = xboxlive.GetRecommendedPlayers(Maps[OnMap])-1-PrivateSlots;
00740	  if (PublicSlots<0)                 PublicSlots = 0;
00741	  if (PublicSlots+PrivateSlots > xboxlive.GetRecommendedPlayers(Maps[OnMap])-1)
00742	  {
00743	    PrivateSlots = 0;
00744	    PrivateSlotsButton.Caption = string(PrivateSlots);
00745	    PublicSlots = xboxlive.GetRecommendedPlayers(Maps[OnMap])-PrivateSlots-1;
00746	    PrivateSlotsChanged();
00747	  }
00748	  if (PrivateSlots+PublicSlots+1 <= 1) PublicSlots = 1;
00749	  PublicSlotsButton.Caption = string(PublicSlots);
00750	  PublicSlotsChanged();
00751	  
00752	  //Map = MapNameButton.Caption$".unr";
00753	  Map = Maps[onMap]$".unr";
00754	  xboxlive.SessionSetMapName(Maps[OnMap]);
00755	  xboxlive.SetSetting(SETID_C_ONMAP, OnMap);
00756	  // temp lobby
00757	  /*
00758	  if (!xboxlive.SessionUpdate())
00759	  {
00760	    msg = xboxlive.GetLastError();
00761	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00762	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00763	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00764	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00765	  }
00766	  */
00767	}
00768	
00769	function PublicSlotsChanged()
00770	{
00771	  local int msg;
00772	  xboxlive.SessionSetPublicSlots(PublicSlots+1);
00773	  xboxlive.SetSetting(SETID_C_PUBLIC, PublicSlots);
00774	  // temp lobby
00775	  /*
00776	  if (!xboxlive.SessionUpdate())
00777	  {
00778	    msg = xboxlive.GetLastError();
00779	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00780	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00781	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00782	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00783	  }
00784	  */
00785	}
00786	
00787	function PrivateSlotsChanged()
00788	{
00789	  local int msg;
00790	  xboxlive.SessionSetPrivateSlots(PrivateSlots);
00791	  xboxlive.SetSetting(SETID_C_PRIVATE, PrivateSlots);
00792	  // temp lobby
00793	  /*
00794	  if (!xboxlive.SessionUpdate())
00795	  {
00796	    msg = xboxlive.GetLastError();
00797	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00798	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00799	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00800	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00801	  }
00802	  */
00803	}
00804	
00805	function FragLimitChanged()
00806	{
00807	  local int msg;
00808	  xboxlive.SessionSetFragLimit(FragLimit);
00809	  xboxlive.SetSetting(SETID_C_FRAGS, FragLimit);
00810	  // temp lobby
00811	  /*
00812	  if (!xboxlive.SessionUpdate())
00813	  {
00814	    msg = xboxlive.GetLastError();
00815	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00816	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00817	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00818	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00819	  }
00820	  */
00821	}
00822	
00823	function TimeLimitChanged()
00824	{
00825	  local int msg;
00826	  xboxlive.SessionSetTimeLimit(TimeLimit);
00827	  xboxlive.SetSetting(SETID_C_TIME, TimeLimit);
00828	  // temp lobby
00829	  /*
00830	  if (!xboxlive.SessionUpdate())
00831	  {
00832	    msg = xboxlive.GetLastError();
00833	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00834	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00835	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00836	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00837	  }
00838	  */
00839	}
00840	
00841	function FriendlyFireChanged()
00842	{
00843	  local int msg;
00844	  xboxlive.SessionSetFriendlyFire(FriendlyFire);
00845	  xboxlive.SetSetting(SETID_C_FFIRE, int(FriendlyFire));
00846	
00847	  // temp lobby
00848	  /*
00849	  if (!xboxlive.SessionUpdate())
00850	  {
00851	    msg = xboxlive.GetLastError();
00852	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00853	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00854	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00855	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00856	  }
00857	  */
00858	}
00859	
00860	function LanguageChanged()
00861	{
00862	  xboxlive.SessionSetLanguage(Language);
00863	  xboxlive.SetSetting(SETID_C_LANGUAGE, Language);
00864	}
00865	
00866	function MinSkillChanged()
00867	{
00868	  xboxlive.SessionSetMinSkill(MinSkill);
00869	}
00870	
00871	function MaxSkillChanged()
00872	{
00873	  xboxlive.SessionSetMaxSkill(MaxSkill);
00874	}
00875	
00876	function CycleLevelsChanged()
00877	{
00878	  local int msg;
00879	  xboxlive.SessionSetCycleLevels(CycleLevels);
00880	  // temp lobby
00881	  /*
00882	  if (!xboxlive.SessionUpdate())
00883	  {
00884	    msg = xboxlive.GetLastError();
00885	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00886	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00887	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00888	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00889	  }
00890	  */
00891	}
00892	
00893	function Created()
00894	{
00895	  local int i;
00896	  local int msg;
00897	
00898	  Super.Created();
00899	
00900	  GameTypeButton        = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-15-30,    100,      180, 30));
00901	  MapNameButton         = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-15,    100+35,   150, 30));
00902	  PublicSlotsButton     = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-15,    100+35*2, 50,  30));
00903	  PrivateSlotsButton    = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-15,    100+35*3, 50,  30));
00904	  FragLimitButton       = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 525-37-15, 100+35*4, 75,  30));
00905	  TimeLimitButton       = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 525-37-15, 100+35*5, 75,  30));
00906	  FriendlyFireButton    = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-15,    100+35*6, 50,  30));
00907	  //CycleLevelsButton     = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500, 345, 50, 30));
00908	  LanguageButton        = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-15,    100+35*7, 150, 30));
00909	  //MinSkillButton        = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-10,    100-11+31*8, 150, 30));
00910	  //MaxSkillButton        = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-10,    100-11+31*9, 150, 30));
00911	
00912	  Controls[0]=GameTypeButton;
00913	  Controls[1]=MapNameButton;
00914	  Controls[2]=PublicSlotsButton;
00915	  Controls[3]=PrivateSlotsButton;
00916	  Controls[4]=FragLimitButton;
00917	  Controls[5]=TimeLimitButton;
00918	  Controls[6]=FriendlyFireButton;
00919	  //Controls[7]=CycleLevelsButton;
00920	  Controls[7]=LanguageButton;
00921	  //Controls[8]=MinSkillButton;
00922	  //Controls[9]=MaxSkillButton;
00923	
00924	  XIIIGuiButton(Controls[0]).bDrawArrows = true;
00925	  XIIIGuiButton(Controls[1]).bDrawArrows = true;
00926	  XIIIGuiButton(Controls[2]).bDrawArrows = true;
00927	  XIIIGuiButton(Controls[3]).bDrawArrows = true;
00928	  XIIIGuiButton(Controls[4]).bDrawArrows = true;
00929	  XIIIGuiButton(Controls[5]).bDrawArrows = true;
00930	  XIIIGuiButton(Controls[6]).bDrawArrows = true;
00931	  XIIIGuiButton(Controls[7]).bDrawArrows = true;
00932	
00933	  for (i=0; i<8; i++)
00934	    Controls[i].StyleName = "SquareButton";
00935	
00936	  Labels[0] = GUILabel(CreateControl(class'GUILabel', 300-35, 100,      150, 26));
00937	  Labels[1] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35,   150, 26));
00938	  Labels[2] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35*2, 150, 26));
00939	  Labels[3] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35*3, 150, 26));
00940	  Labels[4] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35*4, 150, 26));
00941	  Labels[5] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35*5, 150, 26));
00942	  Labels[6] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35*6, 150, 26));
00943	  Labels[7] = GUILabel(CreateControl(class'GUILabel', 300-35, 100+35*7, 150, 26));
00944	  //Labels[8] = GUILabel(CreateControl(class'GUILabel', 300-35, 100-11+31*8, 150, 26));
00945	  //Labels[9] = GUILabel(CreateControl(class'GUILabel', 300-35, 100-11+31*9, 150, 26));
00946	
00947	  for (i=0; i<8; i++)
00948	  {
00949	    Labels[i].caption = LabelNames[i];
00950	    Labels[i].StyleName="LabelWhite";
00951	    Labels[i].TextColor.R=255;
00952	    Labels[i].TextColor.G=255;
00953	    Labels[i].TextColor.B=255;
00954	    controls[8+i] = Labels[i];
00955	  }
00956	
00957	  ResetButtons();
00958	
00959	  // temp lobby
00960	  //processMe = true;
00961	
00962	  // temp lobby
00963	  /*
00964	  listbox = GUIListbox(controls[16]);
00965	  listbox.FocusInstead = controls[0];
00966	  */
00967	
00968	  if (xboxlive == none)
00969	    xboxlive=New Class'XboxLiveManager';
00970	
00971	  xboxlive.SessionSetGameType(GetGameType());
00972	  xboxlive.SessionSetMapName(Maps[OnMap]);
00973	  xboxlive.SessionSetLanguage(Language);
00974	  xboxlive.SessionSetFragLimit(FragLimit);
00975	  xboxlive.SessionSetTimeLimit(TimeLimit);
00976	  xboxlive.SessionSetPublicSlots(PublicSlots+1);
00977	  xboxlive.SessionSetPrivateSlots(PrivateSlots);
00978	  //xboxlive.SessionSetReserved(1);
00979	  xboxlive.SessionSetFriendlyFire(FriendlyFire);
00980	  xboxlive.SessionSetCycleLevels(CycleLevels);
00981	  xboxlive.SessionSetMinSkill(MinSkill);
00982	  xboxlive.SessionSetMaxSkill(MaxSkill);
00983	
00984	  // temp lobby
00985	  /*
00986	  if (!xboxlive.SessionCreate())
00987	  {
00988	    msg = xboxlive.GetLastError();
00989	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00990	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00991	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00992	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00993	    processMe = false;
00994	  }
00995	  */
00996	}
00997	
00998	function MsgBoxBtnClicked(byte bButton)
00999	{
01000	  switch (bButton)
01001	  {
01002	    case QBTN_Ok:
01003	      StartPressed();
01004	      //log("[XIIILiveMsgBox] Ok pressed");
01005	      //xboxlive.ShutdownAndCleanup();
01006	      //xboxlive.SessionReset();
01007	      //Controller.ReplaceMenu("XIDInterf.XIIIMenuLiveAccountWindow");
01008	    break;
01009	  }
01010	  //log("msgbox clicked: "$bButton);
01011	}
01012	
01013	function XboxLiveManager.eGameType GetGameType()
01014	{
01015	  switch (OnGame)
01016	  {
01017	    case 0:
01018	      return GT_DM;
01019	    case 1:
01020	      return GT_TeamDM;
01021	    case 2:
01022	      return GT_CTF;
01023	    case 3:
01024	      return GT_Sabotage;
01025	    case 4:
01026	      return GT_Duel;
01027	  }
01028	  return GT_Invalid;
01029	}
01030	
01031	function InitComponent(GUIController MyController,GUIComponent MyOwner)
01032	{
01033	  Super.InitComponent(MyController, MyOwner);
01034	
01035		OnClick = InternalOnClick;
01036	}
01037	
01038	
01039	function ShowWindow()
01040	{
01041	     OnMenu = 0; myRoot.bFired = false;
01042	     Super.ShowWindow();
01043	     bShowBCK = true;
01044	     bShowRUN = true;
01045	     //bShowSEL = true;
01046	}
01047	
01048	// temp lobby
01049	/*
01050	function Process()
01051	{
01052	  local XboxLiveManager.XBL_MESSAGES msg;
01053	  local int i;
01054	
01055	  if (!gameCreated)
01056	  {
01057	    msg = xboxlive.SessionProcess();
01058	
01059	    if (msg != XBLE_NONE)
01060	    {
01061	      if (msg == XBLE_RUNNING)
01062	      { // WHOOO
01063	        gameCreated = true;
01064	      }
01065	      else
01066	      {
01067	        ProcessMe = false;
01068	        //msg = xboxlive.GetLastError();
01069	        Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01070	        msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01071	        msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
01072	        msgbox.OnButtonClick=MsgBoxBtnClicked;
01073	      }
01074	    }
01075	  }
01076	  else
01077	  {
01078	    msg = xboxlive.SessionProcess();
01079	
01080	    if (msg != XBLE_NONE && msg != XBLE_RUNNING)
01081	    {
01082	      if (msg == XBLE_RUNNING)
01083	      {
01084	        ProcessMe = false;
01085	        //msg = xboxlive.GetLastError();
01086	        Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01087	        msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01088	        msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
01089	        msgbox.OnButtonClick=MsgBoxBtnClicked;
01090	      }
01091	    }
01092	  }
01093	}
01094	*/
01095	
01096	// temp lobby
01097	/*
01098	function UpdateDelete()
01099	{
01100	  local XboxLiveManager.XBL_MESSAGES msg;
01101	  local int i;
01102	
01103	  msg = xboxlive.SessionProcess();
01104	
01105	  if (msg != XBLE_NONE)
01106	  {
01107	    if (msg == XBLE_RUNNING)
01108	    { // WHOOO
01109	      waitForDelete = false;
01110	      Controller.CloseMenu(true);
01111	      Controller.CloseMenu(true);
01112	      xboxlive.SessionReset();
01113	    }
01114	    else
01115	    {
01116	      waitForDelete = false;
01117	      //msg = xboxlive.GetLastError();
01118	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01119	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01120	      msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
01121	      msgbox.OnButtonClick=MsgBoxBtnClicked;
01122	    }
01123	  }
01124	}
01125	*/
01126	
01127	function ProcessWait()
01128	{
01129	  local string URL, Checksum;
01130	  local int N;
01131		local int i;
01132		local string MyClass, SkinCode;
01133		local int FriendlyFireInt;
01134	  
01135	  if (true/*xboxlive.SessionIsSubnetStarted() && (GetPlayerOwner().Level.TimeSeconds - starttime)>2.0*/)
01136	  {
01137	    WaitForStart = false;
01138	     //if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena")
01139	     //   class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale = float(FriendlyFire);
01140	
01141	     N = PublicSlots+PrivateSlots+1;//PlayerCombo.GetValue();
01142	     class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = N;
01143	     //MapChanged(); GameChanged();
01144	
01145	    xboxlive.SessionSetGameType(GetGameType());
01146	    xboxlive.SessionSetMapName(Maps[OnMap]);
01147	    xboxlive.SessionSetTimeLimit(TimeLimit);
01148	    xboxlive.SessionSetFragLimit(FragLimit);
01149	    xboxlive.SessionSetPublicSlots(PublicSlots+1);
01150	    xboxlive.SessionSetPrivateSlots(PrivateSlots);
01151	    xboxlive.SessionSetFriendlyFire(FriendlyFire);
01152	    xboxlive.SessionSetCycleLevels(CycleLevels);
01153	    xboxlive.SessionSetLanguage(Language);
01154	    xboxlive.SessionSetMinSkill(MinSkill);
01155	    xboxlive.SessionSetMaxSkill(MaxSkill);
01156	
01157	    Map = Maps[OnMap];
01158	    GameType = Games[OnGame];
01159	
01160	     //URL = Map$"?Game="$GameType$"?Listen";
01161	    //SaveConfigs();
01162	    myRoot.bXboxStartup = true;
01163	    myRoot.CloseMenu(true);
01164	    myRoot.CloseMenu(true);
01165	    myRoot.CloseMenu(true);
01166	    Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow");
01167	    XIIIMenuLiveAccountWindow(myRoot.ActivePage).AutoLoginUser = xboxlive.GetCurrentUser();
01168	    myRoot.CloseAll(true);
01169	    myRoot.GotoState('');
01170	     GetPlayerOwner().AttribPadToViewport();
01171	     GetPlayerOwner().PlayerReplicationInfo.SetPlayerName(xboxlive.GetCurrentUser());
01172	     //log("TRAVELING w/URL: "$URL);
01173	     //GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false);
01174	    //GetPlayerOwner().ConsoleCommand("start "$Map$"?Game="$GameType$"?listen");
01175	
01176		// skin
01177		MyClass = GetPlayerOwner().GetDefaultURL("MySkin");
01178		SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[0].SkinCode;
01179		for (i=0;i<class'MeshSkinList'.default.MeshSkinListInfo.Length;i++)
01180		{
01181			if ( MyClass == class'MeshSkinList'.default.MeshSkinListInfo[i].SkinName )
01182			{
01183				SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[i].SkinCode;
01184				break;
01185			}
01186		}
01187		
01188		FriendlyFireInt = int(FriendlyFire);
01189		
01190	      URL = Map$
01191	            "?listen"$
01192	            "?Game="$GameType$
01193	            "?NP="$N$
01194	            "?FF="$FriendlyFireInt$
01195	            "?FR="$FragLimit$
01196	            "?TI="$TimeLimit$
01197			        "?SK="$SkinCode$
01198	            "?GAMERTAG="$xboxlive.ConvertString(xboxlive.GetCurrentUser());
01199	    log("TRAVELING w/URL: "$URL);
01200	    GetPlayerOwner().ConsoleCommand("start "$URL);
01201	  }
01202	  else
01203	  {
01204	  }
01205	}
01206	
01207	function Paint(Canvas C, float X, float Y)
01208	{
01209	    if (WaitForStart)
01210	    {
01211	      ProcessWait();
01212	    }
01213	
01214	     // temp lobby
01215	     /*
01216	     if (ProcessMe)
01217	     {
01218	      Process();
01219	     }
01220	     */
01221	
01222	     // temp lobby
01223	     /*
01224	     if (waitForDelete)
01225	     {
01226	       UpdateDelete();
01227	     }
01228	     */
01229	
01230	     Super.Paint(C, X, Y);
01231	     PaintStandardBackground(C, X, Y, TitleText);
01232	}
01233	
01234	function StartPressed()
01235	{
01236	  local int msg;
01237	  WaitForStart = true;
01238	  /*if (xboxlive.SessionStartSubnet())
01239	  {
01240	    starttime = GetPlayerOwner().Level.TimeSeconds;
01241	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01242	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01243	    msgbox.SetupQuestion(pleaseWaitString, 0, 0, "Creating Session");
01244	    msgbox.OnButtonClick=MsgBoxBtnClicked;
01245	    msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
01246	    WaitForStart = true;
01247	  }
01248	  else
01249	  {
01250	    msg = xboxlive.GetLastError();
01251	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01252	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01253	    msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
01254	    msgbox.OnButtonClick=MsgBoxBtnClicked;
01255	    msgbox.InitBox(120*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 400*fRatioX, 230*fRatioY*fScaleTo);
01256	  }*/
01257	  /*
01258	     local string URL, Checksum;
01259	     local int N;
01260	     if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena")
01261	        class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale = float(FriendlyFire);
01262	
01263	     N = PublicSlots+PrivateSlots+1;//PlayerCombo.GetValue();
01264	     class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = N;
01265	     MapChanged(); GameChanged();
01266	     URL = Map$"?Game="$GameType$"?Listen";
01267	    //SaveConfigs();
01268	    myRoot.bXboxStartup = true;
01269	    myRoot.GotoState('');
01270	    myRoot.CloseAll(true);
01271	     GetPlayerOwner().AttribPadToViewport();
01272	     GetPlayerOwner().PlayerReplicationInfo.SetPlayerName(xboxlive.GetCurrentUser());
01273	     log("TRAVELING w/URL: "$URL);
01274	     //GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false);
01275	    GetPlayerOwner().ConsoleCommand("start "$Map$"?Game="$GameType$"?listen");
01276	    */
01277	}
01278	
01279	
01280	function SaveConfigs()
01281	{
01282	     GameClass.static.StaticSaveConfig();
01283	     SaveConfig();
01284	     GetPlayerOwner().SaveConfig();
01285	     GetPlayerOwner().PlayerReplicationInfo.SaveConfig();
01286	}
01287	
01288	// Called when a button is clicked
01289	function bool InternalOnClick(GUIComponent Sender)
01290	{
01291	  if (waitForStart)
01292	    return true;
01293	  if (publicSlots+privateSlots<=xboxlive.GetRecommendedPlayers(Maps[OnMap])-1)
01294	  {
01295	    StartPressed();
01296	  }
01297	  else
01298	  {
01299	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01300	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01301	    msgbox.SetupQuestion(WarningTooManyPlayers, QBTN_Ok | QBTN_Cancel, QBTN_Ok, WarningString);
01302	    msgbox.OnButtonClick=MsgBoxBtnClicked;
01303	    msgbox.InitBox(120, 130, 16, 16, 400, 230);
01304	  }
01305	  return true;
01306	}
01307	
01308	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
01309	{
01310	  local int msg;
01311	    if (state==1 || state==2)// IST_Press // to avoid auto-repeat
01312	    {
01313	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
01314		    {
01315	          //Controller.FocusedControl.OnClick(Self);
01316	          InternalOnClick(Controller.FocusedControl);
01317	          return true;
01318		    }
01319		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
01320		    {
01321	          // temp lobby
01322	          /*
01323		        if (gameCreated)
01324		        {
01325		          if (!xboxlive.SessionDelete())
01326		          {
01327	              msg = xboxlive.GetLastError();
01328	              Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01329	              msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01330	              msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
01331	              msgbox.OnButtonClick=MsgBoxBtnClicked;
01332		          }
01333		          else
01334		          {
01335	              Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
01336	              msgbox = XIIILiveMsgBox(myRoot.ActivePage);
01337	              msgbox.SetupQuestion("Please wait...", 0, 0, "Removing Game");
01338	              msgbox.OnButtonClick=MsgBoxBtnClicked;
01339		            waitForDelete = true;
01340		          }
01341		        }
01342		        */
01343		        // anti temp lobby
01344		        myRoot.CloseMenu(true);
01345	    	    return true;
01346		    }
01347		    if (Key==0x25/*IK_Left*/)
01348		    {
01349		      PrevValue(FocusedControl);
01350	    	    return true;
01351		    }
01352		    if (Key==0x27/*IK_Right*/)
01353		    {
01354		      NextValue(FocusedControl);
01355	    	    return true;
01356		    }
01357	    }
01358	    return super.InternalOnKeyEvent(Key, state, delta);
01359	}
01360	
01361	/*
01362	
01363	  ButtonNames(0)="Start / Join a game"
01364	  ButtonNames(1)="Friends"
01365	  ButtonNames(2)="Xbox Live Options"
01366	  ButtonNames(3)="View Scoreboard"
01367	  ButtonNames(4)="Download New Content"
01368	
01369	  //Begin Object Class=GUIListbox Name=cTestButton1
01370	  //   StyleName="Listbox"
01371	  //   WinLeft=350
01372	  //   WinTop=100
01373	 // 	 WinWidth = 200
01374	 // 	 WinHeight = 275
01375	  //   bVisibleWhenEmpty=true
01376	  //End Object
01377	  //controls(0)=cTestButton1
01378	
01379		Begin Object class=XIIIGUIButton name="StartJoin"
01380			StyleName="SquareButton"
01381			WinLeft=300
01382			WinTop=130
01383			WinWidth=250
01384			WinHeight=30
01385			bFocusOnWatch=true
01386	    OnClick=InternalOnClick
01387		End Object
01388		controls(0)="StartJoin"
01389		Begin Object class=XIIIGUIButton name="Friends"
01390			StyleName="SquareButton"
01391			WinLeft=300
01392			WinTop=170
01393			WinWidth=250
01394			WinHeight=30
01395			bFocusOnWatch=true
01396		End Object
01397		controls(1)="Friends"
01398		Begin Object class=XIIIGUIButton name="OnlineSettings"
01399			StyleName="SquareButton"
01400			WinLeft=300
01401			WinTop=210
01402			WinWidth=250
01403			WinHeight=30
01404			bFocusOnWatch=true
01405		End Object
01406		controls(2)="OnlineSettings"
01407		Begin Object class=XIIIGUIButton name="Scoreboard"
01408			StyleName="SquareButton"
01409			WinLeft=300
01410			WinTop=250
01411			WinWidth=250
01412			WinHeight=30
01413			bFocusOnWatch=true
01414		End Object
01415		controls(3)="Scoreboard"
01416		Begin Object class=XIIIGUIButton name="Download"
01417			StyleName="SquareButton"
01418			WinLeft=300
01419			WinTop=290
01420			WinWidth=250
01421			WinHeight=30
01422			bFocusOnWatch=true
01423		End Object
01424		controls(4)="Download"
01425	*/
01426	
01427	

End Source Code