## XIDInterf
Class XIIIMenuLiveOldPlayerList

source: C:\XIII\XIDInterf\Classes\XIIIMenuLiveOldPlayerList.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIILiveWindow
                         |
                         +--XIDInterf.XIIIMenuLiveOldPlayerList

Direct Known Subclasses:None

class XIIIMenuLiveOldPlayerList
extends XIDInterf.XIIILiveWindow

Variables
`int` | `counter`
`XIIIGUIMultiListBox` | `listbox`
`int` | `numberOfPlayersInList`
`Texture` | `onlineIcons[7]`
`int` | `playerListLength`
`string` | `playerListNames[100]`
`XboxLiveManager.FRIEND_PACKET` | `playerList[100]`
`XIIIGUIButton` | `statusButton`
`TitleText3,` | `strLRHelp`
`string` | `strOnlineStatus[7]`
`Texture` | `voiceIcons[3]`

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` | `ShowWindow()`
`void` | `UpdatePlayerList(bool first)`

Source Code

    00001	class XIIIMenuLiveOldPlayerList extends XIIILiveWindow;
    00002
    00003	#exec OBJ LOAD FILE=XIIIXboxPacket.utx
    00004	//#exec OBJ LOAD FILE=GUIContent.utx
    00005
    00006	var localized string TitleText1, TitleText2, TitleText3, strLRHelp;
    00007
    00008	var XIIIGUIMultiListBox listbox;
    00009	var texture voiceIcons[3];
    00010	var texture onlineIcons[7];
    00011
    00012	var int counter;
    00013	var int playerListLength;
    00014
    00015	var localized string strOnlineStatus[7];
    00016
    00017	var XboxLiveManager.FRIEND_PACKET playerList[100];
    00018	var string                        playerListNames[100];
    00019	var int                           numberOfPlayersInList;
    00020
    00021	var XIIIGUIButton statusButton;
    00022
    00023	enum eFriendStatus
    00024	{
    00025	  FRIENDSTATUS_receivedinvitation,
    00026	  FRIENDSTATUS_receivedfriendrequest,
    00027	  FRIENDSTATUS_sentinvitation,
    00028	  FRIENDSTATUS_sentfriendrequest,
    00029	  FRIENDSTATUS_onlinefriendsignedin,
    00030	  FRIENDSTATUS_offline,
    00031	  FRIENDSTATUS_none
    00032	};
    00033
    00034
    00035	function Created()
    00036	{
    00037	  local int i;
    00038	  Super.Created();
    00039	  playerListLength=0;
    00040	}
    00041
    00042	function InitComponent(GUIController MyController,GUIComponent MyOwner)
    00043	{
    00044	  Super.InitComponent(MyController, MyOwner);
    00045		OnClick = InternalOnClick;
    00046
    00047	  listbox = XIIIGUIMultiListBox(Controls[0]);
    00048	  listbox.bVisibleWhenEmpty = true;
    00049	  listbox.ScrollBar.bVisible = false;
    00050	  //listbox.WinLeft = 100;
    00051	  //listbox.WinTop = 100;
    00052	  listbox.SetNumberOfColumns(4);
    00053	  listbox.SetColumnOffset(0, 0);
    00054	  listbox.SetColumnOffset(1, 226);
    00055	  listbox.SetColumnOffset(2, 256);
    00056	  listbox.SetColumnOffset(3, 286);
    00057	  listbox.List.UserDefinedItemHeight = 36;
    00058
    00059	  voiceIcons[0]=none; //AJ texture'XIIIXboxPacket.CommunicatorON';
    00060	  voiceIcons[1]=none; //AJ texture'XIIIXboxPacket.CommunicatorMUTED';
    00061	  voiceIcons[2]=none; //AJ texture'XIIIXboxPacket.CommunicatorON';
    00062
    00063	  onlineIcons[eFriendStatus.FRIENDSTATUS_receivedinvitation]=texture'XIIIXboxPacket.GameInviteReceived';
    00064	  onlineIcons[eFriendStatus.FRIENDSTATUS_receivedfriendrequest]=texture'XIIIXboxPacket.FriendInviteReceived';
    00065	  onlineIcons[eFriendStatus.FRIENDSTATUS_sentinvitation]=texture'XIIIXboxPacket.GameInviteSent';
    00066	  onlineIcons[eFriendStatus.FRIENDSTATUS_sentfriendrequest]=texture'XIIIXboxPacket.FriendInviteSent';
    00067	  onlineIcons[eFriendStatus.FRIENDSTATUS_onlinefriendsignedin]=texture'XIIIXboxPacket.FriendOnline';
    00068	  onlineIcons[eFriendStatus.FRIENDSTATUS_offline]=none;
    00069	  onlineIcons[eFriendStatus.FRIENDSTATUS_none]=none;
    00070
    00071
    00072	  statusButton         = XIIIGUIButton(Controls[1]);
    00073	  statusButton.Caption = "";
    00074
    00075	  xboxlive.CachePlayerList();
    00076	  UpdatePlayerList(true);
    00077	}
    00078
    00079	function UpdatePlayerList(bool first)
    00080	{
    00081	  local XboxLiveManager.FRIEND_PACKET fp;
    00082	  local GUIMultiListBoxLine pack;
    00083	  local string name;
    00084	  local int q;
    00085	  local bool hasVoice,isMuted,isTalking;
    00086	  local string str;
    00087	  local bool friendsUpdated;
    00088	  local int nrOldPlayers;
    00089
    00090	  friendsUpdated = xboxlive.IsFriendsListChanged(); // We might have friends on the player list!!
    00091
    00092
    00093	  if (!xboxlive.UpdatePlayersTalking() && !first && !friendsUpdated)
    00094	    return;
    00095
    00096	  listbox.List.Clear();
    00097
    00098	  playerListLength = xboxlive.GetNumberOfPlayers();
    00099	  nrOldPlayers = 0;
    00100	  for (q=0; q<playerListLength; q++)
    00101	  {
    00102	    if (xboxlive.IsPlayerInGame(q))
    00103	      continue;
    00104	    nrOldPlayers++;
    00105
    00106	    hasVoice = xboxlive.HasPlayerVoice(q);
    00107	    isMuted = xboxlive.IsPlayerMuted(q);
    00108	    isTalking = xboxlive.IsPlayerTalking(q);
    00109	    name = xboxlive.GetPlayerName(q);
    00110	    pack = new class'GUIMultiListBoxLine';
    00111
    00112	    fp = xboxlive.GetFriend(name);
    00113	    // Must have some friends info also!
    00114	    playerListNames[q]         = name;
    00115	    playerList[q].onlineStatus = fp.onlineStatus;
    00116	    playerList[q].voiceStatus  = fp.voiceStatus;
    00117	    playerList[q].isOnline     = fp.isOnline;
    00118	    if (name == "")
    00119	    {
    00120	      playerListNames[q]         = name;
    00121	      playerList[q].onlineStatus = eFriendStatus.FRIENDSTATUS_none;
    00122	      playerList[q].isOnline     = true;
    00123	    }
    00124	    pack.items[0].tex = none;//onlineIcons[playerList[q].onlineStatus];
    00125
    00126	    //if (hasVoice && isTalking)
    00127	      //pack.items[1].tex = voiceIcons[2];
    00128	    //else
    00129	      pack.items[1].tex = none;
    00130	    //if (hasVoice)
    00131	      //pack.items[2].tex = voiceIcons[0];
    00132	    //else
    00133	      pack.items[2].tex = none;
    00134	    //if (isMuted)
    00135	      //pack.items[3].tex = voiceIcons[1];
    00136	    //else
    00137	      pack.items[3].tex = none;
    00138	    listbox.List.Add(name, pack);
    00139	  }
    00140
    00141	  playerListLength = nrOldPlayers;
    00142	  //if (playerListLength != 0)
    00143	  //{
    00144	    //str = "";
    00145	    //if (playerList[listbox.list.Index].isOnline)
    00146	      //str = /*friendsList[listbox.list.Index].name $ " " $*/ strOnlineStatus[eFriendStatus.FRIENDSTATUS_onlinefriendsignedin];
    00147	    //else
    00148	      //str = /*friendsList[listbox.list.Index].name $ " " $*/ strOnlineStatus[eFriendStatus.FRIENDSTATUS_offline];
    00149
    00150	    //if (playerList[listbox.list.Index].onlineStatus <= eFriendStatus.FRIENDSTATUS_sentfriendrequest)
    00151	      //str = /*str $ "  " $*/ strOnlineStatus[playerList[listbox.list.Index].onlineStatus];
    00152
    00153	    //C.SetPos(X+columnOffset[0]+10, Y+(H-16.0)*0.5-2);
    00154	    //C.DrawText(Elements[item].Item, false);
    00155	    //statusButton.Caption = str;
    00156
    00157	  //}
    00158	  //else
    00159	    statusButton.Caption = "";
    00160	}
    00161
    00162	function ShowWindow()
    00163	{
    00164	  OnMenu = 0; myRoot.bFired = false;
    00165	  Super.ShowWindow();
    00166	  bShowBCK = true;
    00167	  bShowRUN = false;
    00168	  bShowSEL = false;
    00169	}
    00170
    00171
    00172	function Paint(Canvas C, float X, float Y)
    00173	{
    00174
    00175	/* AJ no room right now
    00176	  if (xboxlive.IsPlaying())
    00177	  {
    00178	    C.DrawColor = BlackColor;
    00179	    C.SetPos(260, 400);
    00180	    C.DrawText(strLRHelp, false);
    00181	    C.DrawColor = WhiteColor;
    00182	  }
    00183	*/
    00184
    00185	  counter++;
    00186	  Super.Paint(C, X, Y);
    00187	//  PaintStandardBackground(C, X, Y, TitleText);
    00188
    00189
    00190
    00191	//AJ  PaintStandardBackground3(C, X, Y, TitleText1, TitleText2, TitleText3, 3);
    00192	   if (xboxlive.IsPlaying())
    00193	     PaintStandardBackground3(C, X, Y, TitleText1, TitleText2, TitleText3, 3);
    00194	   else
    00195	     PaintStandardBackground3(C, X, Y, "", TitleText2, TitleText3, 3);
    00196
    00197	  UpdatePlayerList(false);
    00198	}
    00199
    00200
    00201	// Called when a button is clicked
    00202	function bool InternalOnClick(GUIComponent Sender)
    00203	{
    00204	  local GUIMultiListBoxLine pack;
    00205	  local string name;
    00206
    00207	  if (playerListLength > 0)//listbox.list.ItemCount != 0)
    00208	  {
    00209	    name = listbox.list.GetItemAtIndex(listbox.list.Index);
    00210	    xboxlive.SetActiveFriend( name );
    00211
    00212	////    if (playerList[listbox.list.Index].onlineStatus == eFriendStatus.FRIENDSTATUS_receivedfriendrequest)
    00213	//      myRoot.OpenMenu("XIDInterf.XIIIMenuLivePlayerMenuSelectedGamerTag");
    00214	//    else if (playerList[listbox.list.Index].onlineStatus == eFriendStatus.FRIENDSTATUS_sentfriendrequest)
    00215	//      myRoot.OpenMenu("XIDInterf.XIIIMenuLivePlayerMenuSelectedGamerTagSentFriendRequest");
    00216	//    else if (playerList[listbox.list.Index].onlineStatus == eFriendStatus.FRIENDSTATUS_onlinefriendsignedin ||
    00217	//             playerList[listbox.list.Index].onlineStatus == eFriendStatus.FRIENDSTATUS_offline)
    00218	//      myRoot.OpenMenu("XIDInterf.XIIIMenuLivePlayerMenuSelectedGamerTagAlreadyFriend");
    00219
    00220	    if (xboxlive.IsFriend(name))  //if (playerList[listbox.list.Index].onlineStatus < eFriendStatus.FRIENDSTATUS_none)
    00221	    {
    00222	      if (xboxlive.IsIngame() && !xboxlive.IsLadderGame())
    00223	      myRoot.OpenMenu("XIDInterf.XIIIMenuLiveOldPlayerMenuSelectedGamerTagNothingFriend");
    00224	    }
    00225	    else
    00226	      myRoot.OpenMenu("XIDInterf.XIIIMenuLiveOldPlayerMenuSelectedGamerTagNothing");
    00227
    00228	    return true;
    00229	  }
    00230
    00231
    00232	/*enum eFriendStatus
    00233	{
    00234	  FRIENDSTATUS_receivedinvitation,
    00235	  FRIENDSTATUS_receivedfriendrequest,
    00236	  FRIENDSTATUS_sentinvitation,
    00237	  FRIENDSTATUS_sentfriendrequest,
    00238	  FRIENDSTATUS_onlinefriendsignedin,
    00239	  FRIENDSTATUS_offline,
    00240	  FRIENDSTATUS_none
    00241	};
    00242	*/
    00243	  return false;
    00244	}
    00245
00246 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00247 { 00248 if (state==1/* || state==2*/)// IST_Press // to avoid auto-repeat 00249 { 00250 if ((Key==0x0D/*IK_Enter*/) || (Key==0x01)) 00251 { 00252 //Controller.FocusedControl.OnClick(Self); 00253 InternalOnClick(Controller.FocusedControl); 00254 return true; 00255 } 00256 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 00257 { 00258 myRoot.CloseMenu(true); 00259 return true; 00260 } 00261 if (Key==0x25/*IK_Left*/) 00262 { 00263 myRoot.CloseMenu(true); 00264 myRoot.OpenMenu("XIDInterf.XIIIMenuLiveFriendsMainPage"); 00265 return true; 00266 } 00267 if (Key==0x27/*IK_Right*/) 00268 { 00269 myRoot.CloseMenu(true); 00270 if (xboxlive.IsPlaying()) 00271 myRoot.OpenMenu("XIDInterf.XIIIMenuLivePlayerList"); 00272 else 00273 myRoot.OpenMenu("XIDInterf.XIIIMenuLiveFriendsMainPage"); 00274 return true; 00275 } 00276 } 00277 return super.InternalOnKeyEvent(Key, state, delta); 00278 } 00279 00280 00281

End Source Code