XIDInterf
Class XIIIMenuLivePlayerMenuSelectedGamerTagAlreadyFriend

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

class XIIIMenuLivePlayerMenuSelectedGamerTagAlreadyFriend
extends XIDInterf.XIIILiveWindow


Variables
 string ButtonNames[4]
 XIIIGUIButton Buttons[4]
 string TitleText
 XboxLiveManager.FRIEND_PACKET activeFriend
 string activeFriendName
 XIIILiveMsgBox msgbox
 int popupStatus
 strKickPlayerQuestion, strRemoveFriendQuestion


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

End Source Code