Changeset 6233 for code/branches/presentation2/data/gui/scripts
- Timestamp:
- Dec 3, 2009, 8:10:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/scripts/AudioMenu.lua
r6206 r6233 14 14 function P:init() 15 15 soundMgr = orxonox.SoundManager:getInstance() 16 block = false 16 17 masterscrollbar_active = false 17 18 musicscrollbar_active = false … … 20 21 musicvolume = soundMgr:getVolume(orxonox.SoundType.ambient) 21 22 effectsvolume = soundMgr:getVolume(orxonox.SoundType.effects) 22 window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar") 23 window:setScrollPosition(mastervolume) 24 window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar") 25 window:setScrollPosition(musicvolume) 26 window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar") 27 window:setScrollPosition(effectsvolume) 28 dropdown = winMgr:getWindow("orxonox/AudioThemeCombobox") 23 mastermute = soundMgr:getMute(orxonox.SoundType.none) 24 musicmute = soundMgr:getMute(orxonox.SoundType.ambient) 25 effectsmute = soundMgr:getMute(orxonox.SoundType.effects) 26 masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar") 27 musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar") 28 effectsscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar") 29 mastermutewindow = tolua.cast(winMgr:getWindow("orxonox/MasterCheckbox"),"CEGUI::Checkbox") 30 musicmutewindow = tolua.cast(winMgr:getWindow("orxonox/MusicCheckbox"),"CEGUI::Checkbox") 31 effectsmutewindow = tolua.cast(winMgr:getWindow("orxonox/EffectsCheckbox"),"CEGUI::Checkbox") 32 masterscrollbarwindow:setScrollPosition(mastervolume) 33 musicscrollbarwindow:setScrollPosition(musicvolume) 34 effectsscrollbarwindow:setScrollPosition(effectsvolume) 35 mastermutewindow:setSelected(mastermute) 36 musicmutewindow:setSelected(musicmute) 37 effectsmutewindow:setSelected(effectsmute) 38 choice = "Default" 39 dropdownwindow = winMgr:getWindow("orxonox/AudioThemeCombobox") 29 40 local themeList = {} 30 41 table.insert(themeList, "Default") … … 33 44 item = CEGUI.createListboxTextItem(v) 34 45 item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") 35 CEGUI.toCombobox(dropdown ):addItem(item)46 CEGUI.toCombobox(dropdownwindow):addItem(item) 36 47 end 48 dropdownwindow:setItemSelectState(0,true) 37 49 end 38 50 39 51 function P.AudioMasterScrollbar_changed(e) 52 if mastermute then 53 block = true 54 mastermutewindow:setSelected(false) 55 block = false 56 mastermute = false 57 end 40 58 if masterscrollbar_active == false then 41 window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar") 42 volume = window:getScrollPosition() 43 orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. volume) 59 mastervolume = masterscrollbarwindow:getScrollPosition() 60 orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. mastervolume) 44 61 end 45 62 end … … 50 67 51 68 function P.AudioMasterScrollbar_ended(e) 52 window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar") 53 volume = window:getScrollPosition() 54 orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. volume) 69 mastervolume = masterscrollbarwindow:getScrollPosition() 70 orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. mastervolume) 55 71 masterscrollbar_active = false 56 72 end 57 73 58 74 function P.AudioMusicScrollbar_changed(e) 75 if musicmute then 76 block = true 77 musicmutewindow:setSelected(false) 78 block = false 79 musicmute = false 80 end 59 81 if musicscrollbar_active == false then 60 window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar") 61 volume = window:getScrollPosition() 62 orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. volume) 82 musicvolume = musicscrollbarwindow:getScrollPosition() 83 orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. musicvolume) 63 84 end 64 85 end … … 69 90 70 91 function P.AudioMusicScrollbar_ended(e) 71 window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")72 volume =window:getScrollPosition()73 orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. volume)92 musicmutewindow:setSelected(false) 93 musicvolume = musicscrollbarwindow:getScrollPosition() 94 orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. musicvolume) 74 95 musicscrollbar_active = false 75 96 end 76 97 77 98 function P.AudioEffectsScrollbar_changed(e) 99 if effectsmute then 100 block = true 101 effectsmutewindow:setSelected(false) 102 block = false 103 effectsmute = false 104 end 78 105 if effectsscrollbar_active == false then 79 window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar") 80 volume = window:getScrollPosition() 81 orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. volume) 106 effectsvolume = effectsscrollbarwindow:getScrollPosition() 107 orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. effectsvolume) 82 108 end 83 109 end … … 88 114 89 115 function P.AudioEffectsScrollbar_ended(e) 90 window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")91 volume =window:getScrollPosition()92 orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. volume)116 effectsmutewindow:setSelected(false) 117 effectsvolume = effectsscrollbarwindow:getScrollPosition() 118 orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. effectsvolume) 93 119 effectsscrollbar_active = false 94 120 end 95 121 96 122 function P.AudioMuteMasterCheckbox_clicked(e) 97 -- if 98 -- mastervolume = soundMgr:getVolume(orxonox.SoundType.none) 99 -- window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar") 100 -- window:setScrollPosition(0) 101 -- end 102 soundMgr:toggleMute(orxonox.SoundType.none) 123 if block == false then 124 if mastermute then 125 masterscrollbarwindow:setScrollPosition(mastervolume) 126 mastermute = false 127 else 128 temp = masterscrollbarwindow:getScrollPosition() 129 masterscrollbarwindow:setScrollPosition(0) 130 mastervolume = temp 131 mastermute = true 132 end 133 soundMgr:toggleMute(orxonox.SoundType.none) 134 end 103 135 end 104 136 105 137 function P.AudioMuteMusicCheckbox_clicked(e) 106 soundMgr:toggleMute(orxonox.SoundType.ambient) 138 if block == false then 139 if musicmute then 140 musicscrollbarwindow:setScrollPosition(musicvolume) 141 musicmute = false 142 else 143 temp = musicscrollbarwindow:getScrollPosition() 144 musicscrollbarwindow:setScrollPosition(0) 145 musicvolume = temp 146 musicmute = true 147 end 148 soundMgr:toggleMute(orxonox.SoundType.ambient) 149 end 107 150 end 108 151 109 152 function P.AudioMuteEffectsCheckbox_clicked(e) 110 soundMgr:toggleMute(orxonox.SoundType.effects) 153 if block == false then 154 if effectsmute then 155 effectsscrollbarwindow:setScrollPosition(effectsvolume) 156 effectsmute = false 157 else 158 temp = effectsscrollbarwindow:getScrollPosition() 159 effectsscrollbarwindow:setScrollPosition(0) 160 effectsvolume = temp 161 effectsmute = true 162 end 163 soundMgr:toggleMute(orxonox.SoundType.effects) 164 end 111 165 end 112 166 113 167 function P.AudioThemeCombobox_changed(e) 114 -- local choice = winMgr:getWindow("orxonox/AudioThemeCombobox"):getFirstSelectedItem() 115 -- if choice == "Default" then 116 -- orxonox.CommandExecutor:execute("setMood default") 117 -- debug("default selected") 118 -- end 119 -- if choice == "Drum 'n Bass" then 120 -- orxonox.CommandExecutor:execute("setMood dnb") 121 -- debug("dnb selected") 122 -- end 168 if dropdownwindow:isItemSelected(1) then 169 orxonox.CommandExecutor:execute("setMood dnb") 170 else 171 orxonox.CommandExecutor:execute("setMood default") 172 end 123 173 end 124 174
Note: See TracChangeset
for help on using the changeset viewer.