feature complete prototype almost done!
This commit is contained in:
parent
93cc1a8c59
commit
af8662fd6a
21 changed files with 327 additions and 41 deletions
39
inv_system/botnet/botnet_panel.gd
Normal file
39
inv_system/botnet/botnet_panel.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
extends Inventory
|
||||
|
||||
@export var install_button : Button
|
||||
@export var score_label : Label
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super()
|
||||
check_server()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
super(delta)
|
||||
score_label.text = str(PlayerInventory.botnet_servers)
|
||||
pass
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
super(what)
|
||||
if what == Node.NOTIFICATION_DRAG_END:
|
||||
check_server()
|
||||
pass
|
||||
|
||||
func check_server():
|
||||
if slots[0].item:
|
||||
if slots[0].item.item_name == "Server":
|
||||
install_button.disabled = false
|
||||
else:
|
||||
install_button.disabled = true
|
||||
else:
|
||||
install_button.disabled = true
|
||||
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
slots[0].item = null
|
||||
slots[0].update_ui()
|
||||
PlayerInventory.botnet_servers += 1
|
||||
1
inv_system/botnet/botnet_panel.gd.uid
Normal file
1
inv_system/botnet/botnet_panel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://du0kijn4lh5kb
|
||||
76
inv_system/botnet/botnet_panel.tscn
Normal file
76
inv_system/botnet/botnet_panel.tscn
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://nfd41hcidmju"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://du0kijn4lh5kb" path="res://inv_system/botnet/botnet_panel.gd" id="1_m02i1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dgqs20xf7l8c" path="res://inv_system/item_slot.tscn" id="2_ngfss"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ti0ti"]
|
||||
font_color = Color(1, 0.75686276, 0, 0.4745098)
|
||||
|
||||
[node name="InventoryPanel" type="PanelContainer" node_paths=PackedStringArray("install_button", "score_label", "slots", "grid", "inv_label")]
|
||||
offset_left = 51.0
|
||||
offset_top = 67.0
|
||||
offset_right = 403.0
|
||||
offset_bottom = 259.0
|
||||
script = ExtResource("1_m02i1")
|
||||
install_button = NodePath("MarginContainer/VBoxContainer/Button")
|
||||
score_label = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/Label2")
|
||||
inventory_name = "Install in Botnet"
|
||||
slots = [NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer/ItemSlot")]
|
||||
type = "Install"
|
||||
grid = NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer")
|
||||
inv_label = NodePath("MarginContainer/VBoxContainer/Label")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Inventory 1"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
columns = 5
|
||||
|
||||
[node name="ItemSlot" parent="MarginContainer/VBoxContainer/HBoxContainer/GridContainer" instance=ExtResource("2_ngfss")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Add a completed server to your botnet, (your main goal!)"
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "(this action cannot be undone)"
|
||||
label_settings = SubResource("LabelSettings_ti0ti")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Button" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Install completed server"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Servers in your botnet:"
|
||||
|
||||
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "0"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Button" to="." method="_on_button_pressed"]
|
||||
|
|
@ -17,7 +17,7 @@ func _ready() -> void:
|
|||
slot.type = type
|
||||
if type == "Inventory":
|
||||
MouseTweaks.player_inventory = self
|
||||
else:
|
||||
elif type != "Install":
|
||||
MouseTweaks.other_inventory = self
|
||||
pass # Replace with function body.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ extends Node
|
|||
@export var button : Button
|
||||
@export var money : int = 0
|
||||
@export var money_label : Label
|
||||
@export var botnet_servers : int = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
|
|||
|
|
@ -28,13 +28,16 @@ func calculate_sell_value():
|
|||
else:
|
||||
sell_label.text = "Place an item"
|
||||
sell_button.disabled = true
|
||||
if not Clock.has_time(15):
|
||||
sell_button.disabled = true
|
||||
|
||||
|
||||
func _on_sell_button_pressed() -> void:
|
||||
if slots[0].item:
|
||||
if slots[0].item and Clock.has_time(15):
|
||||
var sell_value : int = floori(slots[0].item.buy_value / float(2))
|
||||
slots[0].item = null
|
||||
slots[0].update_ui()
|
||||
PlayerInventory.money += sell_value
|
||||
Clock.use_time(15)
|
||||
calculate_sell_value()
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,6 @@ text = "1234"
|
|||
|
||||
[node name="SellButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Sell!"
|
||||
text = "Sell! (Uses 15 time)"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/SellButton" to="." method="_on_sell_button_pressed"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue