-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.lua
More file actions
58 lines (54 loc) · 1.71 KB
/
example.lua
File metadata and controls
58 lines (54 loc) · 1.71 KB
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
local UI = {}
UI.space = SUI.T({ text = " " })
UI.clear_ROOT = SUI.ROOT({ colour = G.C.CLEAR })
UI.centered_C = SUI.C({ align = "cm" })
UI.centered_R = SUI.R({ align = "cm" })
-- CHILDREN_KEY_PROVIDER - context which provides elements which passed via config by using CHILDREN_KEY_MARKER
UI.blue_brackets = SUI.CHILDREN_KEY_PROVIDER({
SUI.T_STYLE({ scale = 0.5 }, {
-- CHILDREN_KEY_MARKER - marker which CHILDREN_KEY_PROVIDER uses to insert elements
SUI.CHILDREN_KEY_MARKER("prefix"),
SUI.T({ text = ": " }),
SUI.T({ text = "[", colour = G.C.CHIPS }),
-- T_STYLE - context which applies config for ALL text elements inside of it and it's children. Useful to apply default colour, scale, or shared ref_table
SUI.T_STYLE({ colour = G.C.EDITION }, {
SUI.CHILDREN_KEY_MARKER("content"),
}),
SUI.T({ text = "]", colour = G.C.CHIPS }),
SUI.T_STYLE({ colour = G.C.UI.TEXT_INACTIVE, scale = 0.35 }, {
SUI.T({ text = " + " }),
SUI.CHILDREN_KEY_MARKER("suffix"),
}),
}),
})
local example_config_definition = SUI.ROOT({ colour = G.C.CLEAR, align = "cm" }, {
SUI.C({ align = "cm" }, {
UI.centered_R({
UI.blue_brackets({
prefix = {
SUI.T({ text = "Now selected" }),
},
content = {
SUI.T({ ref_table = { cards_count = 5 }, ref_value = "cards_count" }),
},
suffix = {
SUI.T({ text = "some more text on end" }),
},
}),
}),
UI.centered_R({
UI.blue_brackets({
prefix = {
SUI.T({ text = "Next will be selected" }),
},
content = {
SUI.T({ ref_table = { cards_count = 6 }, ref_value = "cards_count" }),
},
suffix = {
SUI.T({ text = "bit less text" }),
},
}),
}),
}),
})
SMODS.current_mod.config_tab = example_config_definition.render_func()