## XIDInterf
Class XIIIMenuLivePassword

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

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

Direct Known Subclasses:None

class XIIIMenuLivePassword
extends XIDInterf.XIIILiveWindow

Variables
`XIIIGUIButton` | `Buttons[4]`
`string` | `TitleText`
`sound` | `hMenuCurseur`
`int` | `id`
`XboxLiveManager.ePasscodeSymbol` | `passcode[4]`
`string` | `wrongPasscodeString`

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` | `Paint(Canvas C, float X, float Y)`
`void` | `PasscodeComplete()`
`void` | `ShowWindow()`

Source Code

    00001	class XIIIMenuLivePassword extends XIIILiveWindow;
    00002
    00003	var localized string TitleText;
    00004
    00005	var XIIIGUIButton Buttons[4];
    00006	var int id;
    00007	var sound hMenuCurseur;
    00008
    00009	var XboxLiveManager.ePasscodeSymbol passcode[4];
    00010	var localized string wrongPasscodeString;
    00011
    00012	function Created()
    00013	{
    00014	  local int i;
    00015	     Super.Created();
    00016	}
    00017
    00018
    00019	function InitComponent(GUIController MyController,GUIComponent MyOwner)
    00020	{
    00021	  /*
    00022	  local GUILabel label;
    00023	  label = GUILabel(CreateControl(class'GUILabel', 150, 100, 250, 20));
    00024	  label.caption = "Test";
    00025	  label.StyleName="SquareButton";
    00026	  controls[4] = label;
    00027	  focusedControl = controls[4];
    00028	  label = GUILabel(CreateControl(class'GUILabel', 150, 130, 250, 20));
    00029	  label.caption = "Test2";
    00030	  label.StyleName="SquareButton";
    00031	  controls[5] = label;
    00032	  */
    00033
    00034	  Super.InitComponent(MyController, MyOwner);
    00035
    00036		Buttons[0] = XIIIGUIButton(Controls[0]);
    00037		Buttons[0].Caption = "_";
    00038		Buttons[0].bNeverFocus=true;
    00039		Buttons[1] = XIIIGUIButton(Controls[1]);
    00040		Buttons[1].Caption = "_";
    00041		Buttons[1].bNeverFocus=true;
    00042		Buttons[2] = XIIIGUIButton(Controls[2]);
    00043		Buttons[2].Caption = "_";
    00044		Buttons[2].bNeverFocus=true;
    00045		Buttons[3] = XIIIGUIButton(Controls[3]);
    00046		Buttons[3].Caption = "_";
    00047		Buttons[3].bNeverFocus=true;
    00048
    00049		//btn = new class'GUILabel';
    00050		//btn.StyleName="SquareButton";
    00051		//btn.InitComponent(Controller, MenuOwner);
    00052		//btn.InitComponent(MyController, MyOwner);
    00053		//Controls[Controls.Length] = btn;
    00054		//Buttons[Buttons.Length] = btn;
    00055		//btn.Caption = "Test";//ButtonNames[Clamp(idesc,0,7)];
    00056		//btn.OnClick = ButtonClick;
    00057		//btn.Tag = 1 << idesc;
    00058
    00059	  //listbox.StyleName = "Listbox";
    00060	  //listbox.List.Add("Hello");
    00061	  //listbox.List.Add("World");
    00062	  //listbox.List.ItemsPerPage = 5;
    00063	  //Controls[0]=listbox;
    00064
    00065
    00066
    00067
    00068
    00069
    00070		OnClick = InternalOnClick;
    00071	}
    00072
    00073
    00074	function ShowWindow()
    00075	{
    00076	     OnMenu = 0; myRoot.bFired = false;
    00077	     Super.ShowWindow();
    00078	     bShowBCK = true;
    00079	     bShowRUN = false;
    00080	     bShowSEL = false;
    00081	}
    00082
    00083
    00084	function Paint(Canvas C, float X, float Y)
    00085	{
    00086	  Super.Paint(C, X, Y);
    00087	  PaintStandardBackground(C, X, Y, TitleText);
    00088	}
    00089
    00090
    00091	// Called when a button is clicked
    00092	function bool InternalOnClick(GUIComponent Sender)
    00093	{
    00094	    /*local int i;
    00095	    if (Sender == Controls[0])
    00096	    {
    00097	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveJoinStartWindow");
    00098	    }
    00099	    */
    00100	    return true;
    00101	}
    00102
    00103	function PasscodeComplete()
    00104	{
    00105	  if (xboxlive.IsPasscodeCorrect(xboxlive.GetCurrentUser(), passcode))
    00106	  {
    00107	    Controller.OpenMenu("XIDInterf.XIIIMenuLiveLoginWait",true);
    00108	  }
    00109	  else
    00110	  {
    00111	    //myRoot.CloseMenu(true);
    00112	    Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",true);
    00113	    msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00114	    msgbox.SetupQuestion(wrongPasscodeString, QBTN_Ok, QBTN_Ok);
    00115	    msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00116	    //Controller.OpenMenu("XIDInterf.XIIIMenuLiveLoginWait",true);
    00117
    00118	    //Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
    00119	    //msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00120	    //msgbox.SetupQuestion("Wrong Passcode!", QBTN_Retry | QBTN_Cancel, QBTN_Retry);
    00121	    //Controller.OpenMenu("XIDInterf.XIIIMenuLiveLoginWait",true);
    00122	  }
    00123	}
    00124
    00125	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00126	{
    00127	    //GUILabel(controls[4]).caption = "InternalOnKeyEvent: "@string(int(Key));
    00128	    //GUILabel(controls[5]).caption = "InternalOnKeyEvent: "@string(int(State));
    00129	    if (state==3)// Unpress // to avoid auto-repeat (Can't have it on press since the GUI thing overrides it for some reason)
    00130	    {
    00131	      Log("InternalOnKeyEvent: "@Key);
    00132	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
    00133		    {
    00134	          //Controller.FocusedControl.OnClick(Self);
    00135	          InternalOnClick(Controller.FocusedControl);
    00136	          return true;
    00137		    }
    00138
    00139		    // X = 202
    00140		    // Y = 203
    00141		    // LT = 206
    00142		    // RT = 207
    00143		    // WH = 205
    00144		    // BL = 204
    00145		    // DL = 37
    00146		    // DR = 39
    00147		    // DU = 38
    00148		    // DD = 40
    00149
    00150
    00151		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
    00152		    {
    00153		        myRoot.CloseMenu(true);
    00154	    	    return true;
    00155		    }
    00156
    00157		    if (Key==202) // X-Button
    00158		    {
    00159		      if (id<4)
    00160		      {
    00161	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00162		        Buttons[id].Caption = "X";
    00163		        Buttons[id].MenuState = MSAT_Blurry;
    00164		        passcode[id] = PS_GAMEPAD_X;
    00165		      }
    00166		      id++;
    00167		      if (id<4)
    00168		      {
    00169		        Buttons[id].Caption = "_";
    00170		        Buttons[id].MenuState = MSAT_Focused;
    00171		      }
    00172		      else
    00173		      {
    00174	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00175		        PasscodeComplete();
    00176		      }
    00177	    	  return true;
    00178		    }
    00179		    if (Key==203) // Y-Button
    00180		    {
    00181		      if (id<4)
    00182		      {
    00183	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00184		        Buttons[id].Caption = "X";
    00185		        Buttons[id].MenuState = MSAT_Blurry;
    00186		        passcode[id] = PS_GAMEPAD_Y;
    00187		      }
    00188		      id++;
    00189		      if (id<4)
    00190		      {
    00191		        Buttons[id].Caption = "_";
    00192		        Buttons[id].MenuState = MSAT_Focused;
    00193		      }
    00194		      else
    00195		      {
    00196	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00197		        PasscodeComplete();
    00198		      }
    00199	    	  return true;
    00200		    }
    00201		    if (Key==206) // Left Trigger
    00202		    {
    00203		      if (id<4)
    00204		      {
    00205	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00206		        Buttons[id].Caption = "X";
    00207		        Buttons[id].MenuState = MSAT_Blurry;
    00208		        passcode[id] = PS_GAMEPAD_LEFT_TRIGGER;
    00209		      }
    00210		      id++;
    00211		      if (id<4)
    00212		      {
    00213		        Buttons[id].Caption = "_";
    00214		        Buttons[id].MenuState = MSAT_Focused;
    00215		      }
    00216		      else
    00217		      {
    00218	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00219		        PasscodeComplete();
    00220		      }
    00221	    	  return true;
    00222		    }
    00223		    if (Key==207) // Right Trigger
    00224		    {
    00225		      if (id<4)
    00226		      {
    00227	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00228		        Buttons[id].Caption = "X";
    00229		        Buttons[id].MenuState = MSAT_Blurry;
    00230		        passcode[id] = PS_GAMEPAD_RIGHT_TRIGGER;
    00231		      }
    00232		      id++;
    00233		      if (id<4)
    00234		      {
    00235		        Buttons[id].Caption = "_";
    00236		        Buttons[id].MenuState = MSAT_Focused;
    00237		      }
    00238		      else
    00239		      {
    00240	          myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur);
    00241		        PasscodeComplete();
    00242		      }
    00243	    	  return true;
    00244		    }
    00245
00246 if (Key==0x25/*IK_Left*/) 00247 { 00248 if (id<4) 00249 { 00250 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00251 Buttons[id].Caption = "X"; 00252 Buttons[id].MenuState = MSAT_Blurry; 00253 passcode[id] = PS_DPAD_LEFT; 00254 } 00255 id++; 00256 if (id<4) 00257 { 00258 Buttons[id].Caption = "_"; 00259 Buttons[id].MenuState = MSAT_Focused; 00260 } 00261 else 00262 { 00263 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00264 PasscodeComplete(); 00265 } 00266 return true; 00267 } 00268 if (Key==0x27/*IK_Right*/) 00269 { 00270 if (id<4) 00271 { 00272 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00273 Buttons[id].Caption = "X"; 00274 Buttons[id].MenuState = MSAT_Blurry; 00275 passcode[id] = PS_DPAD_RIGHT; 00276 } 00277 id++; 00278 if (id<4) 00279 { 00280 Buttons[id].Caption = "_"; 00281 Buttons[id].MenuState = MSAT_Focused; 00282 } 00283 else 00284 { 00285 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00286 PasscodeComplete(); 00287 } 00288 return true; 00289 } 00290 if (Key==0x26/*IK_Up*/) 00291 { 00292 if (id<4) 00293 { 00294 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00295 Buttons[id].Caption = "X"; 00296 Buttons[id].MenuState = MSAT_Blurry; 00297 passcode[id] = PS_DPAD_UP; 00298 } 00299 id++; 00300 if (id<4) 00301 { 00302 Buttons[id].Caption = "_"; 00303 Buttons[id].MenuState = MSAT_Focused; 00304 } 00305 else 00306 { 00307 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00308 PasscodeComplete(); 00309 } 00310 return true; 00311 } 00312 if (Key==0x28/*IK_Down*/) 00313 { 00314 if (id<4) 00315 { 00316 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00317 Buttons[id].Caption = "X"; 00318 Buttons[id].MenuState = MSAT_Blurry; 00319 passcode[id] = PS_DPAD_DOWN; 00320 } 00321 id++; 00322 if (id<4) 00323 { 00324 Buttons[id].Caption = "_"; 00325 Buttons[id].MenuState = MSAT_Focused; 00326 } 00327 else 00328 { 00329 myRoot.GetPlayerOwner().PlayMenu(hMenuCurseur); 00330 PasscodeComplete(); 00331 } 00332 return true; 00333 } 00334 } 00335 return super.InternalOnKeyEvent(Key, state, delta); 00336 } 00337 00338 00339

End Source Code