## XIDInterf
Class XIIIMenu

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

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIIWindowMainMenu
                         |
                         +--XIDInterf.XIIIMenu

Direct Known Subclasses:None

class XIIIMenu
extends XIDInterf.XIIIWindowMainMenu

Variables
`OptionsText,` | `NewGameText`
`VideoPlayer` | `VP` to play video
`NewButton/*,` | `WorkButton*/`
`NewLabel,` | `WorkLabel`
`XIIIMsgBox` | `msgbox`
`string` | `pendingInviteString`
`sHighlight[14],` | `sOnomatopee[5]`
`string` | `sVideo` video filename
`Texture` | `tBackGround[14]`
`Texture` | `tHighlight[14]`
`Texture` | `tOnomatopee[5]`
`XboxLiveManager` | `xboxlive`

States
PlayingVideo

Function Summary
`void` | `AfterPaint(Canvas C, float X, float Y)`
`void` | `Created()`
`void` | `EndOfVideo()`
`bool` | `InternalOnClick(GUIComponent Sender)`
    // Called when a button is clicked
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `MsgBoxBtnClicked(byte bButton)`
`void` | `ShowWindow()`

State PlayingVideo Function Summary

Source Code

    00001	class XIIIMenu extends XIIIWindowMainMenu;
    00002
    00003	var XIIITextureButton ContinueButton, MultiButton, LoadButton, OptionsButton, NewButton/*, WorkButton*/;
    00004	var XIIILabel ContinueLabel, MultiLabel, LoadLabel, OptionsLabel, NewLabel, WorkLabel;
    00005	var  localized string    ContinueText, MultiplayerText, LoadGameText, OptionsText, NewGameText;
    00006	var(StartMap)  string    URL;
    00007
    00008	var XboxLiveManager xboxlive;
    00009
    00010	var texture tBackGround[14];
    00011	var texture tHighlight[14];
    00012	var texture tOnomatopee[5];
    00013	var string sBackGround[14], sHighlight[14], sOnomatopee[5];
    00014
    00015	var XIIIMsgBox msgbox;
    00016	var localized string pendingInviteString;
    00017
    00018	var string sVideo;					// video filename
    00019	var VideoPlayer VP;                 // to play video
    00020
    00021
    00022	function MsgBoxBtnClicked(byte bButton)
    00023	{
    00024	  switch (bButton)
    00025	  {
    00026	    case QBTN_Ok:
    00027	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow");
    00028	    break;
    00029	    case QBTN_Cancel:
    00030	      xboxlive.ResetJoiningAfterBoot();
    00031	    break;
    00032	  }
    00033	}
    00034
    00035	function Created()
    00036	{
    00037	    local int i;
    00038
    00039	    super.Created();
    00040
    00041	    for (i=0; i<14; i++)
    00042	    {
    00043	        tHighlight[i] = texture(DynamicLoadObject(sHighlight[i], class'Texture'));
    00044	        tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00045	    }
    00046	    for (i=0; i<5; i++)
    00047	        tOnomatopee[i] = texture(DynamicLoadObject(sOnomatopee[i], class'Texture'));
    00048
    00049	    ContinueButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 30, int(30*fScaleTo), 410, int(140*fScaleTo)));
    00050	    ContinueButton.tFirstTex[0]=tBackGround[0];
    00051	    ContinueButton.tSecondTex[0]=tBackGround[2];
    00052	    ContinueButton.tThirdTex[0]=tBackGround[3];
    00053	 	ContinueButton.tFourthTex[0]=tBackGround[1];
    00054		ContinueButton.tFirstTex[1]=tHighlight[0];
    00055	    ContinueButton.tSecondTex[1]=tHighlight[2];
    00056	    ContinueButton.tThirdTex[1]=tHighlight[3];
    00057		ContinueButton.tFourthTex[1]=tHighlight[1];
    00058	    ContinueButton.xOff = 256;
    00059	    ContinueButton.yOff = 128;
    00060
    00061	    MultiButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 450, 30*fScaleTo, 160, 280*fScaleTo));
    00062	    MultiButton.tFirstTex[0]=tBackGround[4];
    00063	    MultiButton.tSecondTex[0]=tBackGround[5];
    00064	    MultiButton.tFirstTex[1]=tHighlight[4];
    00065	    MultiButton.tSecondTex[1]=tHighlight[5];
    00066	    MultiButton.yOff = 256;
    00067
    00068	    LoadButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 30, 180*fScaleTo, 240, 250*fScaleTo));
    00069	    LoadButton.tFirstTex[0]=tBackGround[6];
    00070	    LoadButton.tSecondTex[0]=tBackGround[7];
    00071	    LoadButton.tThirdTex[0]=tBackGround[8];
    00072	    LoadButton.tFourthTex[0]=tBackGround[9];
    00073	    LoadButton.tAdjustTex[0]=tBackGround[10];
    00074	    LoadButton.tFirstTex[1]=tHighlight[6];
    00075	    LoadButton.tSecondTex[1]=tHighlight[7];
    00076	    LoadButton.tThirdTex[1]=tHighlight[8];
    00077	    LoadButton.tFourthTex[1]=tHighlight[9];
    00078	    LoadButton.tAdjustTex[1]=tHighlight[10];
    00079	    LoadButton.xOff = 256;
    00080	    LoadButton.yOff = 256;
    00081
    00082	    OptionsButton = XIIITexturebutton(CreateControl(class'XIIITextureButton', 280, 180*fScaleTo, 160, 250*fScaleTo));
    00083	    OptionsButton.tFirstTex[0]=tBackGround[11];
    00084	    OptionsButton.tSecondTex[0]=tBackGround[12];
    00085	    OptionsButton.tFirstTex[1]=tHighlight[11];
    00086	    OptionsButton.tSecondTex[1]=tHighlight[12];
    00087	    OptionsButton.yOff = 256;
    00088
    00089	    NewButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 450, 320*fScaleTo, 160, 110*fScaleTo));
    00090	    NewButton.tFirstTex[0]=tBackGround[13];
    00091	    NewButton.tFirstTex[1]=tHighlight[13];
    00092
    00093	//    WorkButton = XIIITexturebutton(CreateControl(class'XIIITextureButton', 357, 440*fScaleTo, 155, 30*fScaleTo));
    00094
    00095		Controls[0]=ContinueButton;
    00096		Controls[1]=MultiButton;
    00097	    Controls[2]=LoadButton;
    00098	    Controls[3]=OptionsButton;
    00099	    Controls[4]=NewButton;
    00100	//    Controls[5]=WorkButton;
    00101
    00102	    InitLabel(ContinueLabel, 16, 32*fScaleTo, 128, 32*fScaleTo, ContinueText);
    00103	    InitLabel(MultiLabel, 420, 220*fScaleTo, 128, 32*fScaleTo, MultiplayerText);
    00104	    InitLabel(LoadLabel, 16, 350*fScaleTo, 128, 32*fScaleTo, LoadGameText);
    00105	    InitLabel(OptionsLabel, 350, 320*fScaleTo, 128, 32*fScaleTo, OptionsText);
    00106	    InitLabel(NewLabel, 500, 350*fScaleTo, 128, 32*fScaleTo, NewGameText);
    00107	//    InitLabel(WorkLabel, 350, 420*fScaleTo, 128, 32*fScaleTo, "DEBUG ONLY");
    00108
    00109		OnReOpen = InternalOnOpen;
    00110
    00111		GotoState('ReinitMusic');
    00112	}
    00113
    00114
    00115	function ShowWindow()
    00116	{
    00117	    super.ShowWindow();
    00118	    bShowBCK = true;
    00119	    bShowSEL = true;
    00120
    00121	    if (xboxLive == none) // SouthEnd
    00122	      xboxLive = new class'xboxlivemanager';
    00123	    if (xboxLive.IsLoggedIn(xboxLive.GetCurrentUser()))
    00124	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveMainWindow", false);
    00125
    00126	    // Added support for pending invites (from other xbox titles)
    00127	    if (xboxlive.IsJoiningAfterBoot())
    00128	    {
    00129	      Log("[XIIIMenu] Joining Invite?");
    00130	      Controller.OpenMenu("XIDInterf.XIIIMsgBox");
    00131	      msgbox = XIIIMsgBox(myRoot.ActivePage);
    00132	      msgbox.SetupQuestion(pendingInviteString, QBTN_Ok|QBTN_Cancel, QBTN_Ok);
    00133	      msgbox.OnButtonClick=MsgBoxBtnClicked;
    00134	      msgbox.InitBox(120, 130, 10, 10, 400, 230);
    00135	    }
    00136	}
    00137
    00138
    00139	function AfterPaint(Canvas C, float X, float Y)
    00140	{
    00141	    local float zoom;
    00142
    00143	    super.AfterPaint(C, X, Y);
    00144
    00145	    C.Style = 5;
    00146	    if (ContinueButton.bDisplayTex) {
    00147	        zoom = ContinueButton.zoom;
    00148	        DrawStretchedTexture(C, (205*fRatioX+223-223*zoom), (23*fRatioY+73-73*zoom), 223*zoom, 73*zoom, tOnomatopee[0]);
    00149	        DrawLabel(C, ContinueLabel);
    00150	    }
    00151	    if (MultiButton.bDisplayTex) {
    00152	        zoom = MultiButton.zoom;
    00153	        DrawStretchedTexture(C, (525*fRatioX+100-100*zoom), (84*fRatioY+100-100*zoom), 100*zoom, 100*zoom, tOnomatopee[1]);
    00154	        DrawLabel(C, MultiLabel);
    00155	    }
    00156	    if (LoadButton.bDisplayTex) {
    00157	        zoom = LoadButton.zoom;
    00158	        DrawStretchedTexture(C, (162*fRatioX+160-160*zoom), (160*fRatioY+74-74*zoom), 160*zoom, 74*zoom, tOnomatopee[2]);
    00159	        DrawLabel(C, LoadLabel);
    00160	    }
    00161	    if (OptionsButton.bDisplayTex) {
    00162	        zoom = OptionsButton.zoom;
    00163	        DrawStretchedTexture(C, (159*fRatioX+193-193*zoom), (279*fRatioY+48-48*zoom), 193*zoom, 96*zoom, tOnomatopee[3]);
    00164	        DrawLabel(C, OptionsLabel);
    00165	    }
    00166	    if (NewButton.bDisplayTex) {
    00167	        zoom = NewButton.zoom;
    00168	        DrawStretchedTexture(C, (385*fRatioX+223-223*zoom), (270*fRatioY+63-63*zoom), 223*zoom, 63*zoom, tOnomatopee[4]);
    00169	        DrawLabel(C, NewLabel);
    00170	    }
    00171	/*    if (WorkButton.bDisplayTex) {
    00172	        DrawLabel(C, WorkLabel);
    00173	    }*/
    00174	    C.Style = 1;
    00175	}
    00176
    00177	// Called when a button is clicked
    00178	function bool InternalOnClick(GUIComponent Sender)
    00179	{
    00180	    local int i;
    00181	    if (Sender == ContinueButton)
    00182	      Controller.OpenMenu("XIDInterf.XIIIMenuContinue");
    00183	    if (Sender == MultiButton)
    00184	      Controller.OpenMenu("XIDInterf.XIIIMenuMultiplayer");
    00185	    if (Sender == LoadButton)
    00186	      Controller.OpenMenu("XIDInterf.XIIIMenuLoadGameWindow");
    00187	    if (Sender == OptionsButton)
    00188	      Controller.OpenMenu("XIDInterf.XIIIMenuOptions");
    00189	    if (Sender == NewButton)
    00190	    {
    00191			GetPlayerOwner().PlayMenu(hSoundNewGame);
    00192			if ( VP == none )
    00193				VP = new class'VideoPlayer';
    00194			if ( VP != none )
    00195			{
    00196				bPlayingVideo = true;
    00197				bNeedRawKey = true;
    00198				VP.Open(sVideo);
    00199				VP.Play();
    00200				GetPlayerOwner().StopAllSounds();
    00201				GotoState('PlayingVideo');
    00202			}
    00203	    }
    00204	/*    if (Sender == WorkButton)
    00205	      Controller.OpenMenu("XIDInterf.XIIIMenuChooseMap");*/
    00206	    return true;
    00207	}
    00208
    00209
    00210	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00211	{
    00212	    local int index;
    00213	    local bool bLeft, bRight, bUp, bDown;
    00214
    00215	    if (State==1)// IST_Press // to avoid auto-repeat
    00216	    {
    00217	      if ( VP != none )
    00218			{
    00219				if (Key==0xD4/*IK_Joy13*/)
    00220				{
    00221					VP.stop();
    00222					EndOfVideo();
    00223				}
    00224			}
    00225			else
    00226			{
    00227				if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
    00228				{
    00229					return InternalOnClick(FocusedControl);
    00230				}
    00231				bUp = (Key==0x26);
    00232				bDown = (Key==0x28);
    00233				bLeft = (Key==0x25);
    00234				bRight = (Key==0x27);
    00235				// controls are
    00236				//   0   1
    00237				//   2 3 4
    00238				//     5 -> will disappear in master
    00239				if (bUp ||bDown || bLeft ||bRight)
    00240				{
    00241
index = FindComponentIndex(FocusedControl); 00242 switch (index) 00243 { 00244 case 0 : 00245 if (bUp || bDown) Controls[2].SetFocus(none); 00246 if (bLeft || bRight) Controls[1].SetFocus(none); 00247 break; 00248 case 1 : 00249 if (bUp || bDown) Controls[4].SetFocus(none); 00250 if (bLeft || bRight) Controls[0].SetFocus(none); 00251 break; 00252 case 2 : 00253 if (bUp || bDown) Controls[0].SetFocus(none); 00254 if (bLeft) Controls[4].SetFocus(none); 00255 if (bRight) Controls[3].SetFocus(none); 00256 break; 00257 case 3 : 00258 if (bUp || bDown) Controls[0].SetFocus(none); 00259 // if (bDown) Controls[0].SetFocus(none); 00260 if (bLeft) Controls[2].SetFocus(none); 00261 if (bRight) Controls[4].SetFocus(none); 00262 break; 00263 case 4 : 00264 if (bUp || bDown) Controls[1].SetFocus(none); 00265 if (bLeft) Controls[3].SetFocus(none); 00266 if (bRight) Controls[2].SetFocus(none); 00267 break; 00268 /* case 5 : 00269 if (bUp) Controls[3].SetFocus(none); 00270 if (bDown) Controls[0].SetFocus(none); 00271 break;*/ 00272 } 00273 return true; 00274 } 00275 else if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B) /*IK_Escape*/) 00276 { 00277 myRoot.CloseMenu(true); 00278 return true; 00279 } 00280 } 00281 } 00282 return super.InternalOnKeyEvent(Key, state, delta); 00283 } 00284 00285 function EndOfVideo() 00286 { 00287 bPlayingVideo = false; 00288 bNeedRawKey = false; 00289 myRoot.CloseAll(true); 00290 myRoot.gotostate(''); 00291 GetPlayerOwner().ClientTravel("Plage00", TRAVEL_Absolute, false); 00292 } 00293 00294 State PlayingVideo 00295 { 00296 event Tick(float dt) 00297 { 00298 if (( VP != none ) && ( VP.GetStatus() == 0 )) 00299 { 00300 EndOfVideo(); 00301 } 00302 } 00303 } 00304 00305 00306 00307 00308 defaultproperties 00309 { 00310 ContinueText="Continue" 00311 QuitText="Quit" 00312 MultiplayerText="Multiplayer" 00313 LoadGameText="Load game" 00314 OptionsText="Options" 00315 NewGameText="New game" 00316 ConfirmQuitText="Do you really want to quit ?" 00317 ConfirmQuitTitle="Quit game" 00318 sBackground(0)="XIIIMenuStart.continue01gris" 00319 sBackground(1)="XIIIMenuStart.continue02gris" 00320 sBackground(2)="XIIIMenuStart.continue03gris" 00321 sBackground(3)="XIIIMenuStart.continue04gris" 00322 sBackground(4)="XIIIMenuStart.multiplayer01gris" 00323 sBackground(5)="XIIIMenuStart.multiplayer02gris" 00324 sBackground(6)="XIIIMenuStart.loadgame01gris" 00325 sBackground(7)="XIIIMenuStart.loadgame02bgris" 00326 sBackground(8)="XIIIMenuStart.loadgame03gris" 00327 sBackground(9)="XIIIMenuStart.loadgame04gris" 00328 sBackground(10)="XIIIMenuStart.loadgame02agris" 00329 sBackground(11)="XIIIMenuStart.options01gris" 00330 sBackground(12)="XIIIMenuStart.options02gris" 00331 sBackground(13)="XIIIMenuStart.newgame01gris" 00332 sBackground(14)="XIIIMenuStart.sortiegris" 00333 sHighlight(0)="XIIIMenuStart.continue01" 00334 sHighlight(1)="XIIIMenuStart.continue02" 00335 sHighlight(2)="XIIIMenuStart.continue03" 00336 sHighlight(3)="XIIIMenuStart.continue04" 00337 sHighlight(4)="XIIIMenuStart.multiplayer01" 00338 sHighlight(5)="XIIIMenuStart.multiplayer02" 00339 sHighlight(6)="XIIIMenuStart.loadgame01" 00340 sHighlight(7)="XIIIMenuStart.loadgame02b" 00341 sHighlight(8)="XIIIMenuStart.loadgame03" 00342 sHighlight(9)="XIIIMenuStart.loadgame04" 00343 sHighlight(10)="XIIIMenuStart.loadgame02a" 00344 sHighlight(11)="XIIIMenuStart.options01" 00345 sHighlight(12)="XIIIMenuStart.options02" 00346 sHighlight(13)="XIIIMenuStart.newgame01" 00347 sHighlight(14)="XIIIMenuStart.sortie" 00348 sOnomatopee(0)="XIIIMenuStart.newgameWoowoo" 00349 sOnomatopee(1)="XIIIMenuStart.multiplayerBam" 00350 sOnomatopee(2)="XIIIMenuStart.loadgameSlam" 00351 sOnomatopee(3)="XIIIMenuStart.optionBrrrr" 00352 sOnomatopee(4)="XIIIMenuStart.newgameksshhh" 00353 sOnomatopee(5)="XIIIMenuStart.bang" 00354 sVideo="cine00" 00355 hSoundMenu1=Sound'XIIIsound.Interface__AmbianceMenu.AmbianceMenu__hMainPage' 00356 hSoundMenu2=Sound'XIIIsound.Interface__AmbianceMenu.AmbianceMenu__hMainPage' 00357 }

End Source Code