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

GUI2K4.UT2K4SettingsPage


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
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
//==============================================================================
//  Description
//
//  Written by Ron Prestenback (based on XInterface.SettingsPage)
//  © 2003, Epic Games, Inc.  All Rights Reserved
//==============================================================================
class UT2K4SettingsPage extends UT2K4MainPage;

#exec OBJ LOAD FILE=InterfaceContent.utx

var Automated GUIButton b_Back;
var Automated GUIButton b_Apply, b_Reset;

var() config bool                 bApplyImmediately;  // Whether to apply changes to setting immediately
var UT2K4Tab_GameSettings       tp_Game;

var() editconst noexport float               SavedPitch;
var() string PageCaption;
var() GUIButton SizingButton;
var() Settings_Tabs ActivePanel;
var localized string InvalidStats;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    local rotator PlayerRot;
    local int i;

    Super.InitComponent(MyController, MyOwner);
    PageCaption = t_Header.Caption;

    GetSizingButton();


    // Set camera's pitch to zero when menu initialised (otherwise spinny weap goes kooky)
    PlayerRot = PlayerOwner().Rotation;
    SavedPitch = PlayerRot.Pitch;
    PlayerRot.Pitch = 0;
    PlayerRot.Roll = 0;
    PlayerOwner().SetRotation(PlayerRot);

	for ( i = 0; i < PanelCaption.Length && i < PanelClass.Length && i < PanelHint.Length; i++ )
	{
		Profile("Settings_" $ PanelCaption[i]);
		c_Tabs.AddTab(PanelCaption[i], PanelClass[i],, PanelHint[i]);
		Profile("Settings_" $ PanelCaption[i]);
	}

    tp_Game = UT2K4Tab_GameSettings(c_Tabs.BorrowPanel(PanelCaption[3]));
}

function GetSizingButton()
{
    local int i;

    SizingButton = None;
    for (i = 0; i < Components.Length; i++)
    {
        if (GUIButton(Components[i]) == None)
            continue;

        if ( SizingButton == None || Len(GUIButton(Components[i]).Caption) > Len(SizingButton.Caption))
            SizingButton = GUIButton(Components[i]);
    }
}

function bool InternalOnPreDraw(Canvas Canvas)
{
    local int X, i;
    local float XL,YL;

    if (SizingButton == None)
        return false;

    SizingButton.Style.TextSize(Canvas, SizingButton.MenuState, SizingButton.Caption, XL, YL, SizingButton.FontScale);

    XL += 32;
    X = Canvas.ClipX - XL;
    for (i = Components.Length - 1; i >= 0; i--)
    {
        if (GUIButton(Components[i]) == None)
            continue;

        Components[i].WinWidth = XL;
        Components[i].WinLeft = X;
        X -= XL;
    }

    return false;
}

function bool InternalOnCanClose(optional bool bCanceled)
{
    if(Controller.ActivePage == Self && !tp_Game.ValidStatConfig())
    {
        c_Tabs.ActivateTabByPanel(tp_Game, True);

		Controller.OpenMenu("GUI2K4.UT2K4GenericMessageBox",InvalidStats,tp_Game.l_Warning.Caption);
        return false;
    }

    return true;
}

function InternalOnClose(optional Bool bCanceled)
{
    local rotator NewRot;

    // Reset player
    NewRot = PlayerOwner().Rotation;
    NewRot.Pitch = SavedPitch;
    PlayerOwner().SetRotation(NewRot);

    Super.OnClose(bCanceled);
}

function InternalOnChange(GUIComponent Sender)
{
	Super.InternalOnChange(Sender);

	if ( c_Tabs.ActiveTab == None )
		ActivePanel = None;
	else ActivePanel = Settings_Tabs(c_Tabs.ActiveTab.MyPanel);
}

function BackButtonClicked()
{
	if ( InternalOnCanClose(False) )
	{
    	c_Tabs.ActiveTab.OnDeActivate();
        Controller.CloseMenu(False);
    }
}


function DefaultsButtonClicked()
{
	ActivePanel.ResetClicked();
}

function bool ButtonClicked(GUIComponent Sender)
{
    ActivePanel.AcceptClicked();
    return true;
}

event bool NotifyLevelChange()
{
	bPersistent = false;
	LevelChanged();
	return true;
}

defaultproperties
{
    OnClose=InternalOnClose
    OnCanClose=InternalOnCanClose
    OnPreDraw=InternalOnPreDraw

    Begin Object class=GUIHeader name=SettingHeader
        Caption="Settings"
		WinHeight=25
		RenderWeight=0.3
    End Object

    Begin Object Class=UT2K4Settings_Footer Name=SettingFooter
        RenderWeight=0.3
        TabOrder=4
    End Object

    Begin Object Class=GUIButton Name=aApply
        Caption="APPLY"
        WinWidth=0.097460
        WinLeft=0.902148
        WinHeight=0.033203
        WinTop=0.966146
        TabOrder=1
        bVisible=True
        OnClick=ButtonClicked
        StyleName="SquareButton"
        MenuState=MSAT_Disabled
        RenderWeight=1.0
    End Object

    t_Header=SettingHeader
    t_Footer=SettingFooter

    WinWidth=1.0
    WinHeight=1.0
    WinTop=0.0
    WinLeft=0.0

    PanelCaption(0)="Display"
    PanelCaption(1)="Audio"
    PanelCaption(2)="Player"
    PanelCaption(3)="Game"
    PanelCaption(4)="Input"
    PanelCaption(5)="Weapons"
    PanelCaption(6)="HUD"

    PanelClass(0)="GUI2K4.UT2K4Tab_DetailSettings"
    PanelClass(1)="GUI2K4.UT2K4Tab_AudioSettings"
    PanelClass(2)="GUI2K4.UT2K4Tab_PlayerSettings"
    PanelClass(3)="GUI2K4.UT2K4Tab_GameSettings"
    PanelClass(4)="GUI2K4.UT2K4Tab_IForceSettings"
    PanelClass(5)="GUI2K4.UT2K4Tab_WeaponPref"
    PanelClass(6)="GUI2K4.UT2K4Tab_HudSettings"

    PanelHint(0)="Select your resolution or change your display and detail settings..."
    PanelHint(1)="Adjust your audio experience..."
    PanelHint(2)="Configure your UT2004 Avatar..."
    PanelHint(3)="Configure game and network related settings..."
    PanelHint(4)="Configure misc. input options..."
    PanelHint(5)="Adjust your weapon priorities and settings..."
    PanelHint(6)="Customize your HUD..."
 	InvalidStats="Invalid Stats Info"
    bApplyImmediately=True
}

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.788 - Created with UnCodeX