## XIDInterf
Class XIIIMenuAudioClientWindow

source: C:\XIII\XIDInterf\Classes\XIIIMenuAudioClientWindow.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIIMenuAudioClientWindow

Direct Known Subclasses:None

class XIIIMenuAudioClientWindow
extends XIDInterf.XIIIWindow

    //============================================================================
    // Audio Volumes Configuration Menu
    //============================================================================

Variables
`XIIICheckBoxControl` | `MusicCheck`
`MusicValue,` | `MusicValueOld`
`OnText,` | `OffText`
`sound` | `menuzik`
`sBackGround[4],` | `sHighlight`
`tBackGround[4],` | `tHighLight`

Function Summary
`void` | `Created()`
    //============================================================================
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `ShowWindow()`

Source Code

    00001	//============================================================================
    00002	// Audio Volumes Configuration Menu
    00003	//============================================================================
    00004	class XIIIMenuAudioClientWindow extends XIIIWindow;
    00005
    00006
    00007	var XIIICheckBoxControl MusicCheck;
    00008	var localized string TitleText, MusicText, OnText, OffText;
    00009
    00010	var texture tBackGround[4], tHighLight;
    00011	var string sBackGround[4], sHighlight;
    00012
    00013	var int MusicValue, MusicValueOld;
    00014
    00015	var sound menuzik;
    00016
    00017
    00018	//============================================================================
    00019	function Created()
    00020	{
    00021		local int i;
    00022
    00023		Super.Created();
    00024
    00025		for (i=0; i<4; i++)
    00026			tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00027
    00028		tHighlight = texture(DynamicLoadObject(sHighlight, class'Texture'));
    00029
    00030		// Music
    00031		MusicCheck = XIIICheckboxControl(CreateControl(class'XIIICheckboxControl', 288, 206*fScaleTo, 300, 29*fScaleTo));
    00032		MusicCheck.Text = MusicText;
    00033		MusicCheck.sYes = OnText;
    00034		MusicCheck.sNo = OffText;
    00035
    00036		Controls[0] = MusicCheck;
    00037
    00038		// default values
    00039		MusicValue = int( GetPlayerOwner().ConsoleCommand("get HXAudio.HXAudioSubsystem MusicSliderPos") );
    00040		if ( MusicValue != 0 )
    00041			MusicValue = 2;
    00042		MusicValueOld = MusicValue;
    00043		// false value is no music
    00044		MusicCheck.bChecked = (MusicValue != 0);
    00045	}
    00046
    00047
    00048	function ShowWindow()
    00049	{
    00050	     Super.ShowWindow();
    00051
    00052	     bShowCCL = true;
    00053	     bShowACC = true;
    00054	}
    00055
    00056
    00057	function Paint(Canvas C, float X, float Y)
    00058	{
    00059	    local float fScale, fHeight, W, H;
    00060	    local int i;
    00061
    00062	    Super.Paint(C,X,Y);
    00063
    00064		DrawStretchedTexture(C, 253*fRatioX, 54*fRatioY, 353*fRatioX, 377*fScaleTo*fRatioY, myRoot.tFondNoir);
    00065
    00066		DrawStretchedTexture(C, 255*fRatioX, 56*fRatioY, 349*fRatioX, 373*fScaleTo*fRatioY, tBackGround[0]);
    00067
    00068		C.Style = 5;
    00069		C.DrawColor.A = 180;
    00070		DrawStretchedTexture(C, 255*fRatioX, (201*fScaleTo)*fRatioY, 349*fRatioX, 40*fRatioY, tHighlight);
    00071		C.DrawColor.A = 255;
    00072		DrawStretchedTexture(C, 120*fRatioX, 60*fRatioY, 180*fRatioX, 190*fScaleTo*fRatioY, tBackGround[1]);
    00073		DrawStretchedTexture(C, 120*fRatioX, (60+190*fScaleTo)*fRatioY, 180*fRatioX, 190*fScaleTo*fRatioY, tBackGround[2]);
    00074		DrawStretchedTexture(C, -60*fRatioX, (60+190*fScaleTo)*fRatioY, 180*fRatioX, 190*fScaleTo*fRatioY, tBackGround[3]);
    00075		C.Style = 1;
    00076
    00077		C.bUseBorder = true;
    00078		DrawStretchedTexture(C, 150*fRatioX, 30*fRatioY, 170*fRatioX, 35*fRatioY, myRoot.FondMenu);
    00079		C.TextSize(TitleText, W, H);
    00080		C.DrawColor = BlackColor;
    00081		C.SetPos((150 + (160-W)/2)*fRatioX, (47.5-H/2)*fRatioY);
    00082		C.DrawText(TitleText, false);
    00083		C.bUseBorder = false;
    00084		C.DrawColor = WhiteColor;
    00085	}
    00086
    00087
    00088	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00089	{
    00090	    if ((State==1)||(State==2)) //  IST_Press
    00091	    {
    00092	        if (Key==0x0D/*IK_Enter*/)
    00093		    {
    00094				// new value for music ?
    00095				if ( MusicValue != MusicValueOld )
    00096				{
    00097					GetPlayerOwner().StopMusic();
    00098					GetPlayerOwner().SetMusicSliderPos(MusicValue);
    00099					GetPlayerOwner().PlayMusic(menuzik);
    00100					GetPlayerOwner().ConsoleCommand("set HXAudio.HXAudioSubsystem MusicSliderPos "$MusicValue);
    00101				}
    00102
    00103
    00104	//			SaveConfigs();
    00105				SaveConfig();
    00106				myRoot.CloseMenu(false);
    00107	            return true;
    00108		    }
    00109		    if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B))
    00110		    {
    00111				myRoot.CloseMenu(true);
    00112	    	    return true;
    00113		    }
    00114		    if (Key==0x26/*IK_Up*/)
    00115		    {
    00116		        PrevControl(FocusedControl);
    00117	    	    return true;
    00118		    }
    00119		    if (Key==0x28/*IK_Down*/)
    00120		    {
    00121		        NextControl(FocusedControl);
    00122	    	    return true;
    00123		    }
    00124			if ((Key==0x25) || (Key==0x27))
    00125			{
    00126				OnMenu = FindComponentIndex(FocusedControl);
    00127				if (Key==0x25)
    00128				{
    00129					MusicCheck.bChecked = true;
    00130					MusicValue = 2;
    00131				}
    00132				else
    00133				{
    00134					if (Key==0x27)
    00135					{
    00136						MusicCheck.bChecked = false;
    00137						MusicValue = 0;
    00138					}
    00139				}
    00140			}
    00141	    }
    00142	    return super.InternalOnKeyEvent(Key, state, delta);
    00143	}
    00144
    00145
    00146
    00147
    00148
    00149	defaultproperties
    00150	{
    00151	     TitleText="Audio Options"
    00152	     MusicText="Music"
    00153	     SoundVolumeText="Sound Volume"
    00154	     OnText="On"
    00155	     OffText="Off"
    00156	     sBackground(0)="XIIIMenuStart.sonsdecor3"
    00157	     sBackground(1)="XIIIMenuStart.sonsXIII01A"
    00158	     sBackground(2)="XIIIMenuStart.sonsXIII02A"
    00159	     sBackground(3)="XIIIMenuStart.sonsXIII03A"
    00160	     sHighlight="XIIIMenuStart.barreselectmenuoptadv"
    00161	     menuzik=Sound'XIIIsound.Music__MapMenu.MapMenu__hMusicInit'
    00162	}

End Source Code