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

GUI2K4.UT2K4InternetSettingsPage


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
//==============================================================================
//  Created on: 02/06/2004
//  Allows player to quickly change playername & netspeed from internet page
//
//  Written by Ron Prestenback
//  © 2003, Epic Games, Inc. All Rights Reserved
//==============================================================================

class UT2K4InternetSettingsPage extends MessageWindow;

var automated GUIButton b_OK, b_Cancel;
var automated moEditbox ed_PlayerName;
var automated moComboBox co_Netspeed;

function InitComponent(GUIController InController, GUIComponent InOwner)
{
    Super.InitComponent(InController, InOwner);

    SetupPlayerName();
    SetupNetspeedCombo();
}

function SetupPlayerName()
{
    local PlayerController PC;

    ed_PlayerName.MyEditBox.bConvertSpaces = True;

    PC = PlayerOwner();
    if ( PC.PlayerReplicationInfo != None )
        ed_PlayerName.SetText(PC.PlayerReplicationInfo.PlayerName);
    else ed_PlayerName.SetText( PC.GetURLOption("Name") );
}

function SetupNetspeedCombo()
{
    local int i;

    for ( i = 0; i < ArrayCount(class'UT2K4Tab_GameSettings'.default.NetspeedText); i++ )
        co_Netspeed.AddItem( class'UT2K4Tab_GameSettings'.default.NetspeedText[i], , GetNetspeedValue(i) );

    co_Netspeed.SetIndex( GetNetspeedIndex(class'Player'.default.ConfiguredInternetSpeed) );
}

function bool InternalOnClick( GUIComponent Sender )
{
    Controller.CloseMenu( Sender == b_Cancel );
    return True;
}

event Closed( GUIComponent Sender, bool bCancelled )
{
    local string NewName;

    if ( !bCancelled )
    {
        NewName = Repl(ed_PlayerName.GetText(), "\"", "");
        NewName = Repl(NewName, " ", "_");

        if ( NewName == "" )
            NewName = "Player";

        PlayerOwner().ConsoleCommand("SetName"@NewName);
        PlayerOwner().ConsoleCommand("NetSpeed"@co_Netspeed.GetExtra());
    }

    Super.Closed(Sender,bCancelled);
}

function string GetNetspeedValue( int i )
{
    switch ( i )
    {
    case 0: return "2600";
    case 1: return "5000";
    case 2: return "10000";
    case 3: return "15000";
    }

    return "10000";
}

function int GetNetspeedIndex( int Netspeed )
{
    if ( NetSpeed < 3500 )
        return 0;
    if ( NetSpeed < 7500 )
        return 1;
    if ( Netspeed < 12500 )
        return 2;

    return 3;
}

defaultproperties
{
     Begin Object Class=GUIButton Name=InternetSettingsOKButton
         Caption="OK"
         WinTop=0.556666
         WinLeft=0.741251
         WinWidth=0.136250
         WinHeight=0.045000
         OnClick=UT2K4InternetSettingsPage.InternalOnClick
         OnKeyEvent=InternetSettingsOKButton.InternalOnKeyEvent
     End Object
     b_OK=GUIButton'GUI2K4.UT2K4InternetSettingsPage.InternetSettingsOKButton'

     Begin Object Class=GUIButton Name=InternetSettingsCancelButton
         Caption="CANCEL"
         WinTop=0.556666
         WinLeft=0.595000
         WinWidth=0.130000
         WinHeight=0.045000
         OnClick=UT2K4InternetSettingsPage.InternalOnClick
         OnKeyEvent=InternetSettingsCancelButton.InternalOnKeyEvent
     End Object
     b_Cancel=GUIButton'GUI2K4.UT2K4InternetSettingsPage.InternetSettingsCancelButton'

     Begin Object Class=moEditBox Name=PlayerNameEditbox
         bVerticalLayout=True
         LabelJustification=TXTA_Center
         ComponentJustification=TXTA_Center
         Caption="Player Name: "
         OnCreateComponent=PlayerNameEditbox.InternalOnCreateComponent
         WinTop=0.401666
         WinLeft=0.085000
         WinWidth=0.381250
         WinHeight=0.090000
         bStandardized=False
     End Object
     ed_PlayerName=moEditBox'GUI2K4.UT2K4InternetSettingsPage.PlayerNameEditbox'

     Begin Object Class=moComboBox Name=NetspeedComboBox
         bReadOnly=True
         bVerticalLayout=True
         LabelJustification=TXTA_Center
         ComponentJustification=TXTA_Center
         Caption="Netspeed: "
         OnCreateComponent=NetspeedComboBox.InternalOnCreateComponent
         WinTop=0.401666
         WinLeft=0.537500
         WinWidth=0.341250
         WinHeight=0.090000
         bStandardized=False
     End Object
     co_Netspeed=moComboBox'GUI2K4.UT2K4InternetSettingsPage.NetspeedComboBox'

}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 17:13:18.000 - Creation time: Wed 7/2/2007 19:16:56.328 - Created with UnCodeX