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

GUI2K4.UT2K4Browser_RulesList


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
class UT2K4Browser_RulesList extends ServerBrowserMCList;

var array<GameInfo.KeyValuePair>    Rules;

// Move to PlayInfo???  Perhaps make use of Localize()?
var localized string TrueString;
var localized string FalseString;
var localized string ServerModeString;
var localized string DedicatedString;
var localized string NonDedicatedString;
var localized string AdminNameString;
var localized string AdminEmailString;
var localized string PasswordString;
var localized string GameStatsString;
var localized string GameSpeedString;
var localized string MutatorString;
var localized string BalanceTeamsString;
var localized string PlayersBalanceTeamsString;
var localized string FriendlyFireString;
var localized string GoalScoreString;
var localized string TimeLimitString;
var localized string MinPlayersString;
var localized string TranslocatorString;
var localized string WeaponStayString;
var localized string MapVotingString;
var localized string KickVotingString;

function MyOnDrawItem(Canvas Canvas, int i, float X, float Y, float W, float H, bool bSelected, bool bPending)
{
    local float CellLeft, CellWidth;
    local GUIStyles DrawStyle;

    if (bSelected)
    {
        SelectedStyle.Draw(Canvas, MSAT_Pressed, X, Y-2, W, H+2);
        DrawStyle = SelectedStyle;
    }
    else DrawStyle = Style;

    GetCellLeftWidth( 0, CellLeft, CellWidth );
    DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left, LocalizeRules(Rules[SortData[i].SortItem].Key), FontScale );

    GetCellLeftWidth( 1, CellLeft, CellWidth );
    DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left, LocalizeRules(Rules[SortData[i].SortItem].Value), FontScale );
}

function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
{
    if( Super.InternalOnKeyEvent(Key, State, delta) )
        return true;

    if( State==3 )
    {
        switch( EInputKey(Key) )
        {
        case IK_Enter:
            tp_MyPage.li_Server.Connect(false);
            return true;

        case IK_F5: //IK_F5
            tp_MyPage.RefreshList();
            return true;
        }
    }
    return false;
}

function string LocalizeRules( string code )
{
    switch( caps(code) )
    {
    case "TRUE":                return TrueString;
    case "FALSE":               return FalseString;
    case "SERVERMODE":          return ServerModeString;
    case "DEDICATED":           return DedicatedString;
    case "NON-DEDICATED":       return NonDedicatedString;
    case "ADMINNAME":           return AdminNameString;
    case "ADMINEMAIL":          return AdminEmailString;
    case "PASSWORD":            return PasswordString;
    case "GAMESTATS":           return GameStatsString;
    case "GAMESPEED":           return GameSpeedString;
    case "MUTATOR":             return MutatorString;
    case "BALANCETEAMS":        return BalanceTeamsString;
    case "PLAYERSBALANCETEAMS": return PlayersBalanceTeamsString;
    case "FRIENDLYFIRE":        return FriendlyFireString;
    case "GOALSCORE":           return GoalScoreString;
    case "TIMELIMIT":           return TimeLimitString;
    case "MINPLAYERS":          return MinPlayersString;
    case "TRANSLOCATOR":        return TranslocatorString;
    case "WEAPONSTAY":          return WeaponStayString;
    case "MAPVOTING":           return MapVotingString;
    case "KICKVOTING":          return KickVotingString;
    }
    return code;
}

function AddNewRule(GameInfo.KeyValuePair NewRule)
{
    Rules[Rules.Length] = NewRule;
    AddedItem();
}

function Clear()
{
    ItemCount = 0;
    Rules.Remove(0, Rules.Length);
    Super.Clear();
}

function string GetSortString( int i )
{
    local string S;

    if (SortColumn == 1)
    {
        S = LocalizeRules(Rules[i].Value);
        S = Left(S, 10);
    }

    else
    {
        S = LocalizeRules(Rules[i].Key);
        S = Left(S, 10);
    }

    return S;
}

defaultproperties
{
    ColumnHeadings(0)="Setting"
    ColumnHeadings(1)="Value"

    InitColumnPerc(0)=0.5
    InitColumnPerc(1)=0.5
    ExpandLastColumn=True
    SortColumn=0

    TrueString="Enabled"
    FalseString="Disabled"
    ServerModeString="Server Mode"
    DedicatedString="Dedicated"
    NonDedicatedString="Non-Dedicated"
    AdminNameString="Server Admin"
    AdminEmailString="Admin Email"
    PasswordString="Requires Password"
    GameStatsString="UT2004 Stats"
    GameSpeedString="Game Speed"
    MutatorString="Mutator"
    BalanceTeamsString="Bots Balance Teams"
    PlayersBalanceTeamsString="Balance Teams"
    FriendlyFireString="Friendly Fire"
    GoalScoreString="Goal Score"
    TimeLimitString="Time Limit"
    MinPlayersString="Minimum Players (bots)"
    TranslocatorString="Translocator"
    WeaponStayString="Weapons Stay"
    StyleName="ServerBrowserGrid"
    SelectedStyleName="BrowserListSelection"
    MapVotingString="Map Voting"
    KickVotingString="Kick Voting"
}


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