fixes merge conflicts
This commit is contained in:
@ -1,14 +1,17 @@
|
||||
extends TextureRect
|
||||
|
||||
|
||||
func _set_tip_image(_card_info: Dictionary, card_image: Image) -> void:
|
||||
card_image.resize(int(size.x / 1.75), int(size.y), Image.INTERPOLATE_LANCZOS)
|
||||
var tex = ImageTexture.new()
|
||||
tex.set_image(card_image)
|
||||
texture = tex
|
||||
|
||||
|
||||
func _clear_tip_image() -> void:
|
||||
texture = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
EventBus.connect("card_on_hover", _set_tip_image)
|
||||
EventBus.connect("card_on_unhover", _clear_tip_image)
|
||||
|
@ -11,6 +11,7 @@ func _convert_text_to_symbol(_text: String):
|
||||
last_idx = _text.find(symbol, last_idx) + symbol.length()
|
||||
return _text
|
||||
|
||||
|
||||
func _set_tip_text(card_info: Dictionary, _card_image: Image) -> void:
|
||||
# TODO: add more card formatting, check all of the logos, very niche icons will be affected i believe since they're
|
||||
# different sizes
|
||||
@ -18,13 +19,30 @@ func _set_tip_text(card_info: Dictionary, _card_image: Image) -> void:
|
||||
text = "[b]" + card_info["name"] + "[/b]\t"
|
||||
text += _convert_text_to_symbol(card_info["cost"]) + "\n"
|
||||
text += "[i]" + card_info["type"] + "[/i]\n"
|
||||
<<<<<<< HEAD
|
||||
|
||||
text += _convert_text_to_symbol(card_info["desc"])
|
||||
|
||||
=======
|
||||
var oracle_text = card_info["desc"]
|
||||
var last_idx = 0
|
||||
|
||||
for symbol in mana_symbols:
|
||||
last_idx = 0
|
||||
while oracle_text.find(symbol, last_idx) != -1:
|
||||
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()
|
||||
|
||||
text += oracle_text
|
||||
|
||||
>>>>>>> 76a23aab5c62c7ff138d393c5f5fedd6cd6c7a46
|
||||
|
||||
func _clear_tip_text() -> void:
|
||||
text = ""
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if !FileAccess.file_exists("res://symbol_cache/symbols.json"):
|
||||
push_error("Symbols haven't been cached yet!")
|
||||
@ -32,8 +50,8 @@ func _ready() -> void:
|
||||
var file = FileAccess.open("res://symbol_cache/symbols.json", FileAccess.READ)
|
||||
mana_symbols = JSON.parse_string(file.get_as_text())
|
||||
file.close()
|
||||
|
||||
|
||||
set_use_bbcode(true)
|
||||
|
||||
|
||||
EventBus.connect("card_on_hover", _set_tip_text)
|
||||
EventBus.connect("card_on_unhover", _clear_tip_text)
|
||||
|
Reference in New Issue
Block a user