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

TribesGUI.TribesOptionsAudioPanel


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
// ====================================================================
//  Class:  TribesGui.TribesOptionsAudioMenu
//
//  Menu to load map from entry screen.
// ====================================================================

class TribesOptionsAudioPanel extends TribesSettingsPanel
	native;

var(TribesGui) private EditInline Config GUISlider SoundVolumeSlider "A component of this page which has its behavior defined in the code for this page's class.";
var(TribesGui) private EditInline Config GUISlider MusicVolumeSlider "A component of this page which has its behavior defined in the code for this page's class.";
var(TribesGui) private EditInline Config GUISlider SpeechVolumeSlider "A component of this page which has its behavior defined in the code for this page's class.";
var(TribesGui) private EditInline Config GUIButton DefaultsButton "A component of this page which has its behavior defined in the code for this page's class.";
var(TribesGUI) private EditInline Config GUICheckBoxButton Use3DCheck;
var(TribesGUI) private EditInline Config GUICheckBoxButton UseDefaultDriverCheck;
//var(TribesGUI) private EditInline Config GUICheckBoxButton UseEAXCheck;
var(TribesGUI) private EditInline Config GUICheckBoxButton CompatibilityCheck;
var(TribesGUI) private EditInline Config GUICheckBoxButton ReverseStereoCheck;
var(TribesGUI) private EditInline Config GUICheckBoxButton LowQualityCheck;
var(TribesGUI) private EditInline Config GUICheckBoxButton ChatWindowCheck;

var bool bIsDataDirty;


function InitComponent(GUIComponent MyOwner)
{
	Super.InitComponent(MyOwner);

	SoundVolumeSlider.OnChange=OnSliderChange;
    MusicVolumeSlider.OnChange=OnSliderChange;
    SpeechVolumeSlider.OnChange=OnSliderChange;
	Use3DCheck.OnClick=OnUse3D;
	UseDefaultDriverCheck.OnClick=OnUseDefaultDriver;
	//UseEAXCheck.OnClick=OnUseEAX;
	CompatibilityCheck.OnClick=OnCompatibility;
	ReverseStereoCheck.OnClick=OnReverseStereo;
	LowQualityCheck.OnClick=OnLowQuality;
	ChatWindowCheck.OnClick=OnChatWindow;

	OnShow=InternalOnShow;
	OnHide=InternalOnHide;

	bIsDataDirty = false;
}

function InternalOnShow()
{
	DefaultsButton.bCanBeShown = true;
	DefaultsButton.Show();

	DefaultsButton.OnClick=OnDefaults;

	SoundVolumeSlider.Value = float(PlayerOwner().ConsoleCommand("get alaudio.alaudiosubsystem soundvolume"));
	MusicVolumeSlider.Value = float(PlayerOwner().ConsoleCommand("get alaudio.alaudiosubsystem musicvolume"));
	SpeechVolumeSlider.Value = float(PlayerOwner().ConsoleCommand("get alaudio.alaudiosubsystem SpeechVolume"));
	Use3DCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET ALAudio.ALAudioSubsystem Use3DSound"));
	UseDefaultDriverCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET ALAudio.ALAudioSubsystem UseDefaultDriver"));
	//UseEAXCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET ALAudio.ALAudioSubsystem UseEAX"));
	CompatibilityCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET ALAudio.ALAudioSubsystem CompatibilityMode"));
	ReverseStereoCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET ALAudio.ALAudioSubsystem ReverseStereo"));
	LowQualityCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET ALAudio.ALAudioSubsystem LowQualitySound"));
	ChatWindowCheck.bChecked = bool(PlayerOwner().ConsoleCommand("GET Gameplay.SinglePlayerGameInfo bShowSubtitles"));
}

function InternalOnHide()
{
	if (bIsDataDirty)
		PlayerOwner().ConsoleCommand("SOUND_REBOOT 1");
}

function OnSliderChange(GUIComponent Sender)
{
	switch(Sender)
	{
		case SoundVolumeSlider:
			PlayerOwner().ConsoleCommand("set alaudio.alaudiosubsystem soundvolume "$GUISlider(Sender).Value);
			PlayerOwner().TriggerEffectEvent('Watched',,,,,,,,'STY_RoundLargeButton');
			break;
		case MusicVolumeSlider:
			PlayerOwner().ConsoleCommand("set alaudio.alaudiosubsystem musicvolume "$GUISlider(Sender).Value);
			break;
		case SpeechVolumeSlider:
			PlayerOwner().ConsoleCommand("set alaudio.alaudiosubsystem SpeechVolume "$GUISlider(Sender).Value);
			break;
	}
}

function OnUse3D(GUIComponent Sender)
{
	PlayerOwner().ConsoleCommand("SET ALAudio.ALAudioSubsystem Use3DSound "$Use3DCheck.bChecked);
	bIsDataDirty = true;
}

function OnUseDefaultDriver(GUIComponent Sender)
{
	PlayerOwner().ConsoleCommand("SET ALAudio.ALAudioSubsystem UseDefaultDriver "$UseDefaultDriverCheck.bChecked);
	bIsDataDirty = true;
}

function OnUseEAX(GUIComponent Sender)
{
	//PlayerOwner().ConsoleCommand("SET ALAudio.ALAudioSubsystem UseEAX "$UseEAXCheck.bChecked);
	//bIsDataDirty = true;
}

function OnCompatibility(GUIComponent Sender)
{
	PlayerOwner().ConsoleCommand("SET ALAudio.ALAudioSubsystem CompatibilityMode "$CompatibilityCheck.bChecked);
	bIsDataDirty = true;
}

function OnReverseStereo(GUIComponent Sender)
{
	PlayerOwner().ConsoleCommand("SET ALAudio.ALAudioSubsystem ReverseStereo "$ReverseStereoCheck.bChecked);
	bIsDataDirty = true;
}

function OnLowQuality(GUIComponent Sender)
{
	PlayerOwner().ConsoleCommand("SET ALAudio.ALAudioSubsystem LowQualitySound "$LowQualityCheck.bChecked);
}

function OnChatWindow(GUIComponent Sender)
{
	PlayerOwner().ConsoleCommand("SET Gameplay.SinglePlayerGameInfo bShowSubtitles "$ChatWindowCheck.bChecked);
	PlayerOwner().ConsoleCommand("SET MojoActions.TsAction bShowSubtitles "$ChatWindowCheck.bChecked);
	bIsDataDirty = true;
}

function OnDefaults(GUIComponent Sender)
{
	RestoreDefaults();
	InternalOnShow();

	PlayerOwner().ConsoleCommand("SET MojoActions.TsAction bShowSubtitles "$ChatWindowCheck.bChecked);
}

native function RestoreDefaults();

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: st 16.4.2014 10:20:44.000 - Creation time: st 23.5.2018 00:10:48.716 - Created with UnCodeX