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

GUI2K4.UT2K4SP_MapChallenge


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
//==============================================================================
// Challenge for the alternative map
//
// Written by Michiel Hendriks
// (c) 2003, 2004, Epic Games, Inc. All Rights Reserved
//==============================================================================

class UT2K4SP_MapChallenge extends LargeWindow;

var automated GUILabel lblTitle;
var automated GUIButton btnOk, btnCancel;
var automated GUIImage imgMapBg, imgMap;
var automated GUIScrollTextBox lblDesc;

var localized string ChallengeDesc;

var UT2K4GameProfile GP;
/** Challenge match info */
var UT2K4MatchInfo ChalMI;
var CacheManager.MapRecord ActiveMap;

var float ChangeCost;

/** called when the OK button was clicked */
delegate MapSelectionUpdate();

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    local UT2K4MatchInfo MI;
    local UT2K4SP_Main MainWindow;
    local CacheManager.MapRecord MR;
    local string tmp;

    Super.Initcomponent(MyController, MyOwner);
    GP = UT2K4GameProfile(PlayerOwner().Level.Game.CurrentGameProfile);
    if (GP == none)
    {
        Warn("GP == none");
        return;
    }

    // find main window
    MainWindow = UT2K4SP_Main(Controller.FindMenuByClass(class'UT2K4SP_Main'));
/*
    for (i = Controller.MenuStack.length-1; i>=0; i--)
    {
        if (UT2K4SP_Main(Controller.MenuStack[i]) != None)
        {
            MainWindow = UT2K4SP_Main(Controller.MenuStack[i]);
            break;
        }
    }
*/
    // get alternative map info
    MI = GP.GetSelectedMatchInfo(GP.CurrentLadder, GP.CurrentMenuRung, GP.GetAltLevel(GP.CurrentLadder, GP.CurrentMenuRung), GP.GetSelectedLevel(GP.CurrentLadder, GP.CurrentMenuRung) != -1);
    MR = class'CacheManager'.static.getMapRecord(MI.LevelName);
    if (MR.FriendlyName != "") tmp = MR.FriendlyName;
        else tmp = MR.MapName;
    ChallengeDesc = repl(ChallengeDesc, "%altmap%", tmp);
    if (MR.ScreenshotRef != "") imgMap.Image = Material(DynamicLoadObject(MR.ScreenshotRef, class'Material'));

    // get current map info
    MI = UT2K4MatchInfo(GP.GetMatchInfo(GP.CurrentLadder, GP.CurrentMenuRung));
    MR = class'CacheManager'.static.getMapRecord(MI.LevelName);
    if (MR.FriendlyName != "") tmp = MR.FriendlyName;
        else tmp = MR.MapName;
    ChallengeDesc = repl(ChallengeDesc, "%curmap%", tmp);

    ChangeCost = MI.PrizeMoney * GP.MapChallengeCost;
    ChallengeDesc = repl(ChallengeDesc, "%fee%", GP.MoneyToString(ChangeCost));

    lblDesc.setContent(ChallengeDesc);

    if (imgMap.Image==None) imgMap.Image = Material'UCGeneric.SolidColours.Black';
}

function bool OnOkClick(GUIComponent Sender)
{
    GP.Balance -= ChangeCost;
    if (GP.GetSelectedLevel(GP.CurrentLadder, GP.CurrentMenuRung) != -1) GP.ResetSelectedLevel(GP.CurrentLadder, GP.CurrentMenuRung);
    else GP.SetSelectedLevel(GP.CurrentLadder, GP.CurrentMenuRung, GP.GetAltLevel(GP.CurrentLadder, GP.CurrentMenuRung));
    MapSelectionUpdate();
    return Controller.CloseMenu(false);
}

function bool OnCancelClick(GUIComponent Sender)
{
    return Controller.CloseMenu(true);
}

defaultproperties
{
     Begin Object Class=GUILabel Name=SPClblTitle
         Caption="Change Arena"
         TextAlign=TXTA_Center
         FontScale=FNS_Large
         StyleName="TextLabel"
         WinTop=0.057847
         WinLeft=0.021563
         WinWidth=0.762501
         WinHeight=0.052500
         RenderWeight=0.200000
         bBoundToParent=Wahr
     End Object
     lblTitle=GUILabel'GUI2K4.UT2K4SP_MapChallenge.SPClblTitle'

     Begin Object Class=GUIButton Name=SPMbtnOk
         Caption="CHANGE"
         FontScale=FNS_Small
         WinTop=0.854397
         WinLeft=0.685071
         WinWidth=0.222222
         WinHeight=0.044444
         RenderWeight=0.200000
         TabOrder=1
         bBoundToParent=Wahr
         OnClick=UT2K4SP_MapChallenge.onOkClick
         OnKeyEvent=SPMbtnOk.InternalOnKeyEvent
     End Object
     btnOK=GUIButton'GUI2K4.UT2K4SP_MapChallenge.SPMbtnOk'

     Begin Object Class=GUIButton Name=SPCbtnCancel
         Caption="CANCEL"
         FontScale=FNS_Small
         WinTop=0.854397
         WinLeft=0.037848
         WinWidth=0.222222
         WinHeight=0.044444
         RenderWeight=0.200000
         TabOrder=2
         bBoundToParent=Wahr
         OnClick=UT2K4SP_MapChallenge.onCancelClick
         OnKeyEvent=SPCbtnCancel.InternalOnKeyEvent
     End Object
     btnCancel=GUIButton'GUI2K4.UT2K4SP_MapChallenge.SPCbtnCancel'

     Begin Object Class=GUIImage Name=SPCimgMapBg
         Image=Texture'2K4Menus.Controls.sectionback'
         ImageStyle=ISTY_Scaled
         WinTop=0.144641
         WinLeft=0.222222
         WinWidth=0.444444
         WinHeight=0.333333
         bBoundToParent=Wahr
     End Object
     imgMapBg=GUIImage'GUI2K4.UT2K4SP_MapChallenge.SPCimgMapBg'

     Begin Object Class=GUIImage Name=SPCimgMap
         Image=Texture'2K4Menus.Controls.sectionback'
         ImageStyle=ISTY_Scaled
         WinTop=0.155865
         WinLeft=0.224722
         WinWidth=0.441667
         WinHeight=0.321250
         RenderWeight=0.150000
         bBoundToParent=Wahr
     End Object
     imgMap=GUIImage'GUI2K4.UT2K4SP_MapChallenge.SPCimgMap'

     Begin Object Class=GUIScrollTextBox Name=SPClblDesc
         bNoTeletype=Wahr
         OnCreateComponent=SPClblDesc.InternalOnCreateComponent
         WinTop=0.717846
         WinLeft=0.042813
         WinWidth=0.731251
         WinHeight=0.090000
         RenderWeight=0.200000
         TabOrder=1
         bBoundToParent=Wahr
     End Object
     lblDesc=GUIScrollTextBox'GUI2K4.UT2K4SP_MapChallenge.SPClblDesc'

     ChallengeDesc="The current arena for this match is %curmap%.|You can change this arena to %altmap% when you pay %fee%."
     DefaultLeft=0.100000
     DefaultWidth=0.800000
     WinLeft=0.100000
     WinWidth=0.800000
}

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