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

XInterface.Tab_NetworkSettings


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
// ====================================================================
//  Class:  XInterface.Tab_OnlineSettings
//  Parent: XInterface.GUITabPanel
//
//  <Enter a description here>
// ====================================================================

class Tab_NetworkSettings extends UT2K3TabPanel;


var localized string    NetSpeedText[4];

var localized string    StatsURL;
var localized string    EpicIDMsg;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{

    local int i;
    Super.Initcomponent(MyController, MyOwner);

    for (i=0;i<Controls.Length;i++)
        Controls[i].OnChange=InternalOnChange;

    for(i = 0;i < ArrayCount(NetSpeedText);i++)
        moComboBox(Controls[1]).AddItem(NetSpeedText[i]);

    moEditBox(Controls[2]).MyEditBox.bConvertSpaces = true;
    moEditBox(Controls[2]).MyEditBox.MaxWidth=14;

    moEditBox(Controls[3]).MyEditBox.MaxWidth=14;

    moEditBox(Controls[3]).MaskText(true);
    moEditBox(Controls[2]).MenuStateChange(MSAT_Disabled);
    moEditBox(Controls[3]).MenuStateChange(MSAT_Disabled);

    GUILabel(Controls[8]).Caption = EpicIDMsg@FormatID(PlayerOwner().GetPlayerIDHash());

    moCheckBox(Controls[9]).Checked(PlayerOwner().bDynamicNetSpeed);

}

function string FormatID(string id)
{
    id=Caps(id);
    return mid(id,0,8)$"-"$mid(id,8,8)$"-"$mid(id,16,8)$"-"$mid(id,24,8);
}

function InternalOnLoadINI(GUIComponent Sender, string s)
{
    local int i;

    if (Sender==Controls[1])
    {
        i = class'Player'.default.ConfiguredInternetSpeed;
        if (i<=2600)
            moComboBox(Sender).SetText(NetSpeedText[0]);
        else if (i<=5000)
            moComboBox(Sender).SetText(NetSpeedText[1]);
        else if (i<=10000)
            moComboBox(Sender).SetText(NetSpeedText[2]);
        else
            moComboBox(Sender).SetText(NetSpeedText[3]);
    }
    else if (Sender==Controls[2])
    {
        if(PlayerOwner().StatsUserName!="" && PlayerOwner().StatsPassword!="")
        {
            moEditBox(Sender).SetText(PlayerOwner().StatsUserName);
            moEditBox(Sender).MenuStateChange(MSAT_Blurry);
        }
        else
        {
            moEditBox(Sender).SetText("");
            moEditBox(Sender).MenuStateChange(MSAT_Disabled);
        }
    }
    else if (Sender==Controls[3])
    {
        if(PlayerOwner().StatsUserName!="" && PlayerOwner().StatsPassword!="")
        {
            moEditBox(Sender).SetText(PlayerOwner().StatsPassword);
            moEditBox(Sender).MenuStateChange(MSAT_Blurry);
        }
        else
        {
            moEditBox(Sender).SetText("");
            moEditBox(Sender).MenuStateChange(MSAT_Disabled);
        }
    }
    else if (Sender==Controls[5])
    {
        GUICheckBoxButton(GUIMenuOption(Sender).MyComponent).SetChecked( PlayerOwner().StatsUserName!="" && PlayerOwner().StatsPassword!="" );
    }

    Controls[7].bVisible = !ValidStatConfig();
}

function bool ValidStatConfig()
{
    if(moCheckBox(Controls[5]).IsChecked())
    {
        if(Len(moEditBox(Controls[2]).GetText()) < 4)
            return false;

        if(Len(moEditBox(Controls[3]).GetText()) < 6)
            return false;
    }

    return true;
}

function ApplyStatConfig()
{
    if(moCheckBox(Controls[5]).IsChecked())
    {
        PlayerOwner().StatsUserName = moEditBox(Controls[2]).GetText();
        PlayerOwner().StatsPassword = moEditBox(Controls[3]).GetText();
    }
    else
    {
        PlayerOwner().StatsUserName = moEditBox(Controls[2]).GetText();
        PlayerOwner().StatsPassword = moEditBox(Controls[3]).GetText();
    }
    PlayerOwner().SaveConfig();
}

function InternalOnChange(GUIComponent Sender)
{
    local GUIMenuOption O;

    if (!Controller.bCurMenuInitialized)
        return;

    if (Sender==Controls[1])
    {
        if (moComboBox(Sender).GetText()==NetSpeedText[0])
            PlayerOwner().ConsoleCommand("netspeed 2600");
        else if (moComboBox(Sender).GetText()==NetSpeedText[1])
            PlayerOwner().ConsoleCommand("netspeed 5000");
        else if (moComboBox(Sender).GetText()==NetSpeedText[2])
            PlayerOwner().ConsoleCommand("netspeed 10000");
        else if (moComboBox(Sender).GetText()==NetSpeedText[3])
            PlayerOwner().ConsoleCommand("netspeed 20000");
    }
    else
    if (Sender==Controls[5])
    {
        O = GUIMenuOption(Sender);
        if ( !GUICheckBoxButton(O.MyComponent).bChecked )
        {
            moEditBox(Controls[2]).SetText("");
            moEditBox(Controls[3]).SetText("");
            moEditBox(Controls[2]).MenuStateChange(MSAT_Disabled);
            moEditBox(Controls[3]).MenuStateChange(MSAT_Disabled);
        }
        else
        {
            moEditBox(Controls[2]).MenuStateChange(MSAT_Blurry);
            moEditBox(Controls[3]).MenuStateChange(MSAT_Blurry);
        }
    }

    else if (Sender==Controls[9])
    {
        PlayerOwner().bDynamicNetSpeed = moCheckBox(Controls[9]).IsChecked();
        PlayerOwner().Saveconfig();
    }

    Controls[7].bVisible = !ValidStatConfig();
}

function bool OnViewStats(GUIComponent Sender)
{
    PlayerOwner().ConsoleCommand("start"@StatsURL);
    return true;
}

defaultproperties
{
     NetSpeedText(0)="Modem"
     NetSpeedText(1)="ISDN"
     NetSpeedText(2)="Cable/ADSL"
     NetSpeedText(3)="LAN/T1"
     StatsURL="http://ut2003stats.epicgames.com/"
     EpicIDMsg="Your Unique id is:"
     Begin Object Class=GUIImage Name=OnlineBK1
         Image=Texture'InterfaceContent.Menu.BorderBoxD'
         ImageColor=(A=160)
         ImageStyle=ISTY_Stretched
         WinTop=0.355208
         WinLeft=0.216797
         WinWidth=0.576640
         WinHeight=0.489999
     End Object
     Controls(0)=GUIImage'XInterface.Tab_NetworkSettings.OnlineBK1'

     Begin Object Class=moComboBox Name=OnlineNetSpeed
         bReadOnly=Wahr
         ComponentJustification=TXTA_Left
         CaptionWidth=0.400000
         Caption="Connection"
         OnCreateComponent=OnlineNetSpeed.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="Cable Modem/DSL"
         Hint="How fast is your connection?"
         WinTop=0.085678
         WinLeft=0.250000
         WinHeight=0.060000
         OnLoadINI=Tab_NetworkSettings.InternalOnLoadINI
     End Object
     Controls(1)=moComboBox'XInterface.Tab_NetworkSettings.OnlineNetSpeed'

     Begin Object Class=moEditBox Name=OnlineStatsName
         CaptionWidth=0.400000
         Caption="Stats UserName"
         OnCreateComponent=OnlineStatsName.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="Please select a name to use for UT Stats!"
         WinTop=0.494271
         WinLeft=0.250000
         WinHeight=0.060000
         OnLoadINI=Tab_NetworkSettings.InternalOnLoadINI
     End Object
     Controls(2)=moEditBox'XInterface.Tab_NetworkSettings.OnlineStatsName'

     Begin Object Class=moEditBox Name=OnlineStatsPW
         CaptionWidth=0.400000
         Caption="Stats Password"
         OnCreateComponent=OnlineStatsPW.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="Please select a password that will secure your UT Stats!"
         WinTop=0.583594
         WinLeft=0.250000
         WinHeight=0.060000
         OnLoadINI=Tab_NetworkSettings.InternalOnLoadINI
     End Object
     Controls(3)=moEditBox'XInterface.Tab_NetworkSettings.OnlineStatsPW'

     Begin Object Class=GUILabel Name=OnlineStatDesc
         Caption="UT2003 Global Stats"
         TextAlign=TXTA_Center
         TextColor=(B=0,G=200,R=230)
         TextFont="UT2HeaderFont"
         WinTop=0.391145
         WinLeft=0.250000
         WinWidth=0.500000
         WinHeight=32.000000
     End Object
     Controls(4)=GUILabel'XInterface.Tab_NetworkSettings.OnlineStatDesc'

     Begin Object Class=moCheckBox Name=OnlineTrackStats
         ComponentJustification=TXTA_Left
         CaptionWidth=0.900000
         Caption="Track Stats"
         OnCreateComponent=OnlineTrackStats.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="True"
         Hint="Enable this option to join the online ranking system."
         WinTop=0.742708
         WinLeft=0.251565
         WinWidth=0.210000
         WinHeight=0.040000
         OnLoadINI=Tab_NetworkSettings.InternalOnLoadINI
     End Object
     Controls(5)=moCheckBox'XInterface.Tab_NetworkSettings.OnlineTrackStats'

     Begin Object Class=GUIButton Name=ViewOnlineStats
         Caption="View Stats"
         Hint="Click to launch the UT stats website."
         WinTop=0.742708
         WinLeft=0.536721
         WinWidth=0.210000
         OnClick=Tab_NetworkSettings.OnViewStats
         OnKeyEvent=ViewOnlineStats.InternalOnKeyEvent
     End Object
     Controls(6)=GUIButton'XInterface.Tab_NetworkSettings.ViewOnlineStats'

     Begin Object Class=GUILabel Name=InvalidWarning
         Caption="Your stats username or password is invalid.  Your username must be at least 4 characters long, and your password must be at least 6 characters long."
         TextAlign=TXTA_Center
         TextColor=(B=0,R=255)
         bMultiLine=Wahr
         WinTop=0.870832
         WinLeft=0.215625
         WinWidth=0.576561
         WinHeight=0.125001
     End Object
     Controls(7)=GUILabel'XInterface.Tab_NetworkSettings.InvalidWarning'

     Begin Object Class=GUILabel Name=EpicID
         Caption="Your Unique id is:"
         TextAlign=TXTA_Center
         TextColor=(B=0,G=255,R=255)
         TextFont="UT2SmallFont"
         bMultiLine=Wahr
         WinTop=0.313279
         WinHeight=0.066407
     End Object
     Controls(8)=GUILabel'XInterface.Tab_NetworkSettings.EpicID'

     Begin Object Class=moCheckBox Name=NetworkDynamicNetspeed
         ComponentJustification=TXTA_Left
         CaptionWidth=0.900000
         Caption="Dynamic Netspeed"
         OnCreateComponent=NetworkDynamicNetspeed.InternalOnCreateComponent
         Hint="Dynamic adjust your netspeed on slower connections."
         WinTop=0.179011
         WinLeft=0.250000
         WinHeight=0.040000
     End Object
     Controls(9)=moCheckBox'XInterface.Tab_NetworkSettings.NetworkDynamicNetspeed'

     WinTop=0.150000
     WinHeight=0.740000
}

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