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

XInterface.UT2VideoChangeOK


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
// ====================================================================
//  Class:  XInterface.UT2VideoChangeOK
//  Parent: XInterface.GUIPage
//
//  <Enter a description here>
// ====================================================================

class UT2VideoChangeOK extends UT2K3GUIPage;

var     Int         Count;
var     string      OrigRes;

var localized string    RestoreTextPre,
                        RestoreTextPost,
                        RestoreTextSingular;

event Timer()
{
    Count--;
    if (Count>1)
        GUILabel(Controls[4]).Caption = RestoreTextPre$Count$RestoreTextPost;
    else
        GUILabel(Controls[4]).Caption = RestoreTextSingular;

    if (Count<=0)
    {
        SetTimer(0);

        // Reset resolution here

        PlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice Use16bit"@(InStr(OrigRes,"x16")!=-1));
        PlayerOwner().ConsoleCommand("setres"@OrigRes);

        Controller.CloseMenu(True);
    }
}

function Execute(string DesiredRes)
{
    local string res,bit,x,y;
    local int i;

    if (DesiredRes=="")
        return;

    res = Controller.GetCurrentRes();
    bit = PlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice Use16bit");

    if (bit=="true")
        OrigRes=res$"x16";
    else
        OrigRes=res$"x32";

    if(bool(PlayerOwner().ConsoleCommand("ISFULLSCREEN")))
        OrigRes=OrigRes$"f";
    else
        OrigRes=OrigRes$"w";

    PlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice Use16bit"@(InStr(DesiredRes,"x16") != -1));
    PlayerOwner().ConsoleCommand("setres"@DesiredRes);

    i = Instr(DesiredRes,"x");
    x = left(DesiredRes,i);
    y = mid(DesiredRes,i+1);

    if( (int(x)<640) || (int(y)<480) )
    {
        PlayerOwner().ConsoleCommand("tempsetres 640x480");
        SetTimer(0,false);
        Controller.ReplaceMenu("xinterface.UT2DeferChangeRes");
        Controller.GameResolution = Left(DesiredRes,Len(DesiredRes) - 4);
    }
    else
        Controller.GameResolution = "";
}


function StartTimer()
{
    Count=15;
    SetTimer(1.0,true);
}

function bool InternalOnClick(GUIComponent Sender)
{
    SetTimer(0);
    if (Sender==Controls[2])
    {
        PlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice Use16bit"@(InStr(OrigRes,"x16")!=-1));
        PlayerOwner().ConsoleCommand("setres"@OrigRes);
    }

    GUILabel(Controls[3]).Caption="Accept these settings?";
    Controller.CloseMenu(Sender == Controls[2]);

    return true;
}

defaultproperties
{
     RestoreTextPre="(Original settings will be restored in "
     RestoreTextPost=" seconds)"
     RestoreTextSingular="(Original settings will be restored in 1 second)"
     InactiveFadeColor=(B=128,G=128,R=128)
     Begin Object Class=GUIButton Name=VidOKBackground
         StyleName="SquareBar"
         WinHeight=1.000000
         bBoundToParent=Wahr
         bScaleToParent=Wahr
         bAcceptsInput=Falsch
         bNeverFocus=Wahr
         OnKeyEvent=VidOKBackground.InternalOnKeyEvent
     End Object
     Controls(0)=GUIButton'XInterface.UT2VideoChangeOK.VidOKBackground'

     Begin Object Class=GUIButton Name=AcceptButton
         Caption="Keep Settings"
         WinTop=0.750000
         WinLeft=0.125000
         WinWidth=0.200000
         bBoundToParent=Wahr
         OnClick=UT2VideoChangeOK.InternalOnClick
         OnKeyEvent=AcceptButton.InternalOnKeyEvent
     End Object
     Controls(1)=GUIButton'XInterface.UT2VideoChangeOK.AcceptButton'

     Begin Object Class=GUIButton Name=BackButton
         Caption="Restore Settings"
         WinTop=0.750000
         WinLeft=0.650000
         WinWidth=0.200000
         bBoundToParent=Wahr
         OnClick=UT2VideoChangeOK.InternalOnClick
         OnKeyEvent=BackButton.InternalOnKeyEvent
     End Object
     Controls(2)=GUIButton'XInterface.UT2VideoChangeOK.BackButton'

     Begin Object Class=GUILabel Name=VideoOKDesc
         Caption="Accept these settings?"
         TextAlign=TXTA_Center
         TextColor=(B=0,G=200,R=230)
         TextFont="UT2HeaderFont"
         WinTop=0.400000
         WinHeight=32.000000
     End Object
     Controls(3)=GUILabel'XInterface.UT2VideoChangeOK.VideoOKDesc'

     Begin Object Class=GUILabel Name=VideoOkTimerDesc
         Caption="(Original settings will be restored in 15 seconds)"
         TextAlign=TXTA_Center
         TextColor=(B=0,G=200,R=230)
         WinTop=0.460000
         WinHeight=32.000000
     End Object
     Controls(4)=GUILabel'XInterface.UT2VideoChangeOK.VideoOkTimerDesc'

     WinTop=0.375000
     WinHeight=0.250000
     OnActivate=UT2VideoChangeOK.StartTimer
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:48.000 - Creation time: Mo 16.4.2007 11:20:57.015 - Created with UnCodeX