diff --git a/DungeonShooting_Art/ui/GUI/CursorCenter.png b/DungeonShooting_Art/ui/GUI/CursorCenter.png new file mode 100644 index 0000000..468ec82 --- /dev/null +++ b/DungeonShooting_Art/ui/GUI/CursorCenter.png Binary files differ diff --git a/DungeonShooting_Godot/prefab/ui/Cursor.tscn b/DungeonShooting_Godot/prefab/ui/Cursor.tscn index b1ecef0..93edd6b 100644 --- a/DungeonShooting_Godot/prefab/ui/Cursor.tscn +++ b/DungeonShooting_Godot/prefab/ui/Cursor.tscn @@ -1,36 +1,42 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=3 uid="uid://brx7nc4mdgjat"] -[ext_resource path="res://resource/sprite/ui/Cursor.png" type="Texture2D" id=1] -[ext_resource path="res://src/game/ui/Cursor.cs" type="Script" id=2] +[ext_resource type="Texture2D" uid="uid://ct5v768lsf6nc" path="res://resource/sprite/ui/Cursor.png" id="1"] +[ext_resource type="Script" path="res://src/game/ui/Cursor.cs" id="2"] +[ext_resource type="Texture2D" uid="uid://cjiiu86a42mnj" path="res://resource/sprite/ui/CursorCenter.png" id="2_2j135"] [node name="Cursor" type="Node2D"] z_index = 10 -script = ExtResource( 2 ) +script = ExtResource("2") + +[node name="Center" type="Sprite2D" parent="."] +visible = false +scale = Vector2(4, 4) +texture = ExtResource("2_2j135") [node name="LT" type="Sprite2D" parent="."] -scale = Vector2( 4, 4 ) -texture = ExtResource( 1 ) -offset = Vector2( -2, -2 ) +scale = Vector2(4, 4) +texture = ExtResource("1") +offset = Vector2(-2, -2) region_enabled = true -region_rect = Rect2( 0, 0, 4, 4 ) +region_rect = Rect2(0, 0, 4, 4) [node name="LB" type="Sprite2D" parent="."] -scale = Vector2( 4, 4 ) -texture = ExtResource( 1 ) -offset = Vector2( -2, 2 ) +scale = Vector2(4, 4) +texture = ExtResource("1") +offset = Vector2(-2, 2) region_enabled = true -region_rect = Rect2( 0, 4, 4, 4 ) +region_rect = Rect2(0, 4, 4, 4) [node name="RT" type="Sprite2D" parent="."] -scale = Vector2( 4, 4 ) -texture = ExtResource( 1 ) -offset = Vector2( 2, -2 ) +scale = Vector2(4, 4) +texture = ExtResource("1") +offset = Vector2(2, -2) region_enabled = true -region_rect = Rect2( 4, 0, 4, 4 ) +region_rect = Rect2(4, 0, 4, 4) [node name="RB" type="Sprite2D" parent="."] -scale = Vector2( 4, 4 ) -texture = ExtResource( 1 ) -offset = Vector2( 2, 2 ) +scale = Vector2(4, 4) +texture = ExtResource("1") +offset = Vector2(2, 2) region_enabled = true -region_rect = Rect2( 4, 4, 4, 4 ) +region_rect = Rect2(4, 4, 4, 4) diff --git a/DungeonShooting_Godot/resource/sprite/ui/CursorCenter.png b/DungeonShooting_Godot/resource/sprite/ui/CursorCenter.png new file mode 100644 index 0000000..468ec82 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/CursorCenter.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/CursorCenter.png.import b/DungeonShooting_Godot/resource/sprite/ui/CursorCenter.png.import new file mode 100644 index 0000000..93da5e5 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/CursorCenter.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cjiiu86a42mnj" +path="res://.godot/imported/CursorCenter.png-221387e3be72196967aca25a86f368aa.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/CursorCenter.png" +dest_files=["res://.godot/imported/CursorCenter.png-221387e3be72196967aca25a86f368aa.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 diff --git a/DungeonShooting_Godot/src/game/ui/Cursor.cs b/DungeonShooting_Godot/src/game/ui/Cursor.cs index f2447a9..639c7cd 100644 --- a/DungeonShooting_Godot/src/game/ui/Cursor.cs +++ b/DungeonShooting_Godot/src/game/ui/Cursor.cs @@ -15,6 +15,7 @@ /// private Role _mountRole; + private Sprite2D center; private Sprite2D lt; private Sprite2D lb; private Sprite2D rt; @@ -22,6 +23,7 @@ public override void _Ready() { + center = GetNode("Center"); lt = GetNode("LT"); lb = GetNode("LB"); rt = GetNode("RT"); @@ -97,7 +99,9 @@ } scope = len / GameConfig.ScatteringDistance * scope; } - scope = Mathf.Clamp(scope, 0, 200); + scope = Mathf.Clamp(scope, 0, 192); + center.Visible = scope > 64; + lt.Position = new Vector2(-scope, -scope); lb.Position = new Vector2(-scope, scope); rt.Position = new Vector2(scope, -scope);