XIDInterf
Class XIIIMenuLiveLadderWindow

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

class XIIIMenuLiveLadderWindow
extends XIDInterf.XIIILiveWindow


Variables
 string AutoLoginName
 int BackFromJoin
 bool BackFromJoinNotNow
 bool ConnectingToGame
 bool Probing
 bool StartGameQuestion
 string TitleText
 UpdateMe, UpdateStats
 string connectingString
 string failedToJoinString
 string firstLadderGameString
 XboxLiveManager.eGameType gameType
 string gettingStatsString
 string ladderNotAvailableString
 string ladderRankString
 string loadingString
 string noGamesFoundString,lookingForGame,yourRankStr
 string searchingString
 XboxLiveManager.eSkill skill
 string skillNames[7]
 float starttime


Function Summary
 void Created()
 string GetPageParameters()
     
// if subclassed, this parent function must always be called first
 void GetStats()
 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 MsgBoxBtnClicked(byte bButton)
 void MsgBoxBtnClickedError(byte bButton)
 void MsgBoxBtnClickedPlay(byte bButton)
 void MsgBoxBtnClickedStats(byte bButton)
 void Paint(Canvas C, float X, float Y)
 void Process()
 void ProcessConnect()
 void ProcessProbe()
 void ProcessStats()
 void SetPageParameters(string PageParameters)
     
// if GetPageParameters() is subclassed, you'd better have this one too !
 void ShowWindow()
 void Start()
 void StartGameMsgBox(BYTE button)



Source Code


00001	class XIIIMenuLiveLadderWindow extends XIIILiveWindow;
00002	
00003	//var GUIListBox listbox;
00004	var localized string TitleText;
00005	var localized string connectingString;
00006	var localized string searchingString;
00007	var localized string noGamesFoundString,lookingForGame,yourRankStr;
00008	var localized string loadingString;
00009	var localized string gettingStatsString;
00010	var localized string ladderNotAvailableString;
00011	
00012	var localized string firstLadderGameString;
00013	var localized string ladderRankString;
00014	
00015	var localized string skillNames[7];
00016	
00017	var localized string failedToJoinString;
00018	
00019	var bool UpdateMe, UpdateStats;
00020	var bool Probing;
00021	var bool ConnectingToGame;
00022	var float starttime;
00023	var bool StartGameQuestion;
00024	var int BackFromJoin;
00025	var bool BackFromJoinNotNow;
00026	var string AutoLoginName;
00027	
00028	//var GUILabel labels[2];
00029	
00030	var XboxLiveManager.eSkill skill;
00031	
00032	var XboxLiveManager.eGameType gameType;
00033	
00034	function Created()
00035	{
00036	  local int i;
00037	  Super.Created();
00038	
00039	  /*
00040	  Labels[0] = GUILabel(CreateControl(class'GUILabel', 270, 100, 300, 26));
00041	  Labels[0].caption = yourRankStr;
00042	  Labels[0].StyleName="LabelWhite";
00043	  Labels[0].TextColor.R=255;
00044	  Labels[0].TextColor.G=255;
00045	  Labels[0].TextColor.B=255;
00046	  controls[0] = Labels[0];
00047	  */
00048	}
00049	
00050	function string GetSkillName(XboxLiveManager.eSkill skill)
00051	{
00052	  switch (skill)
00053	  {
00054	    case SKILL_Beginner:
00055	      return skillNames[0];
00056	    case SKILL_BelowAverage:
00057	      return skillNames[1];
00058	    case SKILL_Average:
00059	      return skillNames[2];
00060	    case SKILL_AboveAverage:
00061	      return skillNames[3];
00062	    case SKILL_Skilled:
00063	      return skillNames[4];
00064	    case SKILL_Pro:
00065	      return skillNames[5];
00066	    case SKILL_Elite:
00067	      return skillNames[6];
00068	  }
00069	  return "";
00070	}
00071	
00072	function InitComponent(GUIController MyController,GUIComponent MyOwner)
00073	{
00074	  local int numberOfAccounts;
00075	
00076	  Super.InitComponent(MyController, MyOwner);
00077	     //listbox = GUIListBox(Controls[0]);
00078	
00079	     if (xboxlive == none)
00080	  	  xboxlive=New Class'XboxLiveManager';
00081	
00082		OnClick = InternalOnClick;
00083	
00084	     /*
00085	     if (xboxlive != none && xboxlive.IsNetCableIn())
00086	     {
00087	       listbox.list.Add("Hello");
00088	       listbox.list.Add("World");
00089	     }
00090	     */
00091	     //listbox.bVisibleWhenEmpty = true;
00092	   
00093	  gameType = GT_Ladder;
00094	  if (xboxlive.IsLoggedIn(xboxlive.GetCurrentUser()))
00095	    GetStats();
00096	}
00097	
00098	function GetStats()
00099	{
00100	  if (!xboxlive.GetMyLadderStats())
00101	  {
00102	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00103	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00104	    msgbox.SetupQuestion(ladderNotAvailableString, QBTN_Ok, QBTN_Ok, loadingString);
00105	    msgbox.OnButtonClick=MsgBoxBtnClickedError;
00106	    msgbox.InitBox(160, 130, 16, 16, 320, 230);
00107	  }
00108	  else
00109	  {
00110	    UpdateStats = true;
00111	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00112	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00113	    msgbox.ShowWorking=true;
00114	    msgbox.SetupQuestion(gettingStatsString, QBTN_Cancel, QBTN_Cancel, loadingString);
00115	    msgbox.OnButtonClick=MsgBoxBtnClickedStats;
00116	    msgbox.InitBox(160, 130, 16, 16, 320, 230);
00117	  }
00118	}
00119	
00120	function Start()
00121	{
00122	  xboxlive.OptimatchStartQuery(gametype, "", LANG_All, 0, 7, -1, -1, skill, skill);
00123	  updateMe = true;
00124	
00125	  Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00126	  msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00127	  msgbox.ShowWorking=true;
00128	  msgbox.SetupQuestion(lookingForGame, QBTN_Cancel, QBTN_Cancel, searchingString);
00129	  msgbox.OnButtonClick=MsgBoxBtnClicked;
00130	  msgbox.InitBox(160, 130, 16, 16, 320, 230);
00131	}
00132	
00133	
00134	function ShowWindow()
00135	{
00136	     OnMenu = 0; myRoot.bFired = false;
00137	     Super.ShowWindow();
00138	     bShowBCK = true;
00139	     bShowRUN = false;
00140	     bShowSEL = false;
00141	}
00142	
00143	function string GetGameTypeString(XboxLiveManager.eGameType gameType)
00144	{
00145	  switch (gameType)
00146	  {
00147	    case GT_DM:
00148	      return "XIIIMP.XIIIMPGameInfo";
00149	    case GT_TeamDM:
00150	      return "XIIIMP.XIIIMPTeamGameInfo";
00151	    case GT_CTF:
00152	      return "XIIIMP.XIIIMPCTFGameInfo";
00153	    case GT_Sabotage:
00154	      return "XIIIMP.XIIIMPBombGame";
00155	    case GT_Duel:
00156	      return "XIIIMP.XIIIRocketArena";
00157	    case GT_Ladder:
00158	      return "XIIIMP.XIIIMPGameInfo";
00159	  }
00160	
00161	  return "";
00162	}
00163	
00164	function StartGameMsgBox(BYTE button)
00165	{
00166	  local int N;
00167	  local string GameTypeString, URL, Map;
00168	  local class<GameInfo> GameClass;
00169	  local bool FriendlyFire;
00170		local int i;
00171		local string MyClass, SkinCode;
00172	
00173	  if (button == QBTN_Yes)
00174	  {
00175	    Map = xboxlive.GetRandomMap(gameType);
00176	    FriendlyFire = false;
00177	    xboxlive.SessionSetGameType(gameType);
00178	    xboxlive.SessionSetMapName(Map);
00179	    xboxlive.SessionSetTimeLimit(15);
00180	    xboxlive.SessionSetFragLimit(25);
00181	    xboxlive.SessionSetPublicSlots(xboxlive.GetRecommendedPlayers(map));
00182	    xboxlive.SessionSetPrivateSlots(0);
00183	    xboxlive.SessionSetFriendlyFire(FriendlyFire);
00184	    xboxlive.SessionSetCycleLevels(true);
00185	    xboxlive.SessionSetMinSkill(skill);
00186	    xboxlive.SessionSetMaxSkill(skill);
00187	    GameTypeString=GetGameTypeString(gameType);
00188	    GameClass = Class<XIIIMPGameInfo>(DynamicLoadObject(GameTypeString, class'Class'));
00189	    if (GameTypeString != "XIIIMP.XIIIMPGameInfo" && GameTypeString != "XIIIMP.XIIIRocketArena")
00190	      class<XIIIMPTeamGameInfo>(GameClass).default.fFriendlyFireScale = float(FriendlyFire);
00191	    N = xboxlive.GetRecommendedPlayers(map)+0;
00192	    class<XIIIMPGameInfo>(GameClass).Default.MaxPlayers = N;
00193	    //MapChanged(); GameChanged();
00194	    //URL = Map$"?Game="$GameTypeString$"?Listen";
00195	    //SaveConfigs();
00196	    myRoot.bXboxStartup = true;
00197	    myRoot.CloseMenu(true);
00198	    myRoot.CloseMenu(true);
00199	    myRoot.CloseMenu(true);
00200	    Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow");
00201	    XIIIMenuLiveAccountWindow(myRoot.ActivePage).AutoLoginUser = xboxlive.GetCurrentUser();
00202	    myRoot.CloseAll(true);
00203	    myRoot.GotoState('');
00204	    GetPlayerOwner().AttribPadToViewport();
00205	    GetPlayerOwner().PlayerReplicationInfo.SetPlayerName(xboxlive.GetCurrentUser());
00206	    //GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false);
00207	
00208	  	// skin
00209	  	MyClass = GetPlayerOwner().GetDefaultURL("MySkin");
00210	  	SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[0].SkinCode;
00211	  	for (i=0;i<class'MeshSkinList'.default.MeshSkinListInfo.Length;i++)
00212	  	{
00213	  		if ( MyClass == class'MeshSkinList'.default.MeshSkinListInfo[i].SkinName )
00214	  		{
00215	  			SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[i].SkinCode;
00216	  			break;
00217	  		}
00218	  	}
00219	  	
00220	      URL = Map$
00221	            "?listen"$
00222	            "?Game="$GameTypeString$
00223	            "?NP="$N$
00224	            "?FF="$FriendlyFire$
00225	            "?FR="$25$
00226	            "?TI="$15$
00227			    "?SK="$SkinCode$
00228	            "?GAMERTAG="$xboxlive.ConvertString(xboxlive.GetCurrentUser());
00229	    log("TRAVELING w/URL: "$URL);
00230	    GetPlayerOwner().ConsoleCommand("start "$URL);
00231	
00232	    //GetPlayerOwner().ConsoleCommand("start "$Map$"?Game="$GameTypeString$"?listen");
00233	  }
00234	  else
00235	  {
00236	    myRoot.CloseMenu(true);
00237	  }
00238	}
00239	
00240	function ProcessStats()
00241	{
00242	  local int msg;
00243	  local int ladderLength;
00244	  local int ladderPos;
00245	  local float fpos;
00246	  
00247	  if (xboxlive.IsGetMyLadderStatsDone())
00248	  {
00249	    UpdateStats = false;
00250	    msg = xboxlive.GetLastError();
00251	    if (msg == 0 || msg == 130)
00252	    {
00253	      myRoot.CloseMenu(true);
00254	      ladderLength = xboxlive.GetLadderSize();
00255	      ladderPos = xboxlive.GetMyLadderRank();
00256	      log("Ladder: POS "$ladderPos$" LEN "$ladderLength);
00257	      fpos = 1.0;
00258	      if (ladderPos != 0 && ladderLength>0)
00259	        fpos = float(ladderPos)/float(ladderLength);
00260	      if (fpos <= 0.14)
00261	        skill = SKILL_Elite;
00262	      else if (fpos <= 0.28)
00263	        skill = SKILL_Pro;
00264	      else if (fpos <= 0.42)
00265	        skill = SKILL_Skilled;
00266	      else if (fpos <= 0.56)
00267	        skill = SKILL_AboveAverage;
00268	      else if (fpos <= 0.70)
00269	        skill = SKILL_Average;
00270	      else if (fpos <= 0.85)
00271	        skill = SKILL_BelowAverage;
00272	      else
00273	        skill = SKILL_Beginner;
00274	      
00275	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00276	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00277	      if (ladderPos == 0)
00278	        msgbox.SetupQuestion(yourRankStr$" "$GetSkillName(skill)$"|"$firstLadderGameString, QBTN_Ok|QBTN_Cancel, QBTN_Ok, ladderRankString);
00279	      else
00280	        msgbox.SetupQuestion(yourRankStr$" "$GetSkillName(skill)$"|"$"("$ladderPos$" / "$ladderLength$")", QBTN_Ok|QBTN_Cancel, QBTN_Ok, ladderRankString);
00281	      msgbox.OnButtonClick=MsgBoxBtnClickedPlay;
00282	      msgbox.InitBox(160, 130, 16, 16, 320, 230);
00283	    }
00284	    else // error!
00285	    {
00286	      myRoot.CloseMenu(true);
00287	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00288	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00289	      msgbox.SetupQuestion(ladderNotAvailableString, QBTN_Ok, QBTN_Ok, loadingString);
00290	      msgbox.OnButtonClick=MsgBoxBtnClickedError;
00291	      msgbox.InitBox(160, 130, 16, 16, 320, 230);
00292	    }
00293	  }
00294	}
00295	
00296	function Process()
00297	{
00298	  local XboxLiveManager.XBL_MESSAGES msg;
00299	  local int count, i, msg2;
00300	  count = 0;
00301	  msg = xboxlive.OptimatchProcessQuery();
00302	
00303	  if (msg != XBLE_NONE)
00304	  {
00305	    if (msg == XBLE_RUNNING)
00306	    { // WHOOO
00307	      UpdateMe = false;
00308	      count = xboxlive.OptimatchGetResultCount();
00309	      /*for (i=0; i<count; i++)
00310	      {
00311	        listbox.list.Add(xboxlive.OptimatchGetMapName(i));
00312	      }*/
00313	
00314	      if (count == 0)
00315	      { // No games found
00316	        // Autocreate one of the requested type...
00317	        myRoot.CloseMenu(true);
00318	        Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00319	        msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00320	        msgbox.SetupQuestion(noGamesFoundString, QBTN_Yes|QBTN_No, QBTN_Yes, TitleText);
00321	        msgbox.OnButtonClick=StartGameMsgBox;
00322	        //msgbox.InitBox(145, 130, 16, 16, 350, 150);
00323	        msgbox.InitBox(160, 130, 16, 16, 320, 230);
00324	      }
00325	      else
00326	      { // Found game(s)
00327	        //Send probes to find out which games work / are best
00328	
00329	        if (!XboxLive.OptimatchProbe())
00330	        {
00331	          // Create one instead (question)
00332	          myRoot.CloseMenu(true);
00333	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00334	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00335	          msgbox.SetupQuestion(noGamesFoundString, QBTN_Yes|QBTN_No, QBTN_Yes, TitleText);
00336	          msgbox.OnButtonClick=StartGameMsgBox;
00337	          //msgbox.InitBox(145, 130, 16, 16, 350, 150);
00338	          msgbox.InitBox(160, 130, 16, 16, 320, 230);
00339	        }
00340	        else
00341	        {
00342	          Probing = true;
00343	        }
00344	      }
00345	    }
00346	    else
00347	    {
00348	      myRoot.CloseMenu(true);
00349	      UpdateMe = false;
00350	      //msg = xboxlive.GetLastError();
00351	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00352	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00353	      msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00354	      msgbox.OnButtonClick=MsgBoxBtnClicked;
00355	      msgbox.InitBox(160, 130, 16, 16, 320, 230);
00356	    }
00357	  }
00358	}
00359	
00360	function ProcessProbe()
00361	{
00362	  local XboxLiveManager.XBL_MESSAGES msg;
00363	  local int i, count, bestIndex, bestQOS, qos, msg2;
00364	  if (!xboxlive.OptimatchIsProbing())
00365	  {
00366	    myRoot.CloseMenu(true);
00367	    probing = false;
00368	    bestIndex = 0;
00369	    bestQOS = 100;
00370	    count = xboxlive.OptimatchGetResultCount();
00371	    for (i=0; i<count; i++)
00372	    {
00373	      qos = xboxlive.OptimatchGetQoS(i);
00374	      if (qos < bestQOS)
00375	      {
00376	        bestIndex = i;
00377	        bestQOS = qos;
00378	      }
00379	    }
00380	    // Ok, join the bestIndex game! (best QoS)
00381	    if (!xboxlive.OptimatchJoinSession(bestIndex))
00382	    {
00383	      msg2 = xboxlive.GetLastError();
00384	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00385	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00386	      msgbox.SetupQuestion(failedToJoinString, QBTN_Ok, QBTN_Ok);
00387	      msgbox.OnButtonClick=MsgBoxBtnClicked;
00388	      msgbox.InitBox(160, 130, 16, 16, 320, 230);
00389	    }
00390	    else
00391	    {
00392	      starttime = GetPlayerOwner().Level.TimeSeconds;
00393	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00394	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00395	      msgbox.ShowWorking=true;
00396	      msgbox.SetupQuestion(pleaseWaitString, QBTN_Cancel, QBTN_Cancel, connectingString);
00397	      msgbox.OnButtonClick=MsgBoxBtnClicked;
00398	      msgbox.InitBox(160, 130, 16, 16, 320, 230);
00399	      ConnectingToGame = true;
00400	    }
00401	  }
00402	  else
00403	  {
00404	    msg = xboxlive.OptimatchProcessQuery();
00405	    if (msg != XBLE_NONE && msg != XBLE_RUNNING)
00406	    {
00407	      // Probe failed!
00408	      probing = false;
00409	      myRoot.CloseMenu(true);
00410	      myRoot.CloseMenu(true);
00411	    }
00412	  }
00413	}
00414	
00415	function ProcessConnect()
00416	{
00417	  local int msg;
00418	  local string URL;
00419	  local XIIIMenuLiveJoinMsgBox JoinMsgbox;
00420	  local string MyClass, SkinCode;
00421		local int i;
00422	
00423	  if (xboxlive.OptimatchJoinIsFinished() && (GetPlayerOwner().Level.TimeSeconds - starttime)>2.0)
00424	  {
00425	    ConnectingToGame = false;
00426	    // Connect to URL
00427	    URL = xboxlive.OptimatchGetURL();
00428	    myRoot.CloseMenu(true);
00429	
00430	    BackFromJoin=1;
00431	    AutoLoginName=xboxlive.GetCurrentUser();
00432	    BackFromJoinNotNow=true;
00433	
00434	    Controller.OpenMenu("XIDInterf.XIIIMenuLiveJoinMsgBox");
00435	    JoinMsgbox = XIIIMenuLiveJoinMsgBox(myRoot.ActivePage);
00436	    JoinMsgbox.InitBox(220*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 220*fRatioX, 230*fRatioY*fScaleTo);//, true);
00437	    JoinMsgbox.MsgBoxStatus = 100;
00438	    JoinMsgbox.URL = URL;//$"?SK="$SkinCode;
00439	  }
00440	  else
00441	  {
00442	    msg = xboxlive.GetLastError();
00443	    if (msg == 0) // Still waiting?
00444	      return;
00445	
00446	    // Error!
00447	    myRoot.CloseMenu(true);
00448	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00449	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00450	    msgbox.SetupQuestion(failedToJoinString, QBTN_Ok, QBTN_Ok);
00451	    msgbox.OnButtonClick=MsgBoxBtnClicked;
00452	    msgbox.InitBox(120, 130, 16, 16, 400, 230);
00453	    ConnectingToGame = false;
00454	  }
00455	}
00456	
00457	event Tick(float deltatime)
00458	{
00459	  if (BackFromJoin==1 && !BackFromJoinNotNow)
00460	  {
00461	    BackFromJoin=0;
00462	    BackFromJoinNotNow=false;
00463		  myRoot.CloseMenu(true);
00464	    myRoot.CloseMenu(true);
00465	    myRoot.CloseMenu(true);
00466	    Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow", true);
00467	    XIIIMenuLiveAccountWindow(myRoot.ActivePage).AutoLoginUser = AutoLoginName;
00468	    return;
00469	  }
00470	}
00471	
00472	function Paint(Canvas C, float X, float Y)
00473	{
00474	  if (UpdateStats)
00475	    ProcessStats();
00476	
00477	  if (UpdateMe)
00478	    Process();
00479	
00480	  if (ConnectingToGame)
00481	    ProcessConnect();
00482	
00483	  if (Probing)
00484	    ProcessProbe();
00485	
00486	  Super.Paint(C, X, Y);
00487	  PaintStandardBackground(C, X, Y, TitleText);
00488	}
00489	
00490	// if subclassed, this parent function must always be called first
00491	function string GetPageParameters()
00492	{
00493	    return Super.GetPageParameters()$"?BackFromJoin="$BackFromJoin$"?AutoLoginName="$xboxlive.ConvertString(AutoLoginName);
00494	}
00495	
00496	// if GetPageParameters() is subclassed, you'd better have this one too !
00497	function SetPageParameters(string PageParameters)
00498	{
00499	    log("SetPageParameters("$PageParameters$") called for "$self);
00500	
00501	    BackFromJoin = int(localParseOption(PageParameters, "BackFromJoin", ""));
00502	    AutoLoginName = xboxlive.UnconvertString((localParseOption(PageParameters, "AutoLoginName", "")));
00503	}
00504	
00505	// Called when a button is clicked
00506	function bool InternalOnClick(GUIComponent Sender)
00507	{
00508	    //local int i,sel,msg;
00509	    if (ConnectingToGame)
00510	      return true;
00511	
00512	    /*
00513	    sel = listbox.list.Index;
00514	
00515	    if (sel >= 0 && sel < listbox.list.Elements.length)
00516	    {
00517	      if (!xboxlive.OptimatchJoinSession(sel))
00518	      {
00519	        msg = xboxlive.GetLastError();
00520	        Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00521	        msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00522	        msgbox.SetupQuestion(xboxlive.GetErrorString(msg), QBTN_Ok, QBTN_Ok);
00523	        msgbox.OnButtonClick=MsgBoxBtnClicked;
00524	        msgbox.InitBox(120*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 400*fRatioX, 230*fRatioY*fScaleTo);
00525	      }
00526	      else
00527	      {
00528	        starttime = GetPlayerOwner().Level.TimeSeconds;
00529	        Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00530	        msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00531	        msgbox.SetupQuestion(pleaseWaitString, 0, 0, "Connecting");
00532	        msgbox.OnButtonClick=MsgBoxBtnClicked;
00533	        msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00534	        ConnectingToGame = true;
00535	      }
00536	    }
00537	    */
00538	    return true;
00539	}
00540	
00541	function MsgBoxBtnClickedPlay(byte bButton)
00542	{
00543	  switch (bButton)
00544	  {
00545	    case QBTN_Ok:
00546	      Start();
00547	    break;
00548	    case QBTN_Cancel:
00549		    myRoot.CloseMenu(true);
00550	    break;
00551	  }
00552	}
00553	
00554	function MsgBoxBtnClicked(byte bButton)
00555	{
00556	  switch (bButton)
00557	  {
00558	    case QBTN_Ok:
00559	      if (updateMe || probing)
00560	      {
00561		      xboxlive.OptimatchCancelQuery();
00562		      myRoot.CloseMenu(true);
00563		    }
00564	      /*log("[XIIILiveMsgBox] Ok pressed");
00565	      xboxlive.ShutdownAndCleanup();
00566		    myRoot.CloseMenu(true);
00567	      Controller.ReplaceMenu("XIDInterf.XIIIMenuLiveAccountWindow");
00568	      */
00569	    break;
00570	    case QBTN_Cancel:
00571	      xboxlive.OptimatchCancelQuery();
00572		    myRoot.CloseMenu(true);
00573	    break;
00574	  }
00575	  //log("msgbox clicked: "$bButton);
00576	}
00577	
00578	function MsgBoxBtnClickedStats(byte bButton)
00579	{
00580	  switch (bButton)
00581	  {
00582	    case QBTN_Cancel:
00583		    myRoot.CloseMenu(true);
00584	    break;
00585	  }
00586	}
00587	
00588	function MsgBoxBtnClickedError(byte bButton)
00589	{
00590	  switch (bButton)
00591	  {
00592	    case QBTN_Ok:
00593	      myRoot.CloseMenu(true);
00594	    break;
00595	  }
00596	}
00597	
00598	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00599	{
00600	  local int msg;
00601	    if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat
00602	    {
00603	      if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
00604		    {
00605	          //Controller.FocusedControl.OnClick(Self);
00606	          InternalOnClick(Controller.FocusedControl);
00607	          return true;
00608		    }
00609		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
00610		    {
00611		        xboxlive.OptimatchCancelQuery();
00612		        myRoot.CloseMenu(true);
00613	    	    return true;
00614		    }
00615	    }
00616	    return super.InternalOnKeyEvent(Key, state, delta);
00617	}
00618	
00619	
00620	

End Source Code