Game state readability progress
This commit is contained in:
parent
9897839420
commit
26a6bf950a
2 changed files with 83 additions and 21 deletions
|
|
@ -16,12 +16,27 @@ var paintings: Array[PaintingInfo] = []
|
|||
var current_painting_idx := 0
|
||||
|
||||
# tracker variables for bid markers, proposing bids happens between numpad and audience
|
||||
var current_bid := 0
|
||||
var starting_price := 0
|
||||
var final_bid := 0
|
||||
var current_bid := 0:
|
||||
set(value):
|
||||
if is_instance_valid(going_price_label):
|
||||
going_price_label.display_caption("Bid: $%sk" % [floor(value / 1000.0)])
|
||||
var starting_price := 0:
|
||||
set(value):
|
||||
if is_instance_valid(starting_price_label):
|
||||
if value == 0:
|
||||
starting_price_label.display_caption("Starting Price: ")
|
||||
else:
|
||||
starting_price_label.display_caption("Starting Price: $%sk" % [floor(value / 1000.0)])
|
||||
var final_bid := 0:
|
||||
set(value):
|
||||
if is_instance_valid(going_price_label):
|
||||
going_price_label.display_caption("Sold for $%sk!" % [floor(value / 1000.0)])
|
||||
@export var current_bid_display: RichTextLabel
|
||||
|
||||
var target_sales := 0
|
||||
var target_sales := 0:
|
||||
set(value):
|
||||
if is_instance_valid(quota_label):
|
||||
quota_label.display_caption("Quota: $%sk Progress: 0%%" % [floor(value / 1000.0)])
|
||||
#var total_sales: int = 0
|
||||
@export var sales_magnitude := 100000
|
||||
@export var single_painting_magnitude := 1000
|
||||
|
|
@ -31,6 +46,10 @@ var target_sales := 0
|
|||
var bidding_open := false
|
||||
var state := bidding_state.CLOSED
|
||||
|
||||
@export var quota_label: CaptionLabel
|
||||
@export var starting_price_label: CaptionLabel
|
||||
@export var going_price_label: CaptionLabel
|
||||
|
||||
func _ready() -> void:
|
||||
audience_manager.ask_accepted.connect(_handle_ask_accepted)
|
||||
desk.gavel.gavel_hit.connect(_handle_gavel_hit)
|
||||
|
|
@ -64,7 +83,8 @@ func _handle_gavel_hit():
|
|||
match state:
|
||||
bidding_state.CLOSED:
|
||||
state = bidding_state.READY
|
||||
current_bid_display.set_text("Starting price: $%s" % [starting_price])
|
||||
#starting_price_label.display_caption("Starting price: $%s" % [starting_price])
|
||||
#current_bid_display.set_text("Starting price: $%s" % [starting_price])
|
||||
bidding_state.ASKING:
|
||||
if current_bid != 0:
|
||||
sell_painting()
|
||||
|
|
@ -90,8 +110,13 @@ func sell_painting():
|
|||
cancel_bidding()
|
||||
move_painting_to_bidders_pile()
|
||||
paintings[current_painting_idx].sold_for = current_bid
|
||||
current_bid_display.set_text("Sold for $%s!" % [current_bid])
|
||||
#current_bid_display.set_text("Sold for $%s!" % [current_bid])
|
||||
var total_sold = 0
|
||||
for painting in paintings:
|
||||
total_sold += painting.sold_for
|
||||
turn_manager.speak_sentence("Sold for $%s!" % [current_bid])
|
||||
@warning_ignore("integer_division")
|
||||
quota_label.display_caption("Quota: $%sk Progress: %s%%" % [floor(target_sales / 1000.0), floor((total_sold / target_sales) * 100.0)])
|
||||
print("Congrats on selling your painting for $%s! You have made $%s so far." % [current_bid, get_total_sales()])
|
||||
|
||||
|
||||
|
|
@ -109,13 +134,15 @@ func next_painting() -> bool:
|
|||
var info := paintings[current_painting_idx]
|
||||
starting_price = info.value
|
||||
current_bid = 0
|
||||
#going_price_label.display_caption("Current bid: $%s" % [current_bid])
|
||||
$NextPainting.play()
|
||||
get_painting_display().animate_show_painting()
|
||||
return true
|
||||
|
||||
|
||||
func _handle_ask_accepted():
|
||||
current_bid_display.set_text("Current bid: $" + str(current_bid))
|
||||
pass
|
||||
#current_bid_display.set_text("Current bid: $" + str(current_bid))
|
||||
|
||||
|
||||
func end_auction():
|
||||
|
|
|
|||
63
main.tscn
63
main.tscn
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=18 format=3 uid="uid://dt4nq0nkmjiit"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://dt4nq0nkmjiit"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b5tcsve1oo5ht" path="res://game_manager.gd" id="1_ig7tw"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvqsf1nlfqwpr" path="res://assets/background/background.png" id="1_lquwl"]
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://c1acpop6amvcl" path="res://audience_manager.tscn" id="6_272bh"]
|
||||
[ext_resource type="PackedScene" uid="uid://b8key4hjaldui" path="res://turn_manager.tscn" id="7_272bh"]
|
||||
[ext_resource type="Script" path="res://captions.gd" id="10_ryguw"]
|
||||
[ext_resource type="PackedScene" uid="uid://6a4hl2twv0lj" path="res://cursor_manager.tscn" id="20_82xsv"]
|
||||
[ext_resource type="AudioStream" uid="uid://b6u25i4ivxist" path="res://theme.ogg" id="22_ryguw"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_272bh"]
|
||||
|
|
@ -46,34 +45,37 @@ texture = ExtResource("3_272bh")
|
|||
unique_name_in_owner = true
|
||||
|
||||
[node name="PaintingDisplay7" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1074, 162)
|
||||
|
||||
[node name="PaintingDisplay6" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1074, 162)
|
||||
|
||||
[node name="PaintingDisplay5" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1074, 162)
|
||||
|
||||
[node name="PaintingDisplay4" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1074, 162)
|
||||
|
||||
[node name="PaintingDisplay3" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1074, 162)
|
||||
|
||||
[node name="PaintingDisplay2" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1074, 162)
|
||||
|
||||
[node name="PaintingDisplay1" parent="Paintings" instance=ExtResource("4_d13ii")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(1074, 136)
|
||||
position = Vector2(1075, 162)
|
||||
|
||||
[node name="GameManager" type="Node2D" parent="." node_paths=PackedStringArray("audience_manager", "desk", "turn_manager", "current_bid_display")]
|
||||
[node name="GameManager" type="Node2D" parent="." node_paths=PackedStringArray("audience_manager", "desk", "turn_manager", "current_bid_display", "quota_label", "starting_price_label", "going_price_label")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("1_ig7tw")
|
||||
audience_manager = NodePath("../AudienceManager")
|
||||
desk = NodePath("../Desk")
|
||||
turn_manager = NodePath("../TurnManager")
|
||||
current_bid_display = NodePath("../UI/RichTextLabel")
|
||||
quota_label = NodePath("../UI/Quota")
|
||||
starting_price_label = NodePath("../UI/StartingPrice")
|
||||
going_price_label = NodePath("../UI/GoingPrice")
|
||||
|
||||
[node name="Timer" type="Timer" parent="GameManager"]
|
||||
wait_time = 300.0
|
||||
|
|
@ -117,18 +119,51 @@ horizontal_alignment = 1
|
|||
vertical_alignment = 1
|
||||
script = ExtResource("10_ryguw")
|
||||
|
||||
[node name="AudienceManager" parent="." node_paths=PackedStringArray("desk", "game_manager", "bark_buttons") instance=ExtResource("6_272bh")]
|
||||
[node name="Quota" type="Label" parent="UI"]
|
||||
layout_mode = 0
|
||||
offset_left = 756.0
|
||||
offset_top = 13.0
|
||||
offset_right = 1256.0
|
||||
offset_bottom = 53.0
|
||||
text = "Quota: 500k Progress: 50%"
|
||||
label_settings = SubResource("LabelSettings_ryguw")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("10_ryguw")
|
||||
|
||||
[node name="StartingPrice" type="Label" parent="UI"]
|
||||
layout_mode = 0
|
||||
offset_left = 857.0
|
||||
offset_top = 259.0
|
||||
offset_right = 1257.0
|
||||
offset_bottom = 299.0
|
||||
text = "Starting Price: 25k"
|
||||
label_settings = SubResource("LabelSettings_ryguw")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("10_ryguw")
|
||||
|
||||
[node name="GoingPrice" type="Label" parent="UI"]
|
||||
layout_mode = 0
|
||||
offset_left = 857.0
|
||||
offset_top = 296.0
|
||||
offset_right = 1257.0
|
||||
offset_bottom = 336.0
|
||||
text = "Asking: 50k"
|
||||
label_settings = SubResource("LabelSettings_ryguw")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("10_ryguw")
|
||||
|
||||
[node name="AudienceManager" parent="." node_paths=PackedStringArray("desk", "game_manager") instance=ExtResource("6_272bh")]
|
||||
desk = NodePath("../Desk")
|
||||
game_manager = NodePath("../GameManager")
|
||||
bark_buttons = NodePath("")
|
||||
|
||||
[node name="TurnManager" parent="." node_paths=PackedStringArray("desk", "captions", "audience_manager") instance=ExtResource("7_272bh")]
|
||||
desk = NodePath("../Desk")
|
||||
captions = NodePath("../UI/Captions")
|
||||
audience_manager = NodePath("../AudienceManager")
|
||||
|
||||
[node name="CursorManager" parent="." instance=ExtResource("20_82xsv")]
|
||||
|
||||
[node name="BackgroundMusic" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("22_ryguw")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue