XIDInterf
Class XIIILiveWindow

source: C:\XIII\XIDInterf\Classes\XIIILiveWindow.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
               |
               +--XIDInterf.XIIIWindow
                  |
                  +--XIDInterf.XIIILiveWindow
Direct Known Subclasses:XIIILiveMsgBox, XIIIMenuInGameLiveSabotage, XIIIMenuInGameXboxLive, XIIIMenuLiveFriendsOnline, XIIIMenuLiveCreateWindow, XIIIMenuLiveDownload, XIIIMenuLiveFeedback, XIIIMenuLiveFriendsCancelFriendRequest, XIIIMenuLiveFriendsInvited, XIIIMenuLiveFriendsMainPage, XIIIMenuLiveFriendsOffline, XIIIMenuLiveAccountWindow, XIIIMenuLiveOptimatchResultWindow, XIIIMenuLiveGameInviteReceived, XIIIMenuLiveJoinFriendWindow, XIIIMenuLiveJoinStartWindow, XIIIMenuLiveLadderWindow, XIIIMenuLiveLoginWait, XIIIMenuLiveMainWindow, XIIIMenuLiveOldPlayerList, XIIIMenuLiveOldPlayerMenuSelectedGamerTagNothing, XIIIMenuLiveOldPlayerMenuSelectedGamerTagNothingFriend, XIIIMenuLiveFriendsshipRequested, XIIIMenuLiveScoreboardViewFriends, XIIIMenuLivePassword, XIIIMenuLivePlayerList, XIIIMenuLivePlayerMenuSelectedGamerTag, XIIIMenuLivePlayerMenuSelectedGamerTagAlreadyFriend, XIIIMenuLivePlayerMenuSelectedGamerTagNothing, XIIIMenuLivePlayerMenuSelectedGamerTagSentFriendRequest, XIIIMenuLiveQuickmatchWindow, XIIIMenuLiveScoreboard, XIIIMenuLiveScoreboardMain, XIIIMenuLiveScoreboardView, XIIIMenuLiveOptimatchWindow, XIIIMenuLiveStatsWritePage, XIIIMenuLiveStartup, XIIIMenuLiveSettings

class XIIILiveWindow
extends XIDInterf.XIIIWindow


Variables
 color LightGrey
 bool bCheckNetworkCable
 bool bPopupHasBeenUp
 networkTroubleShoot, doubleLoginString
 inviteReceivedIcon, friendRequestReceivedIcon
 XIIILiveMsgBox msgbox
 string sBackground[6]
 bool showLiveIcons
 Texture tBackGround[6]
 XboxLiveManager xboxlive


Function Summary
 void Created()
 void InternalOnOpen()
 void MsgBoxClicked(byte bButton)
 void MsgBoxClickedTroubleshooting(byte bButton)
 void Paint(Canvas C, float X, float Y)
 void PaintStandardBackground(Canvas C, float X, float Y, string TitleText)
 void PaintStandardBackground3(Canvas C, float X, float Y, string TitleText1, string TitleText2, string TitleText3, int focus)
     
// The super hack routine of doom just to get SOME kind of working header...
 void ShowErrorBox(string errorText, optional string)
 void Timer()



Source Code


00001	class XIIILiveWindow extends XIIIWindow;
00002	
00003	var XIIILiveMsgBox msgbox;
00004	var XboxLiveManager xboxlive;
00005	var texture tBackGround[6];
00006	var string sBackground[6];
00007	
00008	var bool bCheckNetworkCable;
00009	var bool bPopupHasBeenUp;
00010	
00011	var localized string pleaseWaitString, networkcableDisconnectedString, networkTroubleShoot, doubleLoginString;
00012	
00013	var color LightGrey;
00014	
00015	var texture inviteReceivedIcon, friendRequestReceivedIcon;
00016	var bool showLiveIcons;
00017	
00018	function InternalOnOpen()
00019	{
00020	  Log("Live Timer set");
00021	  SetTimer(0.1, true);
00022	}
00023	
00024	function Created()
00025	{
00026	  local int i;
00027	  if (xboxlive == none)
00028	    xboxlive=New Class'XboxLiveManager';
00029	  Super.Created();
00030	  OnReOpen = InternalOnOpen;
00031	  InternalOnOpen();
00032	  for (i=0; i<6; i++)
00033	    tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
00034	
00035	  bCheckNetworkCable=true;
00036	  bForceHelp=true;
00037	  bPopupHasBeenUp = false;
00038	}
00039	
00040	
00041	function Paint(Canvas C, float X, float Y)
00042	{
00043	  local float alphavalue, yPosInviteIcon;
00044	
00045	  Super.Paint(C, X, Y);
00046	
00047	  if (!showLiveIcons)
00048	    return;
00049	
00050	
00051	  alphavalue      = abs(sin(GetPlayerOwner().Level.TimeSeconds*4.0))*255.0;
00052	  yPosInviteIcon = 55.0;
00053	
00054	
00055	  if (xboxlive.HasInvite())
00056	  {
00057	    // render an invite icon
00058	    if (XIIIPlayerController(GetPlayerOwner()) != none && XIIIPlayerController(GetPlayerOwner()).Player.Actor.Level.Game.IsA('XIIIMPTeamGameInfo') == false)
00059	      C.SetPos( 50.0*fRatioX + 5, yPosInviteIcon);
00060	    else
00061	      C.SetPos(50.0*fRatioX + 5, /*(245.0 - 35.0)*/ yPosInviteIcon);
00062	
00063	    C.DrawColor = WhiteColor;
00064	    C.DrawColor.A = alphavalue;
00065	
00066	    C.Style = 5; // ERenderStyle.STY_Alpha;
00067	    C.DrawTile(inviteReceivedIcon, inviteReceivedIcon.USize, inviteReceivedIcon.VSize, 0, 0, inviteReceivedIcon.USize, inviteReceivedIcon.VSize);
00068	    C.Style = 1; // ERenderStyle.STY_Normal;
00069	  }
00070	  else if (xboxlive.HasFriendRequest())
00071	  {
00072	    // render a friend request icon
00073	    if (XIIIPlayerController(GetPlayerOwner()).Player.Actor.Level.Game.IsA('XIIIMPTeamGameInfo') == false)
00074	      C.SetPos( 50.0*fRatioX + 5, yPosInviteIcon);
00075	    else
00076	      C.SetPos(50.0*fRatioX + 5, yPosInviteIcon);
00077	
00078	    C.DrawColor = WhiteColor;
00079	    C.DrawColor.A = alphavalue;
00080	    C.Style = 5; // ERenderStyle.STY_Alpha;
00081	    C.DrawTile(friendRequestReceivedIcon, friendRequestReceivedIcon.USize, friendRequestReceivedIcon.VSize, 0, 0, friendRequestReceivedIcon.USize, friendRequestReceivedIcon.VSize);
00082	    C.Style = 1; // ERenderStyle.STY_Normal;
00083	  }
00084	
00085	}
00086	
00087	
00088	
00089	function PaintStandardBackground(Canvas C, float X, float Y, string TitleText)
00090	{
00091	     local float W, H, W2;
00092	     local float fScale,fHeight;
00093	     C.DrawColor = WhiteColor;
00094	     C.Style = 5;
00095	     fHeight = (373 / 320) * 5 * 64 * fScaleTo / 2; // (sum_back.height/sum_tex.height) * tex_height
00096	     DrawStretchedTexture(C, 255*fRatioX, 56*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[2]);
00097	     DrawStretchedTexture(C, 255*fRatioX, (56+fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[3]);
00098	     //DrawStretchedTexture(C, 255*fRatioX, (56+2*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[4]);
00099	     //DrawStretchedTexture(C, 255*fRatioX, (56+3*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[5]);
00100	     //DrawStretchedTexture(C, 255*fRatioX, (56+4*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[6]);
00101	     DrawStretchedTexture(C, 41*fRatioX, 68*fRatioY, 242*fRatioX, 180*fScaleTo*fRatioY, tBackGround[0]);
00102	     DrawStretchedTexture(C, 41*fRatioX, (68+180*fScaleTo)*fRatioY, 242*fRatioX, 180*fScaleTo*fRatioY, tBackGround[1]);
00103	     C.Style = 1;
00104	     if (TitleText != "")
00105	     {
00106	       C.bUseBorder = true;
00107	       C.TextSize(TitleText, W, H);
00108	       W2 = W+20;
00109	       if (W2<80)
00110	         W2 = 80;
00111	       DrawStretchedTexture(C, 310*fRatioX- ((W2)*fRatioX*0.5) /*250*fRatioX*/, 40*fRatioY, (W2)*fRatioX, 40*fRatioY, myRoot.FondMenu);
00112	       C.DrawColor = BlackColor;
00113	       C.SetPos( 310*fRatioX- ((W+5)*fRatioX*0.5) /*(250 + 5)*fRatioX*/, (60-H/2)*fRatioY); C.DrawText(TitleText, false);
00114	       C.bUseBorder = false;
00115	       C.DrawColor = WhiteColor;
00116	     }
00117	}
00118	
00119	// The super hack routine of doom just to get SOME kind of working header...
00120	function PaintStandardBackground3(Canvas C, float X, float Y, string TitleText1, string TitleText2, string TitleText3, int focus)
00121	{
00122	     local float W, H, w1, h1, w2, h2, w3, h3;
00123	     local float fScale,fHeight;
00124	     local string str, s1, s2, s3;
00125	
00126	     if (TitleText1 == "")
00127	       str = TitleText1 $ "   " $ TitleText2 $ " - " $ TitleText3;
00128	     else
00129	       str = TitleText1 $ " - " $ TitleText2 $ " - " $ TitleText3;
00130	
00131	     C.DrawColor = WhiteColor;
00132	     C.Style = 5;
00133	     fHeight = (373 / 320) * 5 * 64 * fScaleTo / 2; // (sum_back.height/sum_tex.height) * tex_height
00134	     DrawStretchedTexture(C, 255*fRatioX, 56*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[2]);
00135	     DrawStretchedTexture(C, 255*fRatioX, (56+fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[3]);
00136	     //DrawStretchedTexture(C, 255*fRatioX, (56+2*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[4]);
00137	     //DrawStretchedTexture(C, 255*fRatioX, (56+3*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[5]);
00138	     //DrawStretchedTexture(C, 255*fRatioX, (56+4*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[6]);
00139	     DrawStretchedTexture(C, 41*fRatioX, 68*fRatioY, 242*fRatioX, 180*fScaleTo*fRatioY, tBackGround[0]);
00140	     DrawStretchedTexture(C, 41*fRatioX, (68+180*fScaleTo)*fRatioY, 242*fRatioX, 180*fScaleTo*fRatioY, tBackGround[1]);
00141	     C.Style = 1;
00142	    C.bUseBorder = true;
00143	
00144	    //C.TextSize(TitleText, W, H);
00145	    C.TextSize(str, W, H);
00146	    DrawStretchedTexture(C, 320*fRatioX- ((W+20)*fRatioX*0.5), 40*fRatioY, (W+20)*fRatioX, 40*fRatioY, myRoot.FondMenu);
00147	
00148	    if (focus == 1)
00149	    {
00150	      C.DrawColor = BlackColor;
00151	      if (TitleText1 == "")
00152	        s1 = TitleText1 $ "   ";
00153	      else
00154	        s1 = TitleText1 $ " - ";
00155	    }
00156	    else
00157	    {
00158	      C.DrawColor = LightGrey;
00159	      s1 = TitleText1;
00160	    }
00161	
00162	    C.TextSize(s1, w1, h1);
00163	    C.SetPos((320 + 5)*fRatioX - ((W+20)*fRatioX*0.5), (60-H/2)*fRatioY); C.DrawText(s1, false);
00164	
00165	    if (focus == 2)
00166	    {
00167	      C.DrawColor = BlackColor;
00168	      if (TitleText1 == "")
00169	        s2 = "   " $ TitleText2 $ " - ";
00170	      else
00171	        s2 = " - " $ TitleText2 $ " - ";
00172	    }
00173	    else if (focus == 1)
00174	    {
00175	      C.DrawColor = LightGrey;
00176	      s2 = TitleText2 $ " - ";
00177	    }
00178	    else if (focus == 3)
00179	    {
00180	      C.DrawColor = LightGrey;
00181	      if (TitleText1 == "")
00182	        s2 = "   " $ TitleText2;
00183	      else
00184	        s2 = " - " $ TitleText2;
00185	    }
00186	
00187	    C.TextSize(s2, w2, h2);
00188	    C.SetPos((320 + 5)*fRatioX - ((W+20)*fRatioX*0.5)+w1, (60-H/2)*fRatioY); C.DrawText(s2, false);
00189	
00190	    if (focus == 3)
00191	    {
00192	      C.DrawColor = BlackColor;
00193	      s3 = " - " $ TitleText3;
00194	    }
00195	    else
00196	    {
00197	      C.DrawColor = LightGrey;
00198	      s3 = TitleText3;
00199	    }
00200	    C.TextSize(s3, w3, h3);
00201	    C.SetPos((320 + 5)*fRatioX - ((W+20)*fRatioX*0.5)+w1+w2, (60-H/2)*fRatioY); C.DrawText(s3, false);
00202	
00203	
00204	
00205	    C.bUseBorder = false;
00206	    C.DrawColor = WhiteColor;
00207	}
00208	
00209	function ShowErrorBox(string errorText, optional string captionText)
00210	{
00211	  Controller.OpenMenu("XIDInterf.XIIILiveMsgBox",false);
00212	  msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00213	  msgbox.SetupQuestion(errorText, QBTN_Ok, QBTN_Ok, captionText);
00214	  //msgbox.OnButtonClick=MsgBoxClicked;
00215	  msgbox.InitBox(160, 130, 16, 16, 320, 230);
00216	}
00217	
00218	function MsgBoxClicked(byte bButton)
00219	{
00220	  switch (bButton)
00221	  {
00222	    case QBTN_Ok:
00223	      // Test here if we are ingame
00224	      if (xboxlive.IsIngame())
00225	      { // ingame
00226	  	    while (XIIIMenuInGameXboxLive(myRoot.ActivePage)==none && myRoot.ActivePage!=none)
00227	  	      myRoot.CloseMenu(true);
00228	  	    if (myRoot.ActivePage != none)
00229	          XIIIMenuInGameXboxLive(myRoot.ActivePage).bDoQuitGame = true;
00230	        xboxlive.ResetVoiceNet();
00231	        xboxlive.ShutdownAndCleanup();
00232	      }
00233	      else
00234	      { // menusystem
00235	        xboxlive.ShutdownAndCleanup();
00236	  	    while (XIIIMenuLiveAccountWindow(myRoot.ActivePage)==none && myRoot.ActivePage!=none)
00237	  	      myRoot.CloseMenu(true);
00238	        myRoot.CloseMenu(true);
00239	      }
00240	    break;
00241	  }
00242	}
00243	
00244	function MsgBoxClickedTroubleshooting(byte bButton)
00245	{
00246	  switch (bButton)
00247	  {
00248	    case QBTN_Ok:
00249	        xboxlive.RebootToDashboard(xboxlive.dashboardPage.DASHBOARD_NETWORK_CONFIG);
00250	        myRoot.CloseMenu(true);
00251	/*
00252	        xboxlive.ShutdownAndCleanup();
00253	  	    while (XIIIMenuLiveAccountWindow(myRoot.ActivePage)==none)
00254	  	      myRoot.CloseMenu(true);
00255	        myRoot.CloseMenu(true);
00256	        */
00257	    break;
00258	
00259	    case QBTN_Cancel:
00260	      //myRoot.CloseMenu(true);
00261	    break;
00262	  }
00263	}
00264	
00265	function Timer()
00266	{
00267	  if (XIIILiveMsgBox(myRoot.ActivePage)==none && myRoot.ActivePage == self)
00268	  {
00269	     if (xboxlive != none && !xboxlive.IsNetCableIn() && !bPopupHasBeenUp)
00270	     {
00271	       bPopupHasBeenUp = true;
00272	       if (bCheckNetworkCable)
00273	       {
00274	         KillTimer();
00275	         Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00276	         msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00277	         msgbox.SetupQuestion(networkcableDisconnectedString, QBTN_Ok, QBTN_Ok);
00278	         msgbox.OnButtonClick=MsgBoxClicked;
00279	         msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00280	       }
00281	       else
00282	       {
00283	         KillTimer();
00284	         Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00285	         msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00286	         msgbox.SetupQuestion(networkTroubleShoot, QBTN_Ok | QBTN_Cancel, QBTN_Cancel);
00287	         msgbox.OnButtonClick=MsgBoxClickedTroubleshooting;
00288	         msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00289	       }
00290	     }
00291	
00292	     if (xboxlive != none && xboxlive.IsLoggedInTwice() && !bPopupHasBeenUp)
00293	     {
00294	       bPopupHasBeenUp = true;
00295	       KillTimer();
00296	       Controller.OpenMenu("XIDInterf.XIIILiveMsgBox");
00297	       msgbox = XIIILiveMsgBox(myRoot.ActivePage);
00298	       msgbox.SetupQuestion(doubleLoginString, QBTN_Ok, QBTN_Ok);
00299	       msgbox.OnButtonClick=MsgBoxClicked;
00300	       msgbox.InitBox(160*fRatioX, 130*fRatioY*fScaleTo, 16, 16, 320*fRatioX, 230*fRatioY*fScaleTo);
00301	     }
00302	  }
00303	}
00304	
00305	

End Source Code