## XIDInterf
Class XIIIMenuInGameMultiKick

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

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

Direct Known Subclasses:None

class XIIIMenuInGameMultiKick
extends XIDInterf.XIIIWindow

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

Variables
`PlayerButtons[7],` | `BackButton`
`STRING` | `BackText`
`BackgroundWidth,` | `BackgroundHeight`
`string` | `KickedPlayer`
`BoxHeight,` | `NbPlayers`
`bool` | `bSomebodyWasKicked`

Function Summary
`void` | `BeforePaint(Canvas C, float X, float Y)`
    /*
`void` | `Created()`
    //============================================================================
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `KickMsgBoxReturn(byte bButton)`
`void` | `Paint(Canvas C, float X, float Y)`
    {

    	Super.BeforePaint(C, X, Y);

    	if (bDoQuitGame)
    		QuitGame();
    	if (bDoRestartGame)
    		RestartGame();
    }
    */
`void` | `ShowWindow()`

Source Code

    00001	//============================================================================
    00002	// The In Game menu for multiplayer mode
    00003	//
    00004	//============================================================================
    00005	class XIIIMenuInGameMultiKick 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 PlayerButtons[7], BackButton;
    00015	var string KickedPlayer;
    00016	var bool bSomebodyWasKicked;
    00017
    00018
    00019	//============================================================================
    00020	function Created()
    00021	{
    00022		LOCAL int i, j, LineSpace, FirstLineY;
    00023		LOCAL class<GameInfo> GameClass;
    00024		LOCAL bool bCanKick;
    00025
    00026		Super.Created();
    00027
    00028		// init values
    00029		BoxWidth = 200;
    00030		BoxHeight = 22;
    00031		BoxPosX = 230;
    00032		BackgroundPosX = 220;
    00033		BackgroundPosY = 130;
    00034		BackgroundWidth = 220;
    00035		BackgroundHeight = 230;
    00036
    00037		if ( GetPlayerOwner().myHUD.bShowScores )
    00038			GetPlayerOwner().myHUD.HideScores();
    00039
    00040		BoxPosY = 250 - 8 /*NbButtons*/ * 14;
    00041		LineSpace = 27;
    00042		FirstLineY = BoxPosY;
    00043
    00044		for ( j=0; j<7; j++)
    00045		{
    00046			PlayerButtons[j] = XIIIButton(CreateControl(class'XIIIButton', BoxPosX, FirstLineY*fScaleTo, BoxWidth, BoxHeight*fScaleTo));
    00047			PlayerButtons[j].Text = "";
    00048			PlayerButtons[j].bUseBorder = false;
    00049			PlayerButtons[j].bNeverFocus = true;
    00050	//	ReturnButton.NbMultiSplit = NbPlayers;
    00051			Controls[Controls.Length] = PlayerButtons[j];
    00052			FirstLineY  += LineSpace;
    00053	//		i++;
    00054		}
    00055
    00056		FirstLineY += 4;
    00057		BackButton = XIIIButton(CreateControl(class'XIIIButton', 280, FirstLineY*fScaleTo, 100, BoxHeight*fScaleTo));
    00058		BackButton.Text = BackText;
    00059		BackButton.bUseBorder = true;
    00060	//	ReturnButton.NbMultiSplit = NbPlayers;
    00061		Controls[Controls.Length] = BackButton;
    00062	//	FirstLineY  += LineSpace;
    00063	//	i++;
    00064		NbButtons=	Controls.Length;
    00065
    00066	//	FocusedControl = BackButton;
    00067
    00068
    00069	}
    00070
    00071
    00072	/*
    00073	function BeforePaint(Canvas C, float X, float Y)
    00074	{
    00075
    00076		Super.BeforePaint(C, X, Y);
    00077
    00078		if (bDoQuitGame)
    00079			QuitGame();
    00080		if (bDoRestartGame)
    00081			RestartGame();
    00082	}
    00083	*/
    00084
    00085	function Paint(Canvas C, float X, float Y)
    00086	{
    00087		LOCAL int i, j;
    00088		LOCAL Controller Ctrl;
    00089
    00090		Super.Paint(C,X,Y);
    00091
    00092	//	if (( GetPlayerOwner().Level.bLonePlayer ) || ( GetPlayerOwner().Level.Game.NumPlayers == 1 ))
    00093		C.DrawMsgboxBackground(false, BackgroundPosX*fRatioX, BackgroundPosY*fRatioY*fScaleTo, 10, 10, BackgroundWidth*fRatioX, BackgroundHeight*fRatioY*fScaleTo);
    00094	//	else
    00095	//		C.DrawMsgboxBackground(false, BackgroundPosX, BackgroundPosY*fScaleTo, 10, 10, BackgroundWidth, BackgroundHeight*fScaleTo);
    00096
    00097		// only selected control has a border
    00098	    for (i=0; i<NbButtons; i++)
    00099	        XIIIButton(Controls[i]).bUseBorder = false;
    00100	    if (FindComponentIndex(FocusedControl)!= -1)
    00101	        XIIIButton(Controls[FindComponentIndex(FocusedControl)]).bUseBorder = true;
    00102
    00103		i=0;
    00104		if ( GetPlayerOwner()!=none && GetPlayerOwner().Level!=none )
    00105		{
    00106			for ( Ctrl = GetPlayerOwner().Level.ControllerList; Ctrl!=None; Ctrl= Ctrl.NextController )
    00107			{
    00108				if ( Ctrl==GetPlayerOwner() )
    00109					continue;
    00110				if ( Ctrl.IsA( 'PlayerController' ) )
    00111				{
    00112					XIIIButton(Controls[i]).Text = PlayerController(Ctrl).PlayerReplicationInfo.PlayerName;
    00113					Controls[i].bNeverFocus=false;
    00114					i++;
    00115				}
    00116			}
    00117		}
    00118		if (( bSomebodyWasKicked ) && ( i == 0 ))
    00119		{
    00120			NextControl(FocusedControl);
    00121			bSomebodyWasKicked = false;
    00122		}
    00123
    00124		for ( j=i; j<7; j++ )
    00125		{
    00126			Controls[j].bNeverFocus=true;
    00127			XIIIButton(Controls[j]).Text = "";
    00128		}
    00129
    00130		// restore old param
    00131		C.DrawColor = WhiteColor;
    00132	    C.DrawColor.A = 255;
    00133		C.Style = 1;
    00134		C.bUseBorder = false;
    00135	}
    00136
    00137	function KickMsgBoxReturn(byte bButton)
    00138	{
    00139		bShowBCK = true;
    00140		if ((bButton & QBTN_Yes) != 0)
    00141		{
    00142			GetPlayerOwner().ConsoleCommand("Kick"@KickedPlayer);
    00143			bSomebodyWasKicked = true;
    00144		}
    00145	}
    00146
    00147	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00148	{
    00149	    local int index;
    00150	    local bool bLeftOrRight, bUpOrDown;
    00151	    local controller P;
    00152	    local XIIIMsgBoxInGame MsgBox;
    00153
    00154
    00155	    if (State==1)// IST_Press // to avoid auto-repeat
    00156	    {
    00157	        if ((Key==0x0D) || (Key==0x01)) // IK_Enter && IK_LeftButton
    00158		    {
    00159				if ( FocusedControl==BackButton )
    00160					Key=0x08;
    00161				else
    00162				{
    00163					index= FindComponentIndex(FocusedControl);
    00164					if ( index>=0 && index<=6)
    00165					{	// confirm please
    00166						//GetPlayerOwner().ConsoleCommand("Kick"@XIIIButton(FocusedControl).Text);
    00167						KickedPlayer = XIIIButton(FocusedControl).Text;
    00168						bShowBCK = false;
    00169						myRoot.OpenMenu("XIDInterf.XIIIMsgBoxInGame");
    00170						MsgBox = XIIIMsgBoxInGame(myRoot.ActivePage);
    00171						MsgBox.InitBox(BackgroundPosX*fRatioX, BackgroundPosY*fScaleTo*fRatioY, 10, 10, BackgroundWidth*fRatioX, BackgroundHeight*fScaleTo*fRatioY);
    00172						MsgBox.SetupQuestion(class'XIIIMenuInGameMulti'.default.ConfirmQuitTxt, QBTN_Yes | QBTN_No, QBTN_No,class'XIIIMenuInGameMulti'.default.KickText);
    00173						MsgBox.OnButtonClick = KickMsgBoxReturn;
    00174					}
    00175
    00176					return true; //InternalOnClick(FocusedControl);
    00177				}
    00178		    }
    00179		    if (Key==0x08 || Key==0x1B) // IK_Backspace - IK_Escape
    00180		    {
    00181		        myRoot.CloseMenu(true);
    00182	    	    return true;
    00183		    }
    00184		    if (Key==0x26) // IK_Up
    00185		    {
    00186		        PrevControl(FocusedControl);
    00187	    	    return true;
    00188		    }
    00189		    if (Key==0x28) // IK_Down
    00190		    {
    00191		        NextControl(FocusedControl);
    00192	    	    return true;
    00193		    }
    00194	    }
    00195	    return super.InternalOnKeyEvent(Key, state, delta);
    00196	}
    00197
    00198
    00199	function ShowWindow()
    00200	{
    00201
    00202	     Super.ShowWindow();
    00203
    00204	     bShowBCK = true;
    00205	     bShowSEL = true;
    00206	}
    00207
    00208
    00209
    00210
    00211	defaultproperties
    00212	{
    00213	     BackText="Back"
    00214	     bForceHelp=True
    00215	     Background=None
    00216	     bCheckResolution=True
    00217	     bRequire640x480=False
    00218	     bAllowedAsLast=True
    00219	}

End Source Code