adds better formatting + adds some TODOs

This commit is contained in:
Nathan Singer 2025-04-28 20:21:45 -04:00
parent 1c5c4728a3
commit 1fe7500dd2

View File

@ -3,19 +3,18 @@ extends RichTextLabel
var mana_symbols: Dictionary
func _set_tip_text(card_info: Dictionary, _card_image: Image) -> void:
text = card_info["name"] + " | " + card_info["type"] + "\n"
# TODO: add more card formatting, check all of the logos, very niche icons will be affected i believe since they're
# different sizes
# shrink text if we use too much space for it, etc
text = "[b]" + card_info["name"] + "[/b]\n"
text += "[i]" + card_info["type"] + "[/i]\n"
var oracle_text = card_info["desc"]
var last_idx = 0
var found_card: bool = false
# TODO: fix the string splitting here because its missing some symbols, and misplacing others
# TODO: duh this is skipping some symbols because it will find the first symbol (which could be after many other symbols)
# and then add all the previous text, skipping them
for symbol in mana_symbols:
last_idx = 0
while oracle_text.find(symbol, last_idx) != -1:
print("infinite loop?")
oracle_text = oracle_text.replace(symbol, "[img width=\"16\" height=\"16\"]" + mana_symbols[symbol] + "[/img]")
last_idx = oracle_text.find(symbol, last_idx) + symbol.length()