gui updated

This commit is contained in:
Фёдор Веселов 2024-09-16 19:03:32 +05:00
commit 0c9ea6ed0f
14 changed files with 124 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before After
Before After

View file

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://d0yhee0scl7mc"]
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_i6oyj"]
[resource]
atlas = ExtResource("1_i6oyj")
region = Rect2(0, 300, 36, 36)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_i8m7w") atlas = ExtResource("1_i8m7w")
region = Rect2(355, 68, 51, 47) region = Rect2(341, 67, 51, 47)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_r6k0p") atlas = ExtResource("1_r6k0p")
region = Rect2(36, 264, 36, 36) region = Rect2(45, 272, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_cq0f1") atlas = ExtResource("1_cq0f1")
region = Rect2(72, 264, 36, 36) region = Rect2(81, 272, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_xsjda") atlas = ExtResource("1_xsjda")
region = Rect2(108, 264, 36, 36) region = Rect2(117, 272, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_qlv5m") atlas = ExtResource("1_qlv5m")
region = Rect2(0, 264, 36, 36) region = Rect2(9, 272, 18, 20)

View file

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dxmg20mrnpt8r"]
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_sqfv1"]
[resource]
atlas = ExtResource("1_sqfv1")
region = Rect2(156, 365, 25, 25)

View file

@ -1,6 +1,34 @@
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://b8l285cjcgeyi"] [gd_resource type="Theme" load_steps=6 format=3 uid="uid://b8l285cjcgeyi"]
[ext_resource type="FontFile" uid="uid://nbrt5q3t8tud" path="res://assets/fonts/pico12.ttf" id="1_103to"] [ext_resource type="FontFile" uid="uid://nbrt5q3t8tud" path="res://assets/fonts/pico12.ttf" id="1_103to"]
[ext_resource type="Texture2D" uid="uid://d0yhee0scl7mc" path="res://assets/sprites/gui/ButtonBackground.tres" id="1_y0kbp"]
[ext_resource type="Texture2D" uid="uid://dxmg20mrnpt8r" path="res://assets/sprites/gui/SelectionGeneric.tres" id="2_h0nd2"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_na4u2"]
texture = ExtResource("1_y0kbp")
texture_margin_left = 12.0
texture_margin_top = 12.0
texture_margin_right = 12.0
texture_margin_bottom = 12.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mv7jy"]
texture = ExtResource("2_h0nd2")
texture_margin_left = 12.0
texture_margin_top = 12.0
texture_margin_right = 12.0
texture_margin_bottom = 12.0
axis_stretch_horizontal = 1
axis_stretch_vertical = 1
draw_center = false
[resource] [resource]
default_font = ExtResource("1_103to") default_font = ExtResource("1_103to")
Button/colors/font_color = Color(0, 0, 0, 1)
Button/colors/font_focus_color = Color(0, 0, 0, 1)
Button/colors/font_outline_color = Color(1, 1, 1, 1)
Button/colors/font_pressed_color = Color(1, 1, 1, 1)
Button/styles/disabled = SubResource("StyleBoxTexture_na4u2")
Button/styles/focus = SubResource("StyleBoxTexture_mv7jy")
Button/styles/hover = SubResource("StyleBoxTexture_na4u2")
Button/styles/normal = SubResource("StyleBoxTexture_na4u2")
Button/styles/pressed = SubResource("StyleBoxTexture_na4u2")

View file

@ -5,17 +5,18 @@
[ext_resource type="Texture2D" uid="uid://dfr5ofieigu5j" path="res://assets/sprites/gui/FastForward2.tres" id="3_fj838"] [ext_resource type="Texture2D" uid="uid://dfr5ofieigu5j" path="res://assets/sprites/gui/FastForward2.tres" id="3_fj838"]
[ext_resource type="Texture2D" uid="uid://qgmsoocd4p1o" path="res://assets/sprites/gui/FastForward3.tres" id="4_2wmv1"] [ext_resource type="Texture2D" uid="uid://qgmsoocd4p1o" path="res://assets/sprites/gui/FastForward3.tres" id="4_2wmv1"]
[node name="FastForwardButton" type="TextureButton"] [node name="FastForwardButton" type="Button"]
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.06 anchor_right = 0.043
anchor_bottom = 0.09 anchor_bottom = 0.07
offset_right = 0.199999
size_flags_vertical = 4 size_flags_vertical = 4
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
texture_normal = ExtResource("1_ta3h7") icon = ExtResource("1_ta3h7")
stretch_mode = 0
script = ExtResource("2_wle4k") script = ExtResource("2_wle4k")
firstSpeed = ExtResource("1_ta3h7") firstSpeed = ExtResource("1_ta3h7")
secondSpeed = ExtResource("3_fj838") secondSpeed = ExtResource("3_fj838")
thirdSpeed = ExtResource("4_2wmv1") thirdSpeed = ExtResource("4_2wmv1")
metadata/_edit_use_anchors_ = true
[connection signal="pressed" from="." to="." method="OnPressed"] [connection signal="pressed" from="." to="." method="OnPressed"]

View file

@ -2,12 +2,11 @@
[ext_resource type="Texture2D" uid="uid://dm0hjd67a6mva" path="res://assets/sprites/gui/Pause.tres" id="1_7k3tg"] [ext_resource type="Texture2D" uid="uid://dm0hjd67a6mva" path="res://assets/sprites/gui/Pause.tres" id="1_7k3tg"]
[node name="PauseButton" type="TextureButton"] [node name="PauseButton" type="Button"]
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.067 anchor_right = 0.043
anchor_bottom = 0.1 anchor_bottom = 0.07
offset_right = -0.200001 offset_right = 0.199999
size_flags_vertical = 4 size_flags_vertical = 4
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
texture_normal = ExtResource("1_7k3tg") icon = ExtResource("1_7k3tg")
stretch_mode = 0

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://cfnmspei3k4p7"] [gd_scene load_steps=14 format=3 uid="uid://cfnmspei3k4p7"]
[ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"] [ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"]
[ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/GameStyle.tres" id="1_xf6ra"] [ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/GameStyle.tres" id="1_xf6ra"]
@ -18,6 +18,42 @@ texture_margin_right = 4.0
texture_margin_bottom = 4.0 texture_margin_bottom = 4.0
axis_stretch_horizontal = 1 axis_stretch_horizontal = 1
[sub_resource type="Animation" id="Animation_ffxdv"]
resource_name = "flash"
length = 0.3
step = 0.1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:color:a")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0.25, -0.25, 0, 0, 0.00399721, 0, -0.2, 0.0038315, 0.25, 0),
"times": PackedFloat32Array(0, 0.3)
}
[sub_resource type="Animation" id="Animation_c8fnk"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:color:a")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_myv2j"]
_data = {
"RESET": SubResource("Animation_c8fnk"),
"flash": SubResource("Animation_ffxdv")
}
[node name="RuntimeGUI" type="Control"] [node name="RuntimeGUI" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -84,8 +120,26 @@ layout_mode = 2
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 4 size_flags_vertical = 4
[node name="FastForwardButton" parent="Hotbar" instance=ExtResource("4_66uy4")] [node name="FastForwardButton" parent="Hotbar" node_paths=PackedStringArray("flashAnimator") instance=ExtResource("4_66uy4")]
layout_mode = 2 layout_mode = 2
flashAnimator = NodePath("../../FastForwardEffect/AnimationPlayer")
[node name="PauseButton" parent="Hotbar" instance=ExtResource("5_jyq78")] [node name="PauseButton" parent="Hotbar" instance=ExtResource("5_jyq78")]
layout_mode = 2 layout_mode = 2
[node name="FastForwardEffect" type="ColorRect" parent="."]
z_index = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0.000150553, 0.938204, 0.707471, 0)
metadata/_edit_lock_ = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="FastForwardEffect"]
libraries = {
"": SubResource("AnimationLibrary_myv2j")
}

View file

@ -1,12 +1,14 @@
using Godot; using Godot;
using System; using System;
public partial class FastForwardButton : TextureButton public partial class FastForwardButton : Button
{ {
[Export] private Texture2D firstSpeed; [Export] private Texture2D firstSpeed;
[Export] private Texture2D secondSpeed; [Export] private Texture2D secondSpeed;
[Export] private Texture2D thirdSpeed; [Export] private Texture2D thirdSpeed;
[Export] private AnimationPlayer flashAnimator;
private int speed = 1; private int speed = 1;
public void OnPressed() public void OnPressed()
@ -16,16 +18,18 @@ public partial class FastForwardButton : TextureButton
switch (speed) switch (speed)
{ {
case 1: case 1:
TextureNormal = firstSpeed; Icon = firstSpeed;
break; break;
case 2: case 2:
TextureNormal = secondSpeed; Icon = secondSpeed;
break; break;
case 3: case 3:
TextureNormal = thirdSpeed; Icon = thirdSpeed;
break; break;
} }
flashAnimator.Play("flash");
Engine.TimeScale = speed; Engine.TimeScale = speed;
} }
} }

View file

@ -37,7 +37,7 @@ public partial class ShovelButton : TextureButton
{ {
if (LevelController.Instance.Pools.EntityField[i].TryGetValue(checkedPosition, out var entity) && entity is RuntimePlantData plantData) if (LevelController.Instance.Pools.EntityField[i].TryGetValue(checkedPosition, out var entity) && entity is RuntimePlantData plantData)
{ {
plantData.Kill(); plantData.Kill();
break; break;
} }
} }