Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 1, 2016, 3:08:54 PM (7 years ago)
Author:
kappenh
Message:

updated Highscore interface and Jump save routine TODO Menu!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Highscore_HS16/data/gui/scripts/HighscoreMenu.lua

    r11313 r11315  
    5656
    5757function P.onShow()
    58         P.nameList = {}
    5958       
    6059        P.scoreList = {}
     
    6261
    6362        for i=0,orxonox.Highscore:getInstance():getNumberOfHighscores()-1 do
    64                 table.insert(P.nameList, orxonox.Highscore:getInstance():getHighscore(i))
    65                 table.insert(P.scoreList, i)
     63                table.insert(P.scoreList, orxonox.Highscore:getInstance():getHighscore(i))
    6664       
    6765        end
     
    112110    local offset = 2
    113111    for k,v in pairs(P.scoreList) do
    114         local line = P.createPickupEntry(tabName .. k,k,tag)
    115         table.insert(P.linesList, line)
    116         line:setYPosition(CEGUI.UDim(0,offset))
    117         offset = offset + line:getHeight():asAbsolute(1)+2
    118         pane:addChildWindow(line)
     112       
     113        local splitlist = P.Split(v,"./.")
     114
     115        if(splitlist[1] ~= name)then  --TODO!!!!!!!
     116                local line = P.createPickupEntry(tabName .. k,k,tag)
     117                table.insert(P.linesList, line)
     118                line:setYPosition(CEGUI.UDim(0,offset))
     119                offset = offset + line:getHeight():asAbsolute(1)+2
     120                pane:addChildWindow(line)       
     121        end
     122       
    119123    end
    120124
     
    166170    end
    167171end
    168 
     172function P.Split(str, delim, maxNb)
     173    -- Eliminate bad cases...
     174    if string.find(str, delim) == nil then
     175        return { str }
     176    end
     177    if maxNb == nil or maxNb < 1 then
     178        maxNb = 0    -- No limit
     179    end
     180    local result = {}
     181    local pat = "(.-)" .. delim .. "()"
     182    local nb = 0
     183    local lastPos
     184    for part, pos in string.gfind(str, pat) do
     185        nb = nb + 1
     186        result[nb] = part
     187        lastPos = pos
     188        if nb == maxNb then break end
     189    end
     190    -- Handle the last field
     191    if nb ~= maxNb then
     192        result[nb + 1] = string.sub(str, lastPos)
     193    end
     194    return result
     195end
    169196function P.HighscoreSelectionChanged(e)
    170197        --local pane = tolua.cast(winMgr:getWindow("orxonox/HighscoreMenuPane"), "CEGUI::ScrollablePane")
Note: See TracChangeset for help on using the changeset viewer.