Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2011, 9:47:11 PM (14 years ago)
Author:
landauf
Message:

merged usability branch back to trunk

incomplete summary of the changes in this branch:

  • enhanced keyboard navigation in GUIs
  • implemented new graphics menu and changeable window size at runtime
  • added developer mode
  • HUD shows if game is paused, game pauses if ingame menu is opened
  • removed a few obsolete commands and hid some that are more for internal use
  • numpad works in console and gui
  • faster loading of level info
  • enhanced usage of compositors (Shader class)
  • improved camera handling, configurable FOV and aspect ratio
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/gui/scripts/MultiplayerMenu.lua

    r7876 r8079  
    22
    33local P = createMenuSheet("MultiplayerMenu")
    4 
    5 P.buttonList = {}
    64
    75--joinMode is 1 for choice "LAN" and 2 for "Internet"
     
    108
    119function P.onLoad()
    12     P.multiplayerMode = "startClient" 
     10    P.multiplayerMode = "startClient"
    1311
    14     --button are arranged in a 2x2 matrix, the left lower item is nil
    15     local item = {
     12    --button are arranged in a 3x2 matrix, Join and Host buttons are in the upper left and middle, the back button in the lower right of the table
     13    P:setButton(1, 1, {
    1614            ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton"),
    17             ["function"]  = P.MultiplayerJoinButton_clicked
    18     }
    19     P.buttonList[1] = item
     15            ["callback"]  = P.MultiplayerJoinButton_clicked
     16    })
    2017
    21     local item = {
     18    P:setButton(1, 2, {
    2219            ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton"),
    23             ["function"]  = P.MultiplayerHostButton_clicked
    24     }
    25     P.buttonList[2] = item
     20            ["callback"]  = P.MultiplayerHostButton_clicked
     21    })
    2622
    27     local item = {
     23    P:setButton(2, 3, {
    2824            ["button"] = winMgr:getWindow("orxonox/MultiplayerBackButton"),
    29             ["function"]  = P.MultiplayerBackButton_clicked
    30     }
    31     P.buttonList[4] = item
     25            ["callback"]  = P.MultiplayerBackButton_clicked
     26    })
    3227end
    3328
     
    3530    --P.showServerList()
    3631
    37     --indices to iterate through buttonlist
    38     P.oldindex = -2
    39     P.index = -1
    40    
    4132    if P.joinMode == 1 then
    4233        local window = winMgr:getWindow("orxonox/MultiplayerLanButton")
     
    5647    P.joinMode = 1
    5748    if button:isSelected() == true then
    58             P.showServerList()
     49        P.showServerList()
    5950    end
    6051end
     
    6556    P.joinMode = 2
    6657    if button:isSelected() == true then
    67             P.showServerList()
    68         end
     58        P.showServerList()
     59    end
    6960end
    7061
     
    9283
    9384function 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        
    158 end
     85    -- LAN Discovery
     86    if P.joinMode == 1 then
     87        local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     88        CEGUI.toListbox(listbox):resetList()
     89        local discovery = orxonox.LANDiscovery:getInstance()
     90        discovery:discover()
     91        P.serverList = {}
     92        local index = 0
     93        local servername = ""
     94        local serverip = ""
     95        while true do
     96            servername = discovery:getServerListItemName(index)
     97            if servername == "" then
     98                break
     99            end
     100            serverip = discovery:getServerListItemIP(index)
     101            if serverip == "" then
     102                break
     103            end
     104            table.insert(P.serverList, {servername, serverip})
     105            index = index + 1
     106        end
     107        index = 1
     108        for k,v in pairs(P.serverList) do
     109            local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     110            item:setID(index)
     111            index = index + 1
     112            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     113            CEGUI.toListbox(listbox):addItem(item)
     114        end
     115    -- WAN Discovery
     116    elseif P.joinMode == 2 then
     117        local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     118        CEGUI.toListbox(listbox):resetList()
     119        local discovery = orxonox.WANDiscovery:getInstance()
     120        cout(0, "discovering.\n" )
     121        discovery:discover()
     122        cout(0, "discovered.\n" )
     123        P.serverList = {}
     124        local index = 0
     125        local servername = ""
     126        local serverip = ""
     127        while true do
     128            servername = discovery:getServerListItemName(index)
     129            if servername == "" then
     130                break
     131            end
     132            serverip = discovery:getServerListItemIP(index)
     133            if serverip == "" then
     134                break
     135            end
     136            table.insert(P.serverList, {servername, serverip})
     137            index = index + 1
     138        end
     139        index = 1
     140        for k,v in pairs(P.serverList) do
     141            local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     142            item:setID(index)
     143            index = index + 1
     144            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     145            CEGUI.toListbox(listbox):addItem(item)
     146        end
     147    end
    159148
    160 function P.onKeyPressed()
    161     buttonIteratorHelper(P.buttonList, code, P, 2, 2)
    162149end
    163150
Note: See TracChangeset for help on using the changeset viewer.