added webrtc, pre-4.3 update to fix cyclic dependency

This commit is contained in:
Sch1nken 2024-03-15 18:05:58 +01:00
parent 26fec25a6e
commit e8cd148bc7
45 changed files with 1498 additions and 43 deletions

View file

@ -4,8 +4,8 @@ class_name InsectButton
@onready var hex = $Hex
@onready var tile_count_label = $Hex/TileCountLabel
@onready var insect_icon = $Hex/InsectIcon
@export var insect_resource: TileResource = preload("res://Tile/Prefabs/Bee.tres")
const BEE = preload("res://Tile/Prefabs/Bee.tres")
@export var insect_resource: TileResource = BEE
const HEX_BLACK = preload("res://InsectTiles/Assets/UI/hex_black.svg")
const HEX_WHITE = preload("res://InsectTiles/Assets/UI/hex_white.svg")
@ -18,6 +18,20 @@ var selected: bool = false
var hovered: bool = false
var deactivated: bool = false
func update_color(_is_black: bool) -> void:
is_black = _is_black
if is_black:
hex.texture = HEX_BLACK
else:
hex.texture = HEX_WHITE
update_tile_count_display()
insect_icon.texture = insect_resource.ui_texture
if is_black != GameData.is_player_black and not GameData.debug:
disabled = true
return
func is_empty() -> bool:
return tile_count <= 0
@ -67,15 +81,7 @@ func refresh_state() -> void:
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if is_black:
hex.texture = HEX_BLACK
update_tile_count_display()
insect_icon.texture = insect_resource.ui_texture
if is_black != GameData.is_player_black and not GameData.debug:
disabled = true
return
update_color(is_black)
GameEvents.insect_selected.connect(_on_insect_selected)
GameEvents.insect_placement_cancelled.connect(_on_placement_cancelled)