added a keyboard panel and a toggle button
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
signal buttonPressed
|
||||
@@ -8,6 +9,7 @@ signal buttonUpdated
|
||||
@export var baseColor : Color
|
||||
@export var pressedColor : Color
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$StaticBody3D._initButton(baseColor,pressedColor)
|
||||
print(baseColor,pressedColor)
|
||||
|
||||
35
AGUI.Scripts/AGUI.CharacterButton3D.Collider.gd
Normal file
35
AGUI.Scripts/AGUI.CharacterButton3D.Collider.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
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,char:String):
|
||||
baseColor=BaseColor
|
||||
pressedColor=PressedColor
|
||||
ButtonMaterial.albedo_color = BaseColor
|
||||
$Label3D.text = char
|
||||
|
||||
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($Label3D.text)
|
||||
$"..".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.Scripts/AGUI.CharacterButton3D.Collider.gd.uid
Normal file
1
AGUI.Scripts/AGUI.CharacterButton3D.Collider.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dbv4hr2h4cfug
|
||||
17
AGUI.Scripts/AGUI.CharacterButton3D.gd
Normal file
17
AGUI.Scripts/AGUI.CharacterButton3D.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
signal buttonPressed(char)
|
||||
signal buttonReleased
|
||||
signal buttonUpdated
|
||||
|
||||
@export_category("Visuals")
|
||||
@export var baseColor : Color
|
||||
@export var pressedColor : Color
|
||||
@export var char : String
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$StaticBody3D._initButton(baseColor,pressedColor,char)
|
||||
print(baseColor,pressedColor)
|
||||
1
AGUI.Scripts/AGUI.CharacterButton3D.gd.uid
Normal file
1
AGUI.Scripts/AGUI.CharacterButton3D.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://3m5f4lxd2x3c
|
||||
35
AGUI.Scripts/AGUI.IconButton3D.Collider.gd
Normal file
35
AGUI.Scripts/AGUI.IconButton3D.Collider.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
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,icon:Texture2D):
|
||||
baseColor=BaseColor
|
||||
pressedColor=PressedColor
|
||||
ButtonMaterial.albedo_color = BaseColor
|
||||
$Sprite3D.texture = icon
|
||||
|
||||
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.Scripts/AGUI.IconButton3D.Collider.gd.uid
Normal file
1
AGUI.Scripts/AGUI.IconButton3D.Collider.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://crq0dvryyehig
|
||||
15
AGUI.Scripts/AGUI.IconButton3D.gd
Normal file
15
AGUI.Scripts/AGUI.IconButton3D.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
signal buttonPressed
|
||||
signal buttonReleased
|
||||
signal buttonUpdated
|
||||
|
||||
@export_category("Visuals")
|
||||
@export var baseColor : Color
|
||||
@export var pressedColor : Color
|
||||
@export var icon : Texture2D
|
||||
|
||||
func _ready() -> void:
|
||||
$StaticBody3D._initButton(baseColor,pressedColor,icon)
|
||||
print(baseColor,pressedColor)
|
||||
1
AGUI.Scripts/AGUI.IconButton3D.gd.uid
Normal file
1
AGUI.Scripts/AGUI.IconButton3D.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dkmw6hfq1nkrk
|
||||
37
AGUI.Scripts/AGUI.ToggleCharacterButton3D.Collider.gd
Normal file
37
AGUI.Scripts/AGUI.ToggleCharacterButton3D.Collider.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends StaticBody3D
|
||||
|
||||
var baseColor : Color
|
||||
var pressedColor : Color
|
||||
@onready var Animator = $Animator
|
||||
var pressed : bool = false
|
||||
var ButtonMaterial : StandardMaterial3D = StandardMaterial3D.new()
|
||||
var isBeingHeld = false
|
||||
|
||||
func _initButton(BaseColor:Color,PressedColor:Color,char:String):
|
||||
baseColor=BaseColor
|
||||
pressedColor=PressedColor
|
||||
ButtonMaterial.albedo_color = BaseColor
|
||||
$Label3D.text = char
|
||||
|
||||
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($Label3D.text)
|
||||
$"..".buttonUpdated.emit()
|
||||
Animator.play("interact")
|
||||
ButtonMaterial.albedo_color = pressedColor
|
||||
pressed = true
|
||||
else:
|
||||
$"..".buttonReleased.emit()
|
||||
$"..".buttonUpdated.emit()
|
||||
Animator.play_backwards("interact")
|
||||
ButtonMaterial.albedo_color = baseColor
|
||||
pressed = false
|
||||
|
||||
|
||||
func release():
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
uid://dfdsr0t25d4ha
|
||||
17
AGUI.Scripts/AGUI.ToggleCharacterButton3D.gd
Normal file
17
AGUI.Scripts/AGUI.ToggleCharacterButton3D.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
signal buttonPressed(char)
|
||||
signal buttonReleased
|
||||
signal buttonUpdated
|
||||
|
||||
@export_category("Visuals")
|
||||
@export var baseColor : Color
|
||||
@export var pressedColor : Color
|
||||
@export var char : String
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$StaticBody3D._initButton(baseColor,pressedColor,char)
|
||||
print(baseColor,pressedColor)
|
||||
1
AGUI.Scripts/AGUI.ToggleCharacterButton3D.gd.uid
Normal file
1
AGUI.Scripts/AGUI.ToggleCharacterButton3D.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d0up8mkp431mn
|
||||
Reference in New Issue
Block a user