Updated theming, added dangerous (red) button style, replaced Simulator edit_line with edit_box, tweaked various styles

This commit is contained in:
2020-06-16 00:08:56 -05:00
parent 79b53fdd7a
commit b19826d51f
10 changed files with 142 additions and 111 deletions

View File

@@ -3,9 +3,9 @@ module TAC
class AlertDialog < Dialog
def build
background Gosu::Color::GRAY
label @options[:message], text_size: 18
label @options[:message]
button "Close", width: 1.0, text_size: 18 do
button "Close", width: 1.0 do
close
end
end

View File

@@ -3,13 +3,13 @@ module TAC
class ConfirmDialog < Dialog
def build
background Gosu::Color::GRAY
label @options[:message], text_size: 18
label @options[:message]
flow width: 1.0 do
button "Cancel", width: 0.475, text_size: 18 do
button "Cancel", width: 0.475 do
close
end
button "Okay", width: 0.475, text_size: 18 do
button "Okay", width: 0.475 do
close
@options[:callback_method].call

View File

@@ -4,21 +4,21 @@ module TAC
def build
background Gosu::Color::GRAY
flow width: 1.0 do
label "Name", width: 0.25, text_size: 18
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", width: 0.70, text_size: 18
label "Name", width: 0.25
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", width: 0.70
end
@name_error = label "", text_size: 18, color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error = label "", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
flow width: 1.0 do
button "Cancel", width: 0.475, text_size: 18 do
button "Cancel", width: 0.475 do
close
end
accept_label = @options[:renaming] ? "Update" : "Add"
accept_label = @options[:accept_label] if @options[:accept_label]
button accept_label, width: 0.475, text_size: 18 do
button accept_label, width: 0.475 do
if @name.value.strip.empty?
@name_error.value = "Name cannot be blank.\nName cannot only be whitespace."
@name_error.show

View File

@@ -7,17 +7,17 @@ module TAC
@type = @options[:variable].type if @options[:variable]
label "Name"
@name_error = label "Error", text_size: 18, color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:variable] ? @options[:variable].name : "", text_size: 18
@name = edit_line @options[:variable] ? @options[:variable].name : ""
label "Type"
@type_error = label "Error", text_size: 18, color: TAC::Palette::TACNET_CONNECTION_ERROR
@type_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@type_error.hide
# TODO: Add dropdown menus to CyberarmEngine
flow width: 1.0 do
[:float, :double, :integer, :long, :string, :boolean].each do |btn|
button btn, text_size: 18 do
button btn do
@type = btn
@value_container.show
end
@@ -26,17 +26,17 @@ module TAC
@value_container = stack width: 1.0 do
label "Value"
@value_error = label "Error", text_size: 18, color: TAC::Palette::TACNET_CONNECTION_ERROR
@value_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@value_error.hide
@value = edit_line @options[:variable] ? @options[:variable].value : "", text_size: 18
@value = edit_line @options[:variable] ? @options[:variable].value : ""
end
flow width: 1.0 do
button "Cancel", width: 0.475, text_size: 18 do
button "Cancel", width: 0.475 do
close
end
button @options[:variable] ? "Update" : "Add", width: 0.475, text_size: 18 do |b|
button @options[:variable] ? "Update" : "Add", width: 0.475 do |b|
if valid?
if @options[:variable]
@options[:callback_method].call(@options[:variable], @name.value.strip, @type, @value.value.strip)