## XIDInterf
Class XIIIMenuInGameSabotage

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

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

Direct Known Subclasses:None

class XIIIMenuInGameSabotage
extends XIDInterf.XIIIWindow

    //============================================================================
    // The In Game menu for multiplayer mode
    //
    //============================================================================

Variables
`ClassButtons[4],` | `BackButton`
`BackgroundWidth,` | `BackgroundHeight`
`BoxHeight,` | `NbPlayers`

Function Summary
`void` | `Created()`
    //============================================================================
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `ShowWindow()`

Source Code

    00001	//============================================================================
    00002	// The In Game menu for multiplayer mode
    00003	//
    00004	//============================================================================
    00005	class XIIIMenuInGameSabotage extends XIIIWindow;
    00006
    00007	//var  XIIIButton TeamButton, OptionsButton, QuitButton, ReturnButton, RestartButton, KickButton;
    00008	//var  localized string TeamText, OptionsText, QuitText, ReturnText, RestartText, KickText;
    00009	//var bool bTeamMode;
    00010	//VAR LOCALIZED STRING BackText;
    00011	VAR int NbButtons, BoxPosX, BoxPosY, BoxWidth, BoxHeight, NbPlayers;
    00012	VAR int BackgroundPosX, BackgroundPosY, BackgroundWidth, BackgroundHeight;
    00013	//var float fX, fY;
    00014	VAR XIIIButton ClassButtons[4], BackButton;
    00015
    00016
    00017	//============================================================================
    00018	function Created()
    00019	{
    00020		LOCAL int i, j, LineSpace, FirstLineY;
    00021		LOCAL class<GameInfo> GameClass;
    00022		LOCAL bool bCanKick;
    00023
    00024		Super.Created();
    00025
    00026		// init values
    00027		BoxWidth = 300;
    00028		BoxHeight = 36;
    00029		BoxPosX = 180;
    00030		BackgroundPosX = 170;
    00031		BackgroundPosY = 130;
    00032		BackgroundWidth = 320;
    00033		BackgroundHeight = 230;
    00034
    00035		if ( GetPlayerOwner().myHUD.bShowScores )
    00036			GetPlayerOwner().myHUD.HideScores();
    00037
    00038		BoxPosY = 250 - 8 /*NbButtons*/ * 14;
    00039		LineSpace = 42;
    00040		FirstLineY = BoxPosY+4;
    00041
    00042		for ( j=0; j<4; j++)
    00043		{
    00044			ClassButtons[j] = XIIIButton(CreateControl(class'XIIIButton', BoxPosX, FirstLineY*fScaleTo, BoxWidth, BoxHeight*fScaleTo));
    00045			ClassButtons[j].Text = class'MPClassList'.default.ClassListInfo[j].ReadableName;
    00046			ClassButtons[j].bUseBorder = false;
    00047			ClassButtons[j].bNeverFocus = false;
    00048	//	ReturnButton.NbMultiSplit = NbPlayers;
    00049			Controls[Controls.Length] = ClassButtons[j];
    00050			FirstLineY  += LineSpace;
    00051	//		i++;
    00052		}
    00053
    00054		FirstLineY += 8;
    00055		BackButton = XIIIButton(CreateControl(class'XIIIButton', 250, FirstLineY*fScaleTo, 160, BoxHeight*fScaleTo));
    00056		BackButton.Text = BackText;
    00057		BackButton.bUseBorder = true;
    00058		Controls[Controls.Length] = BackButton;
    00059		NbButtons=	Controls.Length;
    00060	}
    00061
    00062	function Paint(Canvas C, float X, float Y)
    00063	{
    00064		LOCAL int i, j;
    00065		LOCAL Controller Ctrl;
    00066
    00067		Super.Paint(C,X,Y);
    00068
    00069		C.DrawMsgboxBackground(false, BackgroundPosX*fRatioX, BackgroundPosY*fRatioY*fScaleTo, 10, 10, BackgroundWidth*fRatioX, BackgroundHeight*fRatioY*fScaleTo);
    00070
    00071		// only selected control has a border
    00072	    for (i=0; i<NbButtons; i++)
    00073	        XIIIButton(Controls[i]).bUseBorder = false;
    00074	    if (FindComponentIndex(FocusedControl)!= -1)
    00075	        XIIIButton(Controls[FindComponentIndex(FocusedControl)]).bUseBorder = true;
    00076
    00077		// restore old param
    00078		C.DrawColor = WhiteColor;
    00079	    C.DrawColor.A = 255;
    00080		C.Style = 1;
    00081		C.bUseBorder = false;
    00082	}
    00083
    00084	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00085	{
    00086	    local int index;
    00087	    local bool bLeftOrRight, bUpOrDown;
    00088	    local controller P;
    00089
    00090	    if (State==1)// IST_Press // to avoid auto-repeat
    00091	    {
    00092	        if ((Key==0x0D) || (Key==0x01)) // IK_Enter && IK_LeftButton
    00093		    {
    00094				if ( FocusedControl==BackButton )
    00095					Key=0x08;
    00096				else
    00097				{
    00098					index= FindComponentIndex(FocusedControl);
    00099
    00100					XIIIMPPlayerController(GetPlayerOwner()).ChangeClass( index );
    00101					myRoot.CloseAll(true);
    00102					myRoot.GotoState('');
    00103					return true; //InternalOnClick(FocusedControl);
    00104				}
    00105		    }
    00106		    if (Key==0x08 || Key==0x1B) // IK_Backspace - IK_Escape
    00107		    {
    00108		        myRoot.CloseMenu(true);
    00109	    	    return true;
    00110		    }
    00111		    if (Key==0x26) // IK_Up
    00112		    {
    00113		        PrevControl(FocusedControl);
    00114	    	    return true;
    00115		    }
    00116		    if (Key==0x28) // IK_Down
    00117		    {
    00118		        NextControl(FocusedControl);
    00119	    	    return true;
    00120		    }
    00121	    }
    00122	    return super.InternalOnKeyEvent(Key, state, delta);
    00123	}
    00124
    00125
    00126	function ShowWindow()
    00127	{
    00128
    00129	     Super.ShowWindow();
    00130
    00131	     bShowBCK = true;
    00132	     bShowSEL = true;
    00133	}
    00134
    00135	//     BackText="Back"
    00136
    00137
    00138
    00139	defaultproperties
    00140	{
    00141	     bForceHelp=True
    00142	     Background=None
    00143	     bCheckResolution=True
    00144	     bRequire640x480=False
    00145	     bAllowedAsLast=True
    00146	}

End Source Code