フロントエンドプレイアブル
This commit is contained in:
25
test_render.rb
Normal file
25
test_render.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
client = GameApiClient.new
|
||||
turn1 = Turn.find_by(number: 1)
|
||||
|
||||
if turn1
|
||||
puts "Processing Turn 1..."
|
||||
res = client.api_calculate_process(turn1.game_state, turn1.orders || {})
|
||||
|
||||
if res
|
||||
new_gs = res['game_state']
|
||||
puts "Phase: #{new_gs&.dig('phase')}"
|
||||
|
||||
puts "Rendering new state..."
|
||||
svg = client.api_render(new_gs, orders: nil)
|
||||
|
||||
if svg
|
||||
File.write('test_render_turn2.svg', svg)
|
||||
puts "Saved SVG to test_render_turn2.svg"
|
||||
puts "SVG Sample: #{svg[0..100]}..."
|
||||
else
|
||||
puts "Render failed."
|
||||
end
|
||||
else
|
||||
puts "Process failed."
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user