-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4034 from KBVE/alpha
Preparing Beta Branch
- Loading branch information
Showing
10 changed files
with
176 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://cl2srbe0xb2gw"] | ||
|
||
[ext_resource type="Script" path="res://scripts/shop.gd" id="1_xq0us"] | ||
|
||
[node name="Shop" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
script = ExtResource("1_xq0us") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
extends Control | ||
|
||
@onready var score_label = $Panel/Menu/Label | ||
@onready var name_label = $Panel/Menu/StarshipName | ||
@onready var stone_label = $Panel/Menu/Stone | ||
@onready var metal_label = $Panel/Menu/Metal | ||
@onready var gems_label = $Panel/Menu/Gems | ||
@onready var gold_label = $Panel/Menu/Gold | ||
|
||
var resource_labels = {} | ||
|
||
func _ready(): | ||
resource_labels = { | ||
"gold": gold_label, | ||
"stone": stone_label, | ||
"metal": metal_label, | ||
"gems": gems_label | ||
} | ||
|
||
call_deferred("_update_starship_name") | ||
call_deferred("_update_starship_resources") | ||
Global.connect("resource_changed", Callable(self, "_on_resource_changed")) | ||
update_score(0) | ||
|
||
func update_score(new_score): | ||
if score_label: | ||
score_label.text = "Score: %d" % new_score | ||
else: | ||
push_warning("Score label not found!") | ||
|
||
func _update_starship_resources(): | ||
for resource in Global.resources_list: | ||
var amount = Global.get_resource(resource) | ||
if resource_labels.has(resource) and resource_labels[resource]: | ||
resource_labels[resource].text = "%s: %d" % [resource.capitalize(), amount] | ||
|
||
func _on_resource_changed(resource_name: String, new_value: int): | ||
if resource_labels.has(resource_name) and resource_labels[resource_name]: | ||
resource_labels[resource_name].text = "%s: %d" % [resource_name.capitalize(), new_value] | ||
|
||
func _update_starship_name(): | ||
var starship_name = Global.get_starship_data("name") | ||
if name_label: | ||
if starship_name: | ||
name_label.text = "Starship: " + starship_name | ||
else: | ||
name_label.text = "Starship: Unknown" | ||
else: | ||
push_warning("Starship name label not found!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends Control | ||
|
||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready() -> void: | ||
pass # Replace with function body. | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta: float) -> void: | ||
pass |