XIDInterf
Class XIIIMenuLivePlayerMenuSelectedGamerTagSentFriendRequest

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

class XIIIMenuLivePlayerMenuSelectedGamerTagSentFriendRequest
extends XIDInterf.XIIILiveWindow


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

End Source Code