Skip to content
Open

WIP #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
313 changes: 313 additions & 0 deletions saver/properties_panel/property_saver_slots.gui
Original file line number Diff line number Diff line change
@@ -0,0 +1,313 @@
fonts {
name: "druid_text_bold"
font: "/druid/fonts/druid_text_bold.font"
}
textures {
name: "druid"
texture: "/druid/druid.atlas"
}
nodes {
size {
x: 400.0
y: 40.0
}
type: TYPE_BOX
texture: "druid/empty"
id: "root"
adjust_mode: ADJUST_MODE_STRETCH
inherit_alpha: true
visible: false
}
nodes {
position {
x: -200.0
}
scale {
x: 0.5
y: 0.5
}
size {
x: 350.0
y: 40.0
}
color {
x: 0.463
y: 0.475
z: 0.49
}
type: TYPE_TEXT
text: "Slots"
font: "druid_text_bold"
id: "text_name"
pivot: PIVOT_W
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
adjust_mode: ADJUST_MODE_STRETCH
parent: "root"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
nodes {
position {
x: 200.0
}
size {
x: 200.0
y: 40.0
}
type: TYPE_BOX
id: "E_Anchor"
pivot: PIVOT_E
parent: "root"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
visible: false
}
nodes {
position {
x: -170.0
}
size {
x: 60.0
y: 40.0
}
color {
x: 0.463
y: 0.475
z: 0.49
}
type: TYPE_BOX
texture: "druid/rect_round2_width2"
id: "button_1"
parent: "E_Anchor"
inherit_alpha: true
slice9 {
x: 5.0
y: 5.0
z: 5.0
w: 5.0
}
}
nodes {
position {
y: -20.0
}
size {
x: 60.0
y: 4.0
}
color {
x: 0.894
y: 0.506
z: 0.333
}
type: TYPE_BOX
texture: "druid/pixel"
id: "selected_1"
pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH
parent: "button_1"
inherit_alpha: true
}
nodes {
scale {
x: 0.5
y: 0.5
}
size {
x: 90.0
y: 50.0
}
color {
x: 0.722
y: 0.741
z: 0.761
}
type: TYPE_TEXT
text: "1"
font: "druid_text_bold"
id: "text_button_1"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "button_1"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
nodes {
position {
x: -100.0
}
size {
x: 60.0
y: 40.0
}
color {
x: 0.463
y: 0.475
z: 0.49
}
type: TYPE_BOX
texture: "druid/rect_round2_width2"
id: "button_2"
parent: "E_Anchor"
inherit_alpha: true
slice9 {
x: 5.0
y: 5.0
z: 5.0
w: 5.0
}
}
nodes {
position {
y: -20.0
}
size {
x: 60.0
y: 4.0
}
color {
x: 0.894
y: 0.506
z: 0.333
}
type: TYPE_BOX
texture: "druid/pixel"
id: "selected_2"
pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH
parent: "button_2"
inherit_alpha: true
}
nodes {
scale {
x: 0.5
y: 0.5
}
size {
x: 90.0
y: 50.0
}
color {
x: 0.722
y: 0.741
z: 0.761
}
type: TYPE_TEXT
text: "2"
font: "druid_text_bold"
id: "text_button_2"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "button_2"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
nodes {
position {
x: -30.0
}
size {
x: 60.0
y: 40.0
}
color {
x: 0.463
y: 0.475
z: 0.49
}
type: TYPE_BOX
texture: "druid/rect_round2_width2"
id: "button_3"
parent: "E_Anchor"
inherit_alpha: true
slice9 {
x: 5.0
y: 5.0
z: 5.0
w: 5.0
}
}
nodes {
position {
y: -20.0
}
size {
x: 60.0
y: 4.0
}
color {
x: 0.894
y: 0.506
z: 0.333
}
type: TYPE_BOX
texture: "druid/pixel"
id: "selected_3"
pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH
parent: "button_3"
inherit_alpha: true
}
nodes {
scale {
x: 0.5
y: 0.5
}
size {
x: 90.0
y: 50.0
}
color {
x: 0.722
y: 0.741
z: 0.761
}
type: TYPE_TEXT
text: "3"
font: "druid_text_bold"
id: "text_button_3"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "button_3"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
59 changes: 59 additions & 0 deletions saver/properties_panel/property_saver_slots.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---@class druid.widget.property_three_buttons: druid.widget
---@field root node
---@field container druid.container
---@field text_name druid.text
---@field button_1 druid.button
---@field text_button_1 druid.text
---@field button_2 druid.button
---@field text_button_2 druid.text
---@field button_3 druid.button
---@field text_button_3 druid.text
local M = {}


function M:init()
self.root = self:get_node("root")
self.text_name = self.druid:new_text("text_name")
:set_text_adjust("scale_then_trim", 0.3)

self.selected_nodes = {
self:get_node("selected_1"),
self:get_node("selected_2"),
self:get_node("selected_3"),
}
gui.set_alpha(self.selected_nodes[1], 0)
gui.set_alpha(self.selected_nodes[2], 0)
gui.set_alpha(self.selected_nodes[3], 0)

self.button_1 = self.druid:new_button("button_1", self.on_click, 1)
self.text_button_1 = self.druid:new_text("text_button_1")

self.button_2 = self.druid:new_button("button_2", self.on_click, 2)
self.text_button_2 = self.druid:new_text("text_button_2")

self.button_3 = self.druid:new_button("button_3", self.on_click, 3)
self.text_button_3 = self.druid:new_text("text_button_3")

self.container = self.druid:new_container(self.root)
self.container:add_container("text_name", nil, function(_, size)
self.text_name:set_size(size)
end)
self.container:add_container("E_Anchor")
end


function M:on_click(index)
gui.set_alpha(self.selected_nodes[index], 1)
gui.animate(self.selected_nodes[index], "color.w", 0, gui.EASING_INSINE, 0.16)
end


---@param text string
---@return druid.widget.property_three_buttons
function M:set_text_property(text)
self.text_name:set_text(text)
return self
end


return M
Loading