-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtouch_hotkeys.lua
87 lines (75 loc) · 2.65 KB
/
touch_hotkeys.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
touchHotkeysWindow = nil
touchHotkeysButton = nil
addTouchHotkeysWindow = nil
windowType = nil
function init()
windowType = g_settings.getBoolean('touchHotkeys_isHorizontal')
if windowType == nil then
windowType = false
end
touchHotkeysButton = modules.client_topmenu.addRightGameToggleButton('touchHotkeysButton', tr('Touch Hotkeys'), '/touch_hotkeys/img_touch_hotkeys/Hotkey_icon', toggle)
touchHotkeysButton:setOn(true)
if windowType == false then
touchHotkeysWindow = g_ui.loadUI('touch_hotkeys', modules.game_interface.getRightPanel())
touchHotkeysWindow:setup()
touchHotkeysWindow:setContentMinimumHeight(380)
touchHotkeysWindow:setContentMaximumHeight(380)
--touchHotkeysWindow:setHeight()
windowType = true
else
touchHotkeysWindow = g_ui.loadUI('touch_hotkeys_horizontal', modules.game_interface.getRightPanel())
touchHotkeysWindow:setup()
touchHotkeysWindow:setContentMinimumHeight(100)
touchHotkeysWindow:setContentMaximumHeight(100)
--touchHotkeysWindow:setHeight()
windowType = false
end
--[[touchHotkeysWindow = g_ui.loadUI('touch_hotkeys', modules.game_interface.getRightPanel())
touchHotkeysWindow:setup()
touchHotkeysWindow:setContentMinimumHeight(380)
touchHotkeysWindow:setContentMaximumHeight(380)]]
end
function terminate()
disconnect(g_game, { onGameEnd = clear })
touchHotkeysWindow:destroy()
touchHotkeysButton:destroy()
end
function clear()
local touchHotkeysList = touchHotkeysWindow:getChildById('contentsPanel')
touchHotkeysList:destroyChildren()
end
function toggle()
if touchHotkeysButton:isOn() then
touchHotkeysWindow:close()
touchHotkeysButton:setOn(false)
else
touchHotkeysWindow:open()
touchHotkeysButton:setOn(true)
end
end
function onMiniWindowClose()
touchHotkeysButton:setOn(false)
end
function changeVerticalToHorizontal()
if windowType then
clear()
touchHotkeysWindow:destroy()
touchHotkeysWindow = g_ui.loadUI('touch_hotkeys_horizontal', modules.game_interface.getRightPanel())
touchHotkeysWindow:setup()
windowType = false
touchHotkeysWindow:setContentMinimumHeight(65)
touchHotkeysWindow:setContentMaximumHeight(65)
touchHotkeysWindow:setHeight(90)
g_settings.set('touchHotkeys_isHorizontal', true)
else
clear()
touchHotkeysWindow:destroy()
touchHotkeysWindow = g_ui.loadUI('touch_hotkeys', modules.game_interface.getRightPanel())
touchHotkeysWindow:setup()
windowType = true
touchHotkeysWindow:setContentMinimumHeight(380)
touchHotkeysWindow:setContentMaximumHeight(380)
touchHotkeysWindow:setHeight(407)
g_settings.set('touchHotkeys_isHorizontal', false)
end
end