added text input, started adding label button
This commit is contained in:
35
AGUI.StackedUI/AGUI.TextInput.Collider.gd
Normal file
35
AGUI.StackedUI/AGUI.TextInput.Collider.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
@tool
|
||||
extends StaticBody3D
|
||||
|
||||
var baseColor : Color
|
||||
var pressedColor : Color
|
||||
@onready var Animator = $Animator
|
||||
var pressed : bool = false
|
||||
var ButtonMaterial : StandardMaterial3D = StandardMaterial3D.new()
|
||||
|
||||
func _initButton(BaseColor:Color,PressedColor:Color):
|
||||
baseColor=BaseColor
|
||||
pressedColor=PressedColor
|
||||
ButtonMaterial.albedo_color = BaseColor
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
$MeshRoot.material_override = ButtonMaterial
|
||||
ButtonMaterial.albedo_color = baseColor
|
||||
Animator.get_animation("interact").loop_mode = Animation.LOOP_NONE
|
||||
|
||||
func press():
|
||||
if !pressed:
|
||||
$"..".buttonPressed.emit()
|
||||
$"..".buttonUpdated.emit()
|
||||
Animator.play("interact")
|
||||
ButtonMaterial.albedo_color = pressedColor
|
||||
pressed=true
|
||||
|
||||
func release():
|
||||
if pressed:
|
||||
$"..".buttonReleased.emit()
|
||||
$"..".buttonUpdated.emit()
|
||||
Animator.play_backwards("interact")
|
||||
ButtonMaterial.albedo_color = baseColor
|
||||
pressed=false
|
||||
1
AGUI.StackedUI/AGUI.TextInput.Collider.gd.uid
Normal file
1
AGUI.StackedUI/AGUI.TextInput.Collider.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://thynii4x8c6v
|
||||
88
AGUI.StackedUI/AGUI.TextInput.tscn
Normal file
88
AGUI.StackedUI/AGUI.TextInput.tscn
Normal file
@@ -0,0 +1,88 @@
|
||||
[gd_scene format=3 uid="uid://5b3mm6x4dkcc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://nfi6xrly38aw" path="res://AgainstGravityUI/AGUI.StackedUI/agui.text_input.gd" id="1_qfj7f"]
|
||||
[ext_resource type="Script" uid="uid://thynii4x8c6v" path="res://AgainstGravityUI/AGUI.StackedUI/AGUI.TextInput.Collider.gd" id="2_qfj7f"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_xeeyd"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1du0n"]
|
||||
length = 0.001
|
||||
tracks/0/type = "position_3d"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("StaticBody3D/MeshRoot")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xjbij"]
|
||||
resource_name = "interact"
|
||||
length = 0.1
|
||||
tracks/0/type = "position_3d"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("StaticBody3D/MeshRoot")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 0.03333334, 1, 0, -0.05, 0)
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7pntp"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_1du0n"),
|
||||
&"interact": SubResource("Animation_xjbij")
|
||||
}
|
||||
|
||||
[node name="AGUITextInput3D" type="Node3D" unique_id=81597797]
|
||||
script = ExtResource("1_qfj7f")
|
||||
baseColor = Color(0.20579061, 0.44805384, 1, 1)
|
||||
pressedColor = Color(0, 0.5334508, 0.8641794, 1)
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=1473098479]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
script = ExtResource("2_qfj7f")
|
||||
|
||||
[node name="Collider" type="CollisionShape3D" parent="StaticBody3D" unique_id=335334790]
|
||||
transform = Transform3D(7.8185873, 0, 0, 0, 0.37179297, 0, 0, 0, 1, 0, 0, 0)
|
||||
shape = SubResource("BoxShape3D_xeeyd")
|
||||
|
||||
[node name="MeshRoot" type="CSGCombiner3D" parent="StaticBody3D" unique_id=1112723183]
|
||||
transform = Transform3D(7.8185873, 0, 0, 0, 0.024529457, 0, 0, 0, 1, 0, 0, 0)
|
||||
operation = 2
|
||||
|
||||
[node name="MainMesh" type="CSGBox3D" parent="StaticBody3D/MeshRoot" unique_id=1438018078]
|
||||
|
||||
[node name="Subtractor_Box" type="CSGBox3D" parent="StaticBody3D/MeshRoot/MainMesh" unique_id=842962794]
|
||||
operation = 2
|
||||
|
||||
[node name="Subtractor_Cylinder" type="CSGCylinder3D" parent="StaticBody3D/MeshRoot/MainMesh/Subtractor_Box" unique_id=1951089581]
|
||||
transform = Transform3D(0.9, 0, 0, 0, 0.9, 0, 0, 0, 0.9, 0, 0, 0)
|
||||
operation = 2
|
||||
radius = 0.734
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="StaticBody3D" unique_id=53081295]
|
||||
root_node = NodePath("../..")
|
||||
libraries/ = SubResource("AnimationLibrary_7pntp")
|
||||
|
||||
[node name="MeshRoot2" type="CSGCombiner3D" parent="StaticBody3D" unique_id=1127109007]
|
||||
transform = Transform3D(7.122161, 0, 0, 0, 0.024529457, 0, 0, 0, 0.73947906, 0, 0.037864685, 0)
|
||||
operation = 2
|
||||
|
||||
[node name="MainMesh" type="CSGBox3D" parent="StaticBody3D/MeshRoot2" unique_id=916935335]
|
||||
|
||||
[node name="Subtractor_Box" type="CSGBox3D" parent="StaticBody3D/MeshRoot2/MainMesh" unique_id=59198445]
|
||||
operation = 2
|
||||
|
||||
[node name="Subtractor_Cylinder" type="CSGCylinder3D" parent="StaticBody3D/MeshRoot2/MainMesh/Subtractor_Box" unique_id=459666208]
|
||||
transform = Transform3D(0.9, 0, 0, 0, 0.9, 0, 0, 0, 0.9, 0, 0, 0)
|
||||
operation = 2
|
||||
radius = 0.734
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="StaticBody3D" unique_id=442460324]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -3.547236, 0.06489611, 0)
|
||||
pixel_size = 0.01
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
outline_modulate = Color(1, 1, 1, 1)
|
||||
text = "Label"
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
19
AGUI.StackedUI/agui.text_input.gd
Normal file
19
AGUI.StackedUI/agui.text_input.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
signal buttonPressed
|
||||
signal buttonReleased
|
||||
signal buttonUpdated
|
||||
|
||||
@export_category("Visuals")
|
||||
@export var baseColor : Color
|
||||
@export var pressedColor : Color
|
||||
@export var text : String
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
$StaticBody3D/Label3D.text = text
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$StaticBody3D._initButton(baseColor,pressedColor)
|
||||
print(baseColor,pressedColor)
|
||||
1
AGUI.StackedUI/agui.text_input.gd.uid
Normal file
1
AGUI.StackedUI/agui.text_input.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://nfi6xrly38aw
|
||||
Reference in New Issue
Block a user