## XIDInterf
Class XIIIMenuLiveOptimatchWindow

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

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

Direct Known Subclasses:None

class XIIIMenuLiveOptimatchWindow
extends XIDInterf.XIIILiveWindow

Variables
`int` | `CycleLevels` 0 == false, 1 == true, -1 == Any
`string` | `DutchString`
`string` | `EnglishString`
`string` | `FrenchString`
`int` | `FriendlyFire` 0 == false, 1 == true, -1 == Any
`XIIIGUIButton` | `FriendlyFireButton`
`class` | `GameClass`
`string` | `GameType`
`XIIIGUIButton` | `GameTypeButton`
`string` | `GameTypeList[64]`
`string` | `Games[64]`
`string` | `GermanString`
`string` | `ItalianString`
`string` | `LabelNames[7]`
`GUILabel` | `Labels[7]`
`XIIIGUIButton` | `LanguageButton`
`string` | `Map`
`XIIIGUIButton` | `MapNameButton`
`string` | `Maps[64]` 0 == false, 1 == true, -1 == Any
`int` | `MaxGames`
`int` | `MaxPlayers`
`XIIIGUIButton` | `MaxPlayersButton`
`int` | `MinPlayers`
`XIIIGUIButton` | `MinPlayersButton`
`int` | `OnGame`
`string` | `SpanishString`
`string` | `SwedishString`
`string` | `TitleText`
`string` | `YesString,NoString,AnyString` 0 == false, 1 == true, -1 == Any
`bool` | `bAutoUpdate` 0 == false, 1 == true, -1 == Any
`XboxLiveManager.eLanguage` | `language` 0 == false, 1 == true, -1 == Any
`MaxMaps,` | `onMap` 0 == false, 1 == true, -1 == Any

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` | `MaxPlayersChanged()`
`void` | `MinPlayersChanged()`
`void` | `MsgBoxBtnClicked(byte bButton)`
`void` | `NextValue(GUIComponent c)`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `PrevValue(GUIComponent c)`
`void` | `ResetButtons()`
`void` | `SaveConfigs()`
`void` | `ShowWindow()`
`void` | `StartPressed()`
`void` | `TimeLimitChanged()`

Source Code

    00001	class XIIIMenuLiveOptimatchWindow extends XIIILiveWindow;
    00002
    00003	var localized string TitleText;
    00004
    00005	var XIIIGUIButton GameTypeButton;
    00006	var XIIIGUIButton MapNameButton;
    00007	var XIIIGUIButton MinPlayersButton;
    00008	var XIIIGUIButton MaxPlayersButton;
    00009	//var XIIIGUIButton FragLimitButton;
    00010	//var XIIIGUIButton TimeLimitButton;
    00011	var XIIIGUIButton FriendlyFireButton;
    00012	//var XIIIGUIButton CycleLevelsButton;
    00013	var XIIIGUIButton LanguageButton;
    00014
    00015	var localized string LabelNames[7];
    00016	var GUILabel Labels[7];
    00017
    00018	var localized string EnglishString;
    00019	var localized string FrenchString;
    00020	var localized string GermanString;
    00021	var localized string SpanishString;
    00022	var localized string SwedishString;
    00023	var localized string DutchString;
    00024	var localized string ItalianString;
    00025
    00026	// Variables for GameType selection
    00027	var class<GameInfo> GameClass;
    00028	var string Games[64];
    00029	var int MaxGames;
    00030	var config string Map;
    00031	var config string GameType;
    00032	var localized string GameTypeList[64];
    00033	var int OnGame;
    00034	var int MinPlayers;
    00035	var int MaxPlayers;
    00036	//var int FragLimit;
    00037	//var int TimeLimit;
    00038	var int FriendlyFire; // 0 == false, 1 == true, -1 == Any
    00039	var int CycleLevels;  // 0 == false, 1 == true, -1 == Any
    00040	var localized string YesString,NoString,AnyString;
    00041	var string Maps[64];
    00042	var int MaxMaps, onMap;
    00043	var XboxLiveManager.eLanguage language;
    00044	var bool bAutoUpdate;
    00045
    00046	const SETID_ONGAME      = 0;
    00047	const SETID_ONMAP       = 1;
    00048	const SETID_MINPLAYERS  = 2;
    00049	const SETID_MAXPLAYERS  = 3;
    00050	const SETID_FFIRE       = 4;
    00051	const SETID_LANGUAGE    = 5;
    00052
    00053	function IterateGames()
    00054	{
    00055	  local int i;
    00056	  local class<GameInfo> TempClass;
    00057
    00058	  MaxGames = 0;
    00059
    00060	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_DM);
    00061	  MaxGames++;
    00062	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_TeamDM);
    00063	  MaxGames++;
    00064	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_CTF);
    00065	  MaxGames++;
    00066	  Games[MaxGames] = xboxlive.GetGameTypeString(GT_Sabotage);
    00067	  MaxGames++;
    00068	  //Games[MaxGames] = xboxlive.GetGameTypeString(GT_Duel);
    00069	  //MaxGames++;
    00070
    00071	  OnGame = xboxlive.GetSetting(SETID_ONGAME);
    00072	  GameType = Games[OnGame];
    00073	  GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameType, class'Class'));
    00074
    00075	  if (string(GameClass) != "XIIIMP.XIIIMPGameInfo" && string(GameClass) != "XIIIMP.XIIIRocketArena")
    00076	  {
    00077	    FriendlyFireButton.bNeverFocus = false;
    00078	    FriendlyFireButton.MenuState = MSAT_Blurry;
    00079	    //MapCombo.bNeverFocus = false;
    00080	    FriendlyFire = int(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale);
    00081	    if (FriendlyFire==0)
    00082	      FriendlyFireButton.Caption  = NoString;
    00083	    else if (FriendlyFire==1)
    00084	      FriendlyFireButton.Caption  = YesString;
    00085	    else
    00086	      FriendlyFireButton.Caption  = AnyString;
    00087	  }
    00088	  else
    00089	  {
    00090	    FriendlyFireButton.bNeverFocus = true;
    00091	    FriendlyFireButton.MenuState = MSAT_Disabled;
    00092	    FriendlyFire = 0;
    00093	    if (FriendlyFire==0)
    00094	      FriendlyFireButton.Caption  = NoString;
    00095	    else if (FriendlyFire==1)
    00096	      FriendlyFireButton.Caption  = YesString;
    00097	    else
    00098	      FriendlyFireButton.Caption  = AnyString;
    00099	  }
    00100
    00101	  GameTypeButton.Caption = GameTypeList[OnGame];
    00102
    00103	     /*local int i, j, Selection;
    00104	     local class<GameInfo> TempClass;
    00105	     local string TempGame;
    00106	     local string NextGame;
    00107	     local string TempGames[64];
    00108	     local bool bFoundSavedGameClass;
    00109
    00110	     // Compile a list of all gametypes.
    00111	     NextGame = GetPlayerOwner().GetNextInt("GameInfo", 0);
    00112	     while (NextGame != "")
    00113	     {
    00114	          TempGames[i++] = NextGame;
    00115	          NextGame = GetPlayerOwner().GetNextInt("GameInfo", i);
    00116	     }
    00117
    00118	      // Fill the control.
    00119	     for (i=0; i<64; i++)
    00120	     {
    00121	          if (TempGames[i] != "")
    00122	          {
    00123	               Games[MaxGames] = TempGames[i];
    00124	               if ( !bFoundSavedGameClass && (Games[MaxGames] ~= GameType) )
    00125	               {
    00126	                    bFoundSavedGameClass = true;
    00127	                    Selection = MaxGames;
    00128	               }
    00129	               TempClass = Class<GameInfo>(DynamicLoadObject(Games[MaxGames], class'Class'));
    00130	               //GameCombo.AddItem(TempClass.Default.GameName);
    00131	               GameTypeList[MaxGames] = (TempClass.Default.GameName);
    00132	               MaxGames++;
    00133	          }
    00134	     }
    00135
    00136	     //GameCombo.SetSelectedIndex(Selection);
    00137	     OnGame = Selection;
    00138	     GameType = Games[Selection];
    00139	     GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameType, class'Class'));
    00140
    00141	     if (string(GameClass) != "XIIIMP.XIIIMPGameInfo" && string(GameClass) != "XIIIMP.XIIIRocketArena")
    00142	     {
    00143	        FriendlyFireButton.bNeverFocus = false;
    00144	        FriendlyFireButton.MenuState = MSAT_Blurry;
    00145	        //MapCombo.bNeverFocus = false;
    00146	        FriendlyFire = int(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale);
    00147	        if (FriendlyFire==0)
    00148	          FriendlyFireButton.Caption  = NoString;
    00149	        else if (FriendlyFire==1)
    00150	          FriendlyFireButton.Caption  = YesString;
    00151	        else
    00152	          FriendlyFireButton.Caption  = AnyString;
    00153	     }
    00154	     else
    00155	     {
    00156	        FriendlyFireButton.bNeverFocus = true;
    00157	        FriendlyFireButton.MenuState = MSAT_Disabled;
    00158	        FriendlyFire = 0;
    00159	        if (FriendlyFire==0)
    00160	          FriendlyFireButton.Caption  = NoString;
    00161	        else if (FriendlyFire==1)
    00162	          FriendlyFireButton.Caption  = YesString;
    00163	        else
    00164	          FriendlyFireButton.Caption  = AnyString;
    00165	     }
    00166
    00167	     GameTypeButton.Caption = GameTypeList[Selection];
    00168	     */
    00169	}
    00170
    00171	function IterateMaps(int DefaultMap)
    00172	{
    00173	  local XboxLiveManager.eGameType gt;
    00174	  local string map;
    00175
    00176	  gt = GetGameType();
    00177	  map = xboxlive.GetFirstMap(gt);
    00178	  MaxMaps = 0;
    00179	  Maps[MaxMaps] = anystring;
    00180	  MaxMaps++;
    00181	  while (map != "")
    00182	  {
    00183	    // Add the map.
    00184	    Maps[MaxMaps] = map;//Left(map, Len(map) - 4);
    00185	    MaxMaps++;
    00186	    map = xboxlive.GetNextMap(gt);
    00187	  }
    00188	  if (DefaultMap>=MaxMaps)
    00189	    OnMap = 0;
    00190	  else
    00191	    OnMap = DefaultMap;
    00192	  xboxlive.SetSetting(SETID_ONMAP, OnMap);
    00193	  MapNameButton.Caption = Maps[OnMap];
    00194	  /*
    00195	     local string FirstMap, NextMap, TestMap;
    00196	     local int Selected;
    00197	     local bool bFoundSavedMap;
    00198
    00199	     FirstMap = GetPlayerOwner().GetMapName(GameClass.Default.MapPrefix, "", 0);
    00200
    00201	     NextMap = FirstMap;
    00202	     MaxMaps = -1;
    00203
    00204	     MaxMaps++;
    00205	     Maps[MaxMaps] = AnyString;
    00206	     if (Map ~= AnyString || Map == "")
    00207	     {
    00208	        bFoundSavedMap = true;
    00209	        Selected = MaxMaps;
    00210	     }
    00211
    00212	     while (!(FirstMap ~= TestMap))
    00213	     {
    00214	         MaxMaps++;
    00215
    00216	         if ( !bFoundSavedMap && (NextMap ~= Map) )
    00217	         {
    00218	            bFoundSavedMap = true;
    00219	            Selected = MaxMaps;
    00220	         }
    00221	         // Add the map.
    00222	         //MapCombo.AddItem(Left(NextMap, Len(NextMap) - 4)); //, NextMap);
    00223	         Maps[MaxMaps] = Left(NextMap, Len(NextMap) - 4);
    00224	         NextMap = GetPlayerOwner().GetMapName(GameClass.Default.MapPrefix, NextMap, 1);
    00225
    00226	         // Test to see if this is the last.
    00227	         TestMap = NextMap;
    00228	     }
    00229
    00230	     if (bFoundSavedMap)
    00231	     {
    00232	        OnMap = Selected;
    00233	        //MapCombo.SetSelectedIndex(Selected);
    00234	     }
    00235	//     MapCombo.SetSelectedIndex(Max(MapCombo.FindItemIndex(Map, True), 0));
    00236	  MapNameButton.Caption = Maps[Selected];
    00237	  */
    00238	}
    00239
    00240	function String GetLanguageString()
    00241	{
    00242	  switch (language)
    00243	  {
    00244	    case LANG_All:
    00245
return AnyString; 00246 case LANG_EnglishOnly: 00247 return EnglishString; 00248 case LANG_FrenchOnly: 00249 return FrenchString; 00250 case LANG_GermanOnly: 00251 return GermanString; 00252 case LANG_SpanishOnly: 00253 return SpanishString; 00254 case LANG_SwedishOnly: 00255 return SwedishString; 00256 case LANG_DutchOnly: 00257 return DutchString; 00258 case LANG_ItalianOnly: 00259 return ItalianString; 00260 } 00261 return AnyString; 00262 } 00263 00264 function xboxlivemanager.eLanguage GetLanguage(int index) 00265 { 00266 switch (index) 00267 { 00268 case 0: 00269 return LANG_All; 00270 case 1: 00271 return LANG_EnglishOnly; 00272 case 2: 00273 return LANG_FrenchOnly; 00274 case 3: 00275 return LANG_GermanOnly; 00276 case 4: 00277 return LANG_SpanishOnly; 00278 case 5: 00279 return LANG_SwedishOnly; 00280 case 6: 00281 return LANG_DutchOnly; 00282 case 7: 00283 return LANG_ItalianOnly; 00284 } 00285 return LANG_Invalid; 00286 } 00287 00288 function ResetButtons() 00289 { 00290 CycleLevels = -1; 00291 00292 //language = LANG_All; 00293 language = GetLanguage(xboxlive.GetSetting(SETID_LANGUAGE)); 00294 00295 languageButton.Caption = GetLanguageString(); 00296 00297 IterateGames(); 00298 IterateMaps(xboxlive.GetSetting(SETID_ONMAP)); 00299 00300 GameTypeButton.Caption = GameTypeList[OnGame]; 00301 if (OnMap==0) 00302 MapNameButton.Caption = Maps[OnMap]; 00303 else 00304 MapNameButton.Caption = xboxlive.GetNiceName(Maps[OnMap]); 00305 00306 MinPlayers = xboxlive.GetSetting(SETID_MINPLAYERS); 00307 MinPlayersButton.Caption = string(MinPlayers); 00308 00309 MaxPlayers = xboxlive.GetSetting(SETID_MAXPLAYERS); 00310 if (MaxPlayers > 7) MaxPlayers = 7; 00311 if (MaxPlayers == 0) MaxPlayers = 7; 00312 MaxPlayersButton.Caption = string(MaxPlayers); 00313 00314 //FriendlyFire = int(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale); 00315 FriendlyFire = xboxlive.GetSetting(SETID_FFIRE); 00316 if (FriendlyFire==0) 00317 FriendlyFireButton.Caption = NoString; 00318 else if (FriendlyFire==1) 00319 FriendlyFireButton.Caption = YesString; 00320 else 00321 FriendlyFireButton.Caption = AnyString; 00322 00323 /* 00324 FragLimit = class<XIIIMPGameInfo>(GameClass).Default.WinningScore; 00325 FragLimitButton.Caption = string(FragLimit); 00326 if (FragLimit == 0) FragLimitButton.Caption ="-"; 00327 00328 if (string(GameClass) == "XIIIMP.XIIIRocketArena") 00329 { 00330 TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime; 00331 TimeLimitButton.Caption = string(TimeLimit)@"sec"; 00332 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00333 } 00334 else 00335 { 00336 TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime / 60; 00337 TimeLimitButton.Caption = string(TimeLimit); 00338 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00339 } 00340 */ 00341 00342 /*if (CycleLevels==0) 00343 CycleLevelsButton.Caption = NoString; 00344 else if (CycleLevels==1) 00345 CycleLevelsButton.Caption = YesString; 00346 else 00347 CycleLevelsButton.Caption = AnyString; 00348 */ 00349 } 00350 00351 function PrevValue(GUIComponent c) 00352 { 00353 if (c == GameTypeButton) 00354 { 00355 OnGame--; 00356 if (OnGame<0) 00357 OnGame = MaxGames-1; 00358 GameTypeButton.Caption = GameTypeList[OnGame]; 00359 GameChanged(); 00360 } 00361 else if (c==MapNameButton) 00362 { 00363 OnMap--; 00364 if (OnMap<0) 00365 OnMap = MaxMaps-1; 00366 if (OnMap==0) 00367 MapNameButton.Caption = Maps[OnMap]; 00368 else 00369 MapNameButton.Caption = xboxlive.GetNiceName(Maps[OnMap]); 00370 MapChanged(); 00371 } 00372 else if (c==MinPlayersButton) 00373 { 00374 if (MinPlayers>0) 00375 MinPlayers--; 00376 MinPlayersButton.Caption = string(MinPlayers); 00377 MinPlayersChanged(); 00378 } 00379 else if (c==MaxPlayersButton) 00380 { 00381 if (MaxPlayers>MinPlayers && MaxPlayers>1) 00382 MaxPlayers--; 00383 MaxPlayersButton.Caption = string(MaxPlayers); 00384 MaxPlayersChanged(); 00385 } 00386 /*else if (c==FragLimitButton) 00387 { 00388 FragLimit-=10; 00389 if (FragLimit<0) 00390 FragLimit = 0; 00391 class<XIIIMPGameInfo>(GameClass).Default.WinningScore = FragLimit; 00392 FragLimitButton.Caption = string(FragLimit); 00393 if (FragLimit==0) 00394 FragLimitButton.Caption = "-"; 00395 FragLimitChanged(); 00396 } 00397 else if (c==TimeLimitButton) 00398 { 00399 if (string(GameClass) == "XIIIMP.XIIIRocketArena") 00400 { 00401 TimeLimit -= 30; 00402 if (TimeLimit<0) 00403 TimeLimit = 0; 00404 class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit; 00405 TimeLimitButton.Caption = string(TimeLimit)@"sec"; 00406 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00407 } 00408 else 00409 { 00410 TimeLimit -= 5; 00411 if (TimeLimit<0) 00412 TimeLimit = 0; 00413 class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit*60; 00414 TimeLimitButton.Caption = string(TimeLimit); 00415 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00416 } 00417 TimeLimitChanged(); 00418 }*/ 00419 else if (c==FriendlyFireButton) 00420 { 00421 if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena") 00422 { 00423 FriendlyFire--; 00424 if (FriendlyFire<-1) 00425 FriendlyFire=1; 00426 if (FriendlyFire==0) 00427 FriendlyFireButton.Caption = NoString; 00428 else if (FriendlyFire==1) 00429 FriendlyFireButton.Caption = YesString; 00430 else 00431 FriendlyFireButton.Caption = AnyString; 00432 } 00433 FriendlyFireChanged(); 00434 } 00435 /*else if (c==CycleLevelsButton) 00436 { 00437 CycleLevels--; 00438 if (CycleLevels<-1) 00439 CycleLevels=1; 00440 if (CycleLevels==0) 00441 CycleLevelsButton.Caption = NoString; 00442 else if (CycleLevels==1) 00443 CycleLevelsButton.Caption = YesString; 00444 else 00445 CycleLevelsButton.Caption = AnyString; 00446 CycleLevelsChanged(); 00447 }*/ 00448 else if (c==LanguageButton) 00449 { 00450 switch (language) 00451 { 00452 case LANG_All: 00453 language = LANG_ItalianOnly; 00454 break; 00455 case LANG_EnglishOnly: 00456 language = LANG_All; 00457 break; 00458 case LANG_FrenchOnly: 00459 language = LANG_EnglishOnly; 00460 break; 00461 case LANG_GermanOnly: 00462 language = LANG_FrenchOnly; 00463 break; 00464 case LANG_SpanishOnly: 00465 language = LANG_GermanOnly; 00466 break; 00467 case LANG_SwedishOnly: 00468 language = LANG_SpanishOnly; 00469 break; 00470 case LANG_DutchOnly: 00471 language = LANG_SwedishOnly; 00472 break; 00473 case LANG_ItalianOnly: 00474 language = LANG_DutchOnly; 00475 break; 00476 } 00477 LanguageButton.Caption = GetLanguageString(); 00478 LanguageChanged(); 00479 } 00480 } 00481 00482 function NextValue(GUIComponent c) 00483 { 00484 if (c == GameTypeButton) 00485 { 00486 OnGame++; 00487 if (OnGame>=MaxGames) 00488 OnGame = 0; 00489 GameTypeButton.Caption = GameTypeList[OnGame]; 00490 GameChanged(); 00491 } 00492 else if (c==MapNameButton) 00493 { 00494 OnMap++; 00495 if (OnMap>=MaxMaps) 00496 OnMap = 0; 00497 if (OnMap==0) 00498 MapNameButton.Caption = Maps[OnMap]; 00499 else 00500 MapNameButton.Caption = xboxlive.GetNiceName(Maps[OnMap]); 00501 MapChanged(); 00502 } 00503 else if (c==MinPlayersButton) 00504 { 00505 if (MinPlayers<MaxPlayers-1) 00506 MinPlayers++; 00507 MinPlayersButton.Caption = string(MinPlayers); 00508 MinPlayersChanged(); 00509 } 00510 else if (c==MaxPlayersButton) 00511 { 00512 if (MaxPlayers<7) 00513 MaxPlayers++; 00514 MaxPlayersButton.Caption = string(MaxPlayers); 00515 MaxPlayersChanged(); 00516 } 00517 /* 00518 else if (c==FragLimitButton) 00519 { 00520 FragLimit+=10; 00521 if (FragLimit>100) 00522 FragLimit = 100; 00523 class<XIIIMPGameInfo>(GameClass).Default.WinningScore = FragLimit; 00524 FragLimitButton.Caption = string(FragLimit); 00525 if (FragLimit==0) 00526 FragLimitButton.Caption = "-"; 00527 FragLimitChanged(); 00528 } 00529 else if (c==TimeLimitButton) 00530 { 00531 if (string(GameClass) == "XIIIMP.XIIIRocketArena") 00532 { 00533 TimeLimit += 30; 00534 if (TimeLimit>300) 00535 TimeLimit = 300; 00536 class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit; 00537 TimeLimitButton.Caption = string(TimeLimit)@"sec"; 00538 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00539 } 00540 else 00541 { 00542 TimeLimit += 5; 00543 if (TimeLimit>60) 00544 TimeLimit = 60; 00545 class<XIIIMPGameInfo>(GameClass).Default.MaxTime = TimeLimit*60; 00546 TimeLimitButton.Caption = string(TimeLimit); 00547 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00548 } 00549 TimeLimitChanged(); 00550 } 00551 */ 00552 else if (c==FriendlyFireButton) 00553 { 00554 if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena") 00555 { 00556 FriendlyFire++; 00557 if (FriendlyFire>1) 00558 FriendlyFire = -1; 00559 if (FriendlyFire==0) 00560 FriendlyFireButton.Caption = NoString; 00561 else if (FriendlyFire==1) 00562 FriendlyFireButton.Caption = YesString; 00563 else 00564 FriendlyFireButton.Caption = AnyString; 00565 } 00566 FriendlyFireChanged(); 00567 } 00568 /*else if (c==CycleLevelsButton) 00569 { 00570 CycleLevels++; 00571 if (CycleLevels>1) 00572 CycleLevels = -1; 00573 if (CycleLevels==0) 00574 CycleLevelsButton.Caption = NoString; 00575 else if (CycleLevels==1) 00576 CycleLevelsButton.Caption = YesString; 00577 else 00578 CycleLevelsButton.Caption = AnyString; 00579 CycleLevelsChanged(); 00580 }*/ 00581 else if (c==LanguageButton) 00582 { 00583 switch (language) 00584 { 00585 case LANG_All: 00586 language = LANG_EnglishOnly; 00587 break; 00588 case LANG_EnglishOnly: 00589 language = LANG_FrenchOnly; 00590 break; 00591 case LANG_FrenchOnly: 00592 language = LANG_GermanOnly; 00593 break; 00594 case LANG_GermanOnly: 00595 language = LANG_SpanishOnly; 00596 break; 00597 case LANG_SpanishOnly: 00598 language = LANG_SwedishOnly; 00599 break; 00600 case LANG_SwedishOnly: 00601 language = LANG_DutchOnly; 00602 break; 00603 case LANG_DutchOnly: 00604 language = LANG_ItalianOnly; 00605 break; 00606 case LANG_ItalianOnly: 00607 language = LANG_All; 00608 break; 00609 } 00610 LanguageButton.Caption = GetLanguageString(); 00611 LanguageChanged(); 00612 } 00613 } 00614 00615 function GameChanged() 00616 { 00617 local int msg; 00618 00619 xboxlive.SetSetting(SETID_ONGAME, OnGame); 00620 00621 GameType = Games[OnGame]; 00622 GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameType, class'Class')); 00623 00624 IterateMaps(0); 00625 if (string(GameClass) != "XIIIMP.XIIIMPGameInfo" && string(GameClass) != "XIIIMP.XIIIRocketArena") 00626 { 00627 FriendlyFireButton.bNeverFocus = false; 00628 FriendlyFireButton.MenuState = MSAT_Blurry; 00629 //MapCombo.bNeverFocus = false; 00630 FriendlyFire = int(class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale); 00631 if (FriendlyFire==0) 00632 FriendlyFireButton.Caption = NoString; 00633 else if (FriendlyFire==1) 00634 FriendlyFireButton.Caption = YesString; 00635 else 00636 FriendlyFireButton.Caption = AnyString; 00637 } 00638 else 00639 { 00640 FriendlyFireButton.MenuState = MSAT_Disabled; 00641 FriendlyFireButton.bNeverFocus = true; 00642 FriendlyFire = 0; 00643 if (FriendlyFire==0) 00644 FriendlyFireButton.Caption = NoString; 00645 else if (FriendlyFire==1) 00646 FriendlyFireButton.Caption = YesString; 00647 else 00648 FriendlyFireButton.Caption = AnyString; 00649 } 00650 00651 //PublicSlots = class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers; 00652 //PublicSlotsButton.Caption = string(PublicSlots); 00653 00654 //PrivateSlots = 0; 00655 //PrivateSlotsButton.Caption = string(PrivateSlots); 00656 00657 /* 00658 if (string(GameClass) == "XIIIMP.XIIIRocketArena") 00659 { 00660 TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime; 00661 TimeLimitButton.Caption = string(TimeLimit)@"sec"; 00662 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00663 } 00664 else 00665 { 00666 TimeLimit = class<XIIIMPGameInfo>(GameClass).Default.MaxTime / 60; 00667 TimeLimitButton.Caption = string(TimeLimit); 00668 if (TimeLimit == 0) TimeLimitButton.Caption ="-"; 00669 } 00670 00671 FragLimit = class<XIIIMPGameInfo>(GameClass).Default.WinningScore; 00672 FragLimitButton.Caption = string(FragLimit); 00673 if (FragLimit == 0) FragLimitButton.Caption ="-"; 00674 */ 00675 00676 //xboxlive.SessionSetGameType(GetGameType()); 00677 //if (OnMap==0) 00678 // xboxlive.SessionSetMapName(""); 00679 //else 00680 // xboxlive.SessionSetMapName(Maps[OnMap]); 00681 //xboxlive.SessionSetTimeLimit(TimeLimit); 00682 //xboxlive.SessionSetFragLimit(FragLimit); 00683 //xboxlive.SessionSetPublicSlots(PublicSlots); 00684 //xboxlive.SessionSetPrivateSlots(PrivateSlots); 00685 //xboxlive.SessionSetFriendlyFire(FriendlyFire); 00686 //xboxlive.SessionSetCycleLevels(CycleLevels); 00687 //xboxlive.SessionSetLanguage(language); 00688 } 00689 00690 function MapChanged() 00691 { 00692 local int msg; 00693 xboxlive.SetSetting(SETID_ONMAP, OnMap); 00694 if (OnMap == 0) 00695 { 00696 Map = ""; 00697 //xboxlive.SessionSetMapName(""); 00698 } 00699 else 00700 { 00701 Map = Maps[OnMap]$".unr";//MapNameButton.Caption$".unr"; 00702 //xboxlive.SessionSetMapName(Maps[OnMap]); 00703 } 00704 } 00705 00706 function MinPlayersChanged() 00707 { 00708 //local int msg; 00709 //xboxlive.SessionSetPublicSlots(PublicSlots); 00710 xboxlive.SetSetting(SETID_MINPLAYERS, MinPlayers ); 00711 } 00712 00713 function MaxPlayersChanged() 00714 { 00715 //local int msg; 00716 //xboxlive.SessionSetPrivateSlots(PrivateSlots); 00717 xboxlive.SetSetting(SETID_MAXPLAYERS, MaxPlayers ); 00718 } 00719 00720 function FragLimitChanged() 00721 { 00722 //local int msg; 00723 //xboxlive.SessionSetFragLimit(FragLimit); 00724 } 00725 00726 function TimeLimitChanged() 00727 { 00728 //local int msg; 00729 //xboxlive.SessionSetTimeLimit(TimeLimit); 00730 } 00731 00732 function FriendlyFireChanged() 00733 { 00734 //local int msg; 00735 //xboxlive.SessionSetFriendlyFire(FriendlyFire); 00736 xboxlive.SetSetting(SETID_FFIRE, FriendlyFire ); 00737 } 00738 00739 function CycleLevelsChanged() 00740 { 00741 //local int msg; 00742 //xboxlive.SessionSetCycleLevels(CycleLevels); 00743 } 00744 00745 function LanguageChanged() 00746 { 00747 //local int msg; 00748 //xboxlive.SessionSetLanguage(language); 00749 xboxlive.SetSetting(SETID_LANGUAGE, language ); 00750 } 00751 00752 function Created() 00753 { 00754 local int i; 00755 local int msg; 00756 00757 Super.Created(); 00758 00759 GameTypeButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-15-30, 100, 150+30, 30)); 00760 MapNameButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-15, 135, 150, 30)); 00761 MinPlayersButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-15-20, 170, 90, 30)); 00762 MaxPlayersButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-15-20, 205, 90, 30)); 00763 //FragLimitButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 525-37, 240, 75, 30)); 00764 //TimeLimitButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 525-37, 275, 75, 30)); 00765 FriendlyFireButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-15-20, 240, 90, 30)); 00766 //CycleLevelsButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 500-10, 275, 50, 30)); 00767 LanguageButton = XIIIGUIButton(CreateControl(class'XIIIGUIButton', 450-15, 275, 150, 30)); 00768 00769 Controls[0]=GameTypeButton; 00770 Controls[1]=MapNameButton; 00771 Controls[2]=MinPlayersButton; 00772 Controls[3]=MaxPlayersButton; 00773 //Controls[4]=FragLimitButton; 00774 //Controls[5]=TimeLimitButton; 00775 Controls[4]=FriendlyFireButton; 00776 //Controls[5]=CycleLevelsButton; 00777 Controls[5]=LanguageButton; 00778 for (i=0; i<6; i++) 00779 { 00780 Controls[i].StyleName = "SquareButton"; 00781 XIIIGuiButton(Controls[i]).bDrawArrows = true; 00782 } 00783 00784 Labels[0] = GUILabel(CreateControl(class'GUILabel', 270, 100, 170, 26)); 00785 Labels[0].caption = LabelNames[0]; 00786 Labels[0].StyleName="LabelWhite"; 00787 Labels[0].TextColor.R=255; 00788 Labels[0].TextColor.G=255; 00789 Labels[0].TextColor.B=255; 00790 controls[6] = Labels[0]; 00791 Labels[1] = GUILabel(CreateControl(class'GUILabel', 270, 135, 170, 26)); 00792 Labels[1].caption = LabelNames[1]; 00793 Labels[1].StyleName="LabelWhite"; 00794 Labels[1].TextColor.R=255; 00795 Labels[1].TextColor.G=255; 00796 Labels[1].TextColor.B=255; 00797 controls[7] = Labels[1]; 00798 Labels[2] = GUILabel(CreateControl(class'GUILabel', 270, 170, 170, 26)); 00799 Labels[2].caption = LabelNames[2]; 00800 Labels[2].StyleName="LabelWhite"; 00801 Labels[2].TextColor.R=255; 00802 Labels[2].TextColor.G=255; 00803 Labels[2].TextColor.B=255; 00804 controls[8] = Labels[2]; 00805 Labels[3] = GUILabel(CreateControl(class'GUILabel', 270, 205, 170, 26)); 00806 Labels[3].caption = LabelNames[3]; 00807 Labels[3].StyleName="LabelWhite"; 00808 Labels[3].TextColor.R=255; 00809 Labels[3].TextColor.G=255; 00810 Labels[3].TextColor.B=255; 00811 controls[9] = Labels[3]; 00812 Labels[4] = GUILabel(CreateControl(class'GUILabel', 270, 240, 170, 26)); 00813 Labels[4].caption = LabelNames[4]; 00814 Labels[4].StyleName="LabelWhite"; 00815 Labels[4].TextColor.R=255; 00816 Labels[4].TextColor.G=255; 00817 Labels[4].TextColor.B=255; 00818 controls[10] = Labels[4]; 00819 Labels[5] = GUILabel(CreateControl(class'GUILabel', 270, 275, 150, 26)); 00820 Labels[5].caption = LabelNames[5]; 00821 Labels[5].StyleName="LabelWhite"; 00822 Labels[5].TextColor.R=255; 00823 Labels[5].TextColor.G=255; 00824 Labels[5].TextColor.B=255; 00825 controls[11] = Labels[5]; 00826 /*Labels[6] = GUILabel(CreateControl(class'GUILabel', 270, 310, 150, 26)); 00827 Labels[6].caption = LabelNames[6]; 00828 Labels[6].StyleName="LabelWhite"; 00829 Labels[6].TextColor.R=255; 00830 Labels[6].TextColor.G=255; 00831 Labels[6].TextColor.B=255; 00832 controls[13] = Labels[6]; 00833 */ 00834 00835 if (xboxlive == none) 00836 xboxlive=New Class'XboxLiveManager'; 00837 00838 ResetButtons(); 00839 00840 //xboxlive.SessionSetGameType(GetGameType()); 00841 //if (OnMap==0) 00842 // xboxlive.SessionSetMapName(""); 00843 //else 00844 // xboxlive.SessionSetMapName(Maps[OnMap]); 00845 //xboxlive.SessionSetLanguage(LANG_EnglishOnly); 00846 //xboxlive.SessionSetFragLimit(FragLimit); 00847 //xboxlive.SessionSetTimeLimit(TimeLimit); 00848 //xboxlive.SessionSetPublicSlots(PublicSlots); 00849 //xboxlive.SessionSetPrivateSlots(PrivateSlots); 00850 //xboxlive.SessionSetReserved(1); 00851 //xboxlive.SessionSetFriendlyFire(FriendlyFire); 00852 //xboxlive.SessionSetCycleLevels(CycleLevels); 00853 } 00854 00855 function MsgBoxBtnClicked(byte bButton) 00856 { 00857 switch (bButton) 00858 { 00859 case QBTN_Ok: 00860 //log("[XIIILiveMsgBox] Ok pressed"); 00861 //xboxlive.ShutdownAndCleanup(); 00862 //xboxlive.SessionReset(); 00863 //myRoot.CloseMenu(true); 00864 //Controller.ReplaceMenu("XIDInterf.XIIIMenuLiveAccountWindow"); 00865 break; 00866 } 00867 //log("msgbox clicked: "$bButton); 00868 } 00869 00870 function XboxLiveManager.eGameType GetGameType() 00871 { 00872 switch (OnGame) 00873 { 00874 case 0: 00875 return GT_DM; 00876 case 1: 00877 return GT_TeamDM; 00878 case 2: 00879 return GT_CTF; 00880 case 3: 00881 return GT_Sabotage; 00882 case 4: 00883 return GT_Duel; 00884 } 00885 return GT_Invalid; 00886 } 00887 00888 function InitComponent(GUIController MyController,GUIComponent MyOwner) 00889 { 00890 Super.InitComponent(MyController, MyOwner); 00891 00892 OnClick = InternalOnClick; 00893 } 00894 00895 00896 function ShowWindow() 00897 { 00898 OnMenu = 0; myRoot.bFired = false; 00899 Super.ShowWindow(); 00900 bShowBCK = true; 00901 bShowSCH = true; 00902 //bShowSEL = true; 00903 } 00904 00905 function Paint(Canvas C, float X, float Y) 00906 { 00907 super.Paint(C,X,Y); 00908 PaintStandardBackground(C, X, Y, TitleText); 00909 00910 if (bAutoUpdate) 00911 { 00912 bAutoUpdate = false; 00913 StartPressed(); 00914 } 00915 00916 } 00917 00918 function StartPressed() 00919 { 00920 local bool result; 00921 local int msg; 00922 local XboxLiveManager.eGameType gt; 00923 local XIIIMenuLiveOptimatchResultWindow reswin; 00924 local string map; 00925 00926 gt = GetGameType(); 00927 00928 if (OnMap==0) 00929 result = xboxlive.OptimatchStartQuery(gt, "", language, minplayers, maxplayers, friendlyFire, cycleLevels, SKILL_Beginner, SKILL_Elite); 00930 else 00931 result = xboxlive.OptimatchStartQuery(gt, Maps[OnMap], language, minplayers, maxplayers, friendlyFire, cycleLevels, SKILL_Beginner, SKILL_Elite); 00932 00933 if (!result) 00934 { 00935 msg = xboxlive.GetLastError(); 00936 Controller.OpenMenu("XIDInterf.XIIILiveMsgBox"); 00937 msgbox = XIIILiveMsgBox(myRoot.ActivePage); 00938 msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok); 00939 msgbox.OnButtonClick=MsgBoxBtnClicked; 00940 msgbox.InitBox(120*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 400*fRatioX, 230*fRatioY*fScaleTo); 00941 } 00942 else 00943 { 00944 if (OnMap == 0) 00945 map = xboxlive.GetRandomMap(gt); 00946 else 00947 map = Maps[OnMap]; 00948 xboxlive.SetSearchParams(gt,map,friendlyFire,language); 00949 Controller.OpenMenu("XIDInterf.XIIIMenuLiveOptimatchResultWindow"); 00950 } 00951 00952 00953 //updateMe = true; 00954 00955 /* 00956 local string URL, Checksum; 00957 local int N; 00958 00959 if (GameType != "XIIIMP.XIIIMPGameInfo" && GameType != "XIIIMP.XIIIRocketArena") 00960 class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale = float(FriendlyFire); 00961 00962 N = PublicSlots+PrivateSlots;//PlayerCombo.GetValue(); 00963 class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = N; 00964 //GetPlayerOwner().ConsoleCommand("SetViewPortNumberForNextMap "$N); 00965 MapChanged(); GameChanged(); 00966 //TimeChanged(); FragChanged(); 00967 URL = Map$"?Game="$GameType$"?Listen"; 00968 SaveConfigs(); 00969 myRoot.bXboxStartup = true; 00970 myRoot.CloseAll(true); 00971 myRoot.GotoState(''); 00972 GetPlayerOwner().AttribPadToViewport(); 00973 GetPlayerOwner().PlayerReplicationInfo.SetPlayerName(xboxlive.GetCurrentUser()); 00974 log("TRAVELING w/URL: "$URL); 00975 //GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false); 00976 GetPlayerOwner().ConsoleCommand("start "$Map$"?Game="$GameType$"?listen"); 00977 */ 00978 } 00979 00980 function SaveConfigs() 00981 { 00982 GameClass.static.StaticSaveConfig(); 00983 SaveConfig(); 00984 GetPlayerOwner().SaveConfig(); 00985 GetPlayerOwner().PlayerReplicationInfo.SaveConfig(); 00986 } 00987 00988 // Called when a button is clicked 00989 function bool InternalOnClick(GUIComponent Sender) 00990 { 00991 StartPressed(); 00992 return true; 00993 } 00994 00995 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00996 { 00997 local int msg; 00998 if (state==1 || state==2)// IST_Press // to avoid auto-repeat 00999 { 01000 if ((Key==0x0D/*IK_Enter*/) || (Key==0x01)) 01001 { 01002 //Controller.FocusedControl.OnClick(Self); 01003 InternalOnClick(Controller.FocusedControl); 01004 return true; 01005 } 01006 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 01007 { 01008 myRoot.CloseMenu(true); 01009 return true; 01010 } 01011 if (Key==0x25/*IK_Left*/) 01012 { 01013 PrevValue(FocusedControl); 01014 return true; 01015 } 01016 if (Key==0x27/*IK_Right*/) 01017 { 01018 NextValue(FocusedControl); 01019 return true; 01020 } 01021 } 01022 return super.InternalOnKeyEvent(Key, state, delta); 01023 } 01024 01025

End Source Code