mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-13 06:52:33 +00:00
Added production queue progress bar
This commit is contained in:
@@ -177,6 +177,15 @@ class IMICRTS
|
||||
# healthbar
|
||||
Gosu.draw_rect(@position.x - @radius, @position.y - (@radius + 2), @radius * 2, 2, Gosu::Color::GREEN, ZOrder::ENTITY_GIZMOS)
|
||||
|
||||
# build queue progress
|
||||
if component(:build_queue) && component(:build_queue).queue.size.positive?
|
||||
item = component(:build_queue).queue.first
|
||||
factor = item.progress / item.entity.build_steps.to_f
|
||||
|
||||
Gosu.draw_rect(@position.x - @radius, @position.y - (@radius + 6), @radius * 2, 2, Gosu::Color::BLACK, ZOrder::ENTITY_GIZMOS)
|
||||
Gosu.draw_rect(@position.x - @radius, @position.y - (@radius + 6), (@radius * 2) * factor, 2, Gosu::Color::WHITE, ZOrder::ENTITY_GIZMOS)
|
||||
end
|
||||
|
||||
if Setting.enabled?(:debug_pathfinding) && component(:movement) && component(:movement).pathfinder && component(:movement).pathfinder.path_current_node
|
||||
current_node = component(:movement).pathfinder.path_current_node.tile.position + @director.map.tile_size / 2
|
||||
Gosu.draw_line(
|
||||
|
||||
@@ -11,9 +11,10 @@ class IMICRTS
|
||||
|
||||
def self.save_defaults
|
||||
hash = {
|
||||
player_name: "Rookie",
|
||||
player_name: "Commander",
|
||||
player_color: :orange,
|
||||
player_team: 1,
|
||||
player_position: "A",
|
||||
player_default_map_spawn: 0,
|
||||
default_map: "test_map",
|
||||
|
||||
|
||||
@@ -22,22 +22,26 @@ class IMICRTS
|
||||
label "Color"
|
||||
@player_color = list_box items: TeamColors.keys, choose: Setting.get(:player_color).to_sym, width: 1.0
|
||||
@player_color.style.background = (TeamColors[@player_color.value.to_sym])
|
||||
@player_color.style.color = Gosu::Color.new(@player_color.style.background&.gl).value > 0.9 ? Gosu::Color::BLACK : Gosu::Color::WHITE
|
||||
@player_color.subscribe(:changed) do |sender, value|
|
||||
@player_color.style.background = TeamColors[value.to_sym]
|
||||
@player_color.style.color = Gosu::Color.new(@player_color.style.background&.gl).value > 0.9 ? Gosu::Color::BLACK : Gosu::Color::WHITE
|
||||
:handled
|
||||
end
|
||||
|
||||
7.times do |i|
|
||||
box = list_box items: TeamColors.keys, choose: TeamColors.keys[i + 1], width: 1.0
|
||||
box.style.background = (TeamColors[box.value.to_sym])
|
||||
box.style.color = Gosu::Color.new(box.style.background&.gl).value > 0.9 ? Gosu::Color::BLACK : Gosu::Color::WHITE
|
||||
box.subscribe(:changed) do |sender, value|
|
||||
box.style.background = TeamColors[value.to_sym]
|
||||
box.style.color = Gosu::Color.new(box.style.background&.gl).value > 0.9 ? Gosu::Color::BLACK : Gosu::Color::WHITE
|
||||
:handled
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
stack(width: 0.29) do
|
||||
stack(width: 0.15) do
|
||||
label "Team"
|
||||
@player_team = list_box items: Array(1..8), choose: Setting.get(:player_team), width: 1.0
|
||||
|
||||
@@ -45,10 +49,18 @@ class IMICRTS
|
||||
list_box items: Array(1..8), choose: i + 2, width: 1.0
|
||||
end
|
||||
end
|
||||
|
||||
stack(width: 0.15) do
|
||||
label "Position"
|
||||
@player_position = list_box items: Array("A".."H"), choose: Setting.get(:player_position), width: 1.0
|
||||
|
||||
7.times do |i|
|
||||
list_box items: Array("A".."H"), choose: Array("A".."H")[i + 1], width: 1.0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
stack(width: 0.30, height: 1.0) do
|
||||
# TODO: Show preview image
|
||||
label "Map"
|
||||
maps_list = Dir.glob("#{GAME_ROOT_PATH}/assets/maps/*.tmx").map do |m|
|
||||
File.basename(m, ".tmx").to_sym
|
||||
@@ -59,7 +71,7 @@ class IMICRTS
|
||||
@map_preview.value = map_preview(value)
|
||||
end
|
||||
|
||||
@map_preview = image map_preview(@map_name.value), width: 1.0, border_thickness: 2, border_color: Gosu::Color::BLACK, background: Gosu::Color::GRAY
|
||||
@map_preview = image map_preview(@map_name.value), width: 1.0, margin_top: 4, border_thickness: 1, border_color: 0xffff5500, background: Gosu::Color::BLACK
|
||||
end
|
||||
end
|
||||
|
||||
@@ -77,6 +89,7 @@ class IMICRTS
|
||||
|
||||
button("Back", align: :right) do
|
||||
save_playerdata
|
||||
|
||||
push_state(MainMenu)
|
||||
end
|
||||
end
|
||||
@@ -87,6 +100,7 @@ class IMICRTS
|
||||
Setting.set(:player_name, @player_name.value)
|
||||
Setting.set(:player_color, @player_color.value.to_sym)
|
||||
Setting.set(:player_team, @player_team.value.to_i)
|
||||
Setting.set(:player_position, @player_position.value)
|
||||
Setting.set(:default_map, @map_name.value.to_s)
|
||||
|
||||
Setting.save!
|
||||
|
||||
@@ -11,6 +11,6 @@ class IMICRTS
|
||||
gold: Gosu::Color::YELLOW,
|
||||
lightgray: Gosu::Color::WHITE,
|
||||
gray: Gosu::Color::GRAY,
|
||||
black: Gosu::Color.rgb(25, 25, 25),
|
||||
black: Gosu::Color.rgb(50, 50, 50),
|
||||
}
|
||||
end
|
||||
Reference in New Issue
Block a user