1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Gui fixes

This commit is contained in:
James Gillham 2020-11-24 17:44:31 +00:00
parent 171737e587
commit 762d31d465
16 changed files with 64 additions and 53 deletions

View File

@ -49,12 +49,13 @@ local function toggle_main_frame(event)
if frame then
Gui.destroy(frame)
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
frame =
left.add {type = 'frame', name = main_frame_name, caption = {'autofill.frame_name'}, direction = 'vertical'}
@ -73,7 +74,7 @@ local function toggle_main_frame(event)
ammo_count_flow.add {
type = 'textfield',
name = ammo_count_name,
text = Autofill.get_ammo_count(player_index)
text = tostring(Autofill.get_ammo_count(player_index))
}
local enabled_ammos_flow = frame.add {type = 'flow', direction = 'horizontal'}
@ -184,7 +185,7 @@ local function settings_changed(event)
local ammo_count_label = data.ammo_count_label
local ammo_count_textfield = data.ammo_count_textfield
ammo_count_textfield.text = event.new_value
ammo_count_textfield.text = tostring(event.new_value)
set_ammo_count_elements_validation(ammo_count_textfield, ammo_count_label, true)
end
end

View File

@ -366,12 +366,13 @@ local function toggle(event)
end
end
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
main_frame =
left.add {

View File

@ -636,7 +636,7 @@ end
local function close_main_frame(frame, player)
upload_changelog(player)
Gui.destroy(frame)
player.gui.top[main_button_name].style = 'icon_button'
player.gui.top[main_button_name].style = 'slot_button'
end
local function reward_player(player, index, message)
@ -672,10 +672,11 @@ local function toggle(event)
if main_frame then
close_main_frame(main_frame, player)
else
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
draw_main_frame(center, player)
end

View File

@ -249,12 +249,13 @@ local function toggle(event)
if main_frame and main_frame.valid then
Gui.destroy(main_frame)
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
main_frame =
left.add {

View File

@ -646,12 +646,13 @@ local function toggle(event)
if main_frame then
remove_main_frame(main_frame, player)
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
draw_main_frame(left, player)
end

View File

@ -444,14 +444,15 @@ local function toggle(event)
if main_frame then
remove_main_frame(main_frame, left, event.player)
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
draw_main_frame(left, event.player)
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
end
end

View File

@ -13,7 +13,7 @@ local Public = {}
local function close_main_frame(frame, player)
Gui.destroy(frame)
player.gui.top[main_button_name].style = 'icon_button'
player.gui.top[main_button_name].style = 'slot_button'
end
local function player_created(event)
@ -59,7 +59,7 @@ end
local function set_element_value(element, value)
if element.type == 'text-box' then
element.text = value
element.text = tostring(value)
return
end
if element.type == 'slider' then
@ -81,7 +81,7 @@ local function create_input_element(frame, type, value)
end
-- ensure something is always added to prevent errors
return frame.add({type = 'text-box', text = value})
return frame.add({type = 'text-box', text = tostring(value)})
end
local function draw_main_frame(center, player)
@ -187,10 +187,11 @@ local function toggle(event)
else
draw_main_frame(center, player)
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
end
end

View File

@ -158,13 +158,14 @@ Gui.on_click(
if not frame then
score_show(top)
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
else
frame.destroy()
main_button.style = 'icon_button'
main_button.style = 'slot_button'
end
end
)

View File

@ -311,14 +311,15 @@ local function toggle(event)
if main_frame then
Gui.destroy(main_frame)
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
draw_main_frame(event.player)
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
end
end

View File

@ -453,14 +453,15 @@ local function toggle(event)
Gui.destroy(frame)
end
main_button.style = 'icon_button'
main_button.style = 'slot_button'
else
draw_main_frame(left, player)
main_button.style = 'slot_sized_button'
main_button.style = 'highlighted_tool_button'
local style = main_button.style
style.width = 38
style.height = 38
style.width = 40
style.height = 40
style.padding = 0
end
end

View File

@ -508,7 +508,7 @@ Gui.on_value_changed(count_slider_name, function (event)
end
data.count = count
data.text.text = count
data.text.text = tostring(count)
redraw_market_items(data)
end)

View File

@ -28,7 +28,7 @@ softmods_rank_is=Your rank is:
softmods_market_label=Market
softmods_market_text=On most maps you will find a market near spawn where you can use coins to\nmake purchases. Coins are acquired by chopping trees, hand crafting items and\ndestroying biter nests. Most items in the market are constant but some are\nmap-specific (usually landfill) and will rotate in and out from time to time.
softmods_saviour_label=Train\nsavior
softmods_saviour_text=Trains are a factorio players' worst enemy. If you have at least one small plane\nin your inventory and would be killed by a train, your life will be spared\nbut you will lose a small plane. You can get planes from the market.
softmods_saviour_text=Trains are a factorio players' worst enemy. If you have at least one player port\nin your inventory and would be killed by a train, your life will be spared\nbut you will lose a player port. You can get planes from the market.
softmods_plist_label=Player\nlist
softmods_plist_text=Lists all players on the server and shows some stats. You can sort the list by\nclicking on the column headers. You can also poke people, which throws a random\nnoun in the chat.
softmods_polls_label=Polls

View File

@ -787,7 +787,7 @@ local function init(config)
price = 100,
name = 'player-port',
name_label = 'Train Immunity (1x use)',
description = 'Each small plane in your inventory will save you from being killed by a train once.'
description = 'Each player port in your inventory will save you from being killed by a train once.'
}
}
}

View File

@ -79,6 +79,8 @@ function Debug.print_grid_value(value, surface, position, scale, offset, immutab
end
end
text = tostring(text)
if not immutable then
local text_entity = surface.find_entity('flying-text', position)
@ -153,6 +155,8 @@ function Debug.print_colored_grid_value(value, surface, position, offset, immuta
end
end
text = tostring(text)
if not immutable then
local text_entity = surface.find_entity('flying-text', position)

View File

@ -498,7 +498,7 @@ function Experience.toggle(event)
if (frame and event.trigger == nil) then
Gui.destroy(frame)
main_button.style = 'icon_button'
main_button.style = 'slot_button'
return
elseif (frame) then
local data = Gui.get_data(frame)
@ -508,10 +508,7 @@ function Experience.toggle(event)
return
end
main_button.style = 'slot_sized_button'
local style = main_button.style
style.width = 38
style.height = 38
main_button.style = 'highlighted_tool_button'
frame = left.add({name = 'Diggy.Experience.Frame', type = 'frame', direction = 'vertical'})

View File

@ -249,7 +249,7 @@ Event.add(
}
local style = b.style
style.width = 18
style.height = 38
style.height = 40
style.left_padding = 0
style.top_padding = 0
style.right_padding = 0