-
Notifications
You must be signed in to change notification settings - Fork 11
/
examples.gui_script
71 lines (60 loc) · 3.57 KB
/
examples.gui_script
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
local dirtylarry = require "dirtylarry/dirtylarry"
function init(self)
msg.post(".", "acquire_input_focus")
self.checkbox_a_value = false
self.checkbox_b_value = true
self.radio_value = "a"
self.slider_value = 0.0
end
function on_input(self, action_id, action)
self.input_default = dirtylarry:input("input_default", action_id, action, gui.KEYBOARD_TYPE_DEFAULT, "Default text")
self.input_email = dirtylarry:input("input_email", action_id, action, gui.KEYBOARD_TYPE_EMAIL, "Email")
self.input_number = dirtylarry:input("input_number", action_id, action, gui.KEYBOARD_TYPE_NUMBER_PAD, "Number")
self.input_password = dirtylarry:input("input_password", action_id, action, gui.KEYBOARD_TYPE_PASSWORD, "Password")
self.input_smaller = dirtylarry:input("input_smaller", action_id, action, gui.KEYBOARD_TYPE_DEFAULT, "Tiny input")
dirtylarry:button("button_print", action_id, action, function ()
print("Input: " .. tostring(self.input_default))
print("Email: " .. tostring(self.input_email))
print("Number: " .. tostring(self.input_number))
print("Password: " .. tostring(self.input_password))
print("Checkbox A: " .. tostring(self.checkbox_a_value))
print("Checkbox B: " .. tostring(self.checkbox_b_value))
print("Radio: " .. tostring(self.radio_value))
print("Tiny: " .. tostring(self.input_smaller))
end)
self.checkbox_a_value = dirtylarry:checkbox("checkbox_a", action_id, action, self.checkbox_a_value)
self.checkbox_b_value = dirtylarry:checkbox("checkbox_b", action_id, action, self.checkbox_b_value)
self.radio_value = dirtylarry:radio("radio_a", action_id, action, "a", self.radio_value)
self.radio_value = dirtylarry:radio("radio_b", action_id, action, "b", self.radio_value)
self.radio_value = dirtylarry:radio("radio_c", action_id, action, "c", self.radio_value)
self.slider_value = dirtylarry:slider("slider", action_id, action, -1.0, 1.0, self.slider_value)
dirtylarry:button("button_toggle_larry", action_id, action, function ()
local enabled = not gui.is_enabled(gui.get_node("larry_root"))
gui.set_enabled(gui.get_node("larry_root"), enabled)
gui.set_text(gui.get_node("button_toggle_larry/larrylabel"), enabled and "Hide Larry" or "Show Larry")
end)
dirtylarry:button("button_larry", action_id, action, function ()
print("I'm Dirty Larry")
end)
self.scrollarea = dirtylarry:scrollarea("scrollarea", action_id, action, self.scrollarea, function(self, action_id, action)
local tmp_func = function ()
print("button pressed in scrollarea")
end
dirtylarry:button("scrollarea_button", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button1", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button2", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button3", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button4", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button5", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button6", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button7", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button8", action_id, action, tmp_func)
dirtylarry:button("scrollarea_button9", action_id, action, tmp_func)
end)
local node = gui.get_node("defold")
dirtylarry:hit(node, action_id, action, function()
gui.cancel_animation(node, "scale")
gui.set_scale(node, vmath.vector3(1.2))
gui.animate(node, "scale", 1.0, gui.EASING_OUTELASTIC, 0.8)
end)
end