XIDInterf
Class XIIIMenuLiveFriendsshipRequested

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

class XIIIMenuLiveFriendsshipRequested
extends XIDInterf.XIIILiveWindow


Variables
 string ButtonNames[3]
 XIIIGUIButton Buttons[3]
 string TitleText
 XboxLiveManager.FRIEND_PACKET activeFriend
 string activeFriendName
 XIIILiveMsgBox msgbox
 int popupStatus
 strDeclineFriendInviteQuestion, strBlockFriendQuestion


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 XIIIMenuLiveFriendsshipRequested extends XIIILiveWindow;
00002	
00003	var localized string TitleText;
00004	
00005	var XIIIGUIButton Buttons[3];
00006	var localized string ButtonNames[3];
00007	var localized string strFriendshipRequested, strAcceptFriendInviteQuestion, strDeclineFriendInviteQuestion, strBlockFriendQuestion;
00008	
00009	
00010	
00011	
00012	var XboxLiveManager.FRIEND_PACKET activeFriend;
00013	var string                        activeFriendName;
00014	
00015	var XIIILiveMsgBox msgbox;
00016	var int popupStatus;
00017	
00018	
00019	function Created()
00020	{
00021	  local int i;
00022	     Super.Created();
00023	
00024	}
00025	
00026	
00027	function InitComponent(GUIController MyController,GUIComponent MyOwner)
00028	{
00029	
00030	  Super.InitComponent(MyController, MyOwner);
00031	
00032		Buttons[0] = XIIIGUIButton(Controls[0]);
00033		Buttons[0].Caption = ButtonNames[0];
00034		Buttons[1] = XIIIGUIButton(Controls[1]);
00035		Buttons[1].Caption = ButtonNames[1];
00036		Buttons[2] = XIIIGUIButton(Controls[2]);
00037		Buttons[2].Caption = ButtonNames[2];
00038	
00039		OnClick = InternalOnClick;
00040	
00041	}
00042	
00043	
00044	function ShowWindow()
00045	{
00046	  OnMenu = 0; myRoot.bFired = false;
00047	  Super.ShowWindow();
00048	  bShowBCK = true;
00049	  bShowRUN = false;
00050	  bShowSEL = true;
00051	
00052	  activeFriend = xboxlive.GetActiveFriend();
00053	  activeFriendName = xboxlive.GetActiveFriendName();
00054	  TitleText = activeFriendName $ strFriendshipRequested;
00055	}
00056	
00057	
00058	function Paint(Canvas C, float X, float Y)
00059	{
00060	     Super.Paint(C, X, Y);
00061	  PaintStandardBackground(C, X, Y, TitleText);
00062	}
00063	
00064	function ReturnMsgBox(byte bButton)
00065	{
00066	  switch (bButton)
00067	  {
00068	    case QBTN_Ok:
00069	      if (popupStatus == 1)
00070	      {
00071	        xboxlive.AcceptFriendRequest(activeFriendName);
00072	        myRoot.CloseMenu(true);
00073	      }
00074	      else if (popupStatus == 2)
00075	      {
00076	        xboxlive.DeclineFriendRequest(activeFriendName);
00077	        myRoot.CloseMenu(true);
00078	      }
00079	      else if (popupStatus == 3)
00080	      {
00081	        xboxlive.BlockFriendRequest(activeFriendName);
00082	        myRoot.CloseMenu(true);
00083	      }
00084	      popupStatus = 0;
00085	      return;
00086	    break;
00087	
00088	    case QBTN_Cancel:
00089	      popupStatus = 0;
00090	    break;
00091	
00092	  }
00093	}
00094	
00095	// Called when a button is clicked
00096	function bool InternalOnClick(GUIComponent Sender)
00097	{
00098	    local int i;
00099	    if (Sender == Controls[0])
00100	    {
00101	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00102	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00103	      msgbox.SetupQuestion(strAcceptFriendInviteQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00104	      msgbox.OnButtonClick=ReturnMsgBox;
00105	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00106	
00107	      popupStatus=1;
00108	
00109	//      xboxlive.AcceptFriendRequest(activeFriendName);
00110	//      myRoot.CloseMenu(true);
00111	      return true;
00112	    }
00113	    else if (Sender == Controls[1])
00114	    {
00115	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00116	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00117	      msgbox.SetupQuestion(strDeclineFriendInviteQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00118	      msgbox.OnButtonClick=ReturnMsgBox;
00119	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00120	
00121	      popupStatus=2;
00122	
00123	//      xboxlive.DeclineFriendRequest(activeFriendName);
00124	//      myRoot.CloseMenu(true);
00125	      return true;
00126	    }
00127	    else if (Sender == Controls[2])
00128	    {
00129	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00130	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00131	      msgbox.SetupQuestion(strBlockFriendQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00132	      msgbox.OnButtonClick=ReturnMsgBox;
00133	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00134	
00135	      popupStatus=3;
00136	
00137	//      xboxlive.BlockFriendRequest(activeFriendName);
00138	//      myRoot.CloseMenu(true);
00139	      return true;
00140	    }
00141	
00142	    return true;
00143	}
00144	
00145	
00146	
00147	
00148	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00149	{
00150	    if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat
00151	    {
00152	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
00153		    {
00154	          //Controller.FocusedControl.OnClick(Self);
00155	          InternalOnClick(Controller.FocusedControl);
00156	          return true;
00157		    }
00158		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
00159		    {
00160		        myRoot.CloseMenu(true);
00161	    	    return true;
00162		    }
00163		    if (Key==0x25/*IK_Left*/)
00164		    {
00165	    	    return true;
00166		    }
00167		    if (Key==0x27/*IK_Right*/)
00168		    {
00169	    	    return true;
00170		    }
00171	    }
00172	    return super.InternalOnKeyEvent(Key, state, delta);
00173	}
00174	
00175	
00176	

End Source Code