Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 3, 2010, 3:55:32 PM (14 years ago)
Author:
dafrick
Message:

Changing from OrxonoxOverlays to CEGUI as means of displaying Notifications.
Still messy and not working completely but it's a start.

Location:
code/branches/notifications/data/gui/scripts
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/notifications/data/gui/scripts/SheetManager.lua

    r6746 r7338  
    4343
    4444-- ?
    45 function showMenuSheet(name, bHidePrevious, ptr)
    46     local sheet = showMenuSheet(name, bHidePrevious)
     45function showMenuSheet(name, bHidePrevious, bNoInput, ptr)
     46    local sheet = showMenuSheet(name, bHidePrevious, bNoInput)
    4747    sheet.overlay = ptr
    4848    return sheet
     
    5050
    5151-- Shows the specified menu sheet and loads it if neccessary
    52 function showMenuSheet(name, bHidePrevious)
     52function showMenuSheet(name, bHidePrevious, bNoInput)
    5353    if name == "" then
    5454        return nil
     
    6363    end
    6464
     65    if bNoInput == nil then
     66        bNoInput = false
     67    end
     68
    6569    -- Pause game control if this is the first menu to be displayed
    6670    -- HUGE HACK?
     
    7478    end
    7579
     80    menuSheet.tShowCursor = TriBool.Dontcare
     81
    7682    -- Add the sheet in a tuple of additional information
    7783    local sheetTuple =
    7884    {
    7985        ["sheet"]          = menuSheet,
    80         ["bHidePrevious"]  = bHidePrevious
     86        ["bHidePrevious"]  = bHidePrevious,
     87        ["bNoInput"]       = bNoInput
    8188    }
    8289    table.insert(activeMenuSheets, sheetTuple) -- indexed array access
     
    8996
    9097    -- Handle input distribution
    91     inputMgr:enterState(menuSheet.inputState)
     98    if bNoInput == false then
     99        inputMgr:enterState(menuSheet.inputState)
     100    end
    92101
    93102    -- Only change cursor situation if menuSheet.tShowCursor ~= TriBool.Dontcare
     
    148157
    149158    -- Leave the input state
    150     inputMgr:leaveState(sheetTuple.sheet.inputState)
     159    if not sheetTuple.bNoInput then
     160        inputMgr:leaveState(sheetTuple.sheet.inputState)
     161    end
    151162   
    152163    -- CURSOR SHOWING
     
    178189function keyESC()
    179190    -- HUGE, very HUGE hacks!
    180     if activeMenuSheets.size == 1 and activeMenuSheets[1].sheet.name == "MainMenu" then
     191
     192    -- Count the number of sheets that don't need input till the first that does.
     193    local counter = activeMenuSheets.size
     194    while counter > 0 and activeMenuSheets[counter].bNoInput do
     195        counter = counter - 1
     196    end
     197
     198    -- If the first sheet that needs input is the MainMenu.
     199    if counter > 0 and activeMenuSheets.size == counter and activeMenuSheets[counter].sheet.name == "MainMenu" then
    181200        orxonox.execute("exit")
    182     elseif activeMenuSheets.size > 0 then
    183         orxonox.execute("hideGUI "..activeMenuSheets.topSheetTuple.sheet.name)
     201    -- If there is at least one sheet that needs input.
     202    elseif counter > 0 then
     203        orxonox.execute("hideGUI "..activeMenuSheets[counter].sheet.name)
    184204    else
    185205        showMenuSheet("InGameMenu")
Note: See TracChangeset for help on using the changeset viewer.