## XIDInterf
Class XIIIMenuLiveLoginWait

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

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

Direct Known Subclasses:None

class XIIIMenuLiveLoginWait
extends XIDInterf.XIIILiveWindow

Variables
`string` | `TitleText`
`bool` | `loggingIn`
`mustManageAccount,` | `mustLookAtMessage`
`int` | `popupStatus`
`serverBusyString,` | `strInvalidUser`
`XIIILiveMsgBox` | `waitbox`

Function Summary
`void` | `Created()`
`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` | `LoginUser()`
`void` | `MsgBoxBtnClicked(byte bButton)`
`void` | `MsgBoxClickedTroubleshooting(byte bButton)`
`void` | `MsgBoxRetryBtnClicked(byte bButton)`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `Process()`
`void` | `ReturnMsgBox(byte bButton)`
`void` | `ShowWindow()`
`void` | `WaitBoxBtnClicked(byte bButton)`

Source Code

    00001	class XIIIMenuLiveLoginWait extends XIIILiveWindow;
    00002
    00003	var localized string TitleText;
    00004
    00005	var bool loggingIn;
    00006	var bool mustUpdateXBE, mustManageAccount, mustLookAtMessage;
    00007	var localized string failedToLoginString, strMustUpdateXBE, strManageAccount, strLookAtMessage, serverBusyString, strInvalidUser;
    00008
    00009	var XIIILiveMsgBox waitbox;
    00010	var int popupStatus;
    00011
    00012
    00013	function Created()
    00014	{
    00015	  local int i;
    00016	     Super.Created();
    00017
    00018	   OnReOpen = InternalOnOpen;
    00019		//bRequiresTick=On;
    00020	}
    00021
    00022
    00023	function Process()
    00024	{
    00025	  local int userState;
    00026	  local int errorCode;
    00027
    00028	  if (xboxlive != none)
    00029	  {
    00030	    if (xboxlive.IsLoggedIn(xboxlive.GetCurrentUser()))
    00031	    {
    00032	      if (waitbox != none)
    00033	      {
    00034	        myRoot.CloseMenu(true);
    00035	        waitbox = none;
    00036	      }
    00037	      userState = xboxlive.US_ONLINE;
    00038	      //if (xboxlive.HasUserVoice(xboxlive.GetCurrentUser()))
    00039	      //  userState = userState | xboxlive.US_VOICE;
    00040	      xboxlive.SetUserState(xboxlive.GetCurrentUser(), userState);
    00041
    00042	      if (xboxlive.IsJoiningAfterBoot())
    00043	      {
    00044	        xboxlive.SetActiveFriend(xboxlive.GetFriendInviterAfterBoot());
    00045	        Controller.OpenMenu("XIDInterf.XIIIMenuLiveMainWindow",true);
    00046	        Controller.OpenMenu("XIDInterf.XIIIMenuLiveJoinFriendWindow");
    00047	      }
    00048	      else
    00049	      {
    00050	        Controller.OpenMenu("XIDInterf.XIIIMenuLiveMainWindow",true);
    00051	      }
    00052	    }
    00053	    else
    00054	    {    //native static final function bool          BootToUpdateXBE();
    00055	      if (xboxlive.ErrorLoggingIn(xboxlive.GetCurrentUser()))
    00056	      {
    00057	        if (waitbox != none)
    00058	        {
    00059	          myRoot.CloseMenu(true);
    00060	          waitbox = none;
    00061	        }
    00062	        fRatioY  = 1.0;
    00063	        fScaleTo = 1.0;
    00064	        fRatioX  = 1.0;
    00065	        errorCode = xboxlive.GetLastError();
    00066	        if (errorCode == 20) // DAMN script language! XBLE_LOGON_UPDATE_REQUIRED)
    00067	        {
    00068	          mustUpdateXBE = true;
    00069	          loggingIn = false;
    00070
    00071	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00072	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00073	          msgbox.SetupQuestion(strMustUpdateXBE, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, "");
    00074	          msgbox.OnButtonClick=ReturnMsgBox;
    00075	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00076	          popupStatus = 1;
    00077	        }
    00078
    00079	        else if (errorCode == 21) // DAMN script language! XBLE_LOGON_SERVERS_TOO_BUSY)
    00080	        {
    00081	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00082	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00083	          msgbox.SetupQuestion(serverBusyString, QBTN_Ok|QBTN_Cancel, QBTN_Ok);
    00084	          msgbox.OnButtonClick=MsgBoxRetryBtnClicked;
    00085	          msgbox.InitBox(120, 130, 16, 16, 400, 230);
    00086	          popupStatus = 2;
    00087	        }
    00088
    00089	        else if (errorCode == 24) // DAMN script language! XBLE_LOGON_INVALID_USER)
    00090	        {
    00091	          mustManageAccount = true;
    00092	          loggingIn = false;
    00093
    00094	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00095	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00096	          msgbox.SetupQuestion(strInvalidUser, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, "");
    00097	          msgbox.OnButtonClick=ReturnMsgBox;
    00098	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00099	          popupStatus = 2;
    00100	        }
    00101
    00102	        else if (errorCode == 32) // DAMN script language! XBLE_LOGON_USER_ACCOUNT_REQUIRES_MANAGEMENT)
    00103	        {
    00104	          mustManageAccount = true;
    00105	          loggingIn = false;
    00106
    00107	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00108	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00109	          msgbox.SetupQuestion(strManageAccount, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, "");
    00110	          msgbox.OnButtonClick=ReturnMsgBox;
    00111	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00112	          popupStatus = 2;
    00113	        }
    00114
    00115	        else if (errorCode == 31) // DAMN script language! XBLE_LOGON_USER_HAS_MESSAGE)
    00116	        {
    00117	          mustLookAtMessage = true;
    00118	          loggingIn = false;
    00119
    00120	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00121	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00122	          msgbox.SetupQuestion(strLookAtMessage, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, "");
    00123	          msgbox.OnButtonClick=ReturnMsgBox;
    00124	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00125	          popupStatus = 3;
    00126	        }
    00127
    00128	        else
    00129	        {
    00130	          loggingIn = false;
    00131	          /*Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
    00132	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00133	          msgbox.SetupQuestion(failedToLoginString, QBTN_Ok, QBTN_Ok);
    00134	          msgbox.OnButtonClick=MsgBoxBtnClicked;
    00135	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00136	          */
    00137	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
    00138	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00139	          msgbox.SetupQuestion(networkTroubleShoot, QBTN_Ok | QBTN_Cancel, QBTN_Cancel);
    00140	          msgbox.OnButtonClick=MsgBoxClickedTroubleshooting;
    00141	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00142	        }
    00143	      }
    00144	        }
    00145	      }
    00146	    }
    00147
    00148	function MsgBoxClickedTroubleshooting(byte bButton)
    00149	{
    00150	  switch (bButton)
    00151	  {
    00152	    case QBTN_Ok:
    00153	        xboxlive.RebootToDashboard(xboxlive.dashboardPage.DASHBOARD_NETWORK_CONFIG);
    00154	        myRoot.CloseMenu(true);
    00155	    break;
    00156
    00157	    case QBTN_Cancel:
    00158	      xboxlive.ShutdownAndCleanup();
    00159	      myRoot.CloseMenu(true);
    00160	    break;
    00161	  }
    00162	}
    00163
    00164	function MsgBoxBtnClicked(byte bButton)
    00165	{
    00166	  switch (bButton)
    00167	  {
    00168	    case QBTN_Ok:
    00169	      xboxlive.ShutdownAndCleanup();
    00170		    myRoot.CloseMenu(true);
    00171	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow",true);
    00172	      xboxlive.GetNumberOfAccounts();
    00173	    break;
    00174	  }
    00175	  //log("msgbox clicked: "$bButton);
    00176	}
    00177
    00178	function MsgBoxRetryBtnClicked(byte bButton)
    00179	{
    00180	  switch (bButton)
    00181	  {
    00182	    case QBTN_Ok:
    00183	      LoginUser();
    00184	    break;
    00185	    case QBTN_Cancel:
    00186	      xboxlive.ShutdownAndCleanup();
    00187		    myRoot.CloseMenu(true);
    00188		    myRoot.CloseMenu(true);
    00189	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow",true);
    00190	    break;
    00191	  }
    00192	}
    00193
    00194	function WaitBoxBtnClicked(byte bButton)
    00195	{
    00196	  switch (bButton)
    00197	  {
    00198	    case QBTN_Cancel:
    00199	      xboxlive.ShutdownAndCleanup();
    00200		    myRoot.CloseMenu(true);
    00201	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow",true);
    00202	      xboxlive.GetNumberOfAccounts();
    00203	    break;
    00204	  }
    00205	  //log("msgbox clicked: "$bButton);
    00206	}
    00207
    00208	function LoginUser()
    00209	{
    00210	  local int msg;
    00211	  //Controller.CloseMenu(true);
    00212	  if (!xboxlive.StartLogin(xboxlive.GetCurrentUser()))
    00213	  {
    00214	    msg = xboxlive.GetLastError();
    00215	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
    00216	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00217	    if (msg == 21) // XBLE_LOGON_SERVERS_TOO_BUSY
    00218	    {
    00219	      msgbox.SetupQuestion(serverBusyString, QBTN_Ok|QBTN_Cancel, QBTN_Ok);
    00220	      msgbox.OnButtonClick=MsgBoxRetryBtnClicked;
    00221	    }
    00222	    else
    00223	    {
    00224	      myRoot.CloseMenu(true);
    00225	      //msgbox.SetupQuestion(failedToLoginString, QBTN_Ok, QBTN_Ok);
    00226	      //msgbox.OnButtonClick=MsgBoxBtnClicked;
    00227	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
    00228	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00229	      msgbox.SetupQuestion(networkTroubleShoot, QBTN_Ok | QBTN_Cancel, QBTN_Cancel);
    00230	      msgbox.OnButtonClick=MsgBoxClickedTroubleshooting;
    00231	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00232	    }
    00233	    msgbox.InitBox(120, 130, 16, 16, 400, 230);
    00234	  }
    00235	  else
    00236	  {
    00237	    //Controller.OpenMenu("XIDInterf.XIIIMenuLiveLoginWait");
    00238	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00239	    waitbox = XIIILiveMsgBox(myRoot.ActivePage);
    00240	    waitbox.ShowWorking=true;
    00241	    waitbox.SetupQuestion(pleaseWaitString, QBTN_Cancel, QBTN_Cancel, "");
    00242	    waitbox.InitBox(160, 130, 16, 16, 320, 230);
    00243	    waitbox.OnButtonClick=WaitBoxBtnClicked;
    00244	  }
    00245
} 00246 00247 function InitComponent(GUIController MyController,GUIComponent MyOwner) 00248 { 00249 local int msg; 00250 Super.InitComponent(MyController, MyOwner); 00251 OnClick = InternalOnClick; 00252 00253 LoginUser(); 00254 } 00255 00256 function ShowWindow() 00257 { 00258 OnMenu = 0; myRoot.bFired = false; 00259 Super.ShowWindow(); 00260 bShowBCK = true; 00261 bShowRUN = false; 00262 bShowSEL = false; 00263 } 00264 00265 00266 function Paint(Canvas C, float X, float Y) 00267 { 00268 if (myRoot.ActivePage == waitbox && loggingIn) 00269 Process(); 00270 00271 Super.Paint(C, X, Y); 00272 PaintStandardBackground(C, X, Y, TitleText); 00273 } 00274 00275 function ReturnMsgBox(byte bButton) 00276 { 00277 local int userState; 00278 00279 switch (bButton) 00280 { 00281 case QBTN_Ok: 00282 if (popupStatus == 1) 00283 { 00284 xboxlive.BootToUpdateXBE(); 00285 myRoot.CloseMenu(true); 00286 } 00287 else if (popupStatus == 2) 00288 { 00289 xboxlive.RebootToDashboard(xboxlive.dashboardPage.DASHBOARD_ACCOUNT_MANAGEMENT); 00290 myRoot.CloseMenu(true); 00291 } 00292 else if (popupStatus == 3) 00293 { 00294 xboxlive.RebootToDashboard(xboxlive.dashboardPage.DASHBOARD_MESSAGES); 00295 myRoot.CloseMenu(true); 00296 } 00297 popupStatus = 0; 00298 return; 00299 break; 00300 case QBTN_Cancel: // the cancel is the same for both mustManageAccount and mustUpdateXBE 00301 if (popupStatus == 3) 00302 { 00303 00304 userState = xboxlive.US_ONLINE; 00305 //if (xboxlive.HasUserVoice(xboxlive.GetCurrentUser())) 00306 // userState = userState | xboxlive.US_VOICE; 00307 xboxlive.SetUserState(xboxlive.GetCurrentUser(), userState); 00308 Controller.OpenMenu("XIDInterf.XIIIMenuLiveMainWindow",true); 00309 00310 } 00311 else 00312 { 00313 loggingIn = false; 00314 mustManageAccount = false; 00315 mustUpdateXBE = false; 00316 while (XIIIMenu(MyRoot.ActivePage) == none) 00317 myRoot.CloseMenu(true); 00318 } 00319 00320 popupStatus = 0; 00321 break; 00322 00323 } 00324 } 00325 00326 // Called when a button is clicked 00327 function bool InternalOnClick(GUIComponent Sender) 00328 { 00329 /* 00330 local int i; 00331 if (Sender == Controls[0]) 00332 { 00333 Controller.OpenMenu("XIDInterf.XIIIMenuLiveJoinStartWindow"); 00334 } 00335 return true; 00336 */ 00337 return true; 00338 } 00339 00340 00341 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00342 { 00343 if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat 00344 { 00345 if ((Key==0x0D/*IK_Enter*/) || (Key==0x01)) 00346 { 00347 //Controller.FocusedControl.OnClick(Self); 00348 InternalOnClick(Controller.FocusedControl); 00349 return true; 00350 } 00351 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 00352 { 00353 xboxlive.ShutdownAndCleanup(); 00354 myRoot.CloseMenu(true); 00355 myRoot.CloseMenu(true); 00356 return true; 00357 } 00358 if (Key==0x25/*IK_Left*/) 00359 { 00360 return true; 00361 } 00362 if (Key==0x27/*IK_Right*/) 00363 { 00364 return true; 00365 } 00366 } 00367 return super.InternalOnKeyEvent(Key, state, delta); 00368 } 00369 00370 00371

End Source Code