## XIDInterf
Class XIIIMenuLivePlayerMenuSelectedGamerTag

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

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

Direct Known Subclasses:None

class XIIIMenuLivePlayerMenuSelectedGamerTag
extends XIDInterf.XIIILiveWindow

Variables
`string` | `ButtonNames[6]`
`XIIIGUIButton` | `Buttons[6]`
`string` | `TitleText`
`XboxLiveManager.FRIEND_PACKET` | `activeFriend`
`string` | `activeFriendName`
`XIIILiveMsgBox` | `msgbox`
`int` | `popupStatus`
`strBlockFriendRequestQuestion,` | `strKickPlayerQuestion`

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` | `ReturnMsgBox(byte bButton)`
`void` | `ShowWindow()`

Source Code

    00001	class XIIIMenuLivePlayerMenuSelectedGamerTag extends XIIILiveWindow;
    00002
    00003	var localized string TitleText;
    00004
    00005	var XIIIGUIButton Buttons[6];
    00006	var localized string ButtonNames[6];
    00007	var localized string strTitle, strVoiceOn, strVoiceMuted, strAcceptFriendRequestQuestion, strDeclineFriendRequestQuestion, strBlockFriendRequestQuestion, strKickPlayerQuestion;
    00008
    00009	var XboxLiveManager.FRIEND_PACKET activeFriend;
    00010	var string                        activeFriendName;
    00011
    00012	var XIIILiveMsgBox msgbox;
    00013	var int popupStatus;
    00014
    00015
    00016	enum eVoiceStatus
    00017	{
    00018	  VOICESTATUS_voiceon,
    00019	  VOICESTATUS_voicemuted,
    00020	  VOICESTATUS_voicetv,
    00021	  VOICESTATUS_voicenone,
    00022	};
    00023
    00024
    00025
    00026	function Created()
    00027	{
    00028	  local int i;
    00029	     Super.Created();
    00030
    00031	}
    00032
    00033
    00034	function InitComponent(GUIController MyController,GUIComponent MyOwner)
    00035	{
    00036	  Super.InitComponent(MyController, MyOwner);
    00037
    00038		Buttons[0] = XIIIGUIButton(Controls[0]);
    00039		Buttons[0].Caption = ButtonNames[0];
    00040		Buttons[1] = XIIIGUIButton(Controls[1]);
    00041		Buttons[1].Caption = ButtonNames[1];
    00042		Buttons[2] = XIIIGUIButton(Controls[2]);
    00043		Buttons[2].Caption = ButtonNames[2];
    00044		Buttons[3] = XIIIGUIButton(Controls[3]);
    00045		Buttons[3].Caption = ButtonNames[3];
    00046		Buttons[4] = XIIIGUIButton(Controls[4]);
    00047		Buttons[4].Caption = ButtonNames[4];
    00048		Buttons[5] = XIIIGUIButton(Controls[5]);
    00049		Buttons[5].Caption = ButtonNames[5];
    00050
    00051		OnClick = InternalOnClick;
    00052	}
    00053
    00054
    00055	function ShowWindow()
    00056	{
    00057	  OnMenu = 0; myRoot.bFired = false;
    00058	  Super.ShowWindow();
    00059	  bShowBCK = true;
    00060	  bShowRUN = false;
    00061	  bShowSEL = true;
    00062
    00063	  activeFriend = xboxlive.GetActiveFriend();
    00064	  activeFriendName = xboxlive.GetActiveFriendName();
    00065	  TitleText = activeFriendName;
    00066
    00067	//  ButtonNames(0)="Send a game invitation"
    00068	//  ButtonNames(1)="Remove friend"
    00069	//  ButtonNames(2)="Join"
    00070
    00071	/* Should not happen!
    00072	  if ( (activeFriend.onlineStatusFlags & xboxlive.XONLINE_FRIENDSTATE_FLAG_RECEIVEDREQUEST) != 0 )
    00073	  {
    00074	    Buttons[0].bVisible=true;
    00075	    Buttons[1].bVisible=true;
    00076	    Buttons[2].bVisible=true;
    00077	    SetFocus(Buttons[0]);
    00078	    Buttons[0].SetFocus(none);
    00079	  }
    00080	  else
    00081	  {
    00082	    Buttons[0].bVisible=false;
    00083	    Buttons[1].bVisible=false;
    00084	    Buttons[2].bVisible=false;
    00085	    SetFocus(Buttons[3]);
    00086	    Buttons[3].SetFocus(none);
    00087	  }
    00088	*/
    00089	  if (xboxlive.IsHost() && xboxlive.IsPlayerNameInGame(activeFriendName))
    00090	    Buttons[4].bVisible=true;
    00091	  else
    00092	    Buttons[4].bVisible=false;
    00093
    00094	  if (xboxlive.IsFriend(activeFriendName))
    00095	    Buttons[5].bVisible=false;
    00096	  else
    00097	    Buttons[5].bVisible=true;
    00098
    00099	  if (activeFriend.voiceStatus == eVoiceStatus.VOICESTATUS_voicemuted)
    00100	    Buttons[3].Caption = strVoiceMuted;//"Voice is muted";
    00101	  else
    00102	    Buttons[3].Caption = strVoiceOn;//Voice is on;
    00103	}
    00104
    00105
    00106	function Paint(Canvas C, float X, float Y)
    00107	{
    00108	     Super.Paint(C, X, Y);
    00109	  PaintStandardBackground(C, X, Y, TitleText);
    00110	}
    00111
    00112	function ReturnMsgBox(byte bButton)
    00113	{
    00114	  switch (bButton)
    00115	  {
    00116	    case QBTN_Ok:
    00117
    00118	      if (popupStatus == 1)
    00119	      {
    00120	        xboxlive.AcceptFriendRequest(activeFriendName);
    00121	        myRoot.CloseMenu(true);
    00122	      }
    00123	      else if (popupStatus == 2)
    00124	      {
    00125	        xboxlive.DeclineFriendRequest(activeFriendName);
    00126	        myRoot.CloseMenu(true);
    00127	      }
    00128	      else if (popupStatus == 3)
    00129	      {
    00130	        xboxlive.BlockFriendRequest(activeFriendName);
    00131	        myRoot.CloseMenu(true);
    00132	      }
    00133	      else if (popupStatus == 3)
    00134	      {
    00135	        xboxlive.Kick(activeFriendName);
    00136	        myRoot.CloseMenu(true);
    00137	      }
    00138
    00139	      popupStatus = 0;
    00140	      return;
    00141
    00142	    break;
    00143
    00144	    case QBTN_Cancel:
    00145	      popupStatus = 0;
    00146	    break;
    00147
    00148	  }
    00149	}
    00150
    00151	// Called when a button is clicked
    00152	function bool InternalOnClick(GUIComponent Sender)
    00153	{
    00154	    local int i;
    00155	    if (Sender == Controls[0])
    00156	    {
    00157	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00158	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00159	      msgbox.SetupQuestion(strAcceptFriendRequestQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
    00160	      msgbox.OnButtonClick=ReturnMsgBox;
    00161	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00162
    00163	      popupStatus = 1;
    00164	//      xboxlive.AcceptFriendRequest(activeFriendName);
    00165	//      myRoot.CloseMenu(true);
    00166	      return true;
    00167	    }
    00168	    else if (Sender == Controls[1])
    00169	    {
    00170	      // decline friend request
    00171	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00172	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00173	      msgbox.SetupQuestion(strDeclineFriendRequestQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
    00174	      msgbox.OnButtonClick=ReturnMsgBox;
    00175	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00176
    00177	      popupStatus = 2;
    00178
    00179	//      xboxlive.DeclineFriendRequest(activeFriendName);
    00180	//      myRoot.CloseMenu(true);
    00181	      return true;
    00182	    }
    00183	    else if (Sender == Controls[2])
    00184	    {
    00185	      // No more requests from him
    00186	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00187	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00188	      msgbox.SetupQuestion(strBlockFriendRequestQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
    00189	      msgbox.OnButtonClick=ReturnMsgBox;
    00190	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00191
    00192	      popupStatus = 3;
    00193
    00194	      //xboxlive.BlockFriendRequest(activeFriendName);
    00195	      //myRoot.CloseMenu(true);
    00196	      return true;
    00197	    }
    00198	    else if (Sender == Controls[3])
    00199	    {
    00200	      if (activeFriend.voiceStatus == eVoiceStatus.VOICESTATUS_voicemuted)
    00201	      {
    00202	        xboxlive.SetPlayerVoiceStatus(activeFriendName, false);
    00203	        xboxlive.RemovePlayerFromMuteListByName(activeFriendName);
    00204	        activeFriend.voiceStatus = eVoiceStatus.VOICESTATUS_voiceon;
    00205	        Buttons[3].Caption = strVoiceOn;//Voice is on;
    00206	      }
    00207	      else
    00208	      {
    00209	        xboxlive.SetPlayerVoiceStatus(activeFriendName, true);
    00210	        xboxlive.AddPlayerToMuteListByName(activeFriendName);
    00211	        activeFriend.voiceStatus = eVoiceStatus.VOICESTATUS_voicemuted;
    00212	        Buttons[3].Caption = strVoiceMuted;//"Voice is muted";
    00213	      }
    00214
    00215	    }
    00216	    else if (Sender == Controls[4])
    00217	    {
    00218	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
    00219	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
    00220	      msgbox.SetupQuestion(strKickPlayerQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
    00221	      msgbox.OnButtonClick=ReturnMsgBox;
    00222	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
    00223
    00224	      popupStatus = 4;
    00225
    00226	      //xboxlive.Kick(activeFriendName);
    00227	    }
    00228	    else if (Sender == Controls[5])
    00229	    {
    00230	      //xboxlive.SetActiveFriend(friendsList[listbox.list.Index].name);
    00231	      myRoot.OpenMenu("XIDInterf.XIIIMenuLiveFeedback");
    00232	      return true;
    00233	    }
    00234
    00235	    return true;
    00236	}
    00237
    00238
    00239	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00240	{
    00241	    if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat
    00242	    {
    00243	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
    00244		    {
    00245
//Controller.FocusedControl.OnClick(Self); 00246 InternalOnClick(Controller.FocusedControl); 00247 return true; 00248 } 00249 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 00250 { 00251 myRoot.CloseMenu(true); 00252 return true; 00253 } 00254 if (Key==0x25/*IK_Left*/) 00255 { 00256 return true; 00257 } 00258 if (Key==0x27/*IK_Right*/) 00259 { 00260 return true; 00261 } 00262 } 00263 return super.InternalOnKeyEvent(Key, state, delta); 00264 } 00265 00266 00267

End Source Code