-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51d3864
commit 2893c41
Showing
5 changed files
with
77 additions
and
21 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 |
---|---|---|
@@ -1,15 +1,21 @@ | ||
[gd_scene load_steps=3 format=2] | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://entities/itemselect/ItemSelect.cs" type="Script" id=1] | ||
[ext_resource path="res://scenes/main/BottomHud.tscn" type="PackedScene" id=2] | ||
|
||
[sub_resource type="CircleShape2D" id=1] | ||
radius = 1.0 | ||
|
||
[node name="ItemSelect" type="Area2D"] | ||
[node name="ItemSelect" type="Node"] | ||
script = ExtResource( 1 ) | ||
|
||
[node name="Cursor" type="CollisionShape2D" parent="."] | ||
[node name="BottomHud" parent="." instance=ExtResource( 2 )] | ||
grow_vertical = 0 | ||
|
||
[node name="Cursor" type="Area2D" parent="."] | ||
|
||
[node name="CursorShape" type="CollisionShape2D" parent="Cursor"] | ||
shape = SubResource( 1 ) | ||
|
||
[connection signal="area_entered" from="." to="." method="onAreaEntered"] | ||
[connection signal="area_exited" from="." to="." method="onAreaExited"] | ||
[connection signal="area_entered" from="Cursor" to="." method="onAreaEntered"] | ||
[connection signal="area_exited" from="Cursor" to="." method="onAreaExited"] |
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,27 @@ | ||
using Godot; | ||
|
||
public class BottomHud : Control | ||
{ | ||
public void ClearItem() | ||
{ | ||
var label = GetNode<RichTextLabel>("Label"); | ||
var frame = GetNode<NinePatchRect>("Frame"); | ||
|
||
label.BbcodeText = ""; | ||
frame.RectMinSize = Vector2.Zero; | ||
Visible = false; | ||
} | ||
|
||
public void SetItem(ItemLibrary.ItemType item) | ||
{ | ||
var label = GetNode<RichTextLabel>("Label"); | ||
var frame = GetNode<NinePatchRect>("Frame"); | ||
|
||
var name = item.ToString(); | ||
var desc = item.Description(); | ||
|
||
label.BbcodeText = $"[color=yellow]{name}[/color] {desc}"; | ||
frame.RectMinSize = new Vector2(0, label.RectSize.y + 3); | ||
Visible = true; | ||
} | ||
} |
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