Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 10, 2010, 3:35:39 PM (14 years ago)
Author:
smerkli
Message:

added comments, lua function (to be tested) and various implementation bits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/masterserver/data/gui/scripts/MultiplayerMenu.lua

    r7163 r7631  
    129129end
    130130
     131
     132-- same as above, but use WAN Discovery
     133function P.showServerList()
     134    local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     135    CEGUI.toListbox(listbox):resetList()
     136    local discovery = orxonox.WANDiscovery:getInstance()
     137    discovery:discover()
     138    P.serverList = {}
     139    local index = 0
     140    local servername = ""
     141    local serverip = ""
     142    while true do
     143        servername = discovery:getServerListItemName(index)
     144        if servername == "" then
     145            break
     146        end
     147        serverip = discovery:getServerListItemIP(index)
     148        if serverip == "" then
     149          break
     150        end
     151        table.insert(P.serverList, {servername, serverip})
     152        index = index + 1
     153    end
     154    index = 1
     155    for k,v in pairs(P.serverList) do
     156        local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     157        item:setID(index)
     158        index = index + 1
     159        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     160        CEGUI.toListbox(listbox):addItem(item)
     161    end
     162end
     163
    131164return P
    132165
Note: See TracChangeset for help on using the changeset viewer.