Update example with new brand one

This commit is contained in:
Insality
2024-10-17 01:24:15 +03:00
parent 2c762716bb
commit 91879509a0
197 changed files with 36779 additions and 7 deletions

View File

@@ -0,0 +1,236 @@
script: ""
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: 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: ""
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_AUTO
custom_type: 0
enabled: true
visible: false
material: ""
}
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_TEMPLATE
id: "button"
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/templates/button_text_green.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: 280.0
y: 90.0
z: 0.0
w: 1.0
}
color {
x: 0.557
y: 0.835
z: 0.62
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "druid/ui_circle_32"
id: "button/root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button"
layer: "druid"
inherit_alpha: true
slice9 {
x: 16.0
y: 16.0
z: 16.0
w: 16.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: true
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
material: ""
}
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: 245.0
y: 50.0
z: 0.0
w: 1.0
}
color {
x: 0.31
y: 0.318
z: 0.322
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Confirm"
font: "text_bold"
id: "button/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: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button/root"
layer: "text_bold"
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: true
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
material: ""
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,19 @@
local component = require("druid.component")
---@class basic_button: druid.base_component
---@field druid druid_instance
---@field button druid.button
local M = component.create("basic_button")
---@param template string
---@param nodes table<hash, node>
function M:init(template, nodes)
self.druid = self:get_druid(template, nodes)
self.button = self.druid:new_button("button/root", function()
print("Button pressed")
end)
end
return M

View File

@@ -0,0 +1,236 @@
script: ""
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: 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: ""
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_AUTO
custom_type: 0
enabled: true
visible: false
material: ""
}
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_TEMPLATE
id: "button"
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/templates/button_text_green.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: 280.0
y: 90.0
z: 0.0
w: 1.0
}
color {
x: 0.557
y: 0.835
z: 0.62
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "druid/ui_circle_32"
id: "button/root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button"
layer: "druid"
inherit_alpha: true
slice9 {
x: 16.0
y: 16.0
z: 16.0
w: 16.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: true
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
material: ""
}
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: 245.0
y: 50.0
z: 0.0
w: 1.0
}
color {
x: 0.31
y: 0.318
z: 0.322
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Confirm"
font: "text_bold"
id: "button/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: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button/root"
layer: "text_bold"
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: true
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
material: ""
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,23 @@
local component = require("druid.component")
---@class basic_button_double_click: druid.base_component
---@field druid druid_instance
---@field button druid.button
local M = component.create("basic_button_double_click")
---@param template string
---@param nodes table<hash, node>
function M:init(template, nodes)
self.druid = self:get_druid(template, nodes)
self.button = self.druid:new_button("button/root", function()
print("Click")
end)
self.button.on_double_click:subscribe(function()
print("Double click")
end)
end
return M

View File

@@ -0,0 +1,107 @@
fonts {
name: "text_bold"
font: "/example/assets/fonts/text_bold.font"
}
textures {
name: "druid"
texture: "/example/assets/druid.atlas"
}
nodes {
size {
x: 200.0
y: 100.0
}
type: TYPE_BOX
id: "root"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
visible: false
}
nodes {
size {
x: 280.0
y: 90.0
}
color {
x: 0.902
y: 0.875
z: 0.624
}
type: TYPE_BOX
texture: "druid/ui_circle_32"
id: "button"
parent: "root"
inherit_alpha: true
slice9 {
x: 16.0
y: 16.0
z: 16.0
w: 16.0
}
}
nodes {
size {
x: 400.0
y: 400.0
}
type: TYPE_PIE
id: "mask"
parent: "button"
inherit_alpha: true
clipping_mode: CLIPPING_MODE_STENCIL
clipping_visible: false
size_mode: SIZE_MODE_AUTO
}
nodes {
size {
x: 280.0
y: 90.0
}
color {
x: 0.557
y: 0.835
z: 0.62
}
type: TYPE_BOX
texture: "druid/ui_circle_32"
id: "button_image"
parent: "mask"
inherit_alpha: true
slice9 {
x: 16.0
y: 16.0
z: 16.0
w: 16.0
}
}
nodes {
size {
x: 245.0
y: 50.0
}
color {
x: 0.31
y: 0.318
z: 0.322
}
type: TYPE_TEXT
text: "Confirm"
font: "text_bold"
id: "text"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "button"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -0,0 +1,49 @@
local component = require("druid.component")
local panthera = require("panthera.panthera")
local animation = require("example.examples.basic.button.basic_button_hold_panthera")
---@class basic_button_hold: druid.base_component
---@field druid druid_instance
---@field button druid.button
local M = component.create("basic_button_hold")
---@param template string
---@param nodes table<hash, node>
function M:init(template, nodes)
self.druid = self:get_druid(template, nodes)
self.animation = panthera.create_gui(animation, self:get_template(), nodes)
self.button = self.druid:new_button("button", function()
print("Click")
end)
self.button:set_style({})
self.button.style.AUTOHOLD_TRIGGER = 2
self.button.style.LONGTAP_TIME = 0
self.button.on_hold_callback:subscribe(function(_, _, _, time)
local start_time = self.button.style.LONGTAP_TIME
local max_time = self.button.style.AUTOHOLD_TRIGGER
local progress = (time - start_time) / (max_time - start_time)
panthera.set_time(self.animation, "hold", progress)
end)
self.button.on_long_click:subscribe(function()
panthera.play(self.animation, "complete")
end)
self.button.hover.on_mouse_hover:subscribe(function(_, state)
if not state then
panthera.set_time(self.animation, "hold", 0)
end
end)
self.button.on_click_outside:subscribe(function()
panthera.set_time(self.animation, "hold", 0)
end)
end
return M

View File

@@ -0,0 +1,266 @@
return {
type = "animation_editor",
format = "json",
data = {
nodes = {
},
animations = {
{
animation_id = "default",
duration = 1,
animation_keys = {
},
},
{
animation_id = "hold",
duration = 1,
animation_keys = {
{
end_value = -90,
easing = "outsine",
property_id = "rotation_z",
node_id = "button_image",
key_type = "tween",
},
{
end_value = 90,
easing = "outsine",
property_id = "rotation_z",
node_id = "mask",
key_type = "tween",
},
{
end_value = 1.1,
easing = "outsine",
property_id = "scale_x",
duration = 0.15,
key_type = "tween",
node_id = "button",
start_value = 1,
},
{
end_value = 1.1,
easing = "outsine",
property_id = "scale_y",
duration = 0.15,
key_type = "tween",
node_id = "button",
start_value = 1,
},
{
end_value = 1.3,
easing = "outsine",
property_id = "scale_x",
duration = 0.15,
key_type = "tween",
node_id = "text",
start_value = 1,
},
{
end_value = 1.3,
easing = "outsine",
property_id = "scale_y",
duration = 0.15,
key_type = "tween",
node_id = "text",
start_value = 1,
},
{
start_value = 360,
easing = "outsine",
property_id = "fill_angle",
duration = 1,
node_id = "mask",
key_type = "tween",
},
{
end_value = 1,
easing = "incirc",
property_id = "scale_x",
duration = 0.85,
start_value = 1.1,
key_type = "tween",
node_id = "button",
start_time = 0.15,
},
{
end_value = 1,
easing = "incirc",
property_id = "scale_y",
duration = 0.85,
start_value = 1.1,
key_type = "tween",
node_id = "button",
start_time = 0.15,
},
{
end_value = 1,
easing = "outsine",
property_id = "scale_x",
duration = 0.51,
start_value = 1.3,
key_type = "tween",
node_id = "text",
start_time = 0.49,
},
{
end_value = 1,
easing = "outsine",
property_id = "scale_y",
duration = 0.51,
start_value = 1.3,
key_type = "tween",
node_id = "text",
start_time = 0.49,
},
},
},
{
animation_id = "complete",
duration = 0.4,
animation_keys = {
{
easing = "linear",
property_id = "inherit_alpha",
data = "false",
key_type = "trigger",
node_id = "text",
start_data = "true",
},
{
end_value = 0.624,
easing = "outsine",
property_id = "color_b",
key_type = "tween",
node_id = "button_image",
start_value = 0.62,
},
{
end_value = 0.875,
easing = "outsine",
property_id = "color_g",
key_type = "tween",
node_id = "button_image",
start_value = 0.835,
},
{
end_value = 0.902,
easing = "outsine",
property_id = "color_r",
key_type = "tween",
node_id = "button_image",
start_value = 0.557,
},
{
end_value = 1.1,
easing = "outsine",
property_id = "color_a",
duration = 0.17,
key_type = "tween",
node_id = "root",
start_value = 1,
},
{
end_value = 1.2,
easing = "outsine",
property_id = "scale_x",
duration = 0.17,
key_type = "tween",
node_id = "root",
start_value = 1,
},
{
end_value = 1.2,
easing = "outsine",
property_id = "scale_y",
duration = 0.17,
key_type = "tween",
node_id = "root",
start_value = 1,
},
{
end_value = 0.557,
easing = "outsine",
property_id = "color_r",
duration = 0.38,
start_value = 0.902,
key_type = "tween",
node_id = "button_image",
start_time = 0.02,
},
{
end_value = 0.62,
easing = "outsine",
property_id = "color_b",
duration = 0.38,
start_value = 0.624,
key_type = "tween",
node_id = "button_image",
start_time = 0.02,
},
{
end_value = 0.835,
easing = "outsine",
property_id = "color_g",
duration = 0.38,
start_value = 0.875,
key_type = "tween",
node_id = "button_image",
start_time = 0.02,
},
{
end_value = 1,
easing = "outsine",
property_id = "color_a",
duration = 0.22,
start_value = 1.1,
key_type = "tween",
node_id = "root",
start_time = 0.17,
},
{
end_value = 1,
easing = "outsine",
property_id = "scale_x",
duration = 0.22,
start_value = 1.2,
key_type = "tween",
node_id = "root",
start_time = 0.17,
},
{
end_value = 1,
easing = "outsine",
property_id = "scale_y",
duration = 0.22,
start_value = 1.2,
key_type = "tween",
node_id = "root",
start_time = 0.17,
},
{
easing = "linear",
property_id = "inherit_alpha",
start_data = "false",
data = "true",
key_type = "trigger",
node_id = "text",
start_time = 0.39,
},
},
},
},
metadata = {
layers = {
},
gui_path = "/example/examples/basic/button/basic_button_hold.gui",
gizmo_steps = {
},
settings = {
font_size = 40,
},
fps = 60,
},
},
version = 1,
}