wait we can just finish the card cache check rn
This commit is contained in:
parent
a67f2e1096
commit
fcf736af92
7
card.gd
7
card.gd
@ -11,8 +11,9 @@ var card_name = "placeholder_name"
|
|||||||
var card_type = "placeholder_card_type"
|
var card_type = "placeholder_card_type"
|
||||||
var oracle_text = "placeholder_oracle_text"
|
var oracle_text = "placeholder_oracle_text"
|
||||||
|
|
||||||
func _check_cache() -> bool:
|
func _check_cache(id) -> bool:
|
||||||
## want to check the cache before we make any scryfall calls
|
if (FileAccess.file_exists("user://card_cache/" + id + ".json")):
|
||||||
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
func _do_scryfall_get(id) -> void:
|
func _do_scryfall_get(id) -> void:
|
||||||
@ -30,7 +31,7 @@ func _do_scryfall_get(id) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func load_card(id) -> void:
|
func load_card(id) -> void:
|
||||||
if !(_check_cache()):
|
if !(_check_cache(id)):
|
||||||
_do_scryfall_get(id)
|
_do_scryfall_get(id)
|
||||||
|
|
||||||
var ondisk_card = FileAccess.open("user://card_cache/" + id + ".json", FileAccess.READ)
|
var ondisk_card = FileAccess.open("user://card_cache/" + id + ".json", FileAccess.READ)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user