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

GUI2K4.UT2K4Browser_PlayersList


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

var array<GameInfo.PlayerResponseLine>  Players;

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;
    local color TempColor;
    local int Team, PlayerStat;

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

    else DrawStyle = Style;

    TempColor = DrawStyle.FontColors[MenuState];

    // Find out if we have a team number
    PlayerStat = Players[SortData[i].SortItem].StatsID;
    Team = (PlayerStat >> 29) - 1;

    // Clear the extra bits
    PlayerStat = PlayerStat & 268435456;    // 1 << 28
    if (Team == 0 || Team == 1)
        DrawStyle.FontColors[MenuState] = SetColor(Team);


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

    GetCellLeftWidth( 1, CellLeft, CellWidth );
    DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left, string(Players[SortData[i].SortItem].Score), FontScale );

    if( Players[SortData[i].SortItem].StatsID != 0 )
    {
        GetCellLeftWidth( 2, CellLeft, CellWidth );
        DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left, string(PlayerStat), FontScale );
    }

    GetCellLeftWidth( 3, CellLeft, CellWidth );
    DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left, string(Players[SortData[i].SortItem].Ping), FontScale );

    DrawStyle.FontColors[MenuState] = TempColor;
}

function color SetColor(int TeamNum)
{
    local color Col;

    if (TeamNum == 0)
    {
        Col.R = 255;
        Col.B = 0;
        Col.G = 0;
        Col.A = 255;
    }

    else
    {
        Col.R = 128;
        Col.B = 255;
        Col.G = 192;
        Col.A = 255;
    }

    return col;
}

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: //IK_Enter
            tp_MyPage.li_Server.Connect(false);
            return true;

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

function AddNewPlayer(GameInfo.PlayerResponseLine NewPlayer)
{
    Players[Players.Length] = NewPlayer;
    AddedItem();
}

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

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

    switch (SortColumn)
    {
        case 0:
            S = Left(Caps(Players[i].PlayerName), 8);
            break;

        case 1:
            S = string(Players[i].Score);
            PadLeft(S, 4, "0");
            break;

        case 2:
            S = string(Players[i].StatsID & 268435456);
            PadLeft(S, 9, "0");
            break;

        default:
            S = string(Players[i].Ping);
            PadLeft(S, 5, "0");
    }

    return S;
}

defaultproperties
{
    ColumnHeadings(0)="Name"
    ColumnHeadings(1)="Score"
    ColumnHeadings(2)="Rank"
    ColumnHeadings(3)="Ping"
    ExpandLastColumn=True
    SortColumn=0

    InitColumnPerc(0)=0.34
    InitColumnPerc(1)=0.22
    InitColumnPerc(2)=0.22
    InitColumnPerc(3)=0.22
}

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