ui manager
parent
04f4b2514f
commit
ccafce2005
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 81 B |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d04pc2qtxicl2"
|
||||||
|
path="res://.godot/imported/pixel.png-8b85563bd6c30c08e41c5f91f621664f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resource/ui/common/pixel.png"
|
||||||
|
dest_files=["res://.godot/imported/pixel.png-8b85563bd6c30c08e41c5f91f621664f.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=0
|
||||||
|
compress/normal_map=2
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
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=0
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://0uonhojhfgi"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d04pc2qtxicl2" path="res://resource/ui/common/pixel.png" id="1_7uu3x"]
|
||||||
|
|
||||||
|
[node name="MenuScreen" type="CanvasLayer"]
|
||||||
|
|
||||||
|
[node name="Background" type="TextureRect" parent="."]
|
||||||
|
modulate = Color(0, 0, 0, 0.501961)
|
||||||
|
offset_right = 640.0
|
||||||
|
offset_bottom = 360.0
|
||||||
|
texture = ExtResource("1_7uu3x")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
offset_left = 24.0
|
||||||
|
offset_top = 208.0
|
||||||
|
offset_right = 114.0
|
||||||
|
offset_bottom = 309.0
|
||||||
|
|
||||||
|
[node name="Continue" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Continue"
|
||||||
|
|
||||||
|
[node name="Setting" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Setting"
|
||||||
|
|
||||||
|
[node name="Save&Quit" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Save&Quit"
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
class_name UIManager
|
||||||
|
|
||||||
|
@onready var ui_map = {
|
||||||
|
"profile" : $ProfileScreen,
|
||||||
|
"hud" : $HudScreen,
|
||||||
|
"status" : $StatusScreen,
|
||||||
|
"menu" : $MenuScreen
|
||||||
|
}
|
||||||
|
|
||||||
|
var pause_count = 0
|
||||||
|
var ui_stack = []
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
Global.ui_mgr = self
|
||||||
|
close_all()
|
||||||
|
open("hud")
|
||||||
|
|
||||||
|
func input_action(key:String,is_pressed:bool):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func input_dir(key:String,is_pressed:bool):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func open(ui_name:String):
|
||||||
|
set_ui_visible(ui_name,true)
|
||||||
|
|
||||||
|
func close(ui_name:String):
|
||||||
|
set_ui_visible(ui_name,false)
|
||||||
|
|
||||||
|
func close_all():
|
||||||
|
for ui_name in ui_map:
|
||||||
|
close(ui_name)
|
||||||
|
|
||||||
|
func pause_open(ui_name:String):
|
||||||
|
open(ui_name)
|
||||||
|
set_pause(true)
|
||||||
|
|
||||||
|
func pause_close(ui_name:String):
|
||||||
|
close(ui_name)
|
||||||
|
set_pause(false)
|
||||||
|
|
||||||
|
func set_ui_visible(ui_name:String,is_visible:bool):
|
||||||
|
if not ui_name in ui_map:
|
||||||
|
return
|
||||||
|
ui_map[ui_name].visible = is_visible
|
||||||
|
|
||||||
|
func set_pause(is_pause:bool):
|
||||||
|
Global.is_control_pause = is_pause
|
||||||
|
get_tree().paused = is_pause
|
||||||
@ -1,4 +1,4 @@
|
|||||||
extends Label
|
extends Label
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
set_text("FPS %d" % Engine.get_frames_per_second())
|
set_text("%d FPS" % Engine.get_frames_per_second())
|
||||||
|
|||||||
Loading…
Reference in New Issue