XIDInterf
Class XIIIMenuLiveGameInviteReceived

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

class XIIIMenuLiveGameInviteReceived
extends XIDInterf.XIIILiveWindow


Variables
 XIIIGUIButton Buttons[3]
 string TitleText
 XboxLiveManager.FRIEND_PACKET activeFriend
 string activeFriendName
 playlabel, gamelabel
 XIIILiveMsgBox msgbox
 ButtonNames[3], playlabelstring
 string pleaseInsertGameString
 int popupStatus
 string strInviteReceived,strAcceptGameInviteQuestion,strDeclineGameInviteQuestion,strRemoveFriendQuestion,strLeaving,strNoSession
 bool waitForUserToReboot


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 MsgBoxBtnClicked(byte bButton)
 void MsgBoxBtnClicked2(byte bButton)
 void Paint(Canvas C, float X, float Y)
 void ReturnMsgBox(byte bButton)
 void ShowWindow()



Source Code


00001	class XIIIMenuLiveGameInviteReceived extends XIIILiveWindow;
00002	
00003	var localized string TitleText;
00004	
00005	var XIIIGUIButton Buttons[3];
00006	var GUILabel  playlabel, gamelabel;
00007	var localized string ButtonNames[3], playlabelstring;
00008	var localized string strInviteReceived,strAcceptGameInviteQuestion,strDeclineGameInviteQuestion,strRemoveFriendQuestion,strLeaving,strNoSession;
00009	
00010	var XboxLiveManager.FRIEND_PACKET activeFriend;
00011	var string                        activeFriendName;
00012	
00013	var XIIILiveMsgBox msgbox;
00014	var int popupStatus;
00015	
00016	var localized string pleaseInsertGameString;
00017	
00018	var bool waitForUserToReboot;
00019	
00020	
00021	function Created()
00022	{
00023	  local int i;
00024	     Super.Created();
00025	}
00026	
00027	
00028	function InitComponent(GUIController MyController,GUIComponent MyOwner)
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		playlabel = GUILabel(Controls[3]);
00039		gamelabel = GUILabel(Controls[4]);
00040	  activeFriend = xboxlive.GetActiveFriend();
00041	  activeFriendName = xboxlive.GetActiveFriendName();
00042		playlabel.Caption  = playlabelstring;
00043		gamelabel.Caption = xboxlive.GetFriendGameName(activeFriendName);
00044	
00045		OnClick = InternalOnClick;
00046	}
00047	
00048	
00049	function ShowWindow()
00050	{
00051	  OnMenu = 0; myRoot.bFired = false;
00052	  Super.ShowWindow();
00053	  bShowBCK = true;
00054	  bShowRUN = false;
00055	  bShowSEL = true;
00056	
00057	  activeFriend = xboxlive.GetActiveFriend();
00058	  TitleText = activeFriendName $ strInviteReceived;
00059	
00060	/*  if (xboxlive.IsPlaying())
00061	  {
00062	    Buttons[0].bVisible=true;
00063	    SetFocus(Buttons[0]);
00064	    Buttons[0].SetFocus(none);
00065	  }
00066	  else
00067	  {
00068	    Buttons[0].bVisible=false;
00069	    SetFocus(Buttons[1]);
00070	    Buttons[1].SetFocus(none);
00071	  }
00072	*/
00073	
00074	}
00075	
00076	
00077	function Paint(Canvas C, float X, float Y)
00078	{
00079	  //if (waitForUserToReboot)
00080	  //{
00081	  //}
00082	
00083	  Super.Paint(C, X, Y);
00084	  PaintStandardBackground(C, X, Y, TitleText);
00085	
00086		//C.WrapStringToArray(playlabelstring$xboxlive.GetFriendGameName(activeFriendName);, MsgArray, lMessage.ActualWidth(), "|");
00087	
00088	
00089	}
00090	
00091	function MsgBoxBtnClicked(byte bButton)
00092	{
00093	  waitForUserToReboot = false;
00094	  myRoot.CloseMenu(true);
00095	}
00096	
00097	function MsgBoxBtnClicked2(byte bButton)
00098	{
00099	  myRoot.CloseMenu(true);
00100	}
00101	
00102	function ReturnMsgBox(byte bButton)
00103	{
00104	  switch (bButton)
00105	  {
00106	    case QBTN_Ok:
00107	      if (popupStatus == 1)
00108	      {
00109	        xboxlive.AcceptGameInvite(activeFriendName);
00110	        if (xboxlive.FriendIsInSameGame(activeFriendName))
00111	        {
00112	          Controller.OpenMenu("XIDInterf.XIIIMenuLiveJoinFriendWindow", true);
00113	        }
00114	        else if (xboxlive.GetFriendGameName(activeFriendName) != "")
00115	        {
00116	          waitForUserToReboot = true;
00117	          //myRoot.CloseMenu(true);
00118	          Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00119	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00120	          activeFriend = xboxlive.GetActiveFriend();
00121	          msgbox.SetupQuestion(xboxlive.GetFriendGameName(activeFriendName), QBTN_Cancel, QBTN_Cancel, pleaseInsertGameString);
00122	          msgbox.OnButtonClick=MsgBoxBtnClicked;
00123	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00124	        }
00125	        else // Session no longer valid
00126	        {
00127	          msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00128	          msgbox.SetupQuestion(strNoSession, QBTN_Ok, QBTN_Ok);
00129	          msgbox.OnButtonClick=MsgBoxBtnClicked2;
00130	          msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00131	        }
00132	      }
00133	      else if (popupStatus == 2)
00134	      {
00135	        xboxlive.DeclineGameInvite(activeFriendName);
00136	        myRoot.CloseMenu(true);
00137	      }
00138	      else if (popupStatus == 3)
00139	      {
00140	        xboxlive.RemoveFriend(activeFriendName);
00141	        myRoot.CloseMenu(true);
00142	      }
00143	      popupStatus = 0;
00144	      return;
00145	    break;
00146	
00147	    case QBTN_Cancel:
00148	      popupStatus = 0;
00149	    break;
00150	
00151	  }
00152	}
00153	// Called when a button is clicked
00154	function bool InternalOnClick(GUIComponent Sender)
00155	{
00156	  local int i;
00157	
00158	  if (waitForUserToReboot)
00159	    return true;
00160	
00161	    if (Sender == Controls[0])
00162	    { // accept game invite
00163	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00164	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00165	      if (xboxlive.IsIngame())
00166	        msgbox.SetupQuestion(strLeaving$" "$strAcceptGameInviteQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00167	      else
00168	        msgbox.SetupQuestion(strAcceptGameInviteQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00169	      msgbox.OnButtonClick=ReturnMsgBox;
00170	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00171	
00172	      popupStatus=1;
00173	      return true;
00174	    }
00175	    else if (Sender == Controls[1])
00176	    {  // decline game invite
00177	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00178	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00179	      msgbox.SetupQuestion(strDeclineGameInviteQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00180	      msgbox.OnButtonClick=ReturnMsgBox;
00181	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00182	
00183	      popupStatus=2;
00184	      return true;
00185	    }
00186	    else if (Sender == Controls[2])
00187	    {
00188	      // remove friend
00189	      Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00190	      msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00191	      msgbox.SetupQuestion(strRemoveFriendQuestion, QBTN_Ok | QBTN_Cancel, QBTN_Cancel, activeFriendName);
00192	      msgbox.OnButtonClick=ReturnMsgBox;
00193	      msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00194	
00195	      popupStatus=3;
00196	      return true;
00197	    }
00198	
00199	    return true;
00200	}
00201	
00202	
00203	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00204	{
00205	    if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat
00206	    {
00207	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
00208		    {
00209	          //Controller.FocusedControl.OnClick(Self);
00210	          InternalOnClick(Controller.FocusedControl);
00211	          return true;
00212		    }
00213		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
00214		    {
00215		        myRoot.CloseMenu(true);
00216	    	    return true;
00217		    }
00218		    if (Key==0x25/*IK_Left*/)
00219		    {
00220	    	    return true;
00221		    }
00222		    if (Key==0x27/*IK_Right*/)
00223		    {
00224	    	    return true;
00225		    }
00226	    }
00227	    return super.InternalOnKeyEvent(Key, state, delta);
00228	}
00229	
00230	
00231	

End Source Code