Added extras menu, stubbed map editor, made asset viewer and map editor accessible from extras menu

This commit is contained in:
2020-03-22 12:17:28 -05:00
parent d6802c8756
commit fd228aa0c0
8 changed files with 79 additions and 34 deletions

View File

@@ -0,0 +1,2 @@
require_relative "asset_viewer/lib/main_menu"
require_relative "asset_viewer/lib/turn_table"

View File

@@ -1,12 +0,0 @@
require_relative "lib/main_menu"
require_relative "lib/turn_table"
class AssetViewerWindow < IMICFPS::Window
def initialize(*args)
super(*args)
push_state(IMICFPS::AssetViewerTool::MainMenu)
end
end
AssetViewerWindow.new.show

View File

@@ -18,6 +18,10 @@ class IMICFPS
@manifests.sort_by! { |m| m.name.downcase }
button "Back", margin_bottom: 25 do
pop_state
end
flow(margin: 10) do
@manifests.each do |manifest|
button manifest.name do
@@ -25,10 +29,6 @@ class IMICFPS
end
end
end
button "Exit", margin_top: 25 do
window.close
end
end
def update

1
lib/tools/map_editor.rb Normal file
View File

@@ -0,0 +1 @@
require_relative "map_editor/lib/main_menu"

View File

@@ -0,0 +1,45 @@
class IMICFPS
class MapEditorTool
class MainMenu < CyberarmEngine::GuiState
def setup
window.needs_cursor = true
label "#{IMICFPS::NAME}", text_size: 50
label "Map Editor", text_size: 28
@maps = []
Dir.glob(GAME_ROOT_PATH + "/maps/*.json").each do |map|
begin
@maps << MapParser.new(map_file: map)
rescue
warn "Broken map file: #{map}"
end
end
@maps.sort_by! { |m| m.metadata.name.downcase }
button "Back", margin_bottom: 25 do
pop_state
end
button "New Map"
label ""
label "Edit Map"
flow(margin: 10) do
@maps.each do |map|
button map.metadata.name do
# push_state(TurnTable, manifest: manifest)
end
end
end
end
def update
super
window.needs_cursor = true
end
end
end
end

View File

@@ -0,0 +1,20 @@
class IMICFPS
class ExtrasMenu < Menu
def setup
title "I-MIC FPS"
subtitle "Extras"
link "Asset Viewer" do
push_state(IMICFPS::AssetViewerTool::MainMenu)
end
link "Map Editor" do
push_state(IMICFPS::MapEditorTool::MainMenu)
end
link "Back" do
pop_state
end
end
end
end

View File

@@ -12,6 +12,10 @@ class IMICFPS
push_state(SettingsMenu)
end
link "Extras" do
push_state(ExtrasMenu)
end
link "Exit" do
window.close
end