mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-09 13:37:02 +02:00
Gui improvement on mutagen log
This commit is contained in:
parent
459e68dcc1
commit
9fe486431a
@ -79,8 +79,8 @@ function add_stats(player, food, flask_amount,biter_force_name,evo_before_scienc
|
||||
if global.tm_custom_name["north"] then n = global.tm_custom_name["north"] end
|
||||
if global.tm_custom_name["south"] then s = global.tm_custom_name["south"] end
|
||||
local team_strings = {
|
||||
["north"] = table.concat({"[color=120, 120, 255]", n, "'s[/color]"}),
|
||||
["south"] = table.concat({"[color=255, 65, 65]", s, "'s[/color]"})
|
||||
["north"] = table.concat({"[color=120, 120, 255]", n, "[/color]"}),
|
||||
["south"] = table.concat({"[color=255, 65, 65]", s, "[/color]"})
|
||||
}
|
||||
if flask_amount > 1 then
|
||||
-- FIX HOUR/MIN HANDLING(genre 5h58 => 4H MAIS NON, à tester mon idée)
|
||||
@ -113,18 +113,24 @@ function add_stats(player, food, flask_amount,biter_force_name,evo_before_scienc
|
||||
local formatted_threat_after_feed = math.round(global.bb_threat[biter_force_name],0)
|
||||
local evo_jump = table.concat({evo_before_science_feed .. " to " .. formatted_evo_after_feed})
|
||||
local threat_jump = table.concat({threat_before_science_feed .. " to ".. formatted_threat_after_feed})
|
||||
local line_log_stats_to_add = table.concat({ formatted_amount .. " " .. formatted_food .. " by " .. colored_player_name .. " to " .. team_strings[get_enemy_team_of(player.force.name)] .. " biters"})
|
||||
local evo_jump_difference = math.round(formatted_evo_after_feed - evo_before_science_feed,1)
|
||||
local threat_jump_difference = math.round(formatted_threat_after_feed - threat_before_science_feed,0)
|
||||
local line_log_stats_to_add = table.concat({ formatted_amount .. " " .. formatted_food .. " by " .. colored_player_name .. " to " .. team_strings[get_enemy_team_of(player.force.name)]})
|
||||
|
||||
if global.science_logs_text then
|
||||
table.insert(global.science_logs_date, formatted_feed_time)
|
||||
table.insert(global.science_logs_text, line_log_stats_to_add)
|
||||
table.insert(global.science_logs_evo_jump, evo_jump)
|
||||
table.insert(global.science_logs_evo_jump_difference, evo_jump_difference)
|
||||
table.insert(global.science_logs_threat, threat_jump)
|
||||
table.insert(global.science_logs_threat_jump_difference, threat_jump_difference)
|
||||
else
|
||||
global.science_logs_date = { formatted_feed_time }
|
||||
global.science_logs_text = { line_log_stats_to_add }
|
||||
global.science_logs_evo_jump = { evo_jump }
|
||||
global.science_logs_evo_jump_difference = { evo_jump_difference }
|
||||
global.science_logs_threat = { threat_jump }
|
||||
global.science_logs_threat_jump_difference = { threat_jump_difference }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -5,54 +5,44 @@ local Tabs = require 'comfy_panel.main'
|
||||
|
||||
local function add_science_logs(element)
|
||||
local t = element.add { type = "table", name = "science_logs_header_table", column_count = 4 }
|
||||
local column_widths = {tonumber(100), tonumber(400), tonumber(145), tonumber(145)}
|
||||
for _, w in ipairs(column_widths) do
|
||||
local label = t.add { type = "label", caption = "" }
|
||||
label.style.minimal_width = w
|
||||
label.style.maximal_width = w
|
||||
end
|
||||
|
||||
local column_widths = {tonumber(90), tonumber(340), tonumber(170), tonumber(190)}
|
||||
local headers = {
|
||||
[1] = "Date",
|
||||
[2] = "Science details",
|
||||
[1] = "Time",
|
||||
[2] = "Details",
|
||||
[3] = "Evo jump",
|
||||
[4] = "Threat jump",
|
||||
}
|
||||
|
||||
for k, v in ipairs(headers) do
|
||||
local label = t.add {
|
||||
type = "label",
|
||||
name = "science_logs_panel_header_" .. k,
|
||||
caption = v
|
||||
}
|
||||
label.style.font = "default-bold"
|
||||
label.style.font_color = { r=0.98, g=0.66, b=0.22 }
|
||||
for _, w in ipairs(column_widths) do
|
||||
local label = t.add { type = "label", caption = headers[_] }
|
||||
label.style.minimal_width = w
|
||||
label.style.maximal_width = w
|
||||
label.style.font = "default-bold"
|
||||
label.style.font_color = { r=0.98, g=0.66, b=0.22 }
|
||||
if _ == 1 then
|
||||
label.style.horizontal_align = "center"
|
||||
end
|
||||
end
|
||||
|
||||
-- special style on first header
|
||||
local label = t["science_logs_panel_header_1"]
|
||||
label.style.minimal_width = 36
|
||||
label.style.maximal_width = 36
|
||||
label.style.horizontal_align = "right"
|
||||
|
||||
-- List management
|
||||
local science_panel_table = element.add { type = "scroll-pane", name = "scroll_pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"}
|
||||
science_panel_table.style.maximal_height = 530
|
||||
science_panel_table = science_panel_table.add { type = "table", name = "science_panel_table", column_count = 4, draw_horizontal_lines = true }
|
||||
if global.science_logs_date then
|
||||
local science_scrollpanel = element.add { type = "scroll-pane", name = "scroll_pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"}
|
||||
science_scrollpanel.style.maximal_height = 530
|
||||
for i = 1, #global.science_logs_date, 1 do
|
||||
science_panel_table = science_scrollpanel.add { type = "table", column_count = 4 }
|
||||
local label = science_panel_table.add { type = "label", name = "science_logs_date" .. i, caption = global.science_logs_date[i] }
|
||||
label.style.minimal_width = column_widths[1]
|
||||
label.style.maximal_width = column_widths[1]
|
||||
label.style.horizontal_align = "center"
|
||||
local label = science_panel_table.add { type = "label", name = "science_logs_text" .. i, caption = global.science_logs_text[i] }
|
||||
label.style.minimal_width = column_widths[2]
|
||||
label.style.maximal_width = column_widths[2]
|
||||
local label = science_panel_table.add { type = "label", name = "science_logs_evo_jump" .. i, caption = global.science_logs_evo_jump[i] }
|
||||
local label = science_panel_table.add { type = "label", name = "science_logs_evo_jump" .. i, caption = global.science_logs_evo_jump[i].." [color=200,200,200](+"..global.science_logs_evo_jump_difference[i]..")[/color]" }
|
||||
label.style.minimal_width = column_widths[3]
|
||||
label.style.maximal_width = column_widths[3]
|
||||
local label = science_panel_table.add { type = "label", name = "science_logs_threat" .. i, caption = global.science_logs_threat[i] }
|
||||
local label = science_panel_table.add { type = "label", name = "science_logs_threat" .. i, caption = global.science_logs_threat[i].." [color=200,200,200](+"..global.science_logs_threat_jump_difference[i]..")[/color]" }
|
||||
label.style.minimal_width = column_widths[4]
|
||||
label.style.maximal_width = column_widths[4]
|
||||
science_scrollpanel.add({type = "line"})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -68,7 +58,7 @@ local function on_gui_click(event)
|
||||
if not event.element.valid then return end
|
||||
end
|
||||
|
||||
comfy_panel_tabs["ScienceLogs"] = build_config_gui
|
||||
comfy_panel_tabs["MutagenLog"] = build_config_gui
|
||||
|
||||
|
||||
local event = require 'utils.event'
|
||||
|
Loading…
x
Reference in New Issue
Block a user