UI copied over
This commit is contained in:
parent
00220e90bc
commit
8352f5733c
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://src/UI/HUD.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
|
|
||||||
|
|
@ -12,3 +13,5 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="PlayerE" parent="." instance=ExtResource( 1 )]
|
[node name="PlayerE" parent="." instance=ExtResource( 1 )]
|
||||||
position = Vector2( 112, 56 )
|
position = Vector2( 112, 56 )
|
||||||
|
|
||||||
|
[node name="UI_Layer" parent="." instance=ExtResource( 3 )]
|
||||||
|
|
|
||||||
8
assets/Fonts/QuinqueFive.tres
Normal file
8
assets/Fonts/QuinqueFive.tres
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFontData" id=1]
|
||||||
|
font_path = "res://assets/Fonts/QuinqueFive.ttf"
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
size = 5
|
||||||
|
font_data = SubResource( 1 )
|
||||||
BIN
assets/Fonts/QuinqueFive.ttf
Normal file
BIN
assets/Fonts/QuinqueFive.ttf
Normal file
Binary file not shown.
BIN
assets/UI/Healthbar-Indicator.png
Normal file
BIN
assets/UI/Healthbar-Indicator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 174 B |
35
assets/UI/Healthbar-Indicator.png.import
Normal file
35
assets/UI/Healthbar-Indicator.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Healthbar-Indicator.png-cbbde6797adcb3b0445dfd4f9ab1961a.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/UI/Healthbar-Indicator.png"
|
||||||
|
dest_files=[ "res://.import/Healthbar-Indicator.png-cbbde6797adcb3b0445dfd4f9ab1961a.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
||||||
BIN
assets/UI/Healthbar.png
Normal file
BIN
assets/UI/Healthbar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 B |
35
assets/UI/Healthbar.png.import
Normal file
35
assets/UI/Healthbar.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Healthbar.png-838f5c013355fbdfe1abb6dec9197215.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/UI/Healthbar.png"
|
||||||
|
dest_files=[ "res://.import/Healthbar.png-838f5c013355fbdfe1abb6dec9197215.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
||||||
|
|
@ -103,6 +103,11 @@ _global_script_classes=[ {
|
||||||
"class": "StateModifierAnimatedActor",
|
"class": "StateModifierAnimatedActor",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://lib/classes/state_modifier_animation.gd"
|
"path": "res://lib/classes/state_modifier_animation.gd"
|
||||||
|
}, {
|
||||||
|
"base": "Reference",
|
||||||
|
"class": "UIComponent",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://src/UI/UI_Layer.gd"
|
||||||
} ]
|
} ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Actor": "",
|
"Actor": "",
|
||||||
|
|
@ -123,7 +128,8 @@ _global_script_class_icons={
|
||||||
"StateMachine": "",
|
"StateMachine": "",
|
||||||
"StateMachineAnimatedActor": "",
|
"StateMachineAnimatedActor": "",
|
||||||
"StateModifier": "",
|
"StateModifier": "",
|
||||||
"StateModifierAnimatedActor": ""
|
"StateModifierAnimatedActor": "",
|
||||||
|
"UIComponent": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
|
||||||
71
src/UI/HUD.tscn
Normal file
71
src/UI/HUD.tscn
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=2]
|
||||||
|
[ext_resource path="res://src/UI/UI_Layer.gd" type="Script" id=3]
|
||||||
|
[ext_resource path="res://assets/UI/Healthbar.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://src/UI/HealthBar.gd" type="Script" id=5]
|
||||||
|
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=6]
|
||||||
|
|
||||||
|
[node name="UI_Layer" type="CanvasLayer"]
|
||||||
|
pause_mode = 2
|
||||||
|
layer = 2
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
|
margin_left = 2.0
|
||||||
|
margin_top = 2.0
|
||||||
|
margin_right = 318.0
|
||||||
|
margin_bottom = 80.0
|
||||||
|
|
||||||
|
[node name="HSplitContainer" type="HSplitContainer" parent="PanelContainer"]
|
||||||
|
margin_left = 7.0
|
||||||
|
margin_top = 7.0
|
||||||
|
margin_right = 309.0
|
||||||
|
margin_bottom = 71.0
|
||||||
|
size_flags_vertical = 0
|
||||||
|
split_offset = 1
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="PanelContainer/HSplitContainer"]
|
||||||
|
margin_right = 65.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_vertical = 5
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="PanelContainer/HSplitContainer"]
|
||||||
|
margin_left = 77.0
|
||||||
|
margin_right = 302.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
size_flags_vertical = 1
|
||||||
|
size_flags_stretch_ratio = 5.0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World"
|
||||||
|
autowrap = true
|
||||||
|
|
||||||
|
[node name="Polygon2D" type="Polygon2D" parent="PanelContainer"]
|
||||||
|
position = Vector2( 75, 16.5 )
|
||||||
|
scale = Vector2( 0.769547, 0.833333 )
|
||||||
|
color = Color( 0.533333, 0.533333, 0.533333, 1 )
|
||||||
|
polygon = PoolVector2Array( 294, 63, 300.177, 63, 307, 63, 300.503, 69 )
|
||||||
|
|
||||||
|
[node name="HealthBar" type="TextureProgress" parent="."]
|
||||||
|
margin_left = 2.0
|
||||||
|
margin_top = 2.0
|
||||||
|
margin_right = 104.0
|
||||||
|
margin_bottom = 14.0
|
||||||
|
value = 50.0
|
||||||
|
texture_under = ExtResource( 4 )
|
||||||
|
texture_progress = ExtResource( 6 )
|
||||||
|
texture_progress_offset = Vector2( 1, 1 )
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="Debug" type="Label" parent="."]
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
margin_left = -192.0
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = -3.0
|
||||||
|
margin_bottom = 17.0
|
||||||
|
text = "Foo"
|
||||||
|
align = 2
|
||||||
16
src/UI/HealthBar.gd
Normal file
16
src/UI/HealthBar.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
extends TextureProgress
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
value = PlayerInfo.player_health
|
||||||
39
src/UI/UI_Dialog.tscn
Normal file
39
src/UI/UI_Dialog.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=1]
|
||||||
|
[ext_resource path="res://icon.png" type="Texture" id=2]
|
||||||
|
|
||||||
|
[node name="UI_Dialog" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
|
margin_left = 2.0
|
||||||
|
margin_top = 2.0
|
||||||
|
margin_right = 318.0
|
||||||
|
margin_bottom = 80.0
|
||||||
|
|
||||||
|
[node name="HSplitContainer" type="HSplitContainer" parent="PanelContainer"]
|
||||||
|
margin_left = 7.0
|
||||||
|
margin_top = 7.0
|
||||||
|
margin_right = 309.0
|
||||||
|
margin_bottom = 71.0
|
||||||
|
size_flags_vertical = 0
|
||||||
|
split_offset = 1
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="PanelContainer/HSplitContainer"]
|
||||||
|
margin_right = 65.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_vertical = 5
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="PanelContainer/HSplitContainer"]
|
||||||
|
margin_left = 77.0
|
||||||
|
margin_right = 302.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
size_flags_vertical = 1
|
||||||
|
size_flags_stretch_ratio = 5.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World"
|
||||||
|
autowrap = true
|
||||||
60
src/UI/UI_Layer.gd
Normal file
60
src/UI/UI_Layer.gd
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
class_name UIComponent
|
||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
onready var DialogContainer = $PanelContainer
|
||||||
|
|
||||||
|
onready var DialogContainerPortrait = $PanelContainer/HSplitContainer/TextureRect
|
||||||
|
|
||||||
|
onready var DialogContainerText = $PanelContainer/HSplitContainer/Label
|
||||||
|
|
||||||
|
onready var DialogIndicator = $PanelContainer/Polygon2D
|
||||||
|
|
||||||
|
onready var HUD = $HealthBar
|
||||||
|
|
||||||
|
var current_pane
|
||||||
|
|
||||||
|
var tween
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
# How to change to a differant portrait picture.
|
||||||
|
#DialogContainerPortrait.texture = UiManager.dialog_portrait
|
||||||
|
#DialogContainerText.text = UiManager.dialog_text
|
||||||
|
UiManager.current_pane = UiManager.UI_PANES.HUD
|
||||||
|
#DialogContainer.visible = false
|
||||||
|
tween = get_tree().create_tween().set_loops()
|
||||||
|
tween.tween_property(DialogIndicator, "modulate", Color.darkgray, 1)
|
||||||
|
tween.tween_property(DialogIndicator, "modulate", Color.white , 1)
|
||||||
|
##tween.tween_property(DialogIndicator, "modulate", Color.RED, 1)
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
$Debug.text = UiManager.debug_text
|
||||||
|
if (UiManager.current_pane != current_pane):
|
||||||
|
print("UI Switch detected")
|
||||||
|
current_pane = UiManager.current_pane
|
||||||
|
DialogContainer.visible = false
|
||||||
|
HUD.visible = false
|
||||||
|
match current_pane:
|
||||||
|
UiManager.UI_PANES.HUD:
|
||||||
|
print("Enable HUD")
|
||||||
|
HUD.visible = true
|
||||||
|
UiManager.UI_PANES.DIALOG:
|
||||||
|
print("Enable Dialog")
|
||||||
|
DialogContainerPortrait.texture = UiManager.dialog_portrait
|
||||||
|
DialogContainerText.text = UiManager.dialog_text
|
||||||
|
DialogContainer.visible = true
|
||||||
|
#get_tree().paused = true
|
||||||
|
_: # Implicitly off
|
||||||
|
print("UI Turned off")
|
||||||
|
|
||||||
|
|
||||||
|
func _unhandled_input(event):
|
||||||
|
if current_pane == UiManager.UI_PANES.DIALOG and Input.is_action_just_pressed("ui_accept"):
|
||||||
|
UiManager.current_pane = UiManager.UI_PANES.HUD
|
||||||
|
#get_tree().paused = false
|
||||||
Loading…
Reference in New Issue
Block a user