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
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
{
     NoInformation="No Information Available!"
     Begin Object Class=GUIImage Name=PageBack
         Image=Texture'InterfaceContent.Menu.EditBoxDown'
         ImageStyle=ISTY_Stretched
         WinLeft=0.062500
         WinWidth=0.890625
         WinHeight=1.000000
         bBoundToParent=Wahr
         bScaleToParent=Wahr
     End Object
     Controls(0)=GUIImage'XInterface.UT2BotConfigPage.PageBack'

     Begin Object Class=GUIImage Name=imgBotPic
         ImageStyle=ISTY_Justified
         ImageRenderStyle=MSTY_Normal
         WinTop=0.193982
         WinLeft=0.078125
         WinWidth=0.246875
         WinHeight=0.658008
         RenderWeight=0.100100
     End Object
     Controls(1)=GUIImage'XInterface.UT2BotConfigPage.imgBotPic'

     Begin Object Class=GUIImage Name=BotPortraitBorder
         Image=Texture'InterfaceContent.Menu.BorderBoxA1'
         DropShadow=Texture'2K4Menus.Controls.Shadow'
         ImageStyle=ISTY_Stretched
         ImageRenderStyle=MSTY_Normal
         DropShadowX=8
         DropShadowY=8
         WinTop=0.188427
         WinLeft=0.076563
         WinWidth=0.253125
         WinHeight=0.664258
     End Object
     Controls(2)=GUIImage'XInterface.UT2BotConfigPage.BotPortraitBorder'

     Begin Object Class=GUILabel Name=BotCfgName
         Caption="Unknown"
         FontScale=FNS_Large
         StyleName="TextLabel"
         WinTop=0.119068
         WinLeft=0.084744
         WinWidth=0.598437
         WinHeight=0.052539
     End Object
     Controls(3)=GUILabel'XInterface.UT2BotConfigPage.BotCfgName'

     Begin Object Class=GUIButton Name=ResetButton
         Caption="Reset"
         WinTop=0.825001
         WinLeft=0.585938
         WinWidth=0.167187
         WinHeight=0.045313
         OnClick=UT2BotConfigPage.ResetClick
         OnKeyEvent=ResetButton.InternalOnKeyEvent
     End Object
     Controls(4)=GUIButton'XInterface.UT2BotConfigPage.ResetButton'

     Begin Object Class=GUIButton Name=OkButton
         Caption="OK"
         WinTop=0.825001
         WinLeft=0.765625
         WinWidth=0.167187
         WinHeight=0.045313
         OnClick=UT2BotConfigPage.OkClick
         OnKeyEvent=OkButton.InternalOnKeyEvent
     End Object
     Controls(5)=GUIButton'XInterface.UT2BotConfigPage.OkButton'

     Begin Object Class=moSlider Name=BotAggrSlider
         MaxValue=1.000000
         Caption="Aggressiveness"
         OnCreateComponent=BotAggrSlider.InternalOnCreateComponent
         Hint="Configures the aggressiveness rating of this bot."
         WinTop=0.208229
         WinLeft=0.345313
         WinWidth=0.598438
         TabOrder=0
         OnChange=UT2BotConfigPage.SliderChange
     End Object
     Controls(6)=moSlider'XInterface.UT2BotConfigPage.BotAggrSlider'

     Begin Object Class=moSlider Name=BotAccuracySlider
         MaxValue=1.000000
         MinValue=-1.000000
         Caption="Accuracy"
         OnCreateComponent=BotAccuracySlider.InternalOnCreateComponent
         Hint="Configures the accuracy rating of this bot."
         WinTop=0.281145
         WinLeft=0.345313
         WinWidth=0.598438
         OnChange=UT2BotConfigPage.SliderChange
     End Object
     Controls(7)=moSlider'XInterface.UT2BotConfigPage.BotAccuracySlider'

     Begin Object Class=moSlider Name=BotCStyleSlider
         MaxValue=1.000000
         Caption="Combat Style"
         OnCreateComponent=BotCStyleSlider.InternalOnCreateComponent
         Hint="Adjusts the combat style of this bot."
         WinTop=0.354062
         WinLeft=0.345313
         WinWidth=0.598438
         OnChange=UT2BotConfigPage.SliderChange
     End Object
     Controls(8)=moSlider'XInterface.UT2BotConfigPage.BotCStyleSlider'

     Begin Object Class=moSlider Name=BotStrafeSlider
         MaxValue=1.000000
         Caption="Strafing Ability"
         OnCreateComponent=BotStrafeSlider.InternalOnCreateComponent
         Hint="Adjusts the strafing ability of this bot."
         WinTop=0.426979
         WinLeft=0.345313
         WinWidth=0.598438
         OnChange=UT2BotConfigPage.SliderChange
     End Object
     Controls(9)=moSlider'XInterface.UT2BotConfigPage.BotStrafeSlider'

     Begin Object Class=moSlider Name=BotTacticsSlider
         MaxValue=1.000000
         MinValue=-1.000000
         Caption="Tactics"
         OnCreateComponent=BotTacticsSlider.InternalOnCreateComponent
         Hint="Adjusts the team-play awareness ability of this bot."
         WinTop=0.499895
         WinLeft=0.345313
         WinWidth=0.598438
         OnChange=UT2BotConfigPage.SliderChange
     End Object
     Controls(10)=moSlider'XInterface.UT2BotConfigPage.BotTacticsSlider'

     Begin Object Class=moSlider Name=BotReactionSlider
         MaxValue=4.000000
         MinValue=-4.000000
         Caption="Reaction Time"
         OnCreateComponent=BotReactionSlider.InternalOnCreateComponent
         Hint="Adjusts the reaction speed of this bot."
         WinTop=0.593645
         WinLeft=0.345313
         WinWidth=0.598438
         OnChange=UT2BotConfigPage.SliderChange
     End Object
     Controls(11)=moSlider'XInterface.UT2BotConfigPage.BotReactionSlider'

     Begin Object Class=moCheckBox Name=BotJumpy
         CaptionWidth=0.900000
         Caption="Jump Happy"
         OnCreateComponent=BotJumpy.InternalOnCreateComponent
         Hint="Controls whether this bot jumps a lot during the game."
         WinTop=0.666562
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.040000
         OnChange=UT2BotConfigPage.CheckBoxChange
     End Object
     Controls(12)=moCheckBox'XInterface.UT2BotConfigPage.BotJumpy'

     Begin Object Class=moComboBox Name=BotWeapon
         bReadOnly=Wahr
         ComponentJustification=TXTA_Left
         CaptionWidth=0.450000
         Caption="Preferred Weapon"
         OnCreateComponent=BotWeapon.InternalOnCreateComponent
         Hint="Select which weapon this bot should prefer."
         WinTop=0.729062
         WinLeft=0.345313
         WinWidth=0.598438
         WinHeight=0.044375
     End Object
     Controls(13)=moComboBox'XInterface.UT2BotConfigPage.BotWeapon'

     WinTop=0.100000
     WinHeight=0.800000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:50.000 - Creation time: Mo 16.4.2007 11:20:55.406 - Created with UnCodeX