From 1fe7500dd28de6fe246e521490364006f5079477 Mon Sep 17 00:00:00 2001 From: Nathan Singer Date: Mon, 28 Apr 2025 20:21:45 -0400 Subject: [PATCH] adds better formatting + adds some TODOs --- scenes/tooltip/card_text.gd | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scenes/tooltip/card_text.gd b/scenes/tooltip/card_text.gd index 4c58dbe..75da796 100644 --- a/scenes/tooltip/card_text.gd +++ b/scenes/tooltip/card_text.gd @@ -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()