mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 05:22:34 +00:00
Compare commits
5 Commits
f60aadac72
...
b17e24c630
| Author | SHA1 | Date | |
|---|---|---|---|
| b17e24c630 | |||
| f5f9870ae7 | |||
| cec3f90f3c | |||
| 93bfc80a97 | |||
| c37dc7112b |
@@ -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
|
||||
|
||||
@@ -458,7 +458,7 @@ module TAC
|
||||
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}"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ module TAC
|
||||
background 0xff_006000
|
||||
end
|
||||
|
||||
if window.backend.settings.config.empty?
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -62,7 +62,7 @@ class Editor < CyberarmEngine::GuiState
|
||||
end
|
||||
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/menuList.png"), margin: 4, tip: "Editor", image_width: 1.0 do
|
||||
page(TAC::Pages::EditorV3)
|
||||
page(TAC::Pages::Editor)
|
||||
end
|
||||
|
||||
@tacnet_button = button get_image("#{TAC::MEDIA_PATH}/icons/signal3.png"), margin: 4, tip: "TACNET", image_width: 1.0 do
|
||||
|
||||
Reference in New Issue
Block a user