## XIDInterf
Class XIIIMenuPlayersSetupClient

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

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

Direct Known Subclasses:None

class XIIIMenuPlayersSetupClient
extends XIDInterf.XIIIMenuMultiBase

Variables
`FriendlyFire,` | `DefaultConfig`
`URL,` | `Map`
`PT[4],` | `NbClasses`
`OnCombo,` | `OnMenu`
`XIIIButton` | `PlayerButton[4]`
`XIIIComboControl` | `PlayerClassButton[4]`
`XIIICheckBoxControl` | `PlayerTeamButton[4]`
`RedTeam,` | `PlayerText`
`sBackground,` | `sHighlight`
`tBackground,` | `tHighlight`

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

Source Code

    00001	class XIIIMenuPlayersSetupClient extends XIIIMenuMultiBase;
    00002
    00003	var int OnCombo, OnMenu;
    00004
    00005	var XIIIButton PlayerButton[4];
    00006	var XIIIComboControl PlayerClassButton[4];
    00007	var XIIICheckBoxControl PlayerTeamButton[4];
    00008
    00009	var localized string ClassText, TeamText, BlueTeam, RedTeam, PlayerText;
    00010
    00011	var string URL, Map;
    00012	var int PC[4], PT[4], NbClasses;
    00013	var int GameTypeIndex, IPC, N, MaxBots, FragLimit, TimeLimit, BotNumber, TeamBot[7], NivBot[7], FriendlyFire, DefaultConfig;
    00014
    00015	var string sBackground, sHighlight;
    00016	var texture tBackground, tHighlight;
    00017
    00018
    00019	//------------------------------------------------------------------------
    00020	event HandleParameters(string Param1, string Param2)
    00021	{
    00022		if ( Param1!="" )
    00023		{
    00024			URL = Param1;
    00025			log("Param1="$URL);
    00026			Map = localParseOption ( URL, "Map", "");
    00027			GameTypeIndex = int(localParseOption ( URL, "GameTypeIndex", "0"));
    00028			IPC = int( localParseOption( URL,"IP", "0") );
    00029			N = int( localParseOption( URL,"NP", "0") );
    00030			FriendlyFire = int( localParseOption( URL,"FF", "0") );
    00031			FragLimit = int( localParseOption( URL,"FR", "0") );
    00032			TimeLimit = int( localParseOption( URL,"TI", "0") );
    00033			DefaultConfig = int( localParseOption( URL,"DC", "0") );
    00034			BotNumber = int( localParseOption( URL,"NBots", "0") );
    00035			TeamBot[0] = int( localParseOption( URL,"TB0", "1") );
    00036			NivBot[0] = int( localParseOption( URL,"NB0", "1") );
    00037			TeamBot[1] = int( localParseOption( URL,"TB1", "0") );
    00038			NivBot[1] = int( localParseOption( URL,"NB1", "2") );
    00039			TeamBot[2] = int( localParseOption( URL,"TB2", "1") );
    00040			NivBot[2] = int( localParseOption( URL,"NB2", "2") );
    00041			TeamBot[3] = int( localParseOption( URL,"TB3", "0") );
    00042			NivBot[3] = int( localParseOption( URL,"NB3", "0") );
    00043			TeamBot[4] = int( localParseOption( URL,"TB4", "1") );
    00044			NivBot[4] = int( localParseOption( URL,"NB4", "0") );
    00045			TeamBot[5] = int( localParseOption( URL,"TB5", "0") );
    00046			NivBot[5] = int( localParseOption( URL,"NB5", "3") );
    00047			TeamBot[6] = int( localParseOption( URL,"TB6", "1") );
    00048			NivBot[6] = int( localParseOption( URL,"NB6", "3") );
    00049			PC[0] = int( localParseOption( URL,"PC0", "0") );
    00050			PC[1] = int( localParseOption( URL,"PC1", "0") );
    00051			PC[2] = int( localParseOption( URL,"PC2", "1") );
    00052			PC[3] = int( localParseOption( URL,"PC3", "1") );
    00053			PT[0] = int( localParseOption( URL,"PT0", "0") );
    00054			PT[1] = int( localParseOption( URL,"PT1", "1") );
    00055			PT[2] = int( localParseOption( URL,"PT2", "0") );
    00056			PT[3] = int( localParseOption( URL,"PT3", "1") );
    00057
    00058			log(self@"---> Classes :"@PC[0]@PC[1]@PC[2]@PC[3]);
    00059			log(self@"---> Teams :"@PT[0]@PT[1]@PT[2]@PT[3]);
    00060		}
    00061	}
    00062
    00063
    00064	function Created()
    00065	{
    00066	    local int i,j, MyClassIndex;
    00067
    00068		Super.Created();
    00069
    00070		tBackGround = texture(DynamicLoadObject(sBackGround, class'Texture'));
    00071		tHighlight = texture(DynamicLoadObject(sHighlight, class'Texture'));
    00072
    00073		NbClasses = class'MPClassList'.default.ClassListInfo.Length;
    00074		log("NbClasses="$NbClasses);
    00075		for (i=0;i<4;i++)
    00076		{
    00077			PlayerTeamButton[i] = XIIICheckboxControl(CreateControl(class'XIIICheckboxControl', 190, (50 + 100*i)*fScaleTo, 400, 25));
    00078			PlayerTeamButton[i].Text = TeamText;
    00079			PlayerTeamButton[i].sYes = BlueTeam;
    00080			PlayerTeamButton[i].sNo = RedTeam;
    00081			PlayerTeamButton[i].bWhiteColorOnlyWhenFocused = true;
    00082			PlayerTeamButton[i].bChecked = bool(PT[i]);
    00083
    00084			PlayerClassButton[i] = XIIIComboControl(CreateControl(class'XIIIComboControl', 190, (90 + 100*i)*fScaleTo, 410, 25));
    00085			PlayerClassButton[i].Text = ClassText;
    00086			PlayerClassButton[i].bArrows = true;
    00087			PlayerClassButton[i].bCalculateSize = false;
    00088			PlayerClassButton[i].FirstBoxWidth = 230;
    00089			for (j=0;j<NbClasses;j++)
    00090			{
    00091				PlayerClassButton[i].AddItem(class'MPClassList'.default.ClassListInfo[j].ReadableName);
    00092				if ( PC[i] == j )
    00093					MyClassIndex = j;
    00094			}
    00095			PlayerClassButton[i].SetSelectedIndex(MyClassIndex);
    00096
    00097			PlayerButton[i] = XIIIButton(CreateControl(class'XIIIButton', 35, (50 + 100*i)*fScaleTo, 130, 25));
    00098			PlayerButton[i].Text = PlayerText@(i + 1);
    00099			PlayerButton[i].bNeverFocus = true;
    00100			PlayerButton[i].bVisible = true;
    00101
    00102			Controls[2*i] = PlayerTeamButton[i];
    00103			Controls[2*i + 1] = PlayerClassButton[i];
    00104			Controls[8 + i] = PlayerButton[i];
    00105
    00106		}
    00107
    00108		AfterCreate();
    00109	}
    00110
    00111	function AfterCreate()
    00112	{
    00113	    local int i,j, NbPads;
    00114
    00115	 	//NbPads = GetPlayerOwner().GetPadNumber();
    00116		NbPads = 4;
    00117
    00118		if ( N > NbPads )
    00119			N = NbPads;
    00120
    00121		for (i=0;i<4;i++)
    00122		{
    00123			if ( i<N )
    00124			{
    00125				PlayerClassButton[i].bNeverFocus = false;
    00126				PlayerClassButton[i].bVisible = true;
    00127				PlayerTeamButton[i].bNeverFocus = false;
    00128				PlayerTeamButton[i].bVisible = true;
    00129				PlayerButton[i].bVisible = true;
    00130
    00131			}
    00132			else
    00133			{
    00134				PlayerClassButton[i].bNeverFocus = true;
    00135				PlayerClassButton[i].bVisible = false;
    00136				PlayerTeamButton[i].bNeverFocus = true;
    00137				PlayerTeamButton[i].bVisible = false;
    00138				PlayerButton[i].bVisible = false;
    00139			}
    00140
    00141			// no sabotage class if we are not in sabotage mode
    00142			if ( GameTypeIndex != SabotageIndex )
    00143			{
    00144				PlayerClassButton[i].bNeverFocus = true;
    00145				PlayerClassButton[i].bVisible = false;
    00146			}
    00147		}
    00148	}
    00149
    00150
    00151	function ShowWindow()
    00152	{
    00153	     Super.ShowWindow();
    00154
    00155	     bShowBCK = true;
    00156	     bShowACC = true;
    00157	}
    00158
    00159
    00160	function Paint(Canvas C, float X, float Y)
    00161	{
    00162	   local float W, H;
    00163
    00164	   local array<string> MsgArray;
    00165	   local int v;
    00166	   local int Length;
    00167	   local int TextWith;
    00168
    00169
    00170	    Super.Paint(C, X, Y);
    00171
    00172		DrawStretchedTexture(C, 28*fRatioX, 28*fScaleTo*fRatioY, 584*fRatioX, 406*fRatioY*fScaleTo, myRoot.tFondNoir);
    00173		DrawStretchedTexture(C,  30*fRatioX,  30*fScaleTo*fRatioY, 580*fRatioX, 402*fScaleTo*fRatioY, tBackGround);
    00174
    00175		OnMenu = FindComponentIndex(FocusedControl);
    00176		C.Style = 5;
    00177		C.DrawColor.A = 128;
    00178		if (OnMenu%2 == 0)
    00179		{
    00180			DrawStretchedTexture(C, 175*fRatioX, (40 + 50*OnMenu)*fScaleTo*fRatioY, 420*fRatioX, 45*fScaleTo*fRatioY, tHighlight);
    00181		}
    00182		else
    00183		{
    00184			DrawStretchedTexture(C, 175*fRatioX, (80 + 50*(OnMenu - 1))*fScaleTo*fRatioY, 420*fRatioX, 45*fScaleTo*fRatioY, tHighlight);
    00185		}
    00186		C.Style = 1;
    00187		C.DrawColor.A = 255;
    00188	}
    00189
    00190
    00191	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00192	{
    00193		if (State==1)// IST_Press // to avoid auto-repeat
    00194	    {
    00195	        if (Key==0x0D/*IK_Enter*/)
    00196		    {
    00197				URL =
    00198					"?Map="$Map$
    00199					"?IP="$IPC$
    00200					"?NP="$N$
    00201					"?FF="$FriendlyFire$
    00202					"?FR="$FragLimit$
    00203					"?TI="$TimeLimit$
    00204					"?NBots="$BotNumber$
    00205					"?DC="$DefaultConfig$
    00206					"?TB0="$TeamBot[0]$
    00207					"?NB0="$NivBot[0]$
    00208					"?TB1="$TeamBot[1]$
    00209					"?NB1="$NivBot[1]$
    00210					"?TB2="$TeamBot[2]$
    00211					"?NB2="$NivBot[2]$
    00212					"?TB3="$TeamBot[3]$
    00213					"?NB3="$NivBot[3]$
    00214					"?TB4="$TeamBot[4]$
    00215					"?NB4="$NivBot[4]$
    00216					"?TB5="$TeamBot[5]$
    00217					"?NB5="$NivBot[5]$
    00218					"?TB6="$TeamBot[6]$
    00219					"?NB6="$NivBot[6]$
    00220					"?PC0="$PC[0]$
    00221					"?PC1="$PC[1]$
    00222					"?PC2="$PC[2]$
    00223					"?PC3="$PC[3]$
    00224					"?PT0="$PT[0]$
    00225					"?PT1="$PT[1]$
    00226					"?PT2="$PT[2]$
    00227					"?PT3="$PT[3];
    00228
    00229				//log(URL);
    00230
    00231	            myRoot.CloseMenu(true, URL);
    00232	            return true;
    00233		    }
    00234		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
    00235		    {
    00236				myRoot.CloseMenu(true, URL);
    00237	    	    return true;
    00238		    }
    00239			if (Key==0x26/*IK_Up*/)
    00240			{
    00241				PrevControl(FocusedControl);
    00242	   			return true;
    00243			}
    00244			if (Key==0x28/*IK_Down*/)
    00245
{ 00246 NextControl(FocusedControl); 00247 return true; 00248 } 00249 if ((Key==0x25) || (Key==0x27)) 00250 { 00251 OnMenu = FindComponentIndex(FocusedControl); 00252 if (OnMenu%2 == 0) 00253 { 00254 if (Key==0x25) XIIICheckBoxControl(FocusedControl).bChecked = true; 00255 else if (Key==0x27) XIIICheckBoxControl(FocusedControl).bChecked = false; 00256 PT[int( 0.5*OnMenu )] = int(XIIICheckBoxControl(FocusedControl).bChecked); 00257 } 00258 else if (OnMenu%2 == 1) 00259 { 00260 OnCombo = XIIIComboControl(FocusedControl).GetSelectedIndex(); 00261 if (Key==0x25) OnCombo--; 00262 if (Key==0x27) OnCombo++; 00263 OnCombo = Clamp(OnCombo,0,( NbClasses - 1 )); 00264 XIIIComboControl(FocusedControl).SetSelectedIndex(OnCombo); 00265 PC[int( 0.5*( OnMenu - 1 ))] = OnCombo; 00266 } 00267 return true; 00268 } 00269 } 00270 return super.InternalOnKeyEvent(Key, state, delta); 00271 } 00272 00273 00274 00275 00276 defaultproperties 00277 { 00278 TitleText="Select your profile" 00279 ProfileText="Existing profile(s)" 00280 NewProfileText="New profile" 00281 CreateText="Create new profile" 00282 ConfirmCreateText="Save profile" 00283 ProfileFailureText="This profile already exists. Please enter a new profile." 00284 ConfirmQuitText="Do you really want to quit ?" 00285 ConfirmQuitTitle="Quit game" 00286 ProfileErrorTitle="Error with profile" 00287 ProfileErrorText="FAILED to use profile %name%" 00288 NoProfileText="Continue without profile ?|saving game will not be possible" 00289 ProfileInitText="FAILED to read profiles" 00290 sBackground(0)="XIIIMenuStart.Profile.Profilefond1" 00291 sBackground(1)="XIIIMenuStart.Profile.Profilefond2" 00292 sBackground(2)="XIIIMenuStart.Profile.Profilefond3" 00293 sBackground(3)="XIIIMenuStart.Profile.Profilefond4" 00294 bForceHelp=True 00295 Background=None 00296 bAllowedAsLast=True 00297 }

End Source Code