add ant info popup animations
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
extends FollowingUI
|
||||
class_name BuyAnts
|
||||
|
||||
const COUNTER_SIZE:float = 32
|
||||
const COUNTER_SIZE: float = 32
|
||||
|
||||
var _anthill: Anthill
|
||||
|
||||
@onready var buy_nitwit_button: BaseButton = $BuyNitwitButton
|
||||
@onready var nitwit_price_counter: HoneydewCounter = $NitwitPriceCounter
|
||||
@onready var nitwit_info: Control = $NitwitPanel
|
||||
|
||||
@onready var buy_gatherer_button: BaseButton = $BuyGathererButton
|
||||
@onready var gatherer_price_counter: HoneydewCounter = $GathererPriceCounter
|
||||
@onready var gatherer_info: Control = $GathererPanel
|
||||
|
||||
@onready var counter: HoneydewCounter = $HoneydewCounter
|
||||
|
||||
@@ -19,16 +17,12 @@ var _anthill: Anthill
|
||||
func _ready() -> void:
|
||||
assert(buy_nitwit_button != null, "buy_nitwit_button missing!")
|
||||
assert(nitwit_price_counter != null, "nitwit_price_counter missing!")
|
||||
assert(nitwit_info != null, "nitwit_info missing!")
|
||||
assert(buy_gatherer_button != null, "buy_gatherer_button missing!")
|
||||
assert(gatherer_price_counter != null, "gatherer_price_counter missing!")
|
||||
assert(gatherer_info != null, "gatherer_info missing!")
|
||||
assert(counter != null, "counter missing!")
|
||||
super._ready()
|
||||
buy_nitwit_button.pressed.connect(_on_buy_nitwit_button_pressed)
|
||||
nitwit_info.visible = false
|
||||
buy_gatherer_button.pressed.connect(_on_buy_gatherer_button_pressed)
|
||||
gatherer_info.visible = false
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
@@ -36,16 +30,14 @@ func _process(delta: float) -> void:
|
||||
if _anthill == null or not visible:
|
||||
return
|
||||
counter.update_counter(_anthill.honeydew)
|
||||
nitwit_info.visible = buy_nitwit_button.is_hovered()
|
||||
gatherer_info.visible = buy_gatherer_button.is_hovered()
|
||||
|
||||
|
||||
func open(at: Anthill) -> void:
|
||||
visible = true
|
||||
_anthill = at
|
||||
nitwit_price_counter.initialize(
|
||||
AntNitwit.get_cost(),
|
||||
AntNitwit.get_cost(),
|
||||
AntNitwit.get_cost(),
|
||||
AntNitwit.get_cost(),
|
||||
COUNTER_SIZE,
|
||||
)
|
||||
gatherer_price_counter.initialize(
|
||||
@@ -55,15 +47,17 @@ func open(at: Anthill) -> void:
|
||||
)
|
||||
set_target(_anthill.ui_origin)
|
||||
counter.initialize(_anthill.honeydew, _anthill.max_honeydew)
|
||||
_open_animation()
|
||||
_open_animation(self)
|
||||
|
||||
|
||||
func close() -> void:
|
||||
super.close()
|
||||
_anthill = null
|
||||
|
||||
|
||||
func _on_buy_nitwit_button_pressed() -> void:
|
||||
_anthill.spawn_nitwit()
|
||||
|
||||
|
||||
func _on_buy_gatherer_button_pressed() -> void:
|
||||
_anthill.spawn_gatherer()
|
||||
|
||||
Reference in New Issue
Block a user