Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

XInterface.UT2BotConfigPage


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
class UT2BotConfigPage extends UT2K3GUIPage;

var localized string NoInformation;
var GUIImage BotPortrait;
var GUILabel BotName;

var int ConfigIndex;
var xUtil.PlayerRecord ThisBot;
var bool bIgnoreChange;
var moComboBox Wep;

var array<CacheManager.WeaponRecord> Records;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
	local int i;
	Super.Initcomponent(MyController, MyOwner);
	BotPortrait=GUIImage(Controls[1]);
	BotName=GUILabel(Controls[3]);

	class'CacheManager'.static.GetWeaponList( Records );
    Wep = moComboBox(Controls[13]);
    Wep.AddItem("None");
    for (i=0;i<Records.Length;i++)
    	Wep.AddItem(Records[i].FriendlyName,,Records[i].ClassName);

    Wep.Onchange=ComboBoxChange;

	moSlider(Controls[6]).MySlider.OnDrawCaption=AggDC;
	moSlider(Controls[7]).MySlider.OnDrawCaption=AccDC;
	moSlider(Controls[8]).MySlider.OnDrawCaption=ComDC;
	moSlider(Controls[9]).MySlider.OnDrawCaption=StrDC;
	moSlider(Controls[10]).MySlider.OnDrawCaption=TacDC;
	moSlider(Controls[11]).MySlider.OnDrawCaption=ReaDC;
}

function SetupBotInfo(Material Portrait, string DecoTextName, xUtil.PlayerRecord PRE)
{

    ThisBot = PRE;

	// Setup the Portrait from here
	BotPortrait.Image = PRE.Portrait;
	// Setup the decotext from here
	BotName.Caption = PRE.DefaultName;

    ConfigIndex = class'CustomBotConfig'.static.IndexFor(PRE.DefaultName);

	bIgnoreChange = true;
    if (ConfigIndex>=0)
    {
    	moSlider(Controls[6]).SetValue(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Aggressiveness);
    	moSlider(Controls[7]).SetValue(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Accuracy);
    	moSlider(Controls[8]).SetValue(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].CombatStyle);
    	moSlider(Controls[9]).SetValue(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].StrafingAbility);
    	moSlider(Controls[10]).SetValue(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Tactics);
        moSlider(Controls[11]).SetValue(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].ReactionTime);
        mocheckBox(Controls[12]).Checked(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Jumpiness > 0.5);

        Wep.Find(class'CustomBotConfig'.default.ConfigArray[ConfigIndex].FavoriteWeapon,,True);

    }
    else
	{
    	moSlider(Controls[6]).SetValue(float(PRE.Aggressiveness));
    	moSlider(Controls[7]).SetValue(float(PRE.Accuracy));
    	moSlider(Controls[8]).SetValue(float(PRE.CombatStyle));
    	moSlider(Controls[9]).SetValue(float(PRE.StrafingAbility));
    	moSlider(Controls[10]).SetValue(float(PRE.Tactics));
    	moSlider(Controls[11]).SetValue(float(PRE.ReactionTime));
        mocheckBox(Controls[12]).Checked(float(PRE.Jumpiness) > 0.5);

        Wep.Find(PRE.FavoriteWeapon,,True);

    }

    bIgnoreChange=false;

}

function bool OkClick(GUIComponent Sender)
{
	Controller.CloseMenu(false);
	class'CustomBotConfig'.static.StaticSaveConfig();
	return true;
}

function bool ResetClick(GUIComponent Sender)
{
	bIgnoreChange = true;

	SetDefaults();

   	moSlider(Controls[6]).SetValue(float(ThisBot.Aggressiveness));
   	moSlider(Controls[7]).SetValue(float(ThisBot.Accuracy));
   	moSlider(Controls[8]).SetValue(float(ThisBot.CombatStyle));
   	moSlider(Controls[9]).SetValue(float(ThisBot.StrafingAbility));
   	moSlider(Controls[10]).SetValue(float(ThisBot.Tactics));
   	moSlider(Controls[11]).SetValue(float(ThisBot.ReactionTime));
   	moCheckBox(Controls[12]).Checked(float(ThisBot.Jumpiness) > 0.5);
	Wep.Find(ThisBot.FavoriteWeapon,false,True);
    bIgnorechange = false;

	return true;
}


function string DoPerc(GUISlider Control)
{
	local float r,v,vmin;

    vmin = Control.MinValue;
    r = Control.MaxValue - vmin;
    v = Control.Value - vmin;

    return string(int(v/r*100));
}



function string AggDC()
{
	return DoPerc(moSlider(Controls[6]).MySlider) $ "%";
}

function string AccDC()
{
	return DoPerc(moSlider(Controls[7]).MySlider) $"%";
}

function string ComDC()
{
	return DoPerc(moSlider(Controls[8]).MySlider) $"%";
}

function string StrDC()
{
	return DoPerc(moSlider(Controls[9]).MySlider) $"%";
}

function string TacDC()
{
	return DoPerc(moSlider(Controls[10]).MySlider) $"%";
}

function string ReaDC()
{
	return DoPerc(moSlider(Controls[11]).MySlider) $"%";
}

function SetDefaults()
{
	class'CustomBotConfig'.default.ConfigArray[ConfigIndex].CharacterName = ThisBot.DefaultName;
	class'CustomBotConfig'.default.ConfigArray[ConfigIndex].PlayerName = ThisBot.DefaultName;
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].FavoriteWeapon = ThisBot.FavoriteWeapon;
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Aggressiveness = float(ThisBot.Aggressiveness);
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Accuracy = float(ThisBot.Accuracy);
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].CombatStyle = float(ThisBot.CombatStyle);
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].StrafingAbility = float(ThisBot.StrafingAbility);
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Tactics = float(ThisBot.Tactics);
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].ReactionTime = float(ThisBot.ReactionTime);
    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Jumpiness = float(ThisBot.Jumpiness);
}

function SliderChange(GUIComponent Sender)
{
	local GUISlider S;

	if ( moSlider(Sender) != None )
		S = moSlider(Sender).MySlider;

    if ( bIgnoreChange || S == None )
    	return;

	// Look to see if this is a new entry

    if (ConfigIndex==-1)
    {
    	ConfigIndex = class'CustomBotConfig'.Default.ConfigArray.Length;
		class'CustomBotConfig'.Default.ConfigArray.Length = ConfigIndex+1;
        SetDefaults();
    }


	if (S == Controls[6])
      class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Aggressiveness = S.Value;

	else if (S == Controls[7])
      class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Accuracy = S.Value;

	else if (S == Controls[8])
      class'CustomBotConfig'.default.ConfigArray[ConfigIndex].CombatStyle = S.Value;

	else if (S == Controls[9])
      class'CustomBotConfig'.default.ConfigArray[ConfigIndex].StrafingAbility = S.Value;

	else if (S == Controls[10])
      class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Tactics = S.Value;

	else if (S == Controls[11])
      class'CustomBotConfig'.default.ConfigArray[ConfigIndex].ReactionTime = S.Value;
}

function CheckBoxChange(GUIComponent Sender)
{
	if (bIgnorechange || Sender!=Controls[18])
    	return;

	// Look to see if this is a new entry

    if (ConfigIndex==-1)
    {
    	ConfigIndex = class'CustomBotConfig'.Default.ConfigArray.Length;
		class'CustomBotConfig'.Default.ConfigArray.Length = ConfigIndex+1;
        SetDefaults();
    }
    if ( moCheckBox(Controls[18]).IsChecked() )
		class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Jumpiness = 1;
	else 
		class'CustomBotConfig'.default.ConfigArray[ConfigIndex].Jumpiness = 0;
}

function ComboBoxChange(GUIComponent Sender)
{
	if (bIgnorechange || Sender!=Controls[13])
    	return;

	// Look to see if this is a new entry
    if (ConfigIndex==-1)
    {
    	ConfigIndex = class'CustomBotConfig'.Default.ConfigArray.Length;
		class'CustomBotConfig'.Default.ConfigArray.Length = ConfigIndex+1;
        SetDefaults();
    }

    class'CustomBotConfig'.default.ConfigArray[ConfigIndex].FavoriteWeapon = moComboBox(Sender).GetExtra();
}

defaultproperties
{
	Begin Object class=GUIImage Name=PageBack
		Image=Material'InterfaceContent.Menu.EditBoxDown'
		ImageStyle=ISTY_Stretched
		WinWidth=0.890625
		WinHeight=1.000000
		WinLeft=0.062500
		WinTop=0.000000
		bScaleToParent=true
		bBoundToParent=true
	End Object
	Controls(0)=PageBack

	Begin Object class=GUIImage Name=imgBotPic
		WinWidth=0.246875
		WinHeight=0.658008
		WinLeft=0.078125
		WinTop=0.193982
		ImageRenderStyle=MSTY_Normal
		ImageStyle=ISTY_Justified
		RenderWeight=0.1001
	End Object
	Controls(1)=imgBotPic

	Begin Object class=GUIImage Name=BotPortraitBorder
		WinWidth=0.253125
		WinHeight=0.664258
		WinLeft=0.076563
		WinTop=0.188427
		Image=Material'InterfaceContent.Menu.BorderBoxA1'
		ImageColor=(R=255,G=255,B=255,A=255);
		ImageRenderStyle=MSTY_Normal
		ImageStyle=ISTY_Stretched
		DropShadow=Material'2K4Menus.Controls.shadow'
		DropShadowX=8
		DropShadowY=8
		RenderWeight=0.1
	End Object
	Controls(2)=BotPortraitBorder

	Begin Object class=GUILabel Name=BotCfgName
		WinWidth=0.598437
		WinHeight=0.052539
		WinLeft=0.084744
		WinTop=0.119068
		TextAlign=TXTA_Left
		Caption="Unknown"
		StyleName="TextLabel"
		FontScale=FNS_Large
	End Object
	Controls(3)=BotCfgName

	Begin Object class=GUIButton Name=ResetButton
		WinWidth=0.167187
		WinHeight=0.045313
		WinLeft=0.585938
		WinTop=0.825001
		Caption="Reset"
		OnClick=ResetClick
	End Object
	Controls(4)=ResetButton

	Begin Object class=GUIButton Name=OkButton
		WinWidth=0.167187
		WinHeight=0.045313
		WinLeft=0.765625
		WinTop=0.825001
		Caption="OK"
		OnClick=OkClick
	End Object
	Controls(5)=OkButton

/*
	Begin Object class=GUILabel Name=BotAggrText
		TextAlign=TXTA_Left
		StyleName="TextLabel"
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.344727
		WinTop=0.189583
	End Object

	Begin Object class=GUILabel Name=BotAccuracyText
		TextALign=TXTA_Left
		StyleName="TextLabel"
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.344727
		WinTop=0.262499
		TabOrder=1
	End Object

	Begin Object class=GUILabel Name=BotCStyleText
		TextAlign=TXTA_Left
		StyleName="TextLabel"
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.344727
		WinTop=0.335415
	End Object

	Begin Object class=GUILabel Name=BotStrafeText
		TextALign=TXTA_Left
		StyleName="TextLabel"
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.344727
		WinTop=0.408333
	End Object

	Begin Object class=GUILabel Name=BotTacticsText
		TextAlign=TXTA_Left
		StyleName="TextLabel"
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.344727
		WinTop=0.481249
	End Object

	Begin Object class=GUILabel Name=BotReactionText
		TextALign=TXTA_Left
		StyleName="TextLabel"
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.344727
		WinTop=0.574999
	End Object
*/

	Begin Object class=moSlider Name=BotAggrSlider
		Caption="Aggressiveness"
		WinWidth=0.598438
		WinLeft=0.345313
		WinTop=0.208229
		WinHeight=0.03
		MinValue=0
		MaxValue=1
		Hint="Configures the aggressiveness rating of this bot."
        OnChange=SliderChange
        TabOrder=0
        bHeightFromComponent=False
	End Object

	Begin Object class=moSlider Name=BotAccuracySlider
		Caption="Accuracy"
		WinWidth=0.598438
		WinHeight=0.030000
		WinLeft=0.345313
		WinTop=0.281145
		MinValue=-1
		MaxValue=1
		Hint="Configures the accuracy rating of this bot."
        OnChange=SliderChange;
        bHeightFromComponent=False
	End Object

	Begin Object class=moSlider Name=BotCStyleSlider
		Caption="Combat Style"
		WinWidth=0.598438
		WinHeight=0.030000
		WinLeft=0.345313
		WinTop=0.354062
		MinValue=0
		MaxValue=1
		Hint="Adjusts the combat style of this bot."
        OnChange=SliderChange;
        bHeightFromComponent=False
	End Object

	Begin Object class=moSlider Name=BotStrafeSlider
		Caption="Strafing Ability"
		WinWidth=0.598438
		WinHeight=0.030000
		WinLeft=0.345313
		WinTop=0.426979
		MinValue=0
		MaxValue=1
		Hint="Adjusts the strafing ability of this bot."
        OnChange=SliderChange;
        bHeightFromComponent=False
	End Object

	Begin Object class=moSlider Name=BotTacticsSlider
		Caption="Tactics"
		WinWidth=0.598438
		WinHeight=0.030000
		WinLeft=0.345313
		WinTop=0.499895
		MinValue=-1
		MaxValue=1
		Hint="Adjusts the team-play awareness ability of this bot."
        OnChange=SliderChange;
        bHeightFromComponent=False
	End Object

	Begin Object class=moSlider Name=BotReactionSlider
		Caption="Reaction Time"
		WinWidth=0.598438
		WinHeight=0.030000
		WinLeft=0.345313
		WinTop=0.593645
		MinValue=-4
		MaxValue=4
		Hint="Adjusts the reaction speed of this bot."
        OnChange=SliderChange;
        bHeightFromComponent=False
	End Object

	Begin Object class=moCheckBox Name=BotJumpy
		WinWidth=0.598438
		WinHeight=0.040000
		WinLeft=0.345313
		WinTop=0.666562
		Caption="Jump Happy"
		Hint="Controls whether this bot jumps a lot during the game."
		CaptionWidth=0.9
		bSquare=true
		ComponentJustification=TXTA_Right
        OnChange=CheckBoxChange
        bHeightFromComponent=False
	End Object

	Begin Object class=moComboBox Name=BotWeapon
		WinWidth=0.598438
		WinHeight=0.044375
		WinLeft=0.345313
		WinTop=0.729062
		Caption="Preferred Weapon"
		Hint="Select which weapon this bot should prefer."
		CaptionWidth=0.45
        bReadOnly=true
		ComponentJustification=TXTA_Left
        bHeightFromComponent=False
	End Object

    Controls(6)=BotAggrSlider
    Controls(7)=BotAccuracySlider
    Controls(8)=BotCStyleSlider
    Controls(9)=BotStrafeSlider
    Controls(10)=BotTacticsSlider
    Controls(11)=BotReactionSlider
    Controls(12)=BotJumpy
    Controls(13)=BotWeapon

	WinWidth=1.0
	WinHeight=0.8
	WinTop=0.1
	WinLeft=0.0

	NoInformation="No Information Available!"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:36:28.000 - Creation time: Do 14.8.2014 09:58:52.917 - Created with UnCodeX