adds a lot holy crap i forgot to commit
This commit is contained in:
@ -6,6 +6,7 @@ extends Node2D
|
||||
|
||||
# Card information.
|
||||
var card_info: Dictionary
|
||||
var cached_image: Image
|
||||
|
||||
# Card properties.
|
||||
var tapped: bool
|
||||
@ -55,7 +56,7 @@ func _on_mouse_entered() -> void:
|
||||
|
||||
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND)
|
||||
$TweenController.scale(1.05)
|
||||
EventBus.emit_signal("card_on_hover", card_info)
|
||||
EventBus.emit_signal("card_on_hover", card_info, cached_image)
|
||||
|
||||
|
||||
func _on_mouse_exited() -> void:
|
||||
|
@ -46,15 +46,23 @@ func _load_data() -> Error:
|
||||
|
||||
|
||||
func _load_image() -> Error:
|
||||
# NOTE: Assuming we're going with using the .png cards on board.
|
||||
var cached_img = FileAccess.get_file_as_bytes("user://card_cache/" + card.card_info["id"] + "/card.png")
|
||||
|
||||
if cached_img.is_empty():
|
||||
push_error("%sCard on-board image was not found in cache" % card.error("CACHE"))
|
||||
return FAILED
|
||||
|
||||
var cache_image = Image.new()
|
||||
var image_status: Error = cache_image.load_png_from_buffer(cached_img)
|
||||
|
||||
if image_status != OK:
|
||||
push_error("%sCard on-board image failed to load correctly" % card.error("IMAGE"))
|
||||
return FAILED
|
||||
|
||||
card.cached_image = cache_image
|
||||
|
||||
var image = Image.new()
|
||||
var image_status: Error = image.load_png_from_buffer(cached_img)
|
||||
image_status = image.load_png_from_buffer(cached_img)
|
||||
|
||||
if image_status != OK:
|
||||
push_error("%sCard on-board image failed to load correctly" % card.error("IMAGE"))
|
||||
@ -69,4 +77,5 @@ func _load_image() -> Error:
|
||||
var card_sprite = card.get_node("Sprite2D")
|
||||
card_sprite.texture = image_texture
|
||||
|
||||
|
||||
return OK
|
||||
|
Reference in New Issue
Block a user