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

Betrayal.BetrayalClientSettingsMenu


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
/******************************************************************************
BetrayalClientSettingsMenu

Creation date: 2011-03-09 19:29
Last change: $Id$
Copyright © 2011, Wormbo
Website: http://www.koehler-homepage.de/Wormbo/
Feel free to reuse this code. Send me a note if you found it helpful or want
to report bugs/provide improvements.
Please ask for permission first, if you intend to make money off reused code.
******************************************************************************/

class BetrayalClientSettingsMenu extends UT2K4CustomHUDMenu;


var automated moCheckBox SwapTeamColors;
var automated moCheckBox WantUnlagging;
var automated moSlider   PingSmoothing;
var automated moCheckBox NoConsoleDeathMessages;
var bool bPauseGame;


function HandleParameters(string GameClassName, string PauseGame)
{
	bPauseGame = bool(PauseGame);

	Super.HandleParameters(GameClassName, PauseGame);

	if (bPauseGame)
		PlayerOwner().SetPause(True);
}

event Closed(GUIComponent Sender, bool bCancelled)
{
	Super.Closed(Sender, bCancelled);

	if (bPauseGame)
		PlayerOwner().SetPause(False);
}

function bool InitializeGameClass(string GameClassName)
{
	return true;
}

function LoadSettings()
{
	SwapTeamColors.Checked(class'BetrayalPRI'.default.bSwapTeamColors);
	WantUnlagging.Checked(class'BetrayalPRI'.default.bWantUnlagging);
	PingSmoothing.SetValue(class'BetrayalPRI'.default.PingSmoothing);
	NoConsoleDeathMessages.Checked(class'BetrayalDeathMessage'.default.bNoConsoleDeathMessages);
}


function SaveSettings()
{
	local BetrayalPawn P;

	class'BetrayalPRI'.default.bSwapTeamColors = SwapTeamColors.IsChecked();
	class'BetrayalPRI'.default.bWantUnlagging = WantUnlagging.IsChecked();
	class'BetrayalPRI'.default.PingSmoothing = Clamp(Round(PingSmoothing.GetValue()), 0, 255);
	class'BetrayalPRI'.static.StaticSaveConfig();

	class'BetrayalDeathMessage'.default.bNoConsoleDeathMessages = NoConsoleDeathMessages.IsChecked();
	class'BetrayalDeathMessage'.static.StaticSaveConfig();

	// update colors immediately
	foreach PlayerOwner().DynamicActors(class'BetrayalPawn', P) {
		if (BetrayalPRI(P.PlayerReplicationInfo) != None)
			P.SetTeamSkin(BetrayalPRI(P.PlayerReplicationInfo).Rec);
	}
	PlayerOwner().Mutate("WantUnlagging"@int(class'BetrayalPRI'.default.bWantUnlagging));
}


//=============================================================================
// Default values
//=============================================================================

defaultproperties
{
	WindowName = "Betrayal Client Options"
	WinTop     = 0.3
	WinLeft    = 0.3
	WinWidth   = 0.4
	WinHeight  = 0.35

	bAllowedAsLast = True // FFS!

	Begin Object Class=moCheckBox Name=chkSwapTeamColors
		Caption                = "Swap Team Colors"
		CaptionWidth           = 0.10
		ComponentJustification = TXTA_Center
		WinTop                 = 0.35
		WinLeft                = 0.325
		WinWidth               = 0.35
		TabOrder               = 4
		Hint = "Whether you want to reverse team colors so you and your teammates are red and opponents blue."
	End Object
	SwapTeamColors=chkSwapTeamColors

	Begin Object Class=moCheckBox Name=chkWantUnlagging
		Caption                = "Use Shot Unlagging"
		CaptionWidth           = 0.10
		ComponentJustification = TXTA_Center
		WinTop                 = 0.4
		WinLeft                = 0.325
		WinWidth               = 0.35
		TabOrder               = 4
		Hint = "Whether you want to take advantage of server-side ping compensation for hit detection."
	End Object
	WantUnlagging=chkWantUnlagging

	Begin Object Class=moSlider Name=sldPingSmoothing
		Caption                = "Ping Smoothing"
		CaptionWidth           = 0.10
		ComponentJustification = TXTA_Center
		WinTop                 = 0.45
		WinLeft                = 0.325
		WinWidth               = 0.35
		TabOrder               = 5
		MinValue               = 1
		MaxValue               = 100
		bIntSlider             = True
		Hint = "Select the number of recent ping values to consider for smoothing your calculated ping. (default: 20)"
	End Object
	PingSmoothing=sldPingSmoothing

	Begin Object Class=moCheckBox Name=chkNoConsoleDeathMessages
		Caption                = "No Console Death Messages"
		CaptionWidth           = 0.10
		ComponentJustification = TXTA_Center
		WinTop                 = 0.5
		WinLeft                = 0.325
		WinWidth               = 0.35
		TabOrder               = 4
		Hint = "Turn off death messages in Betrayal. (Does not affect other game types.)"
	End Object
	NoConsoleDeathMessages=chkNoConsoleDeathMessages

	Begin Object Class=GUIButton Name=CancelButton
		Caption                = "Cancel"
		WinTop                 = 0.57
		WinLeft                = 0.44
		WinWidth               = 0.1
		WinHeight              = 0.04
		TabOrder               = 7
		OnClick                = InternalOnClick
		Hint = "Click to close this menu, discarding changes."
	End Object
	b_Cancel=CancelButton

	Begin Object Class=GUIButton Name=OkButton
		Caption                = "OK"
		WinTop                 = 0.57
		WinLeft                = 0.55
		WinWidth               = 0.1
		WinHeight              = 0.04
		TabOrder               = 8
		OnClick                = InternalOnClick
		Hint = "Click to close this menu, saving changes."
	End Object
	b_OK=OkButton
}


Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 28.7.2011 21:45:42.000 - Creation time: Do 14.8.2014 09:58:34.681 - Created with UnCodeX