Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 24, 2010, 3:33:26 PM (14 years ago)
Author:
konrad
Message:

key handling in some menu sheets has been added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/menu/data/gui/scripts/MainMenu.lua

    r7608 r7663  
    44P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" }
    55
    6 P.index = 0
     6P.buttonList = {}
     7
     8P.testArray = {}
     9
     10
     11function P.onLoad()
     12    local item = {
     13            ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"),
     14            ["function"]  = P.QuickGameTestButton_clicked
     15    }
     16    table.insert(P.buttonList,item)
     17
     18    item = {
     19            ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"),
     20            ["function"]  = P.SingleplayerButton_clicked
     21    }
     22    table.insert(P.buttonList,item)
     23
     24    item = {
     25            ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"),
     26            ["function"]  = P.MultiplayerButton_clicked
     27    }
     28    table.insert(P.buttonList,item)
     29
     30    item = {
     31            ["button"] = winMgr:getWindow("orxonox/SettingsButton"),
     32            ["function"]  = P.SettingsButton_clicked
     33    }
     34    table.insert(P.buttonList,item)
     35
     36    item = {
     37            ["button"] = winMgr:getWindow("orxonox/CreditsButton"),
     38            ["function"]  = P.CreditsButton_clicked
     39    }
     40    table.insert(P.buttonList,item)
     41
     42    item = {
     43            ["button"] = winMgr:getWindow("orxonox/ExitButton"),
     44            ["function"]  = P.ExitButton_clicked
     45    }
     46    table.insert(P.buttonList,item)
     47end
     48
     49function P.onShow()
     50    P.oldindex = -2
     51    P.index = -1
     52end
    753
    854-- events for MainMenu
     
    1056    hideAllMenuSheets()
    1157    orxonox.execute("startGame")
    12 end
    13 
    14 function P.onShow()
    15 
    1658end
    1759
     
    3678end
    3779
    38 function P.onKeyPressed()
    39     --local we = tolua.cast(e, "CEGUI::KeyEventArgs")
    40     cout(0, code)
    41     if code == "15" then
    42         P.index = P.index + 1
    43         local window = winMgr:getWindow("orxonox/MainMenuBackground")
    44         if P.index == window:getChildCount() then
    45             P.index = 1
    46         end
    47         local child = window:getChildAtIdx(P.index-1)
    48         child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight")
    49         child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-7) .. "Highlight")
    50         child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-7) .. "Highlight")
    51     elseif code == "28" and P.index ~= 0 then
    52         if P.index == 1 then
    53             P.QuickGameTestButton_clicked()
    54         elseif P.index == 2 then
    55             P.SingleplayerButton_clicked()
    56         elseif P.index == 3 then
    57             P.MultiplayerButton_clicked()
    58         elseif P.index == 4 then
    59             P.SettingsButton_clicked()
    60         elseif P.index == 5 then
    61             P.CreditsButton_clicked()
    62         elseif P.index == 6 then
    63             P.ExitButton_clicked()
    64         end
     80
     81--[[
     82list = {}
     83local item =
     84{
     85    ["button"] = buttonWindow,
     86    ["function"]  = buttonFunction,
     87}
     88table.insert(list, item)
     89item = list[i]
     90
     91for i,item in pairs(list) do
     92    button = item["button"]
     93end
     94
     95--]]
     96--[[
     97function createList()
     98    list = {}
     99
     100    local j
     101    while j < P.loadAlong
     102        local item =
     103        {
     104            ["button"] = buttonWindow,
     105            ["function"]  = buttonFunction,
     106        }
     107        table.insert(list, item)
    65108    end
     109
     110--]]
     111
     112function P.onKeyPressed()
     113    cout(0,code)
     114    buttonIteratorHelper(P.buttonList, code, P, 6, 1)
     115    --indexTester(P.buttonList,code,P,6,1)
    66116end
    67117
    68118return P
     119
Note: See TracChangeset for help on using the changeset viewer.