mirror of
https://github.com/Insality/druid.git
synced 2025-09-28 10:32:20 +02:00
Update example with new brand one
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
local component = require("druid.component")
|
||||
local progress = require("druid.extended.progress")
|
||||
|
||||
---@class basic_progress_bar_slice9: druid.base_component
|
||||
---@field druid druid_instance
|
||||
---@field progress druid.progress
|
||||
local M = component.create("basic_progress_bar_slice9")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
self.progress = self.druid:new(progress, "progress_bar_fill", "x")
|
||||
self.text_value = self:get_node("progress_value")
|
||||
|
||||
self:set_value(self.progress:get())
|
||||
end
|
||||
|
||||
|
||||
function M:set_value(value)
|
||||
gui.set_text(self.text_value, math.ceil(value * 100) .. "%")
|
||||
self.progress:set_to(value)
|
||||
end
|
||||
|
||||
|
||||
return M
|
Reference in New Issue
Block a user