-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuiHelper.lua
More file actions
24 lines (24 loc) · 806 Bytes
/
Copy pathuiHelper.lua
File metadata and controls
24 lines (24 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local UIHelper={}
local function keyBindValueCalc(self,addKey,subKey,valueName,valueMax)
if isPressed(addKey)then
self.currentUI[valueName]=self.currentUI[valueName]%valueMax+1
SFX:play('select')
elseif isPressed(subKey)then
self.currentUI[valueName]=(self.currentUI[valueName]-2)%valueMax+1
SFX:play('select')
end
end
local function optionsCalc(self,execFuncs)
local size=#self.currentUI.options
keyBindValueCalc(self,'down','up','chosen',size)
if isPressed('z') then
local value=self.currentUI.options[self.currentUI.chosen].value
SFX:play('select')
if execFuncs[value]then
execFuncs[value](self)
end
end
end
UIHelper.keyBindValueCalc=keyBindValueCalc
UIHelper.optionsCalc=optionsCalc
return UIHelper