This commit is contained in:
liuliang 2024-12-10 14:59:20 +08:00
parent 6c384fa6c7
commit 5842e7d22c
13 changed files with 1047 additions and 238 deletions

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://qaq46brhnjbn"
path="res://.godot/imported/l3_7.png-ca4e6c14f3ecf8e6811217696b7d5cb5.ctex"
path="res://.godot/imported/l3_7.png-5fbd988a714b1a6560cf44c14d69a2bc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://pad_hmi_ui/home/l3_7.png"
dest_files=["res://.godot/imported/l3_7.png-ca4e6c14f3ecf8e6811217696b7d5cb5.ctex"]
source_file="res://code/l3_7.png"
dest_files=["res://.godot/imported/l3_7.png-5fbd988a714b1a6560cf44c14d69a2bc.ctex"]
[params]

View File

@ -0,0 +1,57 @@
extends BaseControl
@onready var main_3d_vehicle: MarginContainer = %Main3DVehicle
@onready var main_3d_vehicle_texture: BaseControl = %Main3DVehicleTexture
@onready var data_panel: HBoxContainer = %DataPanel
@onready var _3d_vehicle: BaseControl = $"HBoxContainer/MarginContainer/DataPanel/MediumMenu/VBoxContainer/CarInfoDisplay/3DVehicle"
@onready var main_3d_vehicle_background: NinePatchRect = %Main3DVehicleBackground
@onready var main_3d_vehicle_information: MarginContainer = %Main3DVehicleInformation
@onready var _3d_vehicle_information: MarginContainer = %"3DVehicleInformation"
@onready var pretend_main_3d_vehicle_information: MarginContainer = %PretendMain3DVehicleInformation
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#Engine.time_scale = 0.01
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func OnClick3DVehicle(_node: Variant) -> void:
main_3d_vehicle.visible = true
#main_3d_vehicle_background.visible = false
pretend_main_3d_vehicle_information.modulate.a = 1
main_3d_vehicle_background.modulate.a = 0
main_3d_vehicle_information.modulate.a = 0
data_panel.modulate.a = 1
_3d_vehicle.modulate.a = 0
_3d_vehicle_information.modulate.a = 1
main_3d_vehicle_texture.modulate.a = 0
await get_tree().process_frame
await get_tree().process_frame
#main_3d_vehicle.self_modulate.a = 0
main_3d_vehicle_texture.modulate.a = 255
main_3d_vehicle_texture.onStart()
var tween0 = create_tween()
tween0.set_parallel()
tween0.tween_property(_3d_vehicle_information, "modulate", Color(1,1,1,0), 0.1)
tween0.tween_property(pretend_main_3d_vehicle_information, "modulate", Color(1,1,1,0), 0.1)
await get_tree().create_timer(0.3).timeout
#main_3d_vehicle_background.visible = true
var tween = create_tween()
tween.set_parallel()
tween.tween_property(main_3d_vehicle_background, "modulate", Color(1,1,1,1), 0.1)
tween.tween_property(main_3d_vehicle_information, "modulate", Color(1,1,1,1), 0.05)
tween.tween_property(data_panel, "modulate", Color(1,1,1,0), 0.1)
main_3d_vehicle_information
_3d_vehicle.modulate.a = 1
await get_tree().create_timer(0.1).timeout
_3d_vehicle_information.modulate.a = 1
data_panel.visible = false
#main_3d_vehicle.self_modulate.a = 1
pass # Replace with function body.""

View File

@ -0,0 +1,9 @@
@tool
extends PathFollow2D
@export var textureProgressBar : TextureProgressBar
@export var node : Node
func _physics_process(delta: float) -> void:
progress_ratio = textureProgressBar._value / textureProgressBar._max_value
node.global_position = global_position - node.size/2
pass

View File

@ -0,0 +1,15 @@
@tool
extends TextureProgressBar
@export var _max_value :float= 0
@export var _value :float= 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _process(delta: float) -> void:
_value = clampf(_value,0,_max_value)
material.set_shader_parameter("value",_value/_max_value)
#value = float(_value) /float( _max_value) * float(max_value)
pass

View File

@ -1,132 +1,3 @@
#@tool
#class_name BaseControl
#extends Control
#
#signal result_data(value)
#signal init_complete()
#signal load_anim_complete()
#signal on_click(_node)
#signal on_long_click(_node)
##@export var long_time = 800
#var clickTime = 0
#var clickPosition = Vector2.ZERO
#var itemRoot : BaseControl = null
#
#enum {
#RESULT_OK,
#RESULT_CANCELED
#}
#
#class GResult :
#var code = RESULT_OK
#var data = null
#func _init(p_code,p_data = null):
#self.code = p_code
#self.data = p_data
#
#
#
#@export var styleBox : StyleBox = null : set = set_styleBox
#@export var enter_anim : Animation = null
#@export var exit_anim : Animation = null
#@export var is_anim = true
#@export var on_click_anim : Animation = null
#var baseAnimationPlayer : AnimationPlayer = null
#func _ready():
#await get_tree().process_frame
#if is_anim:
#init_anim()
#playEnter()
#
#await get_tree().create_timer(0.2).timeout
#init_complete.emit()
#
#
#func init_anim():
#if enter_anim == null and exit_anim == null :
#return
#baseAnimationPlayer = AnimationPlayer.new()
#var animationLibrary = AnimationLibrary.new()
#if enter_anim != null :
#animationLibrary.add_animation("enter",enter_anim)
#if exit_anim != null :
#animationLibrary.add_animation("exit",exit_anim)
#if on_click_anim != null:
#animationLibrary.add_animation("on_click_anim",on_click_anim)
#baseAnimationPlayer.add_animation_library("",animationLibrary)
#add_child(baseAnimationPlayer)
##
#
#func playEnter():
#if enter_anim != null and baseAnimationPlayer != null :
#baseAnimationPlayer.play("enter")
#
#
#
#func playExit():
#if exit_anim != null and baseAnimationPlayer != null :
#baseAnimationPlayer.play("exit")
#await baseAnimationPlayer.animation_finished
#
##func queue_free():
##if is_anim:
##await playExit()
##super.queue_free()
#
#func set_styleBox(value) :
#styleBox = value
#queue_redraw()
#var is_move_r = false
#func _gui_input(event):
#if event is InputEventScreenTouch :
#is_move_r = event.pressed
#if event.pressed == true:
#clickTime = Time.get_ticks_msec()
#clickPosition = event.position
#pressed_true()
#if event.pressed == false:
#var diff = Time.get_ticks_msec() - clickTime
#clickTime = 0
#if event.position.distance_to(clickPosition)<2 :
#if mouse_filter == Control.MOUSE_FILTER_STOP :
#accept_event()
#if diff < 800:
#emit_signal("on_click",self)
#if on_click_anim != null and baseAnimationPlayer != null :
#baseAnimationPlayer.play("on_click_anim")
#click()
#else :
#emit_signal("on_long_click",self)
#long_click()
#pressed_false()
#func pressed_true():
#pass
#func pressed_false():
#pass
#func _process(delta):
#if not Rect2(global_position, global_position+size).has_point(get_global_mouse_position()):
#pressed_false()
#func click():
#pass
#func long_click():
#pass
#
#
#func _draw():
#if styleBox !=null :
#draw_style_box(styleBox, Rect2(Vector2(0,0) , size ))
@tool
class_name BaseControl
extends Control
@ -160,9 +31,20 @@ class GResult :
@export var exit_anim : Animation = null
@export var is_anim = true
@export var on_click_anim : Animation = null
@export var _pivot_offset = "CENTER"
@export var is_Scale = false
@export var is_Rotation = false
@export var OnClickScaleArrNode : Array[Node] = []
var is_OnClickScale = false
@export var size_max : float = 1;
@export var is_OnClickScaleAwt = false
@export var StatusTime = 0.2
@export var scaleMax : Vector2 = Vector2(1,1);
@export var scaleMin : Vector2 = Vector2(0,0);
var baseAnimationPlayer : AnimationPlayer = null
func _ready():
await get_tree().process_frame
OnClickScale()
if is_anim:
init_anim()
playEnter()
@ -184,6 +66,7 @@ func init_anim():
animationLibrary.add_animation("on_click_anim",on_click_anim)
baseAnimationPlayer.add_animation_library("",animationLibrary)
add_child(baseAnimationPlayer)
#
func playEnter():
@ -225,17 +108,68 @@ func _gui_input(event):
if on_click_anim != null and baseAnimationPlayer != null :
baseAnimationPlayer.play("on_click_anim")
click()
if is_Scale:
onScale()
if is_Rotation:
onRotation()
is_OnClickScale = !is_OnClickScale
OnClickScale()
else :
emit_signal("on_long_click",self)
long_click()
pressed_false()
func OnClickScale():
for node : Node in OnClickScaleArrNode:
if is_OnClickScale:
node.onStart()
else:
node.onEnd()
await get_tree().create_timer(StatusTime).timeout
func onScale():
var tween = create_tween()
tween.tween_property(self, "scale", Vector2(1 + (0.2*size_max),1 + (0.2*size_max)), 0.1)
tween.tween_property(self, "scale", Vector2(1 - (0.05*size_max),1 - (0.05*size_max)), 0.15)
tween.tween_property(self, "scale", Vector2(1,1), 0.1)
func onRotation():
var tween = create_tween()
tween.tween_property(self, "rotation_degrees", 50*size_max, 0.1)
tween.tween_property(self, "rotation_degrees", -60*size_max, 0.15)
tween.tween_property(self, "rotation_degrees", 0, 0.1)
func onStart():
#visible = true
#_pivot_offset = "CENTER_Left"
scale = scaleMin
var tween = create_tween()
tween.tween_property(self, "scale", scaleMin - (scaleMin*0.05), 0.1)
tween.tween_property(self, "scale", scaleMax , StatusTime)
func onEnd():
#_pivot_offset = "CENTER_RIGHT"
scale = scaleMax
var tween = create_tween()
tween.tween_property(self, "scale", scaleMin, StatusTime)
func pressed_true():
pass
func pressed_false():
pass
func _physics_process(delta: float) -> void:
if _pivot_offset == "CENTER":
pivot_offset = size/2
if _pivot_offset == "CENTER_RIGHT":
pivot_offset.x = size.x
pivot_offset.y = size.y/2
if _pivot_offset == "CENTER_Left":
pivot_offset.x = 0
pivot_offset.y = size.y/2
func _process(delta):
if not Rect2(global_position, global_position+size).has_point(get_global_mouse_position()):
pressed_false()
func click():
pass
func long_click():

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
extends BaseControl
@onready var main_3d_vehicle_texture: BaseControl = %Main3DVehicleTexture
@onready var data_panel: HBoxContainer = %DataPanel
@onready var main_3d_vehicle_information: MarginContainer = %Main3DVehicleInformation
@onready var main_3d_vehicle_background: NinePatchRect = %Main3DVehicleBackground
func _on_main_3d_vehicle_texture_on_click(_node: Variant) -> void:
main_3d_vehicle_texture.onEnd()
#data_panel.modulate.a = 0
data_panel.visible = true
data_panel.modulate.a = 1
main_3d_vehicle_background.modulate.a = 0
var tween = create_tween()
tween.tween_property(main_3d_vehicle_information, "modulate", Color(1,1,1,0), 0.05)
#tween.tween_property(data_panel, "modulate", Color(1,1,1,1), 0.1)
await get_tree().create_timer(0.3).timeout
visible = false
#tween.set_parallel()
#tween.tween_property(main_3d_vehicle_information, "modulate", Color(1,1,1,1), 0.1)
var tween1 = create_tween()
tween1.tween_property(data_panel, "modulate", Color(1,1,1,1), 0.1)
pass # Replace with function body.

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b2dketby5loag"
path="res://.godot/imported/map.png-25f8d2b28b79266c7cc937e1cc88a043.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://pad_hmi_ui/home/map.png"
dest_files=["res://.godot/imported/map.png-25f8d2b28b79266c7cc937e1cc88a043.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -22,6 +22,10 @@ window/size/viewport_height=1600
window/size/mode=2
window/stretch/mode="canvas_items"
[input_devices]
pointing/emulate_touch_from_mouse=true
[rendering]
renderer/rendering_method="mobile"

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://pomyaut6jtnm"
path="res://.godot/imported/未标题-1.png-e89f7c987f26cfa35ba9cd9670c598b4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://未标题-1.png"
dest_files=["res://.godot/imported/未标题-1.png-e89f7c987f26cfa35ba9cd9670c598b4.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1