18 Commits

Author SHA1 Message Date
b17e24c630 Show coordinates on Field Planner to match official FTC coordinate system 2024-12-10 17:16:07 -06:00
f5f9870ae7 Fixed crash when config file is defined in settings but file doesn't exist 2024-12-10 16:11:14 -06:00
cec3f90f3c Added Into the Deep field 2024-12-10 15:33:28 -06:00
93bfc80a97 Fixed typo 2024-12-10 11:45:42 -06:00
c37dc7112b Fixed crash when commiting variable name update, fixed crashed from wip editor 2024-12-10 11:26:26 -06:00
f60aadac72 Fix missing wip causing crash 2024-12-09 20:08:12 -06:00
628212b5e3 Replace usages of label with para, WIP new Editor (v3) 2024-06-26 19:13:46 -05:00
86c1f24337 Migrate to Ocran, update release date 2024-01-19 17:52:06 -06:00
3aa63b4ad1 Adjust version 2024-01-18 18:12:05 -06:00
abdb86440f Added support for moving children, worked around bug in Ruby's Integer('08') parser, misc. tweaks. 2024-01-18 17:38:53 -06:00
b8cb9b9ab8 Update gems, bump version 2024-01-18 14:29:09 -06:00
c4622fa563 Make action adjust its indention when renamed 2024-01-04 17:48:58 -06:00
d49938855d Update gems 2024-01-04 17:31:41 -06:00
6554140acf Improvements to action shifting 2024-01-04 17:31:23 -06:00
43510faaa2 Made subbase actions indented, added buttons to shift actions up or down (a hair buggy but functional) 2024-01-02 18:49:17 -06:00
3350f4f063 Fix configs not sorting as downcased 2023-12-17 20:51:00 -06:00
49133bb49d update gems 2023-12-11 20:13:04 -06:00
8aaed6bc8d Fix importing action presets not correctly preventing duplicate names 2023-12-11 20:12:39 -06:00
25 changed files with 431 additions and 122 deletions

View File

@@ -1,9 +1,8 @@
source "https://rubygems.org"
gem "cyberarm_engine"
gem "gosu_notifications"
group :packaging do
gem "ocra"
gem "releasy"
end
gem "ocran"
# gem "releasy", path: "../releasy"
end

View File

@@ -1,33 +1,18 @@
GEM
remote: https://rubygems.org/
specs:
cri (2.1.0)
cyberarm_engine (0.23.0)
excon (~> 0.88)
cyberarm_engine (0.24.4)
gosu (~> 1.1)
gosu_more_drawables (~> 0.3)
excon (0.104.0)
gosu (1.4.6)
gosu_more_drawables (0.3.1)
gosu_notifications (0.1.0)
ocra (1.3.11)
rake (13.1.0)
releasy (0.2.3)
bundler (>= 1.2.1)
cri (~> 2.1.0)
ocra (~> 1.3.0)
rake (>= 0.9.2.2)
ocran (1.3.15)
PLATFORMS
x64-mingw-ucrt
x64-mingw32
x86_64-linux
DEPENDENCIES
cyberarm_engine
gosu_notifications
ocra
releasy
ocran
BUNDLED WITH
2.4.3
2.5.14

View File

@@ -11,7 +11,7 @@ module TAC
@titlebar = flow(width: 1.0, height: 36) do
background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY]
label @title, text_size: THEME_SUBHEADING_TEXT_SIZE, font: TAC::THEME_BOLD_FONT, fill: true, text_align: :center, text_border: true, text_border_color: 0xaa_222222, text_border_size: 1
para @title, text_size: THEME_SUBHEADING_TEXT_SIZE, font: TAC::THEME_BOLD_FONT, fill: true, text_align: :center, text_border: true, text_border_color: 0xaa_222222, text_border_size: 1
button get_image("#{TAC::MEDIA_PATH}/icons/cross.png"), image_height: 1.0, **THEME_DANGER_BUTTON do
close

View File

@@ -4,15 +4,15 @@ module TAC
def build
background Gosu::Color::GRAY
label "Name", width: 1.0, text_align: :center
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
para "Name", width: 1.0, text_align: :center
@name_error = para "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:action] ? @options[:action].name : "", filter: method(:name_filter), width: 1.0, autofocus: true, focus: true
@name.subscribe(:changed) do |sender, value|
valid?
end
label "Comment", width: 1.0, text_align: :center
para "Comment", width: 1.0, text_align: :center
@comment = edit_line @options[:action] ? @options[:action].comment : "", width: 1.0
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do

View File

@@ -3,7 +3,7 @@ module TAC
class AlertDialog < Dialog
def build
background Gosu::Color::GRAY
label @options[:message]
para @options[:message]
button "Close", width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
try_commit

View File

@@ -11,7 +11,7 @@ module TAC
@titlebar.style.default[:background] = [ color, darken(color, 50) ]
background Gosu::Color::GRAY
label @options[:message]
para @options[:message]
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.5 do

View File

@@ -5,8 +5,8 @@ module TAC
def build
background Gosu::Color::GRAY
label "Name", width: 1.0, text_align: :center
@name_error = label "", color: TAC::Palette::TACNET_CONNECTION_ERROR
para "Name", width: 1.0, text_align: :center
@name_error = para "", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", filter: method(:name_filter), width: 1.0, autofocus: true, focus: true

View File

@@ -6,7 +6,7 @@ module TAC
@titlebar.style.default[:background] = [ Palette::TACNET_PRIMARY, Palette::TACNET_SECONDARY ]
background Gosu::Color::GRAY
label @options[:message], width: 1.0
para @options[:message], width: 1.0
@sound = Gosu::Sample.new("#{TAC::MEDIA_PATH}/error_alarm.ogg").play(1, 1, true)

View File

@@ -3,7 +3,7 @@ module TAC
class TACNETStatusDialog < Dialog
def build
background Gosu::Color::GRAY
@message_label = label CyberarmEngine::Window.instance.backend.tacnet.full_status
@message_label = para CyberarmEngine::Window.instance.backend.tacnet.full_status
button "Close", width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
try_commit

View File

@@ -6,16 +6,16 @@ module TAC
@type = @options[:variable].type if @options[:variable]
label "Name", width: 1.0, text_align: :center
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
para "Name", width: 1.0, text_align: :center
@name_error = para "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:variable] ? @options[:variable].name : "", filter: method(:name_filter), width: 1.0, autofocus: true, focus: true
@name.subscribe(:changed) do |sender, value|
valid?
end
label "Type", width: 1.0, text_align: :center
@type_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
para "Type", width: 1.0, text_align: :center
@type_error = para "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@type_error.hide
@var_type = list_box items: [:float, :double, :integer, :long, :string, :boolean], choose: @type ? @type : :double, width: 1.0 do |item|
@@ -35,8 +35,8 @@ module TAC
@type ||= @var_type.value.to_sym
@value_container = stack width: 1.0 do
label "Value", width: 1.0, text_align: :center
@value_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
para "Value", width: 1.0, text_align: :center
@value_error = para "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@value_error.hide
@value = edit_line @options[:variable] ? @options[:variable].value : "", width: 1.0
@value_boolean = check_box "Boolean", checked: @options[:variable] ? @options[:variable].value == "true" : false

View File

@@ -42,7 +42,7 @@ module TAC
end
### --- ###
# OVERRIDE: offical CenterStage game clock no longer has colors
# OVERRIDE: official CenterStage game clock no longer has colors
### --- ###
out = Gosu::Color::WHITE

View File

@@ -95,13 +95,13 @@ module TAC
background @menu_background
flow(width: 1.0) do
label "♫ Now playing:"
@current_song_label = label "♫ ♫ ♫"
para "♫ Now playing:"
@current_song_label = para "♫ ♫ ♫"
end
flow(width: 1.0) do
label "Volume:"
@current_volume_label = label "100%"
para "Volume:"
@current_volume_label = para "100%"
end
flow(width: 1.0) do

View File

@@ -27,8 +27,8 @@ module TAC
status_bar.clear do
flow(width: 1.0, max_width: 720, h_align: :center) do
label "Current Configuration: "
@config_label = label window.backend.settings.config
para "Current Configuration: "
@config_label = para window.backend.settings.config
end
end
@@ -45,7 +45,7 @@ module TAC
@config_files_list = @config_files.map { |file| Dialog::NamePromptDialog::NameStub.new(File.basename(file, ".json")) }
@configs_list.clear do
@config_files.each_with_index do |config_file, i|
@config_files.sort_by { |f| [f.downcase] }.each_with_index do |config_file, i|
flow width: 1.0, height: 36, **THEME_ITEM_CONTAINER_PADDING do
name = File.basename(config_file, ".json")

View File

@@ -30,13 +30,13 @@ module TAC
status_bar.clear do
flow(width: 0.3333) do
label "Active group:", margin_right: 20
@active_group_label = label ""
para "Active group:", margin_right: 20
@active_group_label = para ""
end
flow(width: 0.3333) do
label "Active action:", margin_right: 20
@active_action_label = label ""
para "Active action:", margin_right: 20
@active_action_label = para ""
end
end
@@ -44,7 +44,7 @@ module TAC
flow(width: 1.0, height: 1.0) do
stack fill: true, height: 1.0, padding_left: 2, padding_right: 2, border_thickness_right: 1, border_color: Gosu::Color::BLACK do
@groups_menu = flow(width: 1.0, height: 36) do
label "Groups", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
para "Groups", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add group" do
push_state(TAC::Dialog::NamePromptDialog, title: "Create Group", list: window.backend.config.groups, callback_method: method(:create_group))
@@ -117,9 +117,29 @@ module TAC
stack fill: true, height: 1.0, padding_left: 2, padding_right: 2, border_thickness_right: 1, border_color: Gosu::Color::BLACK do
@actions_menu = flow(width: 1.0, height: 36) do
label "Actions", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
para "Actions", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add action" do
# TODO: Implement this
# button get_image("#{TAC::MEDIA_PATH}/icons/barsHorizontal.png"), image_width: THEME_ICON_SIZE, tip: "Auto renumber engine actions", margin_right: 16, enabled: false do
# end
button get_image("#{TAC::MEDIA_PATH}/icons/up.png"), image_width: THEME_ICON_SIZE, tip: "Move selected action up (and its children, if holding SHIFT)" do
if @active_group && @active_action
shift_action(@active_action, :up)
else
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to shift action, no action selected.")
end
end
button get_image("#{TAC::MEDIA_PATH}/icons/down.png"), image_width: THEME_ICON_SIZE, tip: "Move selected action down (and its children, if holding SHIFT)" do
if @active_group && @active_action
shift_action(@active_action, :down)
else
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to shift action, no action selected.")
end
end
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add action", margin_left: 16 do
if @active_group
push_state(TAC::Dialog::ActionDialog, title: "Create Action", list: @active_group.actions, callback_method: method(:create_action))
else
@@ -170,7 +190,7 @@ module TAC
button get_image("#{TAC::MEDIA_PATH}/icons/import.png"), image_width: THEME_ICON_SIZE, tip: "Import action from preset" do
if @active_group
push_state(Dialog::PickPresetDialog, title: "Pick Action Preset", limit: :actions, callback_method: proc { |preset|
push_state(Dialog::ActionDialog, title: "Name Action", action: preset, accept_label: "Add", list: @active_group.actions, callback_method: proc { |action, name, comment|
push_state(Dialog::ActionDialog, title: "Name Action", action: preset, cloning: true, accept_label: "Add", list: @active_group.actions, callback_method: proc { |action, name, comment|
clone = TAC::Config::Action.from_json( JSON.parse( action.to_json, symbolize_names: true ))
clone.name = name.to_s
clone.comment = comment.to_s
@@ -201,7 +221,7 @@ module TAC
stack fill: true, height: 1.0, padding_left: 2, padding_right: 2 do
@variables_menu = flow(width: 1.0, height: 36) do
label "Variables", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
para "Variables", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add variable" do
if @active_action
push_state(TAC::Dialog::VariableDialog, title: "Create Variable", list: @active_action.variables, callback_method: method(:create_variable))
@@ -305,7 +325,7 @@ module TAC
window.backend.config_changed!
group_container = find_element_by_tag(@groups_list, old_name)
label = find_element_by_tag(group_container, "label")
para = find_element_by_tag(group_container, "label")
label.value = name
@@ -362,7 +382,7 @@ module TAC
window.backend.config_changed!
action_container = find_element_by_tag(@actions_list, old_name)
label = find_element_by_tag(action_container, "label")
para = find_element_by_tag(action_container, "label")
comment_container = find_element_by_tag(action_container, "comment_container")
comment_label = find_element_by_tag(action_container, "comment")
@@ -377,6 +397,12 @@ module TAC
comment_label.value = comment.to_s
end
if action_is_child?(action)
action_container.style.default[:margin_left] = 72
else
action_container.style.default[:margin_left] = 0
end
action_container.style.tag = name
update_list_children(@actions_list)
@@ -428,11 +454,11 @@ module TAC
window.backend.config_changed!
variable_container = find_element_by_tag(@variables_list, old_name)
label = find_element_by_tag(variable_container, "label")
para = find_element_by_tag(variable_container, "label")
type = find_element_by_tag(variable_container, "type")
value = find_element_by_tag(variable_container, "value")
label.value = name
para.value = name
type.value = "Type: #{variable.type}"
value.value = "Value: #{variable.value}"
@@ -565,7 +591,10 @@ module TAC
def add_action_container(action)
index = @active_group.actions.index(action)
stack width: 1.0, height: action.comment.empty? ? 36 : 72, **THEME_ITEM_CONTAINER_PADDING, tag: action.name do |container|
# Determine whether we should intent this action's container element because it is for a child state (i.e. 00-01)
indent = action_is_child?(action)
stack width: 1.0, height: action.comment.empty? ? 36 : 72, **THEME_ITEM_CONTAINER_PADDING, margin_left: indent ? 72 : 0, tag: action.name do |container|
background action == @active_action ? THEME_HIGHLIGHTED_COLOR : (index.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR)
@active_action_container = container if action == @active_action
@@ -622,6 +651,176 @@ module TAC
end
end
def shift_action(action, direction)
# Determine whether this action is named as required for this operation
valid_name = valid_engine_action_name?(action)
am_child = action_is_child?(action)
index = @active_group.actions.index(action)
move_children = shift_down? # require that a SHIFT key is down when moving childen with their current parent to prevent undesired relocations.
unless valid_name
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to shift action, incorrectly formated name.\nExpected: name to be like '00-00' not '#{action.name}'")
return
end
base_int = valid_name[0]
subbase_int = valid_name[1]
return if direction == :up && index.zero?
index_before = index - 1 >= 0 ? index - 1 : nil
index_next = index + 1 < @active_group.actions.size ? index + 1 : nil
mutated = false
case direction
when :up
if index_before
other = @active_group.actions[index_before]
other_is_child = action_is_child?(other)
i = index
while(other && ((!am_child && other_is_child) || (am_child && !other_is_child)))
i -= 1
index_before = i - 1 >= 0 ? i - 1 : nil
return unless index_before
return if am_child && valid_engine_action_name?(other).to_a[0].to_i != base_int
other = @active_group.actions[index_before]
other_is_child = action_is_child?(other)
end
move_child_actions(other, action) if move_children
swap_action(action, other)
mutated = true
end
when :down
if index_next
other = @active_group.actions[index_next]
other_is_child = action_is_child?(other)
i = index
while(other && ((!am_child && other_is_child) || (am_child && !other_is_child)))
i += 1
index_next = i + 1 < @active_group.actions.size ? i + 1 : nil
return unless index_next
return if am_child && valid_engine_action_name?(other).to_a[0].to_i != base_int
other = @active_group.actions[index_next]
other_is_child = action_is_child?(other)
end
move_child_actions(action, other) if move_children
swap_action(action, other)
mutated = true
end
end
return unless mutated
@active_group.actions.sort_by! { |a| a.name.downcase }
window.backend.config_changed!
@active_action_label.value = action.name
update_list_children(@actions_list)
scroll_into_view(action)
end
def swap_action(action, other)
old_name = action.name
new_name = other.name
action.name = other.name
other.name = old_name
action_container = find_element_by_tag(@actions_list, old_name)
action_label = find_element_by_tag(action_container, "label")
other_container = find_element_by_tag(@actions_list, new_name)
other_label = find_element_by_tag(other_container, "label")
action_container.style.tag = action.name
other_container.style.tag = other.name
action_label.value = action.name
other_label.value = other.name
end
def move_child_actions(action, other)
# Ordered: OTHER, ACTION
children = [select_child_actions(other), select_child_actions(action)]
[action, other].each_with_index do |a, i|
new_base_int, _new_subbase_int = valid_engine_action_name?(a)
children[i].each do |child|
child_base_int, child_subbase_int = valid_engine_action_name?(child)
# puts format("MOVING CHILD: #{child.name} (#{child.comment}) from %02d-00 to %02d-00", child_base_int, new_base_int)
new_name = format("%02d-%02d", new_base_int, child_subbase_int)
action_container = find_element_by_tag(@actions_list, child.name)
action_label = find_element_by_tag(action_container, "label")
action_container.style.tag = new_name
action_label.value = new_name
child.name = new_name
end
end
end
def select_child_actions(action)
valid_name = valid_engine_action_name?(action)
@active_group.actions.select do |a|
child_base_int, _child_subbase_int = valid_engine_action_name?(a)
next unless child_base_int
child_base_int == valid_name[0] && action_is_child?(a)
end
end
def valid_engine_action_name?(action)
base, subbase = action.name.split("-", 2)
base_int = -1
subbase_int = -1
return false unless base && subbase
return false unless base.length == 2 && subbase.length == 2
# Work around bug in Ruby's `Integer("08")` parser
base = base[0] == "0" ? base[1] : base
subbase = subbase[0] == "0" ? subbase[1] : subbase
begin
base_int = Integer(base)
subbase_int = Integer(subbase)
rescue ArgumentError
base_int = -1
subbase_int = -1
end
return [base_int, subbase_int] if base_int >= 0 && subbase_int >= 0
return false
end
def action_is_child?(action)
_base_int, subbase_int = valid_engine_action_name?(action)
return (subbase_int && subbase_int > 0) ? true : false
end
def draw
super
@@ -629,7 +828,7 @@ module TAC
item = @highlight_item_container
Gosu.draw_rect(
item.x, item.y,
item.x, item.y + (item&.parent&.scroll_top || 0),
item.width, item.height,
@highlight_animator.color_transition,
item.z + 1

View File

@@ -38,7 +38,7 @@ module TAC
refresh_panel
end
list_box items: ["CENTERSTAGE", "Power Play", "Freight Frenzy", "Ultimate Goal", "Skystone"], width: 200, height: 1.0 do |item|
list_box items: ["Into the Deep", "CENTERSTAGE", "Power Play", "Freight Frenzy", "Ultimate Goal", "Skystone"], width: 200, height: 1.0 do |item|
season = item.downcase.gsub(" ", "_").to_sym
@field = TAC::Simulator::Field.new(container: @field_container, season: season, simulation: nil)
end
@@ -63,12 +63,12 @@ module TAC
background 0xff_111111
end
@points_container = stack width: 0.5, height: 1.0 do
@points_container = stack width: 0.5, height: 1.0, scroll: true do
end
end
end
@field = TAC::Simulator::Field.new(container: @field_container, season: :centerstage, simulation: nil)
@field = TAC::Simulator::Field.new(container: @field_container, season: :into_the_deep, simulation: nil)
@nodes ||= []
@unit = :inches
@total_distance = 0
@@ -97,7 +97,8 @@ module TAC
x = (window.mouse_x - @field_container.x) / @field.scale - 72
y = (window.mouse_y - @field_container.y) / @field.scale - 72
@font.text = "X: #{inches_to_unit(x).round(2)} Y: #{inches_to_unit(y).round(2)} (#{@unit.to_s})"
@font.text = "X: #{inches_to_unit(-y).round(2)} Y: #{inches_to_unit(-x).round(2)} (#{@unit.to_s})"
@font.x = window.mouse_x + 6
@font.y = window.mouse_y - (@font.height / 2.0 + 24)
@font.z = 100_001
@@ -133,16 +134,20 @@ module TAC
x = (window.mouse_x - @field_container.x) / @field.scale
y = (window.mouse_y - @field_container.y) / @field.scale
field_x = -((window.mouse_y - @field_container.y) / @field.scale - 72)
field_y = -((window.mouse_x - @field_container.x) / @field.scale - 72)
case id
when Gosu::MS_LEFT # Add Node
@nodes << CyberarmEngine::Vector.new(x, y, 0)
@nodes << [CyberarmEngine::Vector.new(x, y, 0), CyberarmEngine::Vector.new(field_x, field_y, 0)]
measure_path
refresh_panel
when Gosu::MS_RIGHT # Delete Node
result = @nodes.find do |node|
result = @nodes.find do |node_pair|
node = node_pair.first
Gosu.distance(node.x, node.y, x, y) <= @node_radius * 0.25
end
@@ -159,9 +164,10 @@ module TAC
x = (window.mouse_x - @field_container.x) / @field.scale
y = (window.mouse_y - @field_container.y) / @field.scale
last_node = @nodes.first
last_node = @nodes.first&.first
@nodes.each_with_index do |current_node, i|
@nodes.each_with_index do |current_node_pair, i|
current_node = current_node_pair.first
mouse_near = Gosu.distance(current_node.x, current_node.y, x, y) <= @node_radius * 0.25
Gosu.draw_circle(
@@ -199,10 +205,12 @@ module TAC
def measure_path
@total_distance = 0
v1 = @nodes.first
@nodes.each_with_index do |v2, i|
v1 = @nodes.first&.first
@nodes.each_with_index do |pair, i|
next if i.zero?
v2 = pair.first
@total_distance += Gosu.distance(
v1.x + @field_container.x,
v1.y + @field_container.y,
@@ -224,25 +232,10 @@ module TAC
status_bar.recalculate
# @points_container.clear do
# v1 = @nodes.first
# break unless v1
# para "Vector #{inches_to_unit(v1.x).round}:#{inches_to_unit(v1.y).round} - 0 #{@unit.to_s.capitalize}"
# @nodes.each_with_index do |v2, i|
# next if i.zero?
# distance = Gosu.distance(
# v1.x + @field_container.x,
# v1.y + @field_container.y,
# v2.x + @field_container.x,
# v2.y + @field_container.y
# )
# para "Vector #{inches_to_unit(v1.x).round}:#{inches_to_unit(v1.y).round} - #{inches_to_unit(distance).round(2)} #{@unit.to_s.capitalize}"
# v1 = v2
# end
# @nodes.each_with_index do |pair, i|
# v = pair.last
# para format("X: %.3f Y: %.3f", inches_to_unit(v.x), inches_to_unit(v.y))
# end
# end
end

View File

@@ -6,33 +6,33 @@ module TAC
body.clear do
stack(width: 1.0, height: 1.0) do
label TAC::NAME, width: 1.0, text_size: 48, text_align: :center
para TAC::NAME, width: 1.0, text_size: 48, text_align: :center
stack(width: 1.0, height: 8) do
background 0xff_006000
end
if window.backend.settings.config.empty?
label "TODO: Introduction"
label "Get Started", text_size: 28
if window.backend.settings.config.empty? || window.backend.config.nil?
para "TODO: Introduction"
para "Get Started", text_size: 28
button "1. Create a configuration" do
page(TAC::Pages::Configurations)
end
label "2. Add a group"
label "3. Add an action"
label "4. Add a variable"
label "5. Profit?"
para "2. Add a group"
para "3. Add an action"
para "4. Add a variable"
para "5. Profit?"
else
label "Display config stats or something?"
para "Display config stats or something?"
config = window.backend.config
groups = config.groups
actions = config.groups.map { |g| g.actions }.flatten
variables = actions.map { |a| a.variables }.flatten
label "Total groups: #{groups.size}"
label "Total actions: #{actions.size}"
label "Total variables: #{variables.size}"
para "Total groups: #{groups.size}"
para "Total actions: #{actions.size}"
para "Total variables: #{variables.size}"
end
stack(width: 1.0, fill: true, scroll: true, margin_top: 32) do

View File

@@ -201,7 +201,7 @@ module TAC
window.backend.config_changed!
group_container = find_element_by_tag(@group_presets, old_name)
label = find_element_by_tag(group_container, "label")
para = find_element_by_tag(group_container, "label")
label.value = name
@@ -233,7 +233,7 @@ module TAC
window.backend.config_changed!
action_container = find_element_by_tag(@action_presets, old_name)
label = find_element_by_tag(action_container, "label")
para = find_element_by_tag(action_container, "label")
comment_container = find_element_by_tag(action_container, "comment_container")
comment_label = find_element_by_tag(action_container, "comment")

View File

@@ -29,7 +29,7 @@ module TAC
end
status_bar.clear do
@simulation_status = label ""
@simulation_status = para ""
end
body.clear do

View File

@@ -6,9 +6,9 @@ module TAC
menu_bar.clear do
@connect_menu = flow(width: 1.0, height: 1.0) do
label "Hostname", text_size: 28
para "Hostname", text_size: 28
hostname = edit_line window.backend.settings.hostname, width: 0.33, height: 1.0, text_size: 28
label "Port", text_size: 28
para "Port", text_size: 28
port = edit_line window.backend.settings.port, width: 0.33, height: 1.0, text_size: 28
button "Connect", height: 1.0, text_size: 28 do
if hostname.value != window.backend.settings.hostname || port.value.to_i != window.backend.settings.port
@@ -31,11 +31,11 @@ module TAC
status_bar.clear do
@tacnet_icon = image "#{TAC::MEDIA_PATH}/icons/signal3.png", height: 26
@status_label = label "TACNET: Not Connected", text_size: 26
@status_label = para "TACNET: Not Connected", text_size: 26
end
body.clear do
@full_status_label = label ""
@full_status_label = para ""
end
end

View File

@@ -336,9 +336,7 @@ module TAC
end
end
###########################
### --- CENTERSTAGE --- ###
###########################
def draw_field_centerstage
# Corner TAPE
2.times do |i|
@@ -441,6 +439,140 @@ module TAC
end
#############################
### --- Into the Deep --- ###
#############################
def draw_field_into_the_deep
# Observation and net zones
2.times do |i|
Gosu.rotate(i * 180.0, 72, 72) do
Gosu.draw_quad(
24 - 2, 0, i.odd? ? @red : @blue,
24, 0, i.odd? ? @red : @blue,
0, 24 - 2, i.odd? ? @red : @blue,
0, 24, i.odd? ? @red : @blue,
@z
)
Gosu.draw_rect(
12, 144 - 24,
2, 24,
i.odd? ? @red : @blue,
@z
)
Gosu.draw_quad(
12, 144 - 24, i.odd? ? @red : @blue,
14, 144 - 24, i.odd? ? @red : @blue,
0, 144 - 36, i.odd? ? @red : @blue,
0, 144 - 38, i.odd? ? @red : @blue,
@z
)
end
end
faint_white = Gosu::Color.rgb(240, 240, 240)
# spike marks, white
3.times do |i|
Gosu.draw_rect(
48 - 3.5, 22 - i * 10,
3.5, 2,
faint_white,
@z
)
end
#spike marks, red
3.times do |i|
Gosu.draw_rect(
(144 - 48), 22 - i * 10,
3.5, 2,
@red,
@z
)
end
# spike marks, blue
3.times do |i|
Gosu.draw_rect(
48 - 3.5, 144 - 24 + i * 10,
3.5, 2,
@blue,
@z
)
end
# spike marks, yellow
3.times do |i|
Gosu.draw_rect(
(144 - 48), 144 - 24 + i * 10,
3.5, 2,
faint_white,
@z
)
end
# Accent Zone Triangle TAPE
2.times do |i|
Gosu.rotate(i * 180.0, 72, 72) do
Gosu.draw_quad(
48, 48, faint_white,
72, 48 - 10, faint_white,
72, 49 - 10, faint_white,
50, 48, faint_white,
@z
)
Gosu.draw_quad(
96, 48, faint_white,
72, 48 - 10, faint_white,
72, 49 - 10, faint_white,
94, 48, faint_white,
@z
)
end
end
# submersible
bar_gray = 0xff_656565 #Gosu::Color.rgb(50, 50, 50)
2.times do |i|
# left and right edges of submersible
Gosu.draw_rect(
72 - 24 + i * 46, 72 - 24,
2, 48,
bar_gray,
@z
)
# top and bottom edges of submersible
Gosu.draw_rect(
72 - 24, 72 - 15 + i * 28,
48, 2,
bar_gray,
@z
)
# alliance rungs of submersible
Gosu.draw_rect(
72 - 24 + i * 46, 72 - 13,
2, 26,
i.even? ? @blue : @red,
@z
)
end
# alliance bar bars
2.times do |i|
3.times do |x|
Gosu.draw_rect(
72 - 21.5 + x * 21, 72 - 15 + i * 28,
1, 2,
i.even? ? @blue : @red,
@z
)
end
end
end
def draw_tile_box(color)
Gosu.draw_rect(0, 0, 24, 2, color, @z)
Gosu.draw_rect(22, 2, 2, 22, color, @z)

View File

@@ -8,7 +8,7 @@ module TAC
@field_container = field_container
@robots = []
@field = Field.new(simulation: self, season: :centerstage, container: @field_container)
@field = Field.new(simulation: self, season: :into_the_deep, container: @field_container)
@show_paths = false
@last_milliseconds = Gosu.milliseconds

View File

@@ -36,7 +36,7 @@ class Editor < CyberarmEngine::GuiState
@header_bar = flow(width: 1.0, height: 36) do
background 0xff_006000
@header_bar_label = label TAC::NAME, fill: true, text_align: :center, text_size: 32, font: TAC::THEME_BOLD_FONT, margin_left: BORDERLESS ? 36 * 3 : 0
@header_bar_label = para TAC::NAME, fill: true, text_align: :center, text_size: 32, font: TAC::THEME_BOLD_FONT, margin_left: BORDERLESS ? 36 * 3 : 0
@window_controls = flow(width: 36 * 3, height: 1.0) do
button get_image("#{TAC::MEDIA_PATH}/icons/minus.png"), tip: "Minimize", image_height: 1.0 do
@@ -107,7 +107,7 @@ class Editor < CyberarmEngine::GuiState
end
end
@content = stack(width: window.width - @navigation.style.width, height: 1.0) do
@content = stack(fill: true, height: 1.0) do
@chrome = stack(width: 1.0, height: 96) do
@menu_bar = flow(width: 1.0, height: 48, padding: 8) do
background 0xff_008000
@@ -233,4 +233,4 @@ class Editor < CyberarmEngine::GuiState
TAC::Pages::Search
].include?(klass)
end
end
end

View File

@@ -1,5 +1,6 @@
module TAC
NAME = "TimeCrafters Configuration Tool"
VERSION = "0.7.2"
RELEASE_NAME = "Beta"
RELEASE_DATE = "2024-01-19" # ISO 8601 Date of version release
VERSION = "0.8.0"
RELEASE_NAME = "BETA"
end

View File

@@ -5,7 +5,7 @@ module TAC
def initialize(**args)
super(**args)
self.caption = "#{TAC::NAME} v#{TAC::VERSION} (#{TAC::RELEASE_NAME})"
self.caption = "#{TAC::NAME} v#{TAC::VERSION} (#{TAC::RELEASE_NAME}) [#{TAC::RELEASE_DATE}]"
@backend = Backend.new
@notification_manager = CyberarmEngine::NotificationManager.new(window: self, edge: :bottom)

View File

@@ -1,5 +1,5 @@
begin
raise LoadError if defined?(Ocra)
raise LoadError if defined?(Ocra) || defined?(Ocran)
require_relative "../cyberarm_engine/lib/cyberarm_engine"
rescue LoadError
require "cyberarm_engine"
@@ -73,7 +73,7 @@ require_relative "lib/game_clock/net/packet"
USE_REDESIGN = ARGV.include?("--redesign")
BORDERLESS = ARGV.include?("--borderless")
if not defined?(Ocra)
unless defined?(Ocra) || defined?(Ocran)
TAC::Window.new(width: (Gosu.screen_width * 0.8).round, height: (Gosu.screen_height * 0.8).round, resizable: true, borderless: BORDERLESS).show
end