mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Feature: Toolbar Menu (#268)
* Fix left flow not using uids * Mock Toolbar menu * Fix task list after core gui change * Allow show/hide override * Fix autofill permissions * Copy style from toolbar on change * Open and close automatically * Removed hacky prevent default * Fixed more core issues * Add reset button * Allow for custom draw order on join * Add methods to reorder ui flows * Impliment move buttons * Add locale * Add toolbar to player data * Better player data layout * Picked a suitable datastore id * Update locale for readme * Fix swaping left flow order * Fix datastore updates * Code cleanup * Fix incorrect top flow hashing on load * Fix loading of malformed data * Fixed loading state of left flows * Dont save default data * Dont open menu on join * Lint * Remove incorrect new index metamethod * Revert method used for move_toolbar_button * Fixed missing toolbar button * Fixed desync between visibilty and toggle state * Fix bad gui element path * Fixed enable state of toggle button * Change order of operations * Fix reset not showing top flow
This commit is contained in:
@@ -175,24 +175,26 @@ local subfooter_actions =
|
||||
local task_list_item =
|
||||
Gui.element(
|
||||
function(definition, parent, task)
|
||||
local flow =
|
||||
parent.add {
|
||||
local flow = parent.add {
|
||||
type = "flow",
|
||||
name = "task-" .. task.task_id,
|
||||
caption = task.task_id
|
||||
}
|
||||
|
||||
flow.style.horizontally_stretchable = true
|
||||
local button =
|
||||
flow.add {
|
||||
|
||||
local button = flow.add {
|
||||
name = definition.name,
|
||||
type = "button",
|
||||
style = "list_box_item",
|
||||
caption = task.title
|
||||
caption = task.title,
|
||||
tooltip = { "task-list.last-edit", task.last_edit_name, format_time(task.last_edit_time) }
|
||||
}
|
||||
definition:triggers_events(button)
|
||||
|
||||
button.style.horizontally_stretchable = true
|
||||
button.style.horizontally_squashable = true
|
||||
return flow
|
||||
|
||||
return button
|
||||
end
|
||||
):on_click(
|
||||
function(player, element, _)
|
||||
@@ -487,11 +489,7 @@ local repopulate_task_list = function(task_list_element)
|
||||
for _, task_id in ipairs(task_ids) do
|
||||
-- Add the task
|
||||
local task = Tasks.get_task(task_id)
|
||||
local element = task_list_item(task_list_element, task)
|
||||
-- Set tooltip
|
||||
local last_edit_name = task.last_edit_name
|
||||
local last_edit_time = task.last_edit_time
|
||||
element[task_list_item.name].tooltip = {"task-list.last-edit", last_edit_name, format_time(last_edit_time)}
|
||||
task_list_item(task_list_element, task)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -560,19 +558,16 @@ local update_task = function(player, task_list_element, task_id)
|
||||
return
|
||||
end
|
||||
|
||||
local element
|
||||
-- If task does not exist yet add it to the list
|
||||
if not task_list_element["task-" .. task_id] then
|
||||
element = task_list_item(task_list_element, task)
|
||||
local flow = task_list_element["task-" .. task_id]
|
||||
if not flow then
|
||||
-- If task does not exist yet add it to the list
|
||||
task_list_item(task_list_element, task)
|
||||
else
|
||||
-- If the task exists update the caption
|
||||
element = task_list_element["task-" .. task_id]
|
||||
element[task_list_item.name].caption = task.title
|
||||
-- If the task exists update the caption and tooltip
|
||||
local button = flow[task_list_item.name]
|
||||
button.caption = task.title
|
||||
button.tooltip = {"task-list.last-edit", task.last_edit_name, format_time(task.last_edit_time)}
|
||||
end
|
||||
-- Set tooltip
|
||||
local last_edit_name = task.last_edit_name
|
||||
local last_edit_time = task.last_edit_time
|
||||
element[task_list_item.name].tooltip = {"task-list.last-edit", last_edit_name, format_time(last_edit_time)}
|
||||
end
|
||||
|
||||
-- Update the footer task edit view
|
||||
|
||||
Reference in New Issue
Block a user