Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 19, 2011, 5:05:08 PM (13 years ago)
Author:
landauf
Message:

replaced tabs with spaces in files where they were used mixed

File:
1 edited

Legend:

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

    r7876 r7916  
    1010
    1111function P.onLoad()
    12     P.multiplayerMode = "startClient" 
     12    P.multiplayerMode = "startClient"
    1313
    1414    --button are arranged in a 2x2 matrix, the left lower item is nil
     
    3838    P.oldindex = -2
    3939    P.index = -1
    40    
     40
    4141    if P.joinMode == 1 then
    4242        local window = winMgr:getWindow("orxonox/MultiplayerLanButton")
     
    5656    P.joinMode = 1
    5757    if button:isSelected() == true then
    58             P.showServerList()
     58        P.showServerList()
    5959    end
    6060end
     
    6565    P.joinMode = 2
    6666    if button:isSelected() == true then
    67             P.showServerList()
    68         end
     67        P.showServerList()
     68    end
    6969end
    7070
     
    9292
    9393function P.showServerList()
    94         -- LAN Discovery
    95         if P.joinMode == 1 then
    96                 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
    97                 CEGUI.toListbox(listbox):resetList()
    98                 local discovery = orxonox.LANDiscovery:getInstance()
    99                 discovery:discover()
    100                 P.serverList = {}
    101                 local index = 0
    102                 local servername = ""
    103                 local serverip = ""
    104                 while true do
    105                     servername = discovery:getServerListItemName(index)
    106                     if servername == "" then
    107                         break
    108                     end
    109                     serverip = discovery:getServerListItemIP(index)
    110                     if serverip == "" then
    111                       break
    112                     end
    113                     table.insert(P.serverList, {servername, serverip})
    114                     index = index + 1
    115                 end
    116                 index = 1
    117                 for k,v in pairs(P.serverList) do
    118                     local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
    119                     item:setID(index)
    120                     index = index + 1
    121                     item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    122                     CEGUI.toListbox(listbox):addItem(item)
    123                 end
    124         -- WAN Discovery
    125         elseif P.joinMode == 2 then
    126                 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
    127                 CEGUI.toListbox(listbox):resetList()
    128                 local discovery = orxonox.WANDiscovery:getInstance()
    129                 cout(0, "discovering.\n" )
    130                 discovery:discover()
    131                 cout(0, "discovered.\n" )
    132                 P.serverList = {}
    133                 local index = 0
    134                 local servername = ""
    135                 local serverip = ""
    136                 while true do
    137                     servername = discovery:getServerListItemName(index)
    138                     if servername == "" then
    139                         break
    140                     end
    141                     serverip = discovery:getServerListItemIP(index)
    142                     if serverip == "" then
    143                       break
    144                     end
    145                     table.insert(P.serverList, {servername, serverip})
    146                     index = index + 1
    147                 end
    148                 index = 1
    149                 for k,v in pairs(P.serverList) do
    150                     local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
    151                     item:setID(index)
    152                     index = index + 1
    153                     item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    154                     CEGUI.toListbox(listbox):addItem(item)
    155                 end
    156         end
    157        
     94    -- LAN Discovery
     95    if P.joinMode == 1 then
     96        local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     97        CEGUI.toListbox(listbox):resetList()
     98        local discovery = orxonox.LANDiscovery:getInstance()
     99        discovery:discover()
     100        P.serverList = {}
     101        local index = 0
     102        local servername = ""
     103        local serverip = ""
     104        while true do
     105            servername = discovery:getServerListItemName(index)
     106            if servername == "" then
     107                break
     108            end
     109            serverip = discovery:getServerListItemIP(index)
     110            if serverip == "" then
     111                break
     112            end
     113            table.insert(P.serverList, {servername, serverip})
     114            index = index + 1
     115        end
     116        index = 1
     117        for k,v in pairs(P.serverList) do
     118            local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     119            item:setID(index)
     120            index = index + 1
     121            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     122            CEGUI.toListbox(listbox):addItem(item)
     123        end
     124    -- WAN Discovery
     125    elseif P.joinMode == 2 then
     126        local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     127        CEGUI.toListbox(listbox):resetList()
     128        local discovery = orxonox.WANDiscovery:getInstance()
     129        cout(0, "discovering.\n" )
     130        discovery:discover()
     131        cout(0, "discovered.\n" )
     132        P.serverList = {}
     133        local index = 0
     134        local servername = ""
     135        local serverip = ""
     136        while true do
     137            servername = discovery:getServerListItemName(index)
     138            if servername == "" then
     139                break
     140            end
     141            serverip = discovery:getServerListItemIP(index)
     142            if serverip == "" then
     143                break
     144            end
     145            table.insert(P.serverList, {servername, serverip})
     146            index = index + 1
     147        end
     148        index = 1
     149        for k,v in pairs(P.serverList) do
     150            local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     151            item:setID(index)
     152            index = index + 1
     153            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     154            CEGUI.toListbox(listbox):addItem(item)
     155        end
     156    end
     157
    158158end
    159159
    160 function P.onKeyPressed() 
     160function P.onKeyPressed()
    161161    buttonIteratorHelper(P.buttonList, code, P, 2, 2)
    162162end
Note: See TracChangeset for help on using the changeset viewer.