chore: dragon editor

This commit is contained in:
Gerard Gascón 2025-04-12 20:35:40 +02:00
parent 44a36a4e67
commit a8b292aa03
3 changed files with 70 additions and 1154 deletions

View file

@ -11,7 +11,7 @@ func _init(outfits: Array[SpriteFrames] = []):
self.outfits = outfits
func pick_next() -> Texture2D:
func pick_next() -> SpriteFrames:
index += 1
if allow_null:
return _pick_nullable()
@ -19,7 +19,7 @@ func pick_next() -> Texture2D:
return _pick_non_nullable()
func pick_previous() -> Texture2D:
func pick_previous() -> SpriteFrames:
index -= 1
if allow_null:
return _pick_nullable()
@ -27,7 +27,7 @@ func pick_previous() -> Texture2D:
return _pick_non_nullable()
func _pick_nullable():
func _pick_nullable() -> SpriteFrames:
index %= (len(outfits) + 1)
if index == 0:
return null
@ -35,15 +35,11 @@ func _pick_nullable():
return outfits[index - 1]
func _pick_non_nullable():
func _pick_non_nullable() -> SpriteFrames:
index %= len(outfits)
return outfits[index]
func get_index(texture: Texture2D) -> int:
return outfits.find(texture)
func get_texture(index: int) -> SpriteFrames:
if index < 0 or index >= len(outfits):
return null