Move all examples to separate collections

This commit is contained in:
Insality 2021-04-04 13:39:08 +03:00
parent 04d6babdff
commit ebabb37761
20 changed files with 6957 additions and 13500 deletions

View File

@ -4,7 +4,7 @@ embedded_instances {
id: "gui"
data: "components {\n"
" id: \"main\"\n"
" component: \"/example/gui/main/main.gui\"\n"
" component: \"/example/example.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
@ -365,3 +365,255 @@ embedded_instances {
z: 1.0
}
}
embedded_instances {
id: "general_grid"
data: "components {\n"
" id: \"screen_factory\"\n"
" component: \"/monarch/screen_factory.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" properties {\n"
" id: \"screen_id\"\n"
" value: \"general_grid\"\n"
" type: PROPERTY_TYPE_HASH\n"
" }\n"
" properties {\n"
" id: \"popup\"\n"
" value: \"true\"\n"
" type: PROPERTY_TYPE_BOOLEAN\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collectionfactory\"\n"
" type: \"collectionfactory\"\n"
" data: \"prototype: \\\"/example/examples/general/grid/grid.collection\\\"\\n"
"load_dynamically: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
embedded_instances {
id: "general_input"
data: "components {\n"
" id: \"screen_factory\"\n"
" component: \"/monarch/screen_factory.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" properties {\n"
" id: \"screen_id\"\n"
" value: \"general_input\"\n"
" type: PROPERTY_TYPE_HASH\n"
" }\n"
" properties {\n"
" id: \"popup\"\n"
" value: \"true\"\n"
" type: PROPERTY_TYPE_BOOLEAN\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collectionfactory\"\n"
" type: \"collectionfactory\"\n"
" data: \"prototype: \\\"/example/examples/general/input/input.collection\\\"\\n"
"load_dynamically: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
embedded_instances {
id: "general_scroll"
data: "components {\n"
" id: \"screen_factory\"\n"
" component: \"/monarch/screen_factory.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" properties {\n"
" id: \"screen_id\"\n"
" value: \"general_scroll\"\n"
" type: PROPERTY_TYPE_HASH\n"
" }\n"
" properties {\n"
" id: \"popup\"\n"
" value: \"true\"\n"
" type: PROPERTY_TYPE_BOOLEAN\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collectionfactory\"\n"
" type: \"collectionfactory\"\n"
" data: \"prototype: \\\"/example/examples/general/scroll/scroll.collection\\\"\\n"
"load_dynamically: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
embedded_instances {
id: "general_data_list"
data: "components {\n"
" id: \"screen_factory\"\n"
" component: \"/monarch/screen_factory.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" properties {\n"
" id: \"screen_id\"\n"
" value: \"general_data_list\"\n"
" type: PROPERTY_TYPE_HASH\n"
" }\n"
" properties {\n"
" id: \"popup\"\n"
" value: \"true\"\n"
" type: PROPERTY_TYPE_BOOLEAN\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collectionfactory\"\n"
" type: \"collectionfactory\"\n"
" data: \"prototype: \\\"/example/examples/general/data_list/data_list.collection\\\"\\n"
"load_dynamically: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}

View File

@ -1,4 +1,4 @@
script: "/example/gui/main/main.gui_script"
script: "/example/example.gui_script"
fonts {
name: "game"
font: "/example/assets/fonts/game.font"

View File

@ -1,17 +1,8 @@
---@type druid
local druid = require("druid.druid")
local monarch = require("monarch.monarch")
local empty_style = require("druid.styles.empty.style")
local default_style = require("druid.styles.default.style")
local scroll_page = require("example.page.scroll_page")
local input_page = require("example.page.input_page")
local grid_page = require("example.page.grid_page")
local infinity_page = require("example.page.infinity_page")
local function back_to_lobby(self)
monarch.back()
gui.set_enabled(gui.get_node("C_Anchor"), true)
@ -101,30 +92,30 @@ local function init_lobby(self)
self.lobby_grid:add(get_button(self, "Texts", "general_texts"))
self.lobby_grid:add(get_button_disabled(self, "Lang Text", "scene_name"))
self.lobby_grid:add(get_button(self, "Sliders", "general_sliders"))
self.lobby_grid:add(get_button(self, "Scrolls", "scene_name"))
self.lobby_grid:add(get_button(self, "Grids", "scene_name"))
self.lobby_grid:add(get_button(self, "Progress Bar", "scene_name"))
self.lobby_grid:add(get_button(self, "Data List", "scene_name"))
self.lobby_grid:add(get_button(self, "Checkboxes", "scene_name"))
self.lobby_grid:add(get_button(self, "Input text", "scene_name"))
self.lobby_grid:add(get_button(self, "Swipe", "scene_name"))
self.lobby_grid:add(get_button(self, "Drag", "scene_name"))
self.lobby_grid:add(get_button(self, "Scrolls", "general_scroll"))
self.lobby_grid:add(get_button(self, "Grids", "general_grid"))
self.lobby_grid:add(get_button_disabled(self, "Progress Bar", "scene_name"))
self.lobby_grid:add(get_button(self, "Data List", "general_data_list"))
self.lobby_grid:add(get_button_disabled(self, "Checkboxes", "scene_name"))
self.lobby_grid:add(get_button(self, "Input text", "general_input"))
self.lobby_grid:add(get_button_disabled(self, "Swipe", "scene_name"))
self.lobby_grid:add(get_button_disabled(self, "Drag", "scene_name"))
self.lobby_grid:add(get_title(self, "Scrolls"))
self.lobby_grid:add(get_button(self, "Nested scrolls", "scroll_scene"))
self.lobby_grid:add(get_button(self, "With points of interest", "scroll_scene"))
self.lobby_grid:add(get_button(self, "Without inertion", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Nested scrolls", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "With points of interest", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Without inertion", "scroll_scene"))
self.lobby_grid:add(get_title(self, "Grids"))
self.lobby_grid:add(get_button(self, "Static grid", "scroll_scene"))
self.lobby_grid:add(get_button(self, "Dynamic grid", "scroll_scene"))
self.lobby_grid:add(get_button(self, "Scroll binding", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Static grid", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Dynamic grid", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Scroll binding", "scroll_scene"))
self.lobby_grid:add(get_title(self, "Data list / Infinity scroll"))
self.lobby_grid:add(get_button(self, "With static grid", "scroll_scene"))
self.lobby_grid:add(get_button(self, "With dynamic grid", "scroll_scene"))
self.lobby_grid:add(get_button(self, "Add/remove elements", "scroll_scene"))
self.lobby_grid:add(get_button(self, "Navigate over elements", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "With static grid", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "With dynamic grid", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Add/remove elements", "scroll_scene"))
self.lobby_grid:add(get_button_disabled(self, "Navigate over elements", "scroll_scene"))
end

View File

@ -0,0 +1,37 @@
name: "data_list"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"data_list\"\n"
" component: \"/example/examples/general/data_list/data_list.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
local M = {}
local druid = require("druid.druid")
local function create_infinity_instance(self, record, index)
@ -104,7 +104,7 @@ local function setup_infinity_list(self)
-- local pos = self.infinity_grid:get_pos(25)
-- self.infinity_scroll:scroll_to(pos, true)
timer.delay(1, false, function()
self.infinity_list:scroll_to_index(25)
-- self.infinity_list:scroll_to_index(25)
end)
@ -119,7 +119,7 @@ local function setup_infinity_list(self)
end):set_data(data)
timer.delay(1, false, function()
self.infinity_list_dynamic:scroll_to_index(25)
-- self.infinity_list_dynamic:scroll_to_index(25)
end)
self.infinity_list_dynamic_hor = self.druid:new_data_list(self.infinity_scroll_dynamic_hor, self.infinity_grid_dynamic_hor, function(record, index)
@ -140,8 +140,9 @@ local function toggle_stencil(self)
end
function M.setup_page(self)
self.druid:new_scroll("infinity_page", "infinity_page_content")
function init(self)
self.druid = druid.new(self)
self.druid:new_scroll("root", "infinity_page_content")
self.infinity_prefab = gui.get_node("infinity_prefab")
self.infinity_prefab_small = gui.get_node("infinity_prefab_small")
@ -177,4 +178,21 @@ function M.setup_page(self)
end
return M
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end

View File

@ -0,0 +1,37 @@
name: "grid"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"overview\"\n"
" component: \"/example/examples/general/grid/grid.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,6 @@
local druid = require("druid.druid")
local const = require("druid.const")
local M = {}
local function simple_animate(node, pos)
gui.animate(node, "position", pos, gui.EASING_OUTSINE, 0.2)
end
@ -178,8 +176,10 @@ local function init_dynamic_grid(self)
end
function M.setup_page(self)
self.druid:new_scroll("grid_page", "grid_page_content")
function init(self)
self.druid = druid.new(self)
self.druid:new_scroll("root", "grid_page_content")
self.grid_static_grid = self.druid:new_static_grid("grid_nodes", "grid_nodes_prefab", 5)
:set_position_function(simple_animate)
@ -204,4 +204,21 @@ function M.setup_page(self)
end
return M
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end

View File

@ -0,0 +1,37 @@
name: "input"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"overview\"\n"
" component: \"/example/examples/general/input/input.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
local druid = require("druid.druid")
function init(self)
self.druid = druid.new(self)
self.druid:new_input("input_box_usual", "input_text_usual")
self.druid:new_input("input_box_password", "input_text_password", gui.KEYBOARD_TYPE_PASSWORD)
self.druid:new_input("input_box_email", "input_text_email", gui.KEYBOARD_TYPE_EMAIL)
self.druid:new_input("input_box_numpad", "input_text_numpad", gui.KEYBOARD_TYPE_NUMBER_PAD)
:set_allowed_characters("[%d,.]")
end
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end

View File

@ -0,0 +1,37 @@
name: "scroll"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"scroll\"\n"
" component: \"/example/examples/general/scroll/scroll.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
local M = {}
local druid = require("druid.druid")
local function init_scroll_with_grid(self)
@ -34,9 +34,11 @@ local function init_scroll_with_grid(self)
end
function M.setup_page(self)
function init(self)
self.druid = druid.new(self)
-- Usual scroll for whole page
self.druid:new_scroll("scroll_page", "scroll_page_content")
self.druid:new_scroll("root", "scroll_page_content")
-- Simple scroll with no adjust
self.druid:new_scroll("simple_scroll_input", "simple_scroll_content")
@ -68,4 +70,21 @@ function M.setup_page(self)
end
return M
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end

View File

@ -3,8 +3,8 @@ scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"overview\"\n"
" component: \"/example/examples/general/template/template.gui\"\n"
" id: \"template\"\n"
" component: \"/example/examples/template/template.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"

View File

@ -1,4 +1,4 @@
script: "/example/examples/general/template/template.gui_script"
script: "/example/examples/template/template.gui_script"
fonts {
name: "game"
font: "/example/assets/fonts/game.font"

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
local M = {}
function M.setup_page(self)
self.druid:new_input("input_box_usual", "input_text_usual")
self.druid:new_input("input_box_password", "input_text_password", gui.KEYBOARD_TYPE_PASSWORD)
self.druid:new_input("input_box_email", "input_text_email", gui.KEYBOARD_TYPE_EMAIL)
self.druid:new_input("input_box_numpad", "input_text_numpad", gui.KEYBOARD_TYPE_NUMBER_PAD)
:set_allowed_characters("[%d,.]")
end
return M