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
//==============================================================================
//  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=moEditBox Name=PlayerNameEditbox
        bVerticalLayout=True
        LabelJustification=TXTA_Center
        ComponentJustification=TXTA_Center
        Caption="Player Name: "
		WinWidth=0.381250
		WinHeight=0.090000
		WinLeft=0.085000
		WinTop=0.401666
        bStandardized=False
    End Object
	ed_PlayerName=PlayerNameEditBox

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

	Begin Object Class=GUIButton Name=InternetSettingsOKButton
		Caption="OK"
		OnClick=InternalOnClick
		WinWidth=0.136250
		WinHeight=0.045000
		WinLeft=0.741251
		WinTop=0.556666
	End Object
	b_OK=InternetSettingsOKButton

	Begin Object Class=GUIButton Name=InternetSettingsCancelButton
		Caption="CANCEL"
		OnClick=InternalOnClick
		WinWidth=0.130000
		WinHeight=0.045000
		WinLeft=0.595000
		WinTop=0.556666
	End Object
	b_Cancel=InternetSettingsCancelButton
}

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