mardi 4 août 2015

How do I embed icons into text within Squib only on certain cards?

Here is my current deck.rb file:

require 'squib'
require 'game_icons'

Squib::Deck.new(cards: 4, layout: %w(hand.yml layout.yml), width: 825, height: 1425) do
  background color: '#FFFFFF'
  rect x: 0, y: 0, width: 825, height: 1425, x_radius: 38, y_radius: 38
  data = csv file: 'country.csv'
  png file: data['Art'], layout: 'Art'
  png file: 'textbox.png', x: 50, y: 890
  png file: 'titlebox.png', x: 65, y: 30

text(str: data['Ability'], x: 100, y: 900) do |embed|
    embed.svg key: ':tribute:', file: 'tributesmall.svg'
end

  %w(Title Ability Quote Type Subtype).each do |key|
    text str: data[key], layout: key, markup: true
  end

  %w(Tribute Power Dominion).each do |key|
    svg file: "#{key.downcase}.svg", layout: "#{key}Icon"
    text str: data[key], layout: key
  end

  save_png prefix: 'country_'
end

This puts the Ability column of my .csv onto every single card. However, it doesn't replace any text with icons. If I switch the relevant block to this:

text(str: 'Gain 1 :tribute:', x: 100, y: 900) do |embed|
    embed.svg key: ':tribute:', file: 'tributesmall.svg'
end

This now puts "Gain 1 [my tribute icon]" onto every single card.

Here's exactly what I want to do: Whenever one of my cards has within the Ability column of my .csv the text "Gains 1 tribute", the output is "Gains 1 [my tribute icon]" within the text box of the card, formatted so that it's part of the regular Ability text. Is this possible?

Thanks!

Aucun commentaire:

Enregistrer un commentaire