Add clickable scroll nodes

This commit is contained in:
Insality 2020-03-19 00:17:10 +03:00
parent 2ec192d0f5
commit 296bf3dc2f
2 changed files with 60 additions and 5 deletions

View File

@ -5651,6 +5651,61 @@ nodes {
z: 1.0 z: 1.0
w: 1.0 w: 1.0
} }
size {
x: 240.0
y: 150.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "grid_prefab"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "scroll_page_content"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size { size {
x: 200.0 x: 200.0
y: 100.0 y: 100.0
@ -5666,12 +5721,12 @@ nodes {
type: TYPE_BOX type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_blue" texture: "kenney/button_blue"
id: "grid_prefab" id: "grid_button"
xanchor: XANCHOR_NONE xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT adjust_mode: ADJUST_MODE_FIT
parent: "scroll_page_content" parent: "grid_prefab"
layer: "" layer: ""
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
@ -5740,7 +5795,7 @@ nodes {
} }
adjust_mode: ADJUST_MODE_FIT adjust_mode: ADJUST_MODE_FIT
line_break: false line_break: false
parent: "grid_prefab" parent: "grid_button"
layer: "" layer: ""
inherit_alpha: true inherit_alpha: true
alpha: 1.0 alpha: 1.0

View File

@ -4,16 +4,16 @@ local M = {}
local function init_grid(self) local function init_grid(self)
local prefab = gui.get_node("grid_prefab") local prefab = gui.get_node("grid_prefab")
local grid = self.druid:new_grid("grid_content", "grid_prefab", 20) local grid = self.druid:new_grid("grid_content", "grid_prefab", 20)
grid:set_anchor(vmath.vector3(0, 0.5, 0)) grid:set_anchor(vmath.vector3(0, 0.5, 0))
grid:set_offset(vmath.vector3(15, 100, 0))
for i = 1, 40 do for i = 1, 40 do
local clone_prefab = gui.clone_tree(prefab) local clone_prefab = gui.clone_tree(prefab)
grid:add(clone_prefab["grid_prefab"]) grid:add(clone_prefab["grid_prefab"])
gui.set_text(clone_prefab["grid_prefab_text"], "Node " .. i) gui.set_text(clone_prefab["grid_prefab_text"], "Node " .. i)
self.druid:new_button(clone_prefab["grid_button"])
end end
gui.set_enabled(prefab, false) gui.set_enabled(prefab, false)