Changeset 6773
- Timestamp:
- Apr 23, 2010, 11:41:30 AM (15 years ago)
- Location:
- code/branches/gamestates3/data
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestates3/data/gui/scripts/AudioMenu.lua
r6746 r6773 4 4 5 5 function P.onLoad() 6 soundMgr = orxonox.SoundManager:getInstance()7 block = false8 masterscrollbar_active = false9 musicscrollbar_active = false10 effectsscrollbar_active = false11 mastervolume =soundMgr:getVolume(orxonox.SoundType.All)12 musicvolume =soundMgr:getVolume(orxonox.SoundType.Music)13 effectsvolume =soundMgr:getVolume(orxonox.SoundType.Effects)14 mastermute =soundMgr:getMute(orxonox.SoundType.All)15 musicmute =soundMgr:getMute(orxonox.SoundType.Music)16 effectsmute =soundMgr:getMute(orxonox.SoundType.Effects)17 masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")18 musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")19 effectsscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")20 mastermutewindow = tolua.cast(winMgr:getWindow("orxonox/MasterCheckbox"),"CEGUI::Checkbox")21 musicmutewindow = tolua.cast(winMgr:getWindow("orxonox/MusicCheckbox"),"CEGUI::Checkbox")22 effectsmutewindow = tolua.cast(winMgr:getWindow("orxonox/EffectsCheckbox"),"CEGUI::Checkbox")23 masterscrollbarwindow:setScrollPosition(mastervolume)24 musicscrollbarwindow:setScrollPosition(musicvolume)25 effectsscrollbarwindow:setScrollPosition(effectsvolume)26 mastermutewindow:setSelected(mastermute)27 musicmutewindow:setSelected(musicmute)28 effectsmutewindow:setSelected(effectsmute)29 choice = "Default"30 listboxwindow = winMgr:getWindow("orxonox/AudioThemeListbox")6 P.soundMgr = orxonox.SoundManager:getInstance() 7 P.block = false 8 P.masterscrollbar_active = false 9 P.musicscrollbar_active = false 10 P.effectsscrollbar_active = false 11 P.mastervolume = P.soundMgr:getVolume(orxonox.SoundType.All) 12 P.musicvolume = P.soundMgr:getVolume(orxonox.SoundType.Music) 13 P.effectsvolume = P.soundMgr:getVolume(orxonox.SoundType.Effects) 14 P.mastermute = P.soundMgr:getMute(orxonox.SoundType.All) 15 P.musicmute = P.soundMgr:getMute(orxonox.SoundType.Music) 16 P.effectsmute = P.soundMgr:getMute(orxonox.SoundType.Effects) 17 P.masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar") 18 P.musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar") 19 P.effectsscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar") 20 P.mastermutewindow = tolua.cast(winMgr:getWindow("orxonox/MasterCheckbox"),"CEGUI::Checkbox") 21 P.musicmutewindow = tolua.cast(winMgr:getWindow("orxonox/MusicCheckbox"),"CEGUI::Checkbox") 22 P.effectsmutewindow = tolua.cast(winMgr:getWindow("orxonox/EffectsCheckbox"),"CEGUI::Checkbox") 23 P.masterscrollbarwindow:setScrollPosition(P.mastervolume) 24 P.musicscrollbarwindow:setScrollPosition(P.musicvolume) 25 P.effectsscrollbarwindow:setScrollPosition(P.effectsvolume) 26 P.mastermutewindow:setSelected(P.mastermute) 27 P.musicmutewindow:setSelected(P.musicmute) 28 P.effectsmutewindow:setSelected(P.effectsmute) 29 local choice = "Default" 30 P.listboxwindow = winMgr:getWindow("orxonox/AudioThemeListbox") 31 31 local themeList = {} 32 32 table.insert(themeList, "Default") 33 33 table.insert(themeList, "Drum n' Bass") 34 34 for k,v in pairs(themeList) do 35 item = CEGUI.createListboxTextItem(v)35 local item = CEGUI.createListboxTextItem(v) 36 36 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 37 CEGUI.toListbox( listboxwindow):addItem(item)37 CEGUI.toListbox(P.listboxwindow):addItem(item) 38 38 end 39 39 if orxonox.getConfig("MoodManager", "mood_") == "dnb" then 40 listboxwindow:setItemSelectState(1,true)40 P.listboxwindow:setItemSelectState(1,true) 41 41 else 42 listboxwindow:setItemSelectState(0,true)42 P.listboxwindow:setItemSelectState(0,true) 43 43 end 44 44 end 45 45 46 46 function P.AudioMasterScrollbar_changed(e) 47 if mastermute then48 block = true49 mastermutewindow:setSelected(false)50 block = false51 mastermute = false47 if P.mastermute then 48 P.block = true 49 P.mastermutewindow:setSelected(false) 50 P.block = false 51 P.mastermute = false 52 52 end 53 if masterscrollbar_active == false then54 mastervolume =masterscrollbarwindow:getScrollPosition()55 orxonox.config("SoundManager", "soundVolume_", mastervolume)53 if P.masterscrollbar_active == false then 54 P.mastervolume = P.masterscrollbarwindow:getScrollPosition() 55 orxonox.config("SoundManager", "soundVolume_", P.mastervolume) 56 56 end 57 57 end 58 58 59 59 function P.AudioMasterScrollbar_started(e) 60 masterscrollbar_active = true60 P.masterscrollbar_active = true 61 61 end 62 62 63 63 function P.AudioMasterScrollbar_ended(e) 64 mastervolume =masterscrollbarwindow:getScrollPosition()65 orxonox.config("SoundManager", "soundVolume_", mastervolume)66 masterscrollbar_active = false64 P.mastervolume = P.masterscrollbarwindow:getScrollPosition() 65 orxonox.config("SoundManager", "soundVolume_", P.mastervolume) 66 P.masterscrollbar_active = false 67 67 end 68 68 69 69 function P.AudioMusicScrollbar_changed(e) 70 if musicmute then71 block = true72 musicmutewindow:setSelected(false)73 block = false74 musicmute = false70 if P.musicmute then 71 P.block = true 72 P.musicmutewindow:setSelected(false) 73 P.block = false 74 P.musicmute = false 75 75 end 76 if musicscrollbar_active == false then77 musicvolume =musicscrollbarwindow:getScrollPosition()78 orxonox.config("SoundManager", "ambientVolume_", musicvolume)76 if P.musicscrollbar_active == false then 77 P.musicvolume = P.musicscrollbarwindow:getScrollPosition() 78 orxonox.config("SoundManager", "ambientVolume_", P.musicvolume) 79 79 end 80 80 end 81 81 82 82 function P.AudioMusicScrollbar_started(e) 83 musicscrollbar_active = true83 P.musicscrollbar_active = true 84 84 end 85 85 86 86 function P.AudioMusicScrollbar_ended(e) 87 musicmutewindow:setSelected(false)88 musicvolume =musicscrollbarwindow:getScrollPosition()89 orxonox.config("SoundManager", "ambientVolume_", musicvolume)90 musicscrollbar_active = false87 P.musicmutewindow:setSelected(false) 88 P.musicvolume = P.musicscrollbarwindow:getScrollPosition() 89 orxonox.config("SoundManager", "ambientVolume_", P.musicvolume) 90 P.musicscrollbar_active = false 91 91 end 92 92 93 93 function P.AudioEffectsScrollbar_changed(e) 94 if effectsmute then95 block = true96 effectsmutewindow:setSelected(false)97 block = false98 effectsmute = false94 if P.effectsmute then 95 P.block = true 96 P.effectsmutewindow:setSelected(false) 97 P.block = false 98 P.effectsmute = false 99 99 end 100 if effectsscrollbar_active == false then101 effectsvolume =effectsscrollbarwindow:getScrollPosition()102 orxonox.config("SoundManager", "effectsVolume_", effectsvolume)100 if P.effectsscrollbar_active == false then 101 P.effectsvolume = P.effectsscrollbarwindow:getScrollPosition() 102 orxonox.config("SoundManager", "effectsVolume_", P.effectsvolume) 103 103 end 104 104 end 105 105 106 106 function P.AudioEffectsScrollbar_started(e) 107 effectsscrollbar_active = true107 P.effectsscrollbar_active = true 108 108 end 109 109 110 110 function P.AudioEffectsScrollbar_ended(e) 111 effectsmutewindow:setSelected(false)112 effectsvolume =effectsscrollbarwindow:getScrollPosition()113 orxonox.config("SoundManager", "effectsVolume_", effectsvolume)114 effectsscrollbar_active = false111 P.effectsmutewindow:setSelected(false) 112 P.effectsvolume = P.effectsscrollbarwindow:getScrollPosition() 113 orxonox.config("SoundManager", "effectsVolume_", P.effectsvolume) 114 P.effectsscrollbar_active = false 115 115 end 116 116 117 117 function P.AudioMuteMasterCheckbox_clicked(e) 118 if block == false then119 if mastermute then120 masterscrollbarwindow:setScrollPosition(mastervolume)121 mastermute = false118 if P.block == false then 119 if P.mastermute then 120 P.masterscrollbarwindow:setScrollPosition(P.mastervolume) 121 P.mastermute = false 122 122 else 123 temp = masterscrollbarwindow:getScrollPosition()124 masterscrollbarwindow:setScrollPosition(0)125 mastervolume = temp126 mastermute = true123 temp = P.masterscrollbarwindow:getScrollPosition() 124 P.masterscrollbarwindow:setScrollPosition(0) 125 P.mastervolume = temp 126 P.mastermute = true 127 127 end 128 128 end 129 soundMgr:toggleMute(orxonox.SoundType.All)129 P.soundMgr:toggleMute(orxonox.SoundType.All) 130 130 end 131 131 132 132 function P.AudioMuteMusicCheckbox_clicked(e) 133 if block == false then134 if musicmute then135 musicscrollbarwindow:setScrollPosition(musicvolume)136 musicmute = false133 if P.block == false then 134 if P.musicmute then 135 P.musicscrollbarwindow:setScrollPosition(P.musicvolume) 136 P.musicmute = false 137 137 else 138 temp = musicscrollbarwindow:getScrollPosition()139 musicscrollbarwindow:setScrollPosition(0)140 musicvolume = temp141 musicmute = true138 temp = P.musicscrollbarwindow:getScrollPosition() 139 P.musicscrollbarwindow:setScrollPosition(0) 140 P.musicvolume = temp 141 P.musicmute = true 142 142 end 143 143 end 144 soundMgr:toggleMute(orxonox.SoundType.Music)144 P.soundMgr:toggleMute(orxonox.SoundType.Music) 145 145 end 146 146 147 147 function P.AudioMuteEffectsCheckbox_clicked(e) 148 if block == false then149 if effectsmute then150 effectsscrollbarwindow:setScrollPosition(effectsvolume)151 effectsmute = false148 if P.block == false then 149 if P.effectsmute then 150 P.effectsscrollbarwindow:setScrollPosition(P.effectsvolume) 151 P.effectsmute = false 152 152 else 153 temp = effectsscrollbarwindow:getScrollPosition()154 effectsscrollbarwindow:setScrollPosition(0)155 effectsvolume = temp156 effectsmute = true153 temp = P.effectsscrollbarwindow:getScrollPosition() 154 P.effectsscrollbarwindow:setScrollPosition(0) 155 P.effectsvolume = temp 156 P.effectsmute = true 157 157 end 158 158 end 159 soundMgr:toggleMute(orxonox.SoundType.Effects)159 P.soundMgr:toggleMute(orxonox.SoundType.Effects) 160 160 end 161 161 162 162 function P.AudioThemeListbox_changed(e) 163 if listboxwindow:isItemSelected(1) then163 if P.listboxwindow:isItemSelected(1) then 164 164 orxonox.config("MoodManager", "mood_", "dnb") 165 165 else -
code/branches/gamestates3/data/gui/scripts/GUITools.lua
r6746 r6773 3 3 function createMenuSheet(name, bHidePrevious, tShowCursor, tUseKeyboard, bBlockJoyStick) 4 4 local sheet = require("MenuSheet").new(name, bHidePrevious, tShowCursor, tUseKeyboard, bBlockJoyStick) 5 global(sheet.name) 5 6 _G[sheet.name] = sheet -- Global access required because of the event handlers 6 7 return sheet -
code/branches/gamestates3/data/gui/scripts/GameplayMenu.lua
r6746 r6773 4 4 5 5 function P.onLoad() 6 dropdown = winMgr:getWindow("orxonox/ThemeCombobox")6 local dropdown = winMgr:getWindow("orxonox/ThemeCombobox") 7 7 local themeList = {} 8 8 table.insert(themeList, "Theme 1") -
code/branches/gamestates3/data/gui/scripts/GraphicsMenu.lua
r6746 r6773 4 4 5 5 function P.onLoad() 6 block = true7 file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")8 search_mode = 09 f = io.open(file, "r")10 firstline = f:read("*line")11 rendersystem = string.sub(firstline, 15)6 P.block = true 7 P.file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_") 8 P.search_mode = 0 9 local f = io.open(P.file, "r") 10 local firstline = f:read("*line") 11 local rendersystem = string.sub(firstline, 15) 12 12 for line in f:lines() do 13 if search_mode == 0 then13 if P.search_mode == 0 then 14 14 if string.find(line, rendersystem) ~= nil then 15 search_mode = 115 P.search_mode = 1 16 16 end 17 17 end 18 if search_mode == 1 then18 if P.search_mode == 1 then 19 19 if string.sub(line, 1, 11) == "Full Screen" then 20 20 if string.sub(line, 13) == "Yes" then 21 fullscreen = true21 P.fullscreen = true 22 22 else 23 fullscreen = false23 P.fullscreen = false 24 24 end 25 25 end 26 26 if string.sub(line, 1, 10) == "Video Mode" then 27 27 if string.match(line, "@") == "@" then 28 resolution = string.sub(line, 12, string.find(line, "@")-2)28 P.resolution = string.sub(line, 12, string.find(line, "@")-2) 29 29 else 30 resolution = string.sub(line, 12)30 P.resolution = string.sub(line, 12) 31 31 end 32 32 break … … 36 36 f:close() 37 37 local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox") 38 fullscreenwindow:setSelected( fullscreen)39 listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox")38 fullscreenwindow:setSelected(P.fullscreen) 39 P.listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox") 40 40 local resolutionList = {} 41 41 table.insert(resolutionList, "640 x 480") … … 52 52 table.insert(resolutionList, "1440 x 900") 53 53 for k,v in pairs(resolutionList) do 54 item = CEGUI.createListboxTextItem(v)54 local item = CEGUI.createListboxTextItem(v) 55 55 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 56 CEGUI.toListbox( listboxwindow):addItem(item)56 CEGUI.toListbox(P.listboxwindow):addItem(item) 57 57 end 58 if resolution == "640 x 480" then59 listboxwindow:setItemSelectState(0,true)60 elseif resolution == "720 x 480" then61 listboxwindow:setItemSelectState(1,true)62 elseif resolution == "720 x 576" then63 listboxwindow:setItemSelectState(2,true)64 elseif resolution == "800 x 480" then65 listboxwindow:setItemSelectState(3,true)66 elseif resolution == "800 x 600" then67 listboxwindow:setItemSelectState(4,true)68 elseif resolution == "1024 x 480" then69 listboxwindow:setItemSelectState(5,true)70 elseif resolution == "1024 x 600" then71 listboxwindow:setItemSelectState(6,true)72 elseif resolution == "1024 x 768" then73 listboxwindow:setItemSelectState(7,true)74 elseif resolution == "1152 x 864" then75 listboxwindow:setItemSelectState(8,true)76 elseif resolution == "1280 x 720" then77 listboxwindow:setItemSelectState(9,true)78 elseif resolution == "1280 x 768" then79 listboxwindow:setItemSelectState(10,true)80 elseif resolution == "1440 x 900" then81 listboxwindow:setItemSelectState(11,true)58 if P.resolution == "640 x 480" then 59 P.listboxwindow:setItemSelectState(0,true) 60 elseif P.resolution == "720 x 480" then 61 P.listboxwindow:setItemSelectState(1,true) 62 elseif P.resolution == "720 x 576" then 63 P.listboxwindow:setItemSelectState(2,true) 64 elseif P.resolution == "800 x 480" then 65 P.listboxwindow:setItemSelectState(3,true) 66 elseif P.resolution == "800 x 600" then 67 P.listboxwindow:setItemSelectState(4,true) 68 elseif P.resolution == "1024 x 480" then 69 P.listboxwindow:setItemSelectState(5,true) 70 elseif P.resolution == "1024 x 600" then 71 P.listboxwindow:setItemSelectState(6,true) 72 elseif P.resolution == "1024 x 768" then 73 P.listboxwindow:setItemSelectState(7,true) 74 elseif P.resolution == "1152 x 864" then 75 P.listboxwindow:setItemSelectState(8,true) 76 elseif P.resolution == "1280 x 720" then 77 P.listboxwindow:setItemSelectState(9,true) 78 elseif P.resolution == "1280 x 768" then 79 P.listboxwindow:setItemSelectState(10,true) 80 elseif P.resolution == "1440 x 900" then 81 P.listboxwindow:setItemSelectState(11,true) 82 82 end 83 scrollbar_active = false84 block = false83 P.scrollbar_active = false 84 P.block = false 85 85 end 86 86 87 87 function P.GraphicsResolutionListbox_changed(e) 88 if listboxwindow:isItemSelected(0) then89 resolution = "640 x 480"90 elseif listboxwindow:isItemSelected(1) then91 resolution = "720 x 480"92 elseif listboxwindow:isItemSelected(2) then93 resolution = "720 x 576"94 elseif listboxwindow:isItemSelected(3) then95 resolution = "800 x 480"96 elseif listboxwindow:isItemSelected(4) then97 resolution = "800 x 600"98 elseif listboxwindow:isItemSelected(5) then99 resolution = "1024 x 480"100 elseif listboxwindow:isItemSelected(6) then101 resolution = "1024 x 600"102 elseif listboxwindow:isItemSelected(7) then103 resolution = "1024 x 768"104 elseif listboxwindow:isItemSelected(8) then105 resolution = "1152 x 864"106 elseif listboxwindow:isItemSelected(9) then107 resolution = "1280 x 720"108 elseif listboxwindow:isItemSelected(10) then109 resolution = "1280 x 768"110 elseif listboxwindow:isItemSelected(11) then111 resolution = "1440 x 900"88 if P.listboxwindow:isItemSelected(0) then 89 P.resolution = "640 x 480" 90 elseif P.listboxwindow:isItemSelected(1) then 91 P.resolution = "720 x 480" 92 elseif P.listboxwindow:isItemSelected(2) then 93 P.resolution = "720 x 576" 94 elseif P.listboxwindow:isItemSelected(3) then 95 P.resolution = "800 x 480" 96 elseif P.listboxwindow:isItemSelected(4) then 97 P.resolution = "800 x 600" 98 elseif P.listboxwindow:isItemSelected(5) then 99 P.resolution = "1024 x 480" 100 elseif P.listboxwindow:isItemSelected(6) then 101 P.resolution = "1024 x 600" 102 elseif P.listboxwindow:isItemSelected(7) then 103 P.resolution = "1024 x 768" 104 elseif P.listboxwindow:isItemSelected(8) then 105 P.resolution = "1152 x 864" 106 elseif P.listboxwindow:isItemSelected(9) then 107 P.resolution = "1280 x 720" 108 elseif P.listboxwindow:isItemSelected(10) then 109 P.resolution = "1280 x 768" 110 elseif P.listboxwindow:isItemSelected(11) then 111 P.resolution = "1440 x 900" 112 112 end 113 search_mode = 0114 f = io.open(file, "r")115 firstline = f:read("*line")116 text = firstline .. "\n"117 rendersystem = string.sub(firstline, 15)113 P.search_mode = 0 114 local f = io.open(P.file, "r") 115 local firstline = f:read("*line") 116 local text = firstline .. "\n" 117 local rendersystem = string.sub(firstline, 15) 118 118 for line in f:lines() do 119 if search_mode == 0 then119 if P.search_mode == 0 then 120 120 if string.find(line, rendersystem) ~= nil then 121 search_mode = 1121 P.search_mode = 1 122 122 end 123 123 end 124 if search_mode == 1 then124 if P.search_mode == 1 then 125 125 if string.sub(line, 1, 10) == "Video Mode" then 126 126 if string.match(line, "@") == "@" then 127 line = "Video Mode=" .. resolution .. string.sub(line, string.find(line, "@")-1)127 line = "Video Mode=" .. P.resolution .. string.sub(line, string.find(line, "@")-1) 128 128 else 129 line = "Video Mode=" .. resolution129 line = "Video Mode=" .. P.resolution 130 130 end 131 search_mode = 2131 P.search_mode = 2 132 132 end 133 133 end … … 135 135 end 136 136 f:close() 137 f = io.open( file, "w")137 f = io.open(P.file, "w") 138 138 f:write(text) 139 139 f:close() … … 141 141 142 142 function P.GraphicsBrightnessScrollbar_changed(e) 143 if scrollbar_active == false then143 if P.scrollbar_active == false then 144 144 -- brightness 145 145 logMessage(0, "event: brightness") … … 148 148 149 149 function P.GraphicsBrightnessScrollbar_started(e) 150 scrollbar_active = true150 P.scrollbar_active = true 151 151 end 152 152 … … 154 154 -- brightness 155 155 logMessage(0, "event: brightness") 156 scrollbar_active = false156 P.scrollbar_active = false 157 157 end 158 158 159 159 function P.GraphicsFullscreenCheckbox_clicked(e) 160 if block == false then161 search_mode = 0162 f = io.open(file, "r")163 firstline = f:read("*line")164 text = firstline .. "\n"165 rendersystem = string.sub(firstline, 15)160 if P.block == false then 161 P.search_mode = 0 162 local f = io.open(P.file, "r") 163 local firstline = f:read("*line") 164 local text = firstline .. "\n" 165 local rendersystem = string.sub(firstline, 15) 166 166 for line in f:lines() do 167 if search_mode == 0 then167 if P.search_mode == 0 then 168 168 if string.find(line, rendersystem) ~= nil then 169 search_mode = 1169 P.search_mode = 1 170 170 end 171 171 end 172 if search_mode == 1 then172 if P.search_mode == 1 then 173 173 if string.sub(line, 1, 11) == "Full Screen" then 174 if fullscreen == true then174 if P.fullscreen == true then 175 175 line = "Full Screen=No" 176 fullscreen = false176 P.fullscreen = false 177 177 else 178 178 line = "Full Screen=Yes" 179 fullscreen = true179 P.fullscreen = true 180 180 end 181 search_mode = 2181 P.search_mode = 2 182 182 end 183 183 end … … 185 185 end 186 186 f:close() 187 f = io.open( file, "w")187 f = io.open(P.file, "w") 188 188 f:write(text) 189 189 f:close() -
code/branches/gamestates3/data/gui/scripts/HUDSheet.lua
- Property svn:eol-style set to native
-
code/branches/gamestates3/data/gui/scripts/InfoPopup.lua
r6746 r6773 18 18 19 19 function P.setCloseButton(closeButton) 20 close = winMgr:getWindow("orxonox/InfoPopup_close")20 local close = winMgr:getWindow("orxonox/InfoPopup_close") 21 21 close:setVisible(closeButton) 22 22 if(not closeButton) then -
code/branches/gamestates3/data/gui/scripts/KeyBindMenu.lua
r6748 r6773 6 6 function P.onLoad() 7 7 8 commandList = {}9 table.insert( commandList, "fire 0")10 table.insert( commandList, "fire 1 | unfire")11 table.insert( commandList, "onpress fire 2")12 table.insert( commandList, "scale 1 moveFrontBack")13 table.insert( commandList, "scale -1 moveFrontBack")14 table.insert( commandList, "boost")15 table.insert( commandList, "scale 1 moveRightLeft")16 table.insert( commandList, "scale -1 moveRightLeft")17 table.insert( commandList, "scale 1 moveUpDown")18 table.insert( commandList, "scale -1 moveUpDown")19 table.insert( commandList, "scale -1 rotateRoll")20 table.insert( commandList, "scale 1 rotateRoll")21 table.insert( commandList, "scale 1 rotateYaw")22 table.insert( commandList, "scale -1 rotateYaw")23 table.insert( commandList, "scale 1 rotatePitch")24 table.insert( commandList, "scale -1 rotatePitch")25 table.insert( commandList, "NewHumanController changeMode")26 table.insert( commandList, "switchCamera")27 table.insert( commandList, "openConsole")28 table.insert( commandList, "OverlayGroup toggleVisibility Debug")29 table.insert( commandList, "OverlayGroup toggleVisibility Stats")30 table.insert( commandList, "mouseLook")31 table.insert( commandList, "pause")32 33 nameList = {}34 table.insert( nameList, "Primary Fire")35 table.insert( nameList, "Secondary Fire")36 table.insert( nameList, "Fire Rocket")37 table.insert( nameList, "Accelerate")38 table.insert( nameList, "Break")39 table.insert( nameList, "Boost")40 table.insert( nameList, "Move Right")41 table.insert( nameList, "Move Left")42 table.insert( nameList, "Move Up")43 table.insert( nameList, "Move Down")44 table.insert( nameList, "Roll Right")45 table.insert( nameList, "Roll Left")46 table.insert( nameList, "Yaw Left")47 table.insert( nameList, "Yaw Right")48 table.insert( nameList, "Pitch Up")49 table.insert( nameList, "Pitch Down")50 table.insert( nameList, "Switch Input Mode")51 table.insert( nameList, "Switch Camera")52 table.insert( nameList, "Open Console")53 table.insert( nameList, "Show Debug")54 table.insert( nameList, "Show Stats")55 table.insert( nameList, "Look Around")56 table.insert( nameList, "Pause")57 58 linesList = {}8 P.commandList = {} 9 table.insert(P.commandList, "fire 0") 10 table.insert(P.commandList, "fire 1 | unfire") 11 table.insert(P.commandList, "onpress fire 2") 12 table.insert(P.commandList, "scale 1 moveFrontBack") 13 table.insert(P.commandList, "scale -1 moveFrontBack") 14 table.insert(P.commandList, "boost") 15 table.insert(P.commandList, "scale 1 moveRightLeft") 16 table.insert(P.commandList, "scale -1 moveRightLeft") 17 table.insert(P.commandList, "scale 1 moveUpDown") 18 table.insert(P.commandList, "scale -1 moveUpDown") 19 table.insert(P.commandList, "scale -1 rotateRoll") 20 table.insert(P.commandList, "scale 1 rotateRoll") 21 table.insert(P.commandList, "scale 1 rotateYaw") 22 table.insert(P.commandList, "scale -1 rotateYaw") 23 table.insert(P.commandList, "scale 1 rotatePitch") 24 table.insert(P.commandList, "scale -1 rotatePitch") 25 table.insert(P.commandList, "NewHumanController changeMode") 26 table.insert(P.commandList, "switchCamera") 27 table.insert(P.commandList, "openConsole") 28 table.insert(P.commandList, "OverlayGroup toggleVisibility Debug") 29 table.insert(P.commandList, "OverlayGroup toggleVisibility Stats") 30 table.insert(P.commandList, "mouseLook") 31 table.insert(P.commandList, "pause") 32 33 P.nameList = {} 34 table.insert(P.nameList, "Primary Fire") 35 table.insert(P.nameList, "Secondary Fire") 36 table.insert(P.nameList, "Fire Rocket") 37 table.insert(P.nameList, "Accelerate") 38 table.insert(P.nameList, "Break") 39 table.insert(P.nameList, "Boost") 40 table.insert(P.nameList, "Move Right") 41 table.insert(P.nameList, "Move Left") 42 table.insert(P.nameList, "Move Up") 43 table.insert(P.nameList, "Move Down") 44 table.insert(P.nameList, "Roll Right") 45 table.insert(P.nameList, "Roll Left") 46 table.insert(P.nameList, "Yaw Left") 47 table.insert(P.nameList, "Yaw Right") 48 table.insert(P.nameList, "Pitch Up") 49 table.insert(P.nameList, "Pitch Down") 50 table.insert(P.nameList, "Switch Input Mode") 51 table.insert(P.nameList, "Switch Camera") 52 table.insert(P.nameList, "Open Console") 53 table.insert(P.nameList, "Show Debug") 54 table.insert(P.nameList, "Show Stats") 55 table.insert(P.nameList, "Look Around") 56 table.insert(P.nameList, "Pause") 57 58 P.linesList = {} 59 59 60 60 --Calculate design parameters: 61 sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/SampleWindow")62 sampleWindow:setText("SampleText")63 64 local size = getMinTextSize( sampleWindow)65 lineHeight = size[1]66 67 commandWidth = 068 for k,v in pairs( commandList) do69 sampleWindow:setText(nameList[k])70 size = getMinTextSize( sampleWindow)71 if size[2] > commandWidth then72 commandWidth = size[2]61 P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/SampleWindow") 62 P.sampleWindow:setText("SampleText") 63 64 local size = getMinTextSize(P.sampleWindow) 65 P.lineHeight = size[1] 66 67 P.commandWidth = 0 68 for k,v in pairs(P.commandList) do 69 P.sampleWindow:setText(P.nameList[k]) 70 size = getMinTextSize(P.sampleWindow) 71 if size[2] > P.commandWidth then 72 P.commandWidth = size[2] 73 73 end 74 74 end 75 75 76 sampleWindow:setText("add")77 size = getMinTextSize( sampleWindow)78 addWidth = size[2]79 80 sampleWindow:setText("X")81 size = getMinTextSize( sampleWindow)82 clearWidth = size[2]83 84 spaceWidth = math.floor(1/14*commandWidth)85 86 buttonWidth = 14576 P.sampleWindow:setText("add") 77 size = getMinTextSize(P.sampleWindow) 78 P.addWidth = size[2] 79 80 P.sampleWindow:setText("X") 81 size = getMinTextSize(P.sampleWindow) 82 P.clearWidth = size[2] 83 84 P.spaceWidth = math.floor(1/14*P.commandWidth) 85 86 P.buttonWidth = 145 87 87 88 88 P.createLines() … … 113 113 local offset = 0 114 114 local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k) 115 line:setHeight(CEGUI.UDim(0, lineHeight))116 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1))))115 line:setHeight(CEGUI.UDim(0, P.lineHeight)) 116 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1)))) 117 117 118 118 local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 119 command:setText( nameList[k])120 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))119 command:setText(P.nameList[k]) 120 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0))) 121 121 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0))) 122 122 line:addChildWindow(command) 123 offset = offset + commandWidth +spaceWidth123 offset = offset + P.commandWidth + P.spaceWidth 124 124 125 125 local plus = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus") 126 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0)))126 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.addWidth), CEGUI.UDim(0.7, 0))) 127 127 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 128 128 plus:setText("add") 129 129 orxonox.GUIManager:subscribeEventHelper(plus, "Clicked", P.name .. ".KeyBindPlus_clicked") 130 130 line:addChildWindow(plus) 131 offset = offset + addWidth +spaceWidth132 133 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings( commandList[k]);131 offset = offset + P.addWidth + P.spaceWidth 132 133 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(P.commandList[k]); 134 134 for i=0,(numButtons-1) do 135 135 local button = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i) 136 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding( commandList[k],i)136 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(P.commandList[k],i) 137 137 name = P.KeyNameNiceifier(name) 138 138 button:setText(name) 139 sampleWindow:setText(name)140 local size = getMinTextSize( sampleWindow)139 P.sampleWindow:setText(name) 140 local size = getMinTextSize(P.sampleWindow) 141 141 local buttonWidth = size[2] 142 142 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0))) … … 148 148 149 149 local clear = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i) 150 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))150 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.clearWidth), CEGUI.UDim(0.7, 0))) 151 151 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 152 152 clear:setText("X") 153 153 orxonox.GUIManager:subscribeEventHelper(clear, "Clicked", P.name .. ".KeyBindClear_clicked") 154 154 line:addChildWindow(clear) 155 offset = offset + clearWidth +spaceWidth156 end 157 158 line:setWidth(CEGUI.UDim(0, offset+ clearWidth))155 offset = offset + P.clearWidth + P.spaceWidth 156 end 157 158 line:setWidth(CEGUI.UDim(0, offset+P.clearWidth)) 159 159 160 160 return line … … 164 164 local window = winMgr:getWindow("orxonox/KeyBindPane") 165 165 166 for k,v in pairs( commandList) do166 for k,v in pairs(P.commandList) do 167 167 local line = P.createLine(k) 168 table.insert( linesList, line)168 table.insert(P.linesList, line) 169 169 window:addChildWindow(line) 170 170 end 171 171 172 pane = tolua.cast(window, "CEGUI::ScrollablePane")172 local pane = tolua.cast(window, "CEGUI::ScrollablePane") 173 173 pane:setVerticalStepSize(getScrollingStepSize(window)) 174 174 end … … 208 208 local buttonNr = tonumber(match()) 209 209 210 local str = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding( commandList[commandNr], buttonNr)210 local str = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(P.commandList[commandNr], buttonNr) 211 211 orxonox.KeyBinderManager:getInstance():unbind(str) 212 212 … … 218 218 local buttonNr = arguments[2] 219 219 if buttonNr ~= nil then 220 local str = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding( commandList[commandNr], buttonNr)220 local str = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(P.commandList[commandNr], buttonNr) 221 221 orxonox.KeyBinderManager:getInstance():unbind(str) 222 222 end 223 223 224 orxonox.KeyBinderManager:getInstance():keybind( commandList[commandNr])224 orxonox.KeyBinderManager:getInstance():keybind(P.commandList[commandNr]) 225 225 end 226 226 … … 228 228 local pane = tolua.cast(winMgr:getWindow("orxonox/KeyBindPane"), "CEGUI::ScrollablePane") 229 229 local position = pane:getVerticalScrollPosition() 230 while table.getn( linesList) ~= 0 do231 if linesList[1] ~= nil then232 winMgr:destroyWindow( linesList[1]:getName())230 while table.getn(P.linesList) ~= 0 do 231 if P.linesList[1] ~= nil then 232 winMgr:destroyWindow(P.linesList[1]:getName()) 233 233 end 234 table.remove( linesList, 1)235 end 236 237 linesList = {}234 table.remove(P.linesList, 1) 235 end 236 237 P.linesList = {} 238 238 239 239 P.createLines() -
code/branches/gamestates3/data/gui/scripts/MenuSheet.lua
- Property svn:eol-style set to native
r6746 r6773 11 11 -- Parameters: 12 12 -- Except for _name, you can provide nil. Then the default value will be used. 13 -- For _tShowCu sor and _tUseKeyboard you can specify TriBool.Dontcare if the value doesn't matter at all. Then the value of the underlaying sheet will be used.13 -- For _tShowCursor and _tUseKeyboard you can specify TriBool.Dontcare if the value doesn't matter at all. Then the value of the underlaying sheet will be used. 14 14 function P.new(_name, _bHidePrevious, _tShowCursor, _tUseKeyboard, _bBlockJoyStick) 15 15 local newSheet = GUISheet.new(_name) 16 16 newSheet.bHidePrevious = handleDefArg(_bHidePrevious, true) 17 newSheet.tShowCursor = handleDefArg(_tShowCu sor,TriBool.True)17 newSheet.tShowCursor = handleDefArg(_tShowCursor, TriBool.True) 18 18 newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, TriBool.Dontcare) 19 19 newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false) -
code/branches/gamestates3/data/gui/scripts/MouseControlsMenu.lua
r6746 r6773 4 4 5 5 function P.onLoad() 6 block = false 7 mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar") 8 mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar") 9 normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton") 10 derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton") 11 invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox") 12 mousenormalscrollbar_active = false 13 mousederivescrollbar_active = false 14 derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_") 15 invert_active = false 16 mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_") 17 mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_") 18 mousenormalscrollbarwindow:setScrollPosition((math.log(14*mousenormalsensitivity-6))/(6*math.log(2))) 19 mousederivescrollbarwindow:setScrollPosition((math.log(14*mousederivesensitivity-6))/(6*math.log(2))) 6 P.block = false 7 P.mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar") 8 P.mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar") 9 P.normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton") 10 P.derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton") 11 --P.invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox") 12 P.mousenormalscrollbar_active = false 13 P.mousederivescrollbar_active = false 14 local derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_") 15 local invert_active = false 16 local normal_active 17 P.mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_") 18 P.mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_") 19 P.mousenormalscrollbarwindow:setScrollPosition((math.log(14*P.mousenormalsensitivity-6))/(6*math.log(2))) 20 P.mousederivescrollbarwindow:setScrollPosition((math.log(14*P.mousederivesensitivity-6))/(6*math.log(2))) 20 21 if derive_active == "true" then 21 22 normal_active = false 22 23 derive_active = true 23 derivewindow:setSelected(derive_active)24 P.derivewindow:setSelected(derive_active) 24 25 else 25 26 normal_active = true 26 27 derive_active = false 27 normalwindow:setSelected(normal_active)28 P.normalwindow:setSelected(normal_active) 28 29 end 29 30 if invert_active == "true" then … … 35 36 36 37 function P.MouseControlsMouseNormalScrollbar_changed(e) 37 if mousenormalscrollbar_active == false then38 scrollposition =mousenormalscrollbarwindow:getScrollPosition()39 mousenormalsensitivity = (math.pow(64,scrollposition)+6)/1440 orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)38 if P.mousenormalscrollbar_active == false then 39 local scrollposition = P.mousenormalscrollbarwindow:getScrollPosition() 40 P.mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14 41 orxonox.config("KeyBinder", "mouseSensitivity_", P.mousenormalsensitivity) 41 42 end 42 43 end 43 44 44 45 function P.MouseControlsMouseNormalScrollbar_started(e) 45 mousenormalscrollbar_active = true46 P.mousenormalscrollbar_active = true 46 47 end 47 48 48 49 function P.MouseControlsMouseNormalScrollbar_ended(e) 49 scrollposition =mousenormalscrollbarwindow:getScrollPosition()50 mousenormalsensitivity = (math.pow(64,scrollposition)+6)/1451 orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)52 mousenormalscrollbar_active = false50 local scrollposition = P.mousenormalscrollbarwindow:getScrollPosition() 51 P.mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14 52 orxonox.config("KeyBinder", "mouseSensitivity_", P.mousenormalsensitivity) 53 P.mousenormalscrollbar_active = false 53 54 end 54 55 55 56 function P.MouseControlsMouseDeriveScrollbar_changed(e) 56 if mousederivescrollbar_active == false then57 scrollposition =mousederivescrollbarwindow:getScrollPosition()58 mousederivesensitivity = (math.pow(64,scrollposition)+6)/1459 orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)57 if P.mousederivescrollbar_active == false then 58 local scrollposition = P.mousederivescrollbarwindow:getScrollPosition() 59 P.mousederivesensitivity = (math.pow(64,scrollposition)+6)/14 60 orxonox.config("KeyBinder", "mouseSensitivityDerived_", P.mousederivesensitivity) 60 61 end 61 62 end 62 63 63 64 function P.MouseControlsMouseDeriveScrollbar_started(e) 64 mousederivescrollbar_active = true65 P.mousederivescrollbar_active = true 65 66 end 66 67 67 68 function P.MouseControlsMouseDeriveScrollbar_ended(e) 68 scrollposition =mousederivescrollbarwindow:getScrollPosition()69 mousederivesensitivity = (math.pow(64,scrollposition)+6)/1470 orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)71 mousederivescrollbar_active = false69 local scrollposition = P.mousederivescrollbarwindow:getScrollPosition() 70 P.mousederivesensitivity = (math.pow(64,scrollposition)+6)/14 71 orxonox.config("KeyBinder", "mouseSensitivityDerived_", P.mousederivesensitivity) 72 P.mousederivescrollbar_active = false 72 73 end 73 74 74 75 function P.MouseNormalButton_clicked(e) 75 if block == false then76 block = true77 derivewindow:setSelected(false)78 block = false76 if P.block == false then 77 P.block = true 78 P.derivewindow:setSelected(false) 79 P.block = false 79 80 orxonox.config("KeyBinder", "bDeriveMouseInput_", 0) 80 81 end … … 82 83 83 84 function P.MouseDeriveButton_clicked(e) 84 if block == false then85 block = true86 normalwindow:setSelected(false)87 block = false85 if P.block == false then 86 P.block = true 87 P.normalwindow:setSelected(false) 88 P.block = false 88 89 orxonox.config("KeyBinder", "bDeriveMouseInput_", 1) 89 90 end -
code/branches/gamestates3/data/gui/scripts/MultiplayerMenu.lua
r6746 r6773 4 4 5 5 function P.onLoad() 6 l istbox = winMgr:getWindow("orxonox/MultiplayerLevelListbox")7 preselect = orxonox.LevelManager:getInstance():getDefaultLevel()6 local listbox = winMgr:getWindow("orxonox/MultiplayerLevelListbox") 7 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 8 8 orxonox.LevelManager:getInstance():compileAvailableLevelList() 9 9 local levelList = {} … … 20 20 table.sort(levelList) 21 21 for k,v in pairs(levelList) do 22 item = CEGUI.createListboxTextItem(v)22 local item = CEGUI.createListboxTextItem(v) 23 23 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 24 24 CEGUI.toListbox(listbox):addItem(item) … … 27 27 end 28 28 end 29 localmultiplayerMode = "startClient"30 if multiplayerMode == "startClient" then31 window = winMgr:getWindow("orxonox/MultiplayerJoinButton")32 button = tolua.cast(window,"CEGUI::RadioButton")29 P.multiplayerMode = "startClient" 30 if P.multiplayerMode == "startClient" then 31 local window = winMgr:getWindow("orxonox/MultiplayerJoinButton") 32 local button = tolua.cast(window,"CEGUI::RadioButton") 33 33 button:setSelected(true) 34 34 end 35 if multiplayerMode == "startServer" then36 window = winMgr:getWindow("orxonox/MultiplayerHostButton")37 button = tolua.cast(window,"CEGUI::RadioButton")35 if P.multiplayerMode == "startServer" then 36 local window = winMgr:getWindow("orxonox/MultiplayerHostButton") 37 local button = tolua.cast(window,"CEGUI::RadioButton") 38 38 button:setSelected(true) 39 39 end 40 if multiplayerMode == "startDedicated" then41 window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton")42 button = tolua.cast(window,"CEGUI::RadioButton")40 if P.multiplayerMode == "startDedicated" then 41 local window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton") 42 local button = tolua.cast(window,"CEGUI::RadioButton") 43 43 button:setSelected(true) 44 44 end … … 46 46 47 47 function P.MultiplayerJoinButton_clicked(e) 48 multiplayerMode = "startClient"48 P.multiplayerMode = "startClient" 49 49 end 50 50 51 51 function P.MultiplayerHostButton_clicked(e) 52 multiplayerMode = "startServer"52 P.multiplayerMode = "startServer" 53 53 end 54 54 55 55 function P.MultiplayerDedicatedButton_clicked(e) 56 multiplayerMode = "startDedicated"56 P.multiplayerMode = "startDedicated" 57 57 end 58 58 … … 61 61 if choice then 62 62 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 63 orxonox.execute( multiplayerMode)63 orxonox.execute(P.multiplayerMode) 64 64 hideAllMenuSheets() 65 65 end -
code/branches/gamestates3/data/gui/scripts/PickupInventory.lua
r6750 r6773 8 8 9 9 function P.onLoad() 10 carrierList = {}11 10 end 12 11 -
code/branches/gamestates3/data/gui/scripts/SingleplayerMenu.lua
r6754 r6773 4 4 5 5 function P.onLoad() 6 l istbox = winMgr:getWindow("orxonox/SingleplayerLevelListbox")7 preselect = orxonox.LevelManager:getInstance():getDefaultLevel()6 local listbox = winMgr:getWindow("orxonox/SingleplayerLevelListbox") 7 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 8 8 orxonox.LevelManager:getInstance():compileAvailableLevelList() 9 9 local levelList = {} … … 20 20 table.sort(levelList) 21 21 for k,v in pairs(levelList) do 22 item = CEGUI.createListboxTextItem(v)22 local item = CEGUI.createListboxTextItem(v) 23 23 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 24 24 CEGUI.toListbox(listbox):addItem(item) -
code/branches/gamestates3/data/lua/LuaStateInit.lua
r6746 r6773 1 -- Note: luaState is a pointer to the LuaState instance that created this lua state 1 -- LuaStateInit.lua 2 3 -- Note: 'luaState' is a pointer to the LuaState instance that created this lua state 2 4 3 5 -- Redirect print to the C++ print function 4 6 original_print = print 5 print = function(s)7 function print(s) 6 8 luaState:luaPrint(s) 7 9 end 8 10 9 11 -- Create function to log text like COUT, but always prints a line! 10 logMessage = function(level, message)12 function logMessage(level, message) 11 13 luaState:luaLog(level, message) 12 14 end … … 15 17 -- Redirect dofile in order to load with the resource manager 16 18 original_dofile = dofile 17 dofile = function(filename)19 function dofile(filename) 18 20 if not luaState:doFile(filename) then 19 21 error("Error propagation. Do not display") … … 26 28 -- Create includeFile function that preparses the file according 27 29 -- to a function provided to the LuaState constructor (in C++) 28 include = function(filename)30 function include(filename) 29 31 if not luaState:includeFile(filename) then 30 32 error("Error propagation. Do not display") … … 37 39 -- The loaded modules are then stored with their names (where name has no .lua extension) 38 40 -- Furthermore the ".lua" extension is appended to the moduleName parameter when looking for the file 41 _LOADED = {} 42 _LOADED_RETURN_VALUES = {} 43 _REQUIREDNAME = nil 39 44 original_require = require 40 _REQUIREDNAME = "" 41 LuaStateReturnValue = true 42 require = function(moduleName) 45 function require(moduleName) 43 46 if not luaState:fileExists(moduleName .. ".lua") then 44 47 logMessage(2, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ") 45 48 return nil 46 end47 48 if not _LOADED then49 _LOADED = {}50 end51 if not _LOADED_RETURN_VALUES then52 _LOADED_RETURN_VALUES = {}53 49 end 54 50 … … 69 65 _REQUIREDNAME = _REQUIREDNAME_OLD 70 66 end 71 local asdf = _LOADED_RETURN_VALUES[moduleName] 72 return asdf 67 return _LOADED_RETURN_VALUES[moduleName] 73 68 end 74 75 69 76 70 -- Load useful tool functions (like handleDefaultArgument) 77 71 require("Tools") 78 79 72 80 73 -- Include command line debugger for lua 5.1 … … 84 77 else 85 78 -- Fallback pause function 86 pause = function()79 function pause() 87 80 logMessage(2, [["Warning: debug() called in Lua, but Debugger is not active. 88 81 Do you have the IOConsole disabled and are you using Lua version 5.1?"]]) … … 91 84 92 85 -- General error handler that gets called whenever an error happens at runtime 93 errorHandler = function(err)86 function errorHandler(err) 94 87 if type(err) == "string" then 95 88 -- Simply return if the error has already been handled … … 112 105 end 113 106 114 115 107 -- Convenience function for console commands 116 108 orxonox.execute = function(command)
Note: See TracChangeset
for help on using the changeset viewer.