mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 18:37:44 +02:00
Better grid example hints
This commit is contained in:
parent
1c292f44b7
commit
0e96c582c9
@ -9696,7 +9696,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
y: -190.0
|
y: -354.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -9805,8 +9805,8 @@ nodes {
|
|||||||
}
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: -150.0
|
x: -80.0
|
||||||
y: -140.0
|
y: -304.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -9964,167 +9964,8 @@ nodes {
|
|||||||
}
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 80.0
|
||||||
y: -140.0
|
y: -304.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 {
|
|
||||||
x: 200.0
|
|
||||||
y: 100.0
|
|
||||||
z: 0.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
color {
|
|
||||||
x: 1.0
|
|
||||||
y: 1.0
|
|
||||||
z: 1.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
type: TYPE_TEMPLATE
|
|
||||||
id: "button_remove"
|
|
||||||
parent: "grid_page_content"
|
|
||||||
layer: ""
|
|
||||||
inherit_alpha: true
|
|
||||||
alpha: 1.0
|
|
||||||
template: "/example/templates/button.gui"
|
|
||||||
template_node_child: false
|
|
||||||
}
|
|
||||||
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 {
|
|
||||||
x: 130.0
|
|
||||||
y: 60.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/button_blue"
|
|
||||||
id: "button_remove/button"
|
|
||||||
xanchor: XANCHOR_NONE
|
|
||||||
yanchor: YANCHOR_NONE
|
|
||||||
pivot: PIVOT_CENTER
|
|
||||||
adjust_mode: ADJUST_MODE_FIT
|
|
||||||
parent: "button_remove"
|
|
||||||
layer: "image"
|
|
||||||
inherit_alpha: true
|
|
||||||
slice9 {
|
|
||||||
x: 15.0
|
|
||||||
y: 15.0
|
|
||||||
z: 15.0
|
|
||||||
w: 15.0
|
|
||||||
}
|
|
||||||
clipping_mode: CLIPPING_MODE_NONE
|
|
||||||
clipping_visible: true
|
|
||||||
clipping_inverted: false
|
|
||||||
alpha: 1.0
|
|
||||||
template_node_child: true
|
|
||||||
size_mode: SIZE_MODE_MANUAL
|
|
||||||
}
|
|
||||||
nodes {
|
|
||||||
position {
|
|
||||||
x: 0.0
|
|
||||||
y: 7.0
|
|
||||||
z: 0.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
rotation {
|
|
||||||
x: 0.0
|
|
||||||
y: 0.0
|
|
||||||
z: 0.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
scale {
|
|
||||||
x: 0.7
|
|
||||||
y: 0.7
|
|
||||||
z: 1.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
size {
|
|
||||||
x: 200.0
|
|
||||||
y: 100.0
|
|
||||||
z: 0.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
color {
|
|
||||||
x: 1.0
|
|
||||||
y: 1.0
|
|
||||||
z: 1.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
type: TYPE_TEXT
|
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
|
||||||
text: "Remove"
|
|
||||||
font: "game"
|
|
||||||
id: "button_remove/text"
|
|
||||||
xanchor: XANCHOR_NONE
|
|
||||||
yanchor: YANCHOR_NONE
|
|
||||||
pivot: PIVOT_CENTER
|
|
||||||
outline {
|
|
||||||
x: 1.0
|
|
||||||
y: 1.0
|
|
||||||
z: 1.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
shadow {
|
|
||||||
x: 0.101960786
|
|
||||||
y: 0.2
|
|
||||||
z: 0.6
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
adjust_mode: ADJUST_MODE_FIT
|
|
||||||
line_break: false
|
|
||||||
parent: "button_remove/button"
|
|
||||||
layer: "text"
|
|
||||||
inherit_alpha: true
|
|
||||||
alpha: 1.0
|
|
||||||
outline_alpha: 0.0
|
|
||||||
shadow_alpha: 0.78
|
|
||||||
overridden_fields: 8
|
|
||||||
template_node_child: true
|
|
||||||
text_leading: 1.0
|
|
||||||
text_tracking: 0.0
|
|
||||||
}
|
|
||||||
nodes {
|
|
||||||
position {
|
|
||||||
x: 150.0
|
|
||||||
y: -140.0
|
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10283,7 +10124,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: -160.0
|
x: -160.0
|
||||||
y: -230.0
|
y: -394.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10456,7 +10297,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
y: -650.0
|
y: -814.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10566,7 +10407,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
y: -700.0
|
y: -864.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10621,7 +10462,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: -250.0
|
x: -250.0
|
||||||
y: -1300.0
|
y: -1464.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10731,7 +10572,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
y: -1309.0
|
y: -1473.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10786,7 +10627,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: -60.0
|
x: -60.0
|
||||||
y: -620.0
|
y: -784.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -10911,7 +10752,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_TEXT
|
type: TYPE_TEXT
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
text: "Add Start"
|
text: "Add First"
|
||||||
font: "game"
|
font: "game"
|
||||||
id: "button_add_start_dynamic/text"
|
id: "button_add_start_dynamic/text"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
@ -10945,7 +10786,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 60.0
|
x: 60.0
|
||||||
y: -620.0
|
y: -784.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -11070,7 +10911,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_TEXT
|
type: TYPE_TEXT
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
text: "Add End"
|
text: "Add Last"
|
||||||
font: "game"
|
font: "game"
|
||||||
id: "button_add_end_dynamic/text"
|
id: "button_add_end_dynamic/text"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
@ -11104,7 +10945,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: -60.0
|
x: -60.0
|
||||||
y: -1211.0
|
y: -1375.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -11229,7 +11070,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_TEXT
|
type: TYPE_TEXT
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
text: "Add Start"
|
text: "Add First"
|
||||||
font: "game"
|
font: "game"
|
||||||
id: "button_add_start_dynamic_hor/text"
|
id: "button_add_start_dynamic_hor/text"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
@ -11263,7 +11104,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 60.0
|
x: 60.0
|
||||||
y: -1211.0
|
y: -1375.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -11388,7 +11229,7 @@ nodes {
|
|||||||
}
|
}
|
||||||
type: TYPE_TEXT
|
type: TYPE_TEXT
|
||||||
blend_mode: BLEND_MODE_ALPHA
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
text: "Add End"
|
text: "Add Last"
|
||||||
font: "game"
|
font: "game"
|
||||||
id: "button_add_end_dynamic_hor/text"
|
id: "button_add_end_dynamic_hor/text"
|
||||||
xanchor: XANCHOR_NONE
|
xanchor: XANCHOR_NONE
|
||||||
@ -11419,6 +11260,70 @@ nodes {
|
|||||||
text_leading: 1.0
|
text_leading: 1.0
|
||||||
text_tracking: 0.0
|
text_tracking: 0.0
|
||||||
}
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: -200.0
|
||||||
|
y: -180.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale {
|
||||||
|
x: 0.75
|
||||||
|
y: 0.75
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 533.33
|
||||||
|
y: 200.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
blend_mode: BLEND_MODE_ALPHA
|
||||||
|
text: "Tap on node for remove\n"
|
||||||
|
"Long tap on node for remove without node shift"
|
||||||
|
font: "game"
|
||||||
|
id: "text_grid_hint"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_W
|
||||||
|
outline {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
shadow {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
line_break: true
|
||||||
|
parent: "grid_page_content"
|
||||||
|
layer: ""
|
||||||
|
inherit_alpha: true
|
||||||
|
alpha: 1.0
|
||||||
|
outline_alpha: 0.0
|
||||||
|
shadow_alpha: 0.0
|
||||||
|
template_node_child: false
|
||||||
|
text_leading: 1.0
|
||||||
|
text_tracking: 0.0
|
||||||
|
}
|
||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
|
@ -66,19 +66,18 @@ local function init_static_grid(self)
|
|||||||
self.druid:new_button("button_add/button", function()
|
self.druid:new_button("button_add/button", function()
|
||||||
add_node(self)
|
add_node(self)
|
||||||
end)
|
end)
|
||||||
self.druid:new_button("button_clear/button", clear_nodes)
|
self.druid:new_button("button_clear/button", function()
|
||||||
|
clear_nodes(self)
|
||||||
local remove_button = self.druid:new_button("button_remove/button", remove_node)
|
end)
|
||||||
gui.set_enabled(remove_button.node, false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function remove_dynamic_node(self, button)
|
local function remove_dynamic_node(self, button, is_shift_left)
|
||||||
gui.delete_node(button.node)
|
gui.delete_node(button.node)
|
||||||
|
|
||||||
self.druid:remove(button)
|
self.druid:remove(button)
|
||||||
local index = self.grid_dynamic_grid:get_index_by_node(button.node)
|
local index = self.grid_dynamic_grid:get_index_by_node(button.node)
|
||||||
self.grid_dynamic_grid:remove(index)
|
self.grid_dynamic_grid:remove(index, is_shift_left)
|
||||||
for i = 1, #self.dynamic_node_buttons do
|
for i = 1, #self.dynamic_node_buttons do
|
||||||
if self.dynamic_node_buttons[i] == button then
|
if self.dynamic_node_buttons[i] == button then
|
||||||
table.remove(self.dynamic_node_buttons, i)
|
table.remove(self.dynamic_node_buttons, i)
|
||||||
@ -97,6 +96,9 @@ local function add_node_dynamic(self, index, is_shift_left)
|
|||||||
local button = self.druid:new_button(node, function(_, params, button)
|
local button = self.druid:new_button(node, function(_, params, button)
|
||||||
remove_dynamic_node(self, button)
|
remove_dynamic_node(self, button)
|
||||||
end)
|
end)
|
||||||
|
button.on_long_click:subscribe(function()
|
||||||
|
remove_dynamic_node(self, button, true)
|
||||||
|
end)
|
||||||
button:set_click_zone(self.grid_dynamic_scroll.view_node)
|
button:set_click_zone(self.grid_dynamic_scroll.view_node)
|
||||||
table.insert(self.dynamic_node_buttons, button)
|
table.insert(self.dynamic_node_buttons, button)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user