## XIDInterf
Class XIIIMenuMultiplayer

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

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

Direct Known Subclasses:None

class XIIIMenuMultiplayer
extends XIDInterf.XIIIWindowMainMenu

    //============================================================================
    // Save Game menu.
    //
    //============================================================================

Variables
`GSButton,` | `ProfileButton`
`GSLabel,` | `ProfileLabel`
`XBoxLiveText,` | `ProfileXBoxText`
`XIIIMsgBox` | `msgbox`
`string` | `networkcableDisconnectedString`
`sHighlight[9],` | `sOnomatopee[5]`
`Texture` | `tBackGround[9]`
`Texture` | `tHighlight[9]`
`Texture` | `tOnomatopee[5]`

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

Source Code

    00001	//============================================================================
    00002	// Save Game menu.
    00003	//
    00004	//============================================================================
    00005	class XIIIMenuMultiplayer extends XIIIWindowMainMenu;
    00006
    00007	var XIIITextureButton SplitButton, LANJoinButton, LANHostButton, GSButton, ProfileButton;
    00008	var XIIILabel SplitLabel, LANJoinLabel, LANHostLabel, GSLabel, ProfileLabel;
    00009	var localized string    SplitText, LANJoinText, LANHostText, XBoxLiveText, ProfileXBoxText;
    00010
    00011	var localized string networkcableDisconnectedString;
    00012
    00013	var texture tBackGround[9];
    00014	var texture tHighlight[9];
    00015	var texture tOnomatopee[5];
    00016	var string sBackGround[9], sHighlight[9], sOnomatopee[5];
    00017	var XIIIMsgBox msgbox;
    00018
    00019	function Created()
    00020	{
    00021	    local int i;
    00022
    00023	    super.Created();
    00024
    00025	    for (i=0; i<9; i++)
    00026	    {
    00027	        tHighlight[i] = texture(DynamicLoadObject(sHighlight[i], class'Texture'));
    00028	        tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00029	    }
    00030	    for (i=0; i<5; i++)
    00031	        tOnomatopee[i] = texture(DynamicLoadObject(sOnomatopee[i], class'Texture'));
    00032
    00033	    SplitButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 30, 30*fScaleTo, 270, 140*fScaleTo));
    00034	    SplitButton.tFirstTex[0]=tBackGround[0];
    00035	    SplitButton.tFirstTex[1]=tHighlight[0];
    00036
    00037	    LANJoinButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 310, 30*fScaleTo, 145, 250*fScaleTo));
    00038	    LANJoinButton.tFirstTex[0]=tBackGround[1];
    00039	    LANJoinButton.tSecondTex[0]=tBackGround[2];
    00040	    LANJoinButton.tThirdTex[0]=tBackGround[3];
    00041	    LANJoinButton.tFirstTex[1]=tHighlight[1];
    00042	    LANJoinButton.tSecondTex[1]=tHighlight[2];
    00043	    LANJoinButton.tThirdTex[1]=tHighlight[3];
    00044	    LANJoinButton.yOff = 256;
    00045
    00046	    LANHostButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 465, 30*fScaleTo, 145, 250*fScaleTo));
    00047	    LANHostButton.tFirstTex[0]=tBackGround[4];
    00048	    LANHostButton.tSecondTex[0]=tBackGround[5];
    00049	    LANHostButton.tThirdTex[0]=tBackGround[6];
    00050	    LANHostButton.tFirstTex[1]=tHighlight[4];
    00051	    LANHostButton.tSecondTex[1]=tHighlight[5];
    00052	    LANHostButton.tThirdTex[1]=tHighlight[6];
    00053	    LANHostButton.yOff = 256;
    00054
    00055	    GSButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 30, 180*fScaleTo, 270, 250*fScaleTo));
    00056	    GSButton.tFirstTex[0]=tBackGround[7];
    00057	    GSButton.tFirstTex[1]=tHighlight[7];
    00058
    00059	    ProfileButton = XIIITextureButton(CreateControl(class'XIIITextureButton', 310, 290*fScaleTo, 300, 140*fScaleTo));
    00060	    ProfileButton.tFirstTex[0]=tBackGround[8];
    00061	    ProfileButton.tFirstTex[1]=tHighlight[8];
    00062
    00063		Controls[0]=SplitButton;
    00064		Controls[1]=LANJoinButton;
    00065	    Controls[2]=LANHostButton;
    00066	    Controls[3]=GSButton;
    00067	    Controls[4]=ProfileButton;
    00068
    00069	    InitLabel(SplitLabel, 16, 128*fScaleTo, 208, 32*fScaleTo, SplitText);
    00070	    InitLabel(LANJoinLabel, 256, 192*fScaleTo, 192, 32*fScaleTo, LANJoinText);
    00071	    InitLabel(LANHostLabel, 416, 48*fScaleTo, 192, 32*fScaleTo, LANHostText);
    00072	    InitLabel(GSLabel, 80, 200*fScaleTo, 240, 32*fScaleTo, XBoxLiveText);
    00073	    InitLabel(ProfileLabel, 256, 380*fScaleTo, 256, 32*fScaleTo, ProfileXBoxText);
    00074
    00075		OnReOpen = InternalOnOpen;
    00076
    00077		GotoState('ReinitMusic');
    00078	}
    00079
    00080	function bool InternalOnPreDraw(Canvas C)
    00081	{
    00082		local int index;
    00083		index = FindComponentIndex(FocusedControl);
    00084		if (myRoot.CableDisconnected )
    00085		{
    00086			Controls[1].bNeverFocus=true;
    00087			Controls[2].bNeverFocus=true;
    00088			if ((index>0) && (index<3))
    00089				Controls[0].SetFocus(none);
    00090		}
    00091		else
    00092		{
    00093			Controls[1].bNeverFocus=false;
    00094			Controls[2].bNeverFocus=false;
    00095		}
    00096	    return super.InternalOnPreDraw(C);
    00097	}
    00098
    00099	function ShowWindow()
    00100	{
    00101	    super.ShowWindow();
    00102	    bShowBCK = true;
    00103	    bShowSEL = true;
    00104	}
    00105
    00106
    00107	function AfterPaint(Canvas C, float X, float Y)
    00108	{
    00109	    local float zoom;
    00110
    00111	    super.AfterPaint(C, X, Y);
    00112
    00113	    C.Style = 5;
    00114	    if (SplitButton.bDisplayTex) {
    00115	        zoom = SplitButton.zoom;
    00116	        DrawStretchedTexture(C, (160*fRatioX+224-224*zoom), (23*fRatioY+64-64*zoom), 224*zoom, 64*zoom, tOnomatopee[0]);
    00117	        DrawLabel(C, SplitLabel);
    00118	    }
    00119	    if (LANJoinButton.bDisplayTex) {
    00120	        zoom = LANJoinButton.zoom;
    00121	        DrawStretchedTexture(C, (304*fRatioX+96-96*zoom), (32*fRatioY+64-64*zoom), 96*zoom, 64*zoom, tOnomatopee[1]);
    00122	        DrawLabel(C, LANJoinLabel);
    00123	    }
    00124	    if (LANHostButton.bDisplayTex) {
    00125	        zoom = LANHostButton.zoom;
    00126	        DrawStretchedTexture(C, (480*fRatioX+142-142*zoom), (196*fRatioY+64-64*zoom), 142*zoom, 64*zoom, tOnomatopee[2]);
    00127	        DrawLabel(C, LANHostLabel);
    00128	    }
    00129	    if (GSButton.bDisplayTex) {
    00130	        zoom = GSButton.zoom;
    00131	        DrawStretchedTexture(C, (159*fRatioX+193-193*zoom), (279*fRatioY+48-48*zoom), 193*zoom, 96*zoom, tOnomatopee[3]);
    00132	        DrawLabel(C, GSLabel);
    00133	    }
    00134	    if (ProfileButton.bDisplayTex) {
    00135	        zoom = ProfileButton.zoom;
    00136	        DrawStretchedTexture(C, (512*fRatioX+128-128*zoom), (256*fRatioY+64-64*zoom), 128*zoom, 64*zoom, tOnomatopee[4]);
    00137	        DrawLabel(C, ProfileLabel);
    00138	    }
    00139	    C.Style = 1;
    00140	}
    00141
    00142	// Called when a button is clicked
    00143	function bool InternalOnClick(GUIComponent Sender)
    00144	{
    00145	    local int i;
    00146	    if (Sender == SplitButton)
    00147	      Controller.OpenMenu("XIDInterf.XIIIMenuSplitSetupClient");
    00148	    else if (Sender == ProfileButton)
    00149	      Controller.OpenMenu("XIDInterf.XIIIMenuMultiProfile");
    00150	    else if (Sender == GSButton)
    00151	      Controller.OpenMenu("XIDInterf.XIIIMenuLiveAccountWindow");//XIIIMenuLiveMainWindow");
    00152		/*else if (myRoot.CableDisconnected )
    00153		{
    00154	        Controller.OpenMenu("XIDInterf.XIIIMsgBox");
    00155	        msgbox = XIIIMsgBox(myRoot.ActivePage);
    00156	        msgbox.SetupQuestion(networkcableDisconnectedString, QBTN_Ok, QBTN_Ok);
    00157	        msgbox.InitBox(120, 130, 10, 10, 400, 230);
    00158		}*/
    00159		else if (Sender == LANJoinButton)
    00160	      Controller.OpenMenu("XIDInterf.XIIIMenuMultiLANJoin");
    00161	    else if (Sender == LANHostButton)
    00162	      Controller.OpenMenu("XIDInterf.XIIIMenuMultiLANHost");
    00163
    00164	    return true;
    00165	}
    00166
    00167
    00168	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00169	{
    00170	    local int index;
    00171	    local bool bLeft, bRight, bUp, bDown;
    00172
    00173	    if (State==1)// IST_Press // to avoid auto-repeat
    00174	    {
    00175	        if ((Key==0x0D/*IK_Enter*/) || (Key==0x01))
    00176		    {
    00177	            return InternalOnClick(FocusedControl);
    00178		    }
    00179	        bUp = (Key==0x26);
    00180	        bDown = (Key==0x28);
    00181	        bLeft = (Key==0x25);
    00182	        bRight = (Key==0x27);
    00183
    00184	        // controls are
    00185	        //   0 1 2
    00186	        //   3  4
    00187		    if (bUp ||bDown || bLeft ||bRight)
    00188		    {
    00189		        index = FindComponentIndex(FocusedControl);
    00190				if (myRoot.CableDisconnected )
    00191				{
    00192					switch (index)
    00193					{
    00194						case 0 :
    00195							if (bUp || bDown) Controls[3].SetFocus(none);
    00196							if (bLeft || bRight) Controls[4].SetFocus(none);
    00197						break;
    00198						case 3 :
    00199							if (bUp || bDown) Controls[0].SetFocus(none);
    00200							if (bLeft || bRight) Controls[4].SetFocus(none);
    00201						break;
    00202						case 4 :
    00203							if (bUp || bDown) Controls[0].SetFocus(none);
    00204							if (bLeft || bRight) Controls[3].SetFocus(none);
    00205						break;
    00206						default :
    00207							Controls[0].SetFocus(none);
    00208						break;
    00209					}
    00210					return true;
    00211				}
    00212				else
    00213				{
    00214					switch (index)
    00215					{
    00216						case 0 :
    00217							if (bUp || bDown) Controls[3].SetFocus(none);
    00218							if (bLeft) Controls[2].SetFocus(none);
    00219							if (bRight) Controls[1].SetFocus(none);
    00220						break;
    00221						case 1 :
    00222							if (bUp || bDown) Controls[4].SetFocus(none);
    00223							if (bLeft) Controls[0].SetFocus(none);
    00224							if (bRight) Controls[2].SetFocus(none);
    00225						break;
    00226						case 2 :
    00227							if (bUp || bDown) Controls[4].SetFocus(none);
    00228							if (bLeft) Controls[1].SetFocus(none);
    00229							if (bRight) Controls[0].SetFocus(none);
    00230						break;
    00231						case 3 :
    00232							if (bUp || bDown) Controls[0].SetFocus(none);
    00233							if (bLeft || bRight) Controls[4].SetFocus(none);
    00234						break;
    00235						case 4 :
    00236							if (bUp || bDown) Controls[1].SetFocus(none);
    00237							if (bLeft || bRight) Controls[3].SetFocus(none);
    00238						break;
    00239					}
    00240	    			return true;
    00241	    		}
    00242		    }
    00243	        else if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B) /*IK_Escape*/)
    00244		    {
    00245
myRoot.CloseMenu(true); 00246 return true; 00247 } 00248 } 00249 return super.InternalOnKeyEvent(Key, state, delta); 00250 } 00251 00252 00253 00254 00255 defaultproperties 00256 { 00257 TitleText="Multiplayer" 00258 BotChallengeText="Bot Challenge" 00259 LANJoinPCText="Join a LAN game" 00260 LANHostPCText="Host a LAN game" 00261 GameServiceText="UbiSoft's Online Game Service" 00262 ProfileText="Online Multiplayer profile" 00263 sBackground(0)="XIIIMenuStart.Multi_rules.multi_splittergris" 00264 sBackground(1)="XIIIMenuStart.Multi_rules.multi_BG01gris" 00265 sBackground(2)="XIIIMenuStart.Multi_rules.multi_BG02gris" 00266 sBackground(3)="XIIIMenuStart.Multi_rules.multi_BG03gris" 00267 sBackground(4)="XIIIMenuStart.Multi_rules.multi_BG01gris" 00268 sBackground(5)="XIIIMenuStart.Multi_rules.multi_BG02gris" 00269 sBackground(6)="XIIIMenuStart.Multi_rules.multi_BG03gris" 00270 sBackground(7)="XIIIMenuStart.Multi_rules.multilive01gris" 00271 sBackground(8)="XIIIMenuStart.Multi_rules.multi_profilegris" 00272 sHighlight(0)="XIIIMenuStart.Multi_rules.multi_splitter" 00273 sHighlight(1)="XIIIMenuStart.Multi_rules.multi_BG01" 00274 sHighlight(2)="XIIIMenuStart.Multi_rules.multi_BG02" 00275 sHighlight(3)="XIIIMenuStart.Multi_rules.multi_BG03" 00276 sHighlight(4)="XIIIMenuStart.Multi_rules.multi_BG01_1" 00277 sHighlight(5)="XIIIMenuStart.Multi_rules.multi_BG02_2" 00278 sHighlight(6)="XIIIMenuStart.Multi_rules.multi_BG03_3" 00279 sHighlight(7)="XIIIMenuStart.Multi_rules.multilive01" 00280 sHighlight(8)="XIIIMenuStart.Multi_rules.multi_profile" 00281 sOnomatopee(0)="XIIIMenuStart.onlineBaomm" 00282 sOnomatopee(1)="XIIIMenuStart.Controle_PC.Bang" 00283 sOnomatopee(2)="XIIIMenuStart.Controle_PC.Crash" 00284 sOnomatopee(3)="XIIIMenuStart.Controle_PC.ksshss" 00285 sOnomatopee(4)="XIIIMenuStart.Controle_PC.clapclap" 00286 hSoundMenu1=Sound'XIIIsound.Interface__AmbianceMenu.AmbianceMenu__hMulti' 00287 }

End Source Code