This commit is contained in:
2025-02-12 22:20:20 +09:00
parent eb69977365
commit 2ab8a8ae66

View File

@@ -16,10 +16,8 @@ local precision = {
} }
local font_color = { local font_color = {
-- positive ["positive"] = { r = 0.3, g = 1, b = 0.3 },
[1] = { r = 0.3, g = 1, b = 0.3 }, ["negative"] = { r = 1, g = 0.3, b = 0.3 },
-- negative
[2] = { r = 1, g = 0.3, b = 0.3 },
} }
local function format_n(n) local function format_n(n)
@@ -66,7 +64,7 @@ local production_data_group = Gui.element("production_data_group")
} }
data_1.style.width = 90 data_1.style.width = 90
data_1.style.horizontal_align = "right" data_1.style.horizontal_align = "right"
data_1.style.font_color = font_color[1] data_1.style.font_color = font_color["positive"]
local data_2 = parent.add{ local data_2 = parent.add{
type = "label", type = "label",
@@ -76,7 +74,7 @@ local production_data_group = Gui.element("production_data_group")
} }
data_2.style.width = 90 data_2.style.width = 90
data_2.style.horizontal_align = "right" data_2.style.horizontal_align = "right"
data_2.style.font_color = font_color[2] data_2.style.font_color = font_color["negative"]
local data_3 = parent.add{ local data_3 = parent.add{
type = "label", type = "label",
@@ -86,7 +84,7 @@ local production_data_group = Gui.element("production_data_group")
} }
data_3.style.width = 90 data_3.style.width = 90
data_3.style.horizontal_align = "right" data_3.style.horizontal_align = "right"
data_3.style.font_color = font_color[1] data_3.style.font_color = font_color["positive"]
return item return item
end) end)
@@ -153,15 +151,15 @@ Event.on_nth_tick(60, function()
table[production_prefix .. "_3"].caption = format_n(sum) table[production_prefix .. "_3"].caption = format_n(sum)
if sum < 0 then if sum < 0 then
table[production_prefix .. "_3"].style.font_color = font_color[2] table[production_prefix .. "_3"].style.font_color = font_color["negative"]
else else
table[production_prefix .. "_3"].style.font_color = font_color[1] table[production_prefix .. "_3"].style.font_color = font_color["positive"]
end end
else else
table[production_prefix .. "_1"].caption = "0.0" table[production_prefix .. "_1"].caption = "0.0"
table[production_prefix .. "_2"].caption = "0.0" table[production_prefix .. "_2"].caption = "0.0"
table[production_prefix .. "_3"].caption = "0.0" table[production_prefix .. "_3"].caption = "0.0"
table[production_prefix .. "_3"].style.font_color = font_color[1] table[production_prefix .. "_3"].style.font_color = font_color["positive"]
end end
end end
end end