Update examples

This commit is contained in:
Insality
2023-05-31 21:54:55 +03:00
parent a01eae3d89
commit b628212c58
21 changed files with 3306 additions and 164 deletions

View File

@@ -212,9 +212,9 @@ nodes {
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
@@ -226,15 +226,15 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.0
y: 0.2
x: 0.2
y: 0.0
z: 0.2
w: 1.0
}
shadow {
x: 0.101960786
y: 0.3019608
z: 0.3019608
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
@@ -243,8 +243,8 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.1
outline_alpha: 0.75
shadow_alpha: 0.25
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
@@ -564,9 +564,9 @@ nodes {
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
@@ -578,15 +578,15 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.0
y: 0.2
x: 0.2
y: 0.0
z: 0.2
w: 1.0
}
shadow {
x: 0.101960786
y: 0.3019608
z: 0.3019608
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
@@ -595,8 +595,8 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.1
outline_alpha: 0.75
shadow_alpha: 0.25
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
@@ -989,9 +989,9 @@ nodes {
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
@@ -1003,15 +1003,15 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.0
y: 0.2
x: 0.2
y: 0.0
z: 0.2
w: 1.0
}
shadow {
x: 0.101960786
y: 0.3019608
z: 0.3019608
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
@@ -1020,8 +1020,8 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.1
outline_alpha: 0.75
shadow_alpha: 0.25
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
@@ -1347,9 +1347,9 @@ nodes {
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
@@ -1361,15 +1361,15 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.0
y: 0.2
x: 0.2
y: 0.0
z: 0.2
w: 1.0
}
shadow {
x: 0.101960786
y: 0.3019608
z: 0.3019608
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
@@ -1378,8 +1378,8 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.1
outline_alpha: 0.75
shadow_alpha: 0.25
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
@@ -2287,9 +2287,9 @@ nodes {
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
@@ -2301,15 +2301,15 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.0
y: 0.2
x: 0.2
y: 0.0
z: 0.2
w: 1.0
}
shadow {
x: 0.101960786
y: 0.3019608
z: 0.3019608
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
@@ -2318,8 +2318,8 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.1
outline_alpha: 0.75
shadow_alpha: 0.25
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
@@ -5062,9 +5062,9 @@ nodes {
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
@@ -5076,15 +5076,15 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.0
y: 0.2
x: 0.2
y: 0.0
z: 0.2
w: 1.0
}
shadow {
x: 0.101960786
y: 0.3019608
z: 0.3019608
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
@@ -5093,8 +5093,8 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.1
outline_alpha: 0.75
shadow_alpha: 0.25
template_node_child: false
text_leading: 1.0
text_tracking: 0.0

View File

@@ -0,0 +1,39 @@
name: "data_list_manage_data"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"data_list_manage_data\"\n"
" component: \"/example/examples/data_list/manage_data/manage_data.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"
" property_decls {\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

@@ -0,0 +1,774 @@
script: "/example/examples/data_list/manage_data/manage_data.gui_script"
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 300.0
y: 415.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: 600.0
y: 830.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: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
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
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: 0.0
y: 370.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: 700.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_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Add nodes and remove it by click on them"
font: "game"
id: "text_hint_horizontal"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.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: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: 0.0
y: 200.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: 300.0
y: 400.0
z: 0.0
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "data_list_view"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_STENCIL
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
}
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: 300.0
y: 400.0
z: 0.0
w: 1.0
}
color {
x: 0.8
y: 1.0
z: 0.8
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "data_list_content"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_FIT
parent: "data_list_view"
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
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: -110.0
y: 270.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_add_first"
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/templates/button.gui"
template_node_child: false
custom_type: 0
enabled: true
}
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: 150.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_add_first/button"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button_add_first"
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
overridden_fields: 4
template_node_child: true
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
}
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: 100.0
y: 50.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: "Add First"
font: "game"
id: "button_add_first/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_add_first/button"
layer: "text"
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.78
overridden_fields: 4
overridden_fields: 8
overridden_fields: 36
template_node_child: true
text_leading: 0.8
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: 110.0
y: 270.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_add_last"
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/templates/button.gui"
template_node_child: false
custom_type: 0
enabled: true
}
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: 150.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_add_last/button"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button_add_last"
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
overridden_fields: 4
template_node_child: true
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
}
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: 100.0
y: 50.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: "Add Last"
font: "game"
id: "button_add_last/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_add_last/button"
layer: "text"
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.78
overridden_fields: 4
overridden_fields: 8
overridden_fields: 36
template_node_child: true
text_leading: 0.8
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: 385.0
y: 139.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_prefab"
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/templates/button.gui"
template_node_child: false
custom_type: 0
enabled: true
}
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: 140.0
y: 140.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_prefab/button"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button_prefab"
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
overridden_fields: 4
template_node_child: true
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
}
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: 150.0
y: 50.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: "Element"
font: "game"
id: "button_prefab/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: true
parent: "button_prefab/button"
layer: "text"
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.78
overridden_fields: 4
overridden_fields: 8
overridden_fields: 18
overridden_fields: 36
template_node_child: true
text_leading: 0.8
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
}
layers {
name: "image"
}
layers {
name: "text"
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,79 @@
local druid = require("druid.druid")
---@class script_manage_data
---@field data_list druid.data_list
---@field grid druid.static_grid
---@param self script_manage_data
local function create_element(self, data)
local nodes = gui.clone_tree(self.prefab)
local root = nodes["button_prefab/button"]
gui.set_text(nodes["button_prefab/text"], "Element " .. data)
gui.set_enabled(root, true)
local button = self.druid:new_button(root, function()
self.data_list:remove_by_data(data)
end)
button:set_click_zone(self.scroll.view_node)
return root, button
end
local index = 0
---@param self script_manage_data
local function on_add_first(self)
--index = index + 1
--self.data_list:add(index, 1)
end
---@param self script_manage_data
local function on_add_last(self)
index = index + 1
self.data_list:add(index)
end
---@param self script_manage_data
function init(self)
self.druid = druid.new(self)
self.prefab = gui.get_node("button_prefab/button")
gui.set_enabled(self.prefab, false)
self.scroll = self.druid:new_scroll("data_list_view", "data_list_content")
self.scroll:set_horizontal_scroll(false)
self.grid = self.druid:new_static_grid("data_list_content", self.prefab, 2)
self.grid:set_position_function(function(node, position)
gui.animate(node, "position", position, gui.EASING_OUTSINE, 0.6)
end)
self.data_list = self.druid:new_data_list(self.scroll, self.grid, create_element)
self.data_list:set_debug(true)
self.druid:new_button("button_add_first/button", on_add_first)
local button = self.druid:new_button("button_add_last/button", on_add_last)
button:set_html5_user_interaction(true)
end
---@param self script_manage_data
function final(self)
self.druid:final()
end
---@param self script_manage_data
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,429 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
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: 600.0
y: 200.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: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_FIT
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
custom_type: 0
enabled: true
visible: 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: 0.8
y: 0.8
z: 1.0
w: 1.0
}
size {
x: 750.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 0.9411765
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Here is simple example with text"
font: "game"
id: "hint"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
outline {
x: 0.101960786
y: 0.101960786
z: 0.101960786
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: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.7
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: 0.0
y: -60.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: 600.0
y: 130.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 0.9411765
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "area"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_FIT
parent: "root"
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
custom_type: 0
enabled: true
visible: true
}
nodes {
position {
x: 0.0
y: -65.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: "rich_text"
parent: "area"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/druid/custom/rich_text/rich_text.gui"
template_node_child: false
custom_type: 0
enabled: true
}
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: 500.0
y: 130.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: ""
id: "rich_text/root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "rich_text"
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
overridden_fields: 4
template_node_child: true
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: 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: 300.0
y: 60.0
z: 0.0
w: 1.0
}
color {
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Rich text"
font: "game"
id: "rich_text/text_prefab"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: true
parent: "rich_text/root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
overridden_fields: 1
overridden_fields: 4
overridden_fields: 5
overridden_fields: 14
overridden_fields: 18
template_node_child: true
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
}
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: 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_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "items/checkmark"
id: "rich_text/icon_prefab"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "rich_text/root"
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: true
size_mode: SIZE_MODE_AUTO
custom_type: 0
enabled: true
visible: true
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,39 @@
name: "rich_text_texts"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"rich_text_texts\"\n"
" component: \"/example/examples/rich_text/rich_text_texts/rich_text_texts.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"
" property_decls {\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,38 @@
local druid = require("druid.druid")
local RichText = require("druid.custom.rich_text.rich_text")
function init(self)
self.druid = druid.new(self)
self.druid:new_scroll("root", "content")
self.rich_text_1 = self.druid:new(RichText, "case1/rich_text")
self.rich_text_1:set_text("Here is basic Rich Text without any text settings")
self.rich_text_2 = self.druid:new(RichText, "case2/rich_text")
self.rich_text_2:set_text("Here is color example for <color=0.4,0.6,0.25,1>Rich Text</color>. You can adjust the <color=0000ff>color</color>, <shadow=#FF0000>shadow</shadow> or <outline=00000055>outline</outline>")
self.rich_text_3 = self.druid:new(RichText, "case3/rich_text")
self.rich_text_3:set_text("Here <font=another_font>font change</font> example. Can be used<font=another_font>for bold and italic fonts or other one</font>")
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