XIDInterf
Class XIIIMenuLiveFriendsOffline

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

class XIIIMenuLiveFriendsOffline
extends XIDInterf.XIIILiveWindow


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


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

End Source Code