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,33 @@
local event = require("druid.event")
local timer = require("druid.extended.timer")
local component = require("druid.component")
---@class basic_timer: druid.component
---@field druid druid_instance
---@field root node
---@field text druid.text
local M = component.create("basic_timer")
---@param template string
---@param nodes table<hash, node>
function M:init(template, nodes)
self.druid = self:get_druid(template, nodes)
self.root = self:get_node("root")
self.timer = self.druid:new(timer, "text")
local time = 5
self.timer:set_interval(time, 0)
self.timer.on_timer_end:subscribe(function()
time = time + 5
self.timer:set_interval(time, 0)
self.on_cycle_end:trigger()
end)
self.on_cycle_end = event.create()
end
return M