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

GUI2K4.UT2K4BotConfigPage


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
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
//==============================================================================
//	Created on: 08/08/2003
//	Description
//
//	Written by Ron Prestenback
//	© 2003, Epic Games, Inc.  All Rights Reserved
//==============================================================================
class UT2K4BotConfigPage extends LockedFloatingWindow;

var localized string NoInformation, NoPref, DefaultString;
var GUIImage BotPortrait;
var GUILabel BotName;

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

var automated GUIImage i_Portrait;
var automated moSlider sl_Agg, sl_Acc, sl_Com, sl_Str, sl_Tac, sl_Rea, sl_Jumpy;
var automated moComboBox co_Weapon, co_Voice, co_Orders;

var	automated GUISectionBackground sb_PicBK;

var class<CustomBotConfig> BotConfigClass;
var array<CacheManager.WeaponRecord> Records;
var localized string ResetString;
var localized string AttributesString;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
	local int i;

	Super.InitComponent(MyController, MyOwner);

	sb_PicBK.ManageComponent(i_Portrait);

	sb_Main.SetPosition(0.350547,0.078391,0.565507,0.600586);

	sb_Main.Caption=AttributesString;

    sb_Main.ManageComponent(sl_Agg);
    sb_Main.ManageComponent(sl_Acc);
    sb_Main.ManageComponent(sl_Com);
    sb_Main.ManageComponent(sl_Str);
    sb_Main.ManageComponent(sl_Tac);
    sb_Main.ManageComponent(sl_Rea);
    sb_Main.ManageComponent(sl_Jumpy);
    sb_Main.ManageComponent(co_Weapon);
    sb_Main.ManageComponent(co_Voice);
    sb_Main.ManageComponent(co_Orders);


	class'CacheManager'.static.GetWeaponList( Records );
    co_Weapon.AddItem(NoPref);
    for (i=0;i<Records.Length;i++)
    	co_Weapon.AddItem(Records[i].FriendlyName,,Records[i].ClassName);

    for ( i = 0; i < ArrayCount(class'GameProfile'.default.PositionName); i++ )
    	co_Orders.AddItem(class'GameProfile'.default.PositionName[i]);

    co_Weapon.Onchange=ComboBoxChange;

	sl_Agg.MySlider.OnDrawCaption=AggDC;
	sl_Acc.MySlider.OnDrawCaption=AccDC;
	sl_Com.MySlider.OnDrawCaption=ComDC;
	sl_Str.MySlider.OnDrawCaption=StrDC;
	sl_Tac.MySlider.OnDrawCaption=TacDC;
	sl_Rea.MySlider.OnDrawCaption=ReaDC;
	sl_Jumpy.MySlider.OnDrawCaption=JumpyDC;

	b_OK.OnClick = OkClick;

	b_Cancel.Caption=ResetString;
	b_Cancel.OnClick=ResetClick;

}

function SetupBotInfo(Material Portrait, string DecoTextName, xUtil.PlayerRecord PRE)
{
	local int i;
	local array<string> VoicePackClasses;
	local class<xVoicePack> Pack;

	bIgnoreChange = true;

    ThisBot = PRE;
    PlayerOwner().GetAllInt("XGame.xVoicePack", VoicePackClasses);

    co_Voice.MyComboBox.List.Clear();
    co_Voice.AddItem(DefaultString);
    for ( i = 0; i < VoicePackClasses.Length; i++ )
    {
    	Pack = class<xVoicePack>(DynamicLoadObject( VoicePackClasses[i], class'Class'));
    	if ( Pack != None )
    	{
    		// Only show voices that correspond to this gender
    		if ( class'TeamVoicePack'.static.VoiceMatchesGender(Pack.default.VoiceGender, ThisBot.Sex) )
	    		co_Voice.AddItem( Pack.default.VoicePackName, Pack, VoicePackClasses[i] );
	    }
    }

	// Setup the Portrait from here
	i_Portrait.Image = PRE.Portrait;
	// Setup the decotext from here
	sb_PicBK.Caption = PRE.DefaultName;

    ConfigIndex = BotConfigClass.static.IndexFor(PRE.DefaultName);

    if (ConfigIndex>=0)
    {
    	sl_Agg.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].Aggressiveness);
    	sl_Acc.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].Accuracy);
    	sl_Com.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].CombatStyle);
    	sl_Str.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].StrafingAbility);
    	sl_Tac.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].Tactics);
        sl_Rea.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].ReactionTime);
        sl_Jumpy.SetValue(BotConfigClass.default.ConfigArray[ConfigIndex].Jumpiness);

        co_Weapon.Find(BotConfigClass.default.ConfigArray[ConfigIndex].FavoriteWeapon,,True);
        co_Voice.Find(BotConfigClass.default.ConfigArray[ConfigIndex].CustomVoice,,True);
        co_Orders.Find(class'GameProfile'.static.TextPositionDescription(BotConfigClass.default.ConfigArray[ConfigIndex].CustomOrders));

    }
    else
	{
    	sl_Agg.SetValue(float(PRE.Aggressiveness));
    	sl_Acc.SetValue(float(PRE.Accuracy));
    	sl_Com.SetValue(float(PRE.CombatStyle));
    	sl_Str.SetValue(float(PRE.StrafingAbility));
    	sl_Tac.SetValue(float(PRE.Tactics));
    	sl_Rea.SetValue(float(PRE.ReactionTime));
        sl_Jumpy.SetValue(float(PRE.Jumpiness));

        co_Weapon.Find(PRE.FavoriteWeapon,,True);
        if ( PRE.VoiceClassName != "" )
	        co_Voice.Find(PRE.VoiceClassName,,True);

	    co_Orders.SetIndex(0);
    }

    bIgnoreChange=false;

}

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

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

	if ( ConfigIndex >= 0 )
	{
		class'CustomBotConfig'.default.ConfigArray.Remove(ConfigIndex,1);
		class'CustomBotConfig'.static.StaticSaveConfig();
	}

	ConfigIndex = -1;
   	sl_Agg.SetValue(float(ThisBot.Aggressiveness));
   	sl_Acc.SetValue(float(ThisBot.Accuracy));
   	sl_Com.SetValue(float(ThisBot.CombatStyle));
   	sl_Str.SetValue(float(ThisBot.StrafingAbility));
   	sl_Tac.SetValue(float(ThisBot.Tactics));
   	sl_Rea.SetValue(float(ThisBot.ReactionTime));
   	sl_Jumpy.SetValue(float(ThisBot.Jumpiness));
	co_Weapon.Find(ThisBot.FavoriteWeapon,false,True);

	if ( ThisBot.VoiceClassName != "" )
		co_Voice.Find(ThisBot.VoiceClassName,false,True);

	else co_Voice.SetIndex(0);

	co_Orders.SetIndex(0);
    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(sl_Agg.MySlider) $ "%";
}

function string AccDC()
{
	return sl_Acc.GetComponentValue();
}

function string ComDC()
{
	return DoPerc(sl_Com.MySlider) $"%";
}

function string StrDC()
{
	return sl_Str.GetComponentValue();
}

function string TacDC()
{
	return sl_Tac.GetComponentValue();
}

function string ReaDC()
{
	return sl_Rea.GetComponentValue();
}

function string JumpyDC()
{
	return DoPerc(sl_Jumpy.MySlider) $ "%";
}

function SetDefaults()
{
	BotConfigClass.default.ConfigArray[ConfigIndex].CharacterName = ThisBot.DefaultName;
	BotConfigClass.default.ConfigArray[ConfigIndex].PlayerName = ThisBot.DefaultName;
    BotConfigClass.default.ConfigArray[ConfigIndex].FavoriteWeapon = ThisBot.FavoriteWeapon;
    BotConfigClass.default.ConfigArray[ConfigIndex].Aggressiveness = float(ThisBot.Aggressiveness);
    BotConfigClass.default.ConfigArray[ConfigIndex].Accuracy = float(ThisBot.Accuracy);
    BotConfigClass.default.ConfigArray[ConfigIndex].CombatStyle = float(ThisBot.CombatStyle);
    BotConfigClass.default.ConfigArray[ConfigIndex].StrafingAbility = float(ThisBot.StrafingAbility);
    BotConfigClass.default.ConfigArray[ConfigIndex].Tactics = float(ThisBot.Tactics);
    BotConfigClass.default.ConfigArray[ConfigIndex].ReactionTime = float(ThisBot.ReactionTime);
    BotConfigClass.default.ConfigArray[ConfigIndex].Jumpiness = float(ThisBot.Jumpiness);
    BotConfigClass.default.ConfigArray[ConfigIndex].CustomVoice = ThisBot.VoiceClassName;
    BotConfigClass.default.ConfigArray[ConfigIndex].CustomOrders = POS_Auto;
}

function SliderChange(GUIComponent Sender)
{
	local moSlider S;

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

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

	ValidateIndex();
	if (S == sl_Agg)
      BotConfigClass.default.ConfigArray[ConfigIndex].Aggressiveness = S.GetValue();

	else if (S == sl_Acc)
      BotConfigClass.default.ConfigArray[ConfigIndex].Accuracy = S.GetValue();

	else if (S == sl_Com)
      BotConfigClass.default.ConfigArray[ConfigIndex].CombatStyle = S.GetValue();

	else if (S == sl_Str)
      BotConfigClass.default.ConfigArray[ConfigIndex].StrafingAbility = S.GetValue();

	else if (S == sl_Tac)
      BotConfigClass.default.ConfigArray[ConfigIndex].Tactics = S.GetValue();

	else if (S == sl_Rea)
      BotConfigClass.default.ConfigArray[ConfigIndex].ReactionTime = S.GetValue();

    else if ( S == sl_Jumpy )
      BotConfigClass.default.ConfigArray[ConfigIndex].Jumpiness = S.GetValue();
}

function ComboBoxChange(GUIComponent Sender)
{
	if (bIgnorechange || moComboBox(Sender) == None)
    	return;

	ValidateIndex();
	if ( Sender == co_Weapon )
	    BotConfigClass.default.ConfigArray[ConfigIndex].FavoriteWeapon = co_Weapon.GetExtra();

	else if ( Sender == co_Voice )
		BotConfigClass.default.ConfigArray[ConfigIndex].CustomVoice = co_Voice.GetExtra();

	else if ( Sender == co_Orders )
		BotConfigClass.default.ConfigArray[ConfigIndex].CustomOrders = class'GameProfile'.static.EnumPositionDescription(co_Orders.GetText());
}

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

defaultproperties
{
     NoInformation="No Information Available!"
     NoPref="No Preference"
     DefaultString="Default"
     Begin Object Class=GUIImage Name=imgBotPic
         ImageStyle=ISTY_Scaled
         ImageRenderStyle=MSTY_Normal
         WinTop=0.116031
         WinLeft=0.079861
         WinWidth=0.246875
         WinHeight=0.822510
         RenderWeight=0.110000
         bBoundToParent=True
         bScaleToParent=True
     End Object
     i_Portrait=GUIImage'GUI2K4.UT2K4BotConfigPage.imgBotPic'

     Begin Object Class=moSlider Name=BotAggrSlider
         MaxValue=1.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Aggressiveness"
         OnCreateComponent=BotAggrSlider.InternalOnCreateComponent
         Hint="Configures the aggressiveness rating of this bot."
         WinTop=0.107618
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=0
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Agg=moSlider'GUI2K4.UT2K4BotConfigPage.BotAggrSlider'

     Begin Object Class=moSlider Name=BotAccuracySlider
         MaxValue=2.000000
         MinValue=-2.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Accuracy"
         OnCreateComponent=BotAccuracySlider.InternalOnCreateComponent
         Hint="Configures the accuracy rating of this bot."
         WinTop=0.177603
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=1
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Acc=moSlider'GUI2K4.UT2K4BotConfigPage.BotAccuracySlider'

     Begin Object Class=moSlider Name=BotCStyleSlider
         MaxValue=1.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Combat Style"
         OnCreateComponent=BotCStyleSlider.InternalOnCreateComponent
         Hint="Adjusts the combat style of this bot."
         WinTop=0.247588
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=2
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Com=moSlider'GUI2K4.UT2K4BotConfigPage.BotCStyleSlider'

     Begin Object Class=moSlider Name=BotStrafeSlider
         MaxValue=2.000000
         MinValue=-2.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Strafing Ability"
         OnCreateComponent=BotStrafeSlider.InternalOnCreateComponent
         Hint="Adjusts the strafing ability of this bot."
         WinTop=0.317573
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=3
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Str=moSlider'GUI2K4.UT2K4BotConfigPage.BotStrafeSlider'

     Begin Object Class=moSlider Name=BotTacticsSlider
         MaxValue=2.000000
         MinValue=-2.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Tactics"
         OnCreateComponent=BotTacticsSlider.InternalOnCreateComponent
         Hint="Adjusts the team-play awareness ability of this bot."
         WinTop=0.387558
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=4
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Tac=moSlider'GUI2K4.UT2K4BotConfigPage.BotTacticsSlider'

     Begin Object Class=moSlider Name=BotReactionSlider
         MaxValue=2.000000
         MinValue=-2.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Reaction Time"
         OnCreateComponent=BotReactionSlider.InternalOnCreateComponent
         Hint="Adjusts the reaction speed of this bot."
         WinTop=0.457542
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=5
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Rea=moSlider'GUI2K4.UT2K4BotConfigPage.BotReactionSlider'

     Begin Object Class=moSlider Name=BotJumpy
         MaxValue=1.000000
         SliderCaptionStyleName="TextLabel"
         Caption="Jumpiness"
         OnCreateComponent=BotJumpy.InternalOnCreateComponent
         Hint="Controls whether this bot jumps a lot during the game."
         WinTop=0.527528
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.037500
         TabOrder=6
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.SliderChange
     End Object
     sl_Jumpy=moSlider'GUI2K4.UT2K4BotConfigPage.BotJumpy'

     Begin Object Class=moComboBox Name=BotWeapon
         bReadOnly=True
         ComponentJustification=TXTA_Left
         Caption="Preferred Weapon"
         OnCreateComponent=BotWeapon.InternalOnCreateComponent
         Hint="Select which weapon this bot should prefer."
         WinTop=0.647967
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.055469
         TabOrder=7
         bBoundToParent=True
         bScaleToParent=True
     End Object
     co_Weapon=moComboBox'GUI2K4.UT2K4BotConfigPage.BotWeapon'

     Begin Object Class=moComboBox Name=BotVoice
         bReadOnly=True
         ComponentJustification=TXTA_Left
         Caption="Voice"
         OnCreateComponent=BotVoice.InternalOnCreateComponent
         Hint="Choose which voice this bot uses."
         WinTop=0.718011
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.055469
         TabOrder=8
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.ComboBoxChange
     End Object
     co_Voice=moComboBox'GUI2K4.UT2K4BotConfigPage.BotVoice'

     Begin Object Class=moComboBox Name=BotOrders
         bReadOnly=True
         ComponentJustification=TXTA_Left
         Caption="Orders"
         OnCreateComponent=BotOrders.InternalOnCreateComponent
         Hint="Choose which role this bot will play in the game."
         WinTop=0.791159
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.055469
         TabOrder=9
         bBoundToParent=True
         bScaleToParent=True
         OnChange=UT2K4BotConfigPage.ComboBoxChange
     End Object
     co_Orders=moComboBox'GUI2K4.UT2K4BotConfigPage.BotOrders'

     Begin Object Class=GUISectionBackground Name=PicBK
         WinTop=0.078391
         WinLeft=0.026150
         WinWidth=0.290820
         WinHeight=0.638294
         OnPreDraw=PicBK.InternalPreDraw
     End Object
     sb_PicBK=GUISectionBackground'GUI2K4.UT2K4BotConfigPage.PicBK'

     BotConfigClass=Class'UnrealGame.CustomBotConfig'
     ResetString="Reset"
     AttributesString="Attributes"
     DefaultLeft=0.078125
     DefaultWidth=0.921875
     DefaultHeight=0.759115
     WinTop=0.123958
     WinLeft=0.043945
     WinWidth=0.921875
     WinHeight=0.759115
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:54.000 - Creation time: sk 18-3-2018 09:50:23.230 - Created with UnCodeX