mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 02:17:52 +02:00
Update
This commit is contained in:
parent
50e59d9469
commit
74ddc67469
@ -1,5 +1,7 @@
|
|||||||
-- Place this script nearby with the gui component to able make requests
|
-- Place this script nearby with the gui component to able make requests
|
||||||
-- To the go namespace from GUI with events systems (cross context)
|
-- To the go namespace from GUI with events systems (cross context)
|
||||||
|
-- This one is a required to make a unified "Shaders" pipeline in the GUI scripts
|
||||||
|
-- This required to grab a texture data with `go.get` function
|
||||||
|
|
||||||
local defer = require("event.defer")
|
local defer = require("event.defer")
|
||||||
|
|
||||||
|
@ -1,28 +1,30 @@
|
|||||||
local druid = require("druid.druid")
|
--- Attach this script to your GUI file instead custom *.gui_script file
|
||||||
|
--- This allows to grab a widget from the GO scripts by gui_url
|
||||||
|
--- To do this you need to call `druid.get_widget` in the GO script
|
||||||
|
--- The new widget will be created and returned to GO script
|
||||||
|
--- And now all top level functions from the widget will be available in the GO script
|
||||||
|
--- Use with caution, this is a new feature, but allow utilize flexability of `event` module
|
||||||
|
|
||||||
|
local druid = require("druid.druid")
|
||||||
|
|
||||||
function init(self)
|
function init(self)
|
||||||
self.druid = druid.new(self)
|
self.druid = druid.new(self)
|
||||||
druid.register_druid_as_widget(self.druid)
|
druid.register_druid_as_widget(self.druid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function final(self)
|
function final(self)
|
||||||
druid.unregister_druid_as_widget()
|
druid.unregister_druid_as_widget()
|
||||||
self.druid:final()
|
self.druid:final()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function update(self, dt)
|
function update(self, dt)
|
||||||
self.druid:update(dt)
|
self.druid:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function on_message(self, message_id, message, sender)
|
function on_message(self, message_id, message, sender)
|
||||||
self.druid:on_message(message_id, message, sender)
|
self.druid:on_message(message_id, message, sender)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function on_input(self, action_id, action)
|
function on_input(self, action_id, action)
|
||||||
return self.druid:on_input(action_id, action)
|
return self.druid:on_input(action_id, action)
|
||||||
end
|
end
|
||||||
|
@ -60,12 +60,11 @@ end
|
|||||||
---Remove a backup file
|
---Remove a backup file
|
||||||
---@param backup_path string - The path of the backup file to remove
|
---@param backup_path string - The path of the backup file to remove
|
||||||
local function remove_backup(backup_path)
|
local function remove_backup(backup_path)
|
||||||
print("Removing backup file:", backup_path)
|
-- Check file exists and remove it
|
||||||
local success, err = os.remove(backup_path)
|
local file = io.open(backup_path, "r")
|
||||||
if not success then
|
if file then
|
||||||
print("Warning: Could not remove backup file:", err)
|
file:close()
|
||||||
print("You may want to manually remove it:", backup_path)
|
os.remove(backup_path)
|
||||||
else
|
|
||||||
print("Backup file removed successfully")
|
print("Backup file removed successfully")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,8 +9,8 @@ local function to_camel_case(snake_str)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M.create_druid_widget(opts)
|
function M.create_druid_widget(selection)
|
||||||
local gui_filepath = editor.get(opts.selection, "path")
|
local gui_filepath = editor.get(selection, "path")
|
||||||
local filename = gui_filepath:match("([^/]+)%.gui$")
|
local filename = gui_filepath:match("([^/]+)%.gui$")
|
||||||
print("Create Druid widget for", gui_filepath)
|
print("Create Druid widget for", gui_filepath)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user