add pictograms and change ui
This commit is contained in:
parent
9e98556f8c
commit
76ccd210ec
BIN
assets/textures/gui/button_bg.png
(Stored with Git LFS)
Normal file
BIN
assets/textures/gui/button_bg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
assets/textures/gui/button_bg.png.import
Normal file
34
assets/textures/gui/button_bg.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bh01xbmjanku0"
|
||||
path="res://.godot/imported/button_bg.png-25d2a78f0bd1edc847120563d61c8427.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/textures/gui/button_bg.png"
|
||||
dest_files=["res://.godot/imported/button_bg.png-25d2a78f0bd1edc847120563d61c8427.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
|
||||
BIN
assets/textures/gui/button_hover_bg.png
(Stored with Git LFS)
Normal file
BIN
assets/textures/gui/button_hover_bg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
assets/textures/gui/button_hover_bg.png.import
Normal file
34
assets/textures/gui/button_hover_bg.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://jv8twhntt6x3"
|
||||
path="res://.godot/imported/button_hover_bg.png-7b610b11a9e111cf99d0c7ad8b8b61c2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/textures/gui/button_hover_bg.png"
|
||||
dest_files=["res://.godot/imported/button_hover_bg.png-7b610b11a9e111cf99d0c7ad8b8b61c2.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
|
||||
BIN
assets/textures/gui/pictograms.png
(Stored with Git LFS)
Normal file
BIN
assets/textures/gui/pictograms.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
assets/textures/gui/pictograms.png.import
Normal file
34
assets/textures/gui/pictograms.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://slraulfmk8c0"
|
||||
path="res://.godot/imported/pictograms.png-c1f75f83d7253c1dddf8da19b7b7ead2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/textures/gui/pictograms.png"
|
||||
dest_files=["res://.godot/imported/pictograms.png-c1f75f83d7253c1dddf8da19b7b7ead2.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
|
||||
@ -40,11 +40,13 @@ gdscript/warnings/integer_division=0
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1280
|
||||
window/size/viewport_height=720
|
||||
window/size/viewport_width=1920
|
||||
window/size/viewport_height=1080
|
||||
window/size/always_on_top=true
|
||||
window/size/window_width_override=1280
|
||||
window/size/window_height_override=720
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="keep_height"
|
||||
window/stretch/aspect="expand"
|
||||
mouse_cursor/custom_image="res://assets/textures/gui/cursor.png"
|
||||
mouse_cursor/custom_image_hotspot=Vector2(32, 32)
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://ceru75se7ifkb"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://ceru75se7ifkb"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/main_camera.gd" id="1_gnxhh"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfixshlmwhpmi" path="res://scenes/units/test_unit.tscn" id="2_4bgm6"]
|
||||
[ext_resource type="PackedScene" uid="uid://d4c6ujs1ra1ob" path="res://scenes/units/aphid.tscn" id="3_eh22j"]
|
||||
[ext_resource type="PackedScene" uid="uid://clftjlaotf2g2" path="res://scenes/structures/anthill.tscn" id="7_f30w3"]
|
||||
[ext_resource type="PackedScene" uid="uid://d8ut24fit87x" path="res://scenes/ui/anthill_info.tscn" id="8_ohyy4"]
|
||||
@ -68,23 +67,6 @@ shadow_enabled = true
|
||||
|
||||
[node name="Units" type="Node" parent="."]
|
||||
|
||||
[node name="TestUnits" type="Node" parent="Units"]
|
||||
|
||||
[node name="TestUnit" parent="Units/TestUnits" instance=ExtResource("2_4bgm6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.97063, 0, -0.12038)
|
||||
|
||||
[node name="TestUnit2" parent="Units/TestUnits" instance=ExtResource("2_4bgm6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.93308, 0, -0.12038)
|
||||
|
||||
[node name="TestUnit3" parent="Units/TestUnits" instance=ExtResource("2_4bgm6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.94234, 0, -0.12038)
|
||||
|
||||
[node name="TestUnit4" parent="Units/TestUnits" instance=ExtResource("2_4bgm6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.77962, 0, -0.12038)
|
||||
|
||||
[node name="TestUnit5" parent="Units/TestUnits" instance=ExtResource("2_4bgm6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.64126, 0, -0.12038)
|
||||
|
||||
[node name="Aphids" type="Node" parent="Units"]
|
||||
|
||||
[node name="Aphid" parent="Units/Aphids" instance=ExtResource("3_eh22j")]
|
||||
|
||||
@ -1,67 +1,39 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://d8ut24fit87x"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://d8ut24fit87x"]
|
||||
|
||||
[ext_resource type="StyleBox" uid="uid://do5c5v5kvgv0s" path="res://resources/styles/panel_small_style.tres" id="1_tod8w"]
|
||||
[ext_resource type="Script" path="res://scripts/ui/anthill_info.gd" id="2_aj5vl"]
|
||||
[ext_resource type="PackedScene" uid="uid://w3ydggdgvyqn" path="res://scenes/ui/honeydew_counter.tscn" id="3_8onrx"]
|
||||
[ext_resource type="Texture2D" uid="uid://bh01xbmjanku0" path="res://assets/textures/gui/button_bg.png" id="4_b8264"]
|
||||
[ext_resource type="Texture2D" uid="uid://slraulfmk8c0" path="res://assets/textures/gui/pictograms.png" id="4_dw0d6"]
|
||||
[ext_resource type="Texture2D" uid="uid://jv8twhntt6x3" path="res://assets/textures/gui/button_hover_bg.png" id="5_f3si0"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nwfun"]
|
||||
atlas = ExtResource("4_dw0d6")
|
||||
region = Rect2(13.5399, 21.083, 83.1337, 49.5326)
|
||||
|
||||
[node name="AnthillInfo" type="Panel"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -183.0
|
||||
offset_top = -108.0
|
||||
offset_right = 184.0
|
||||
offset_bottom = -28.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset = Vector2(185, 80)
|
||||
offset_right = 332.0
|
||||
offset_bottom = 80.0
|
||||
pivot_offset = Vector2(170, 79)
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
theme_override_styles/panel = ExtResource("1_tod8w")
|
||||
script = ExtResource("2_aj5vl")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
offset_left = 103.0
|
||||
offset_top = 47.0
|
||||
offset_right = 235.0
|
||||
offset_bottom = 70.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "honeydew: 5"
|
||||
|
||||
[node name="NitwitButton" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 233.0
|
||||
offset_top = 44.0
|
||||
offset_right = 295.0
|
||||
offset_bottom = 75.0
|
||||
text = "ntwt: 5"
|
||||
|
||||
[node name="GathererButton" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 298.0
|
||||
offset_top = 42.0
|
||||
offset_right = 363.0
|
||||
offset_bottom = 73.0
|
||||
text = "gthrr: 15"
|
||||
|
||||
[node name="AddOneButton" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 243.0
|
||||
offset_top = 8.0
|
||||
offset_right = 270.0
|
||||
offset_bottom = 39.0
|
||||
offset_left = 239.0
|
||||
offset_top = -10.0
|
||||
offset_right = 266.0
|
||||
offset_bottom = 21.0
|
||||
text = "+1"
|
||||
|
||||
[node name="AddFiveButton" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 274.0
|
||||
offset_top = 8.0
|
||||
offset_right = 301.0
|
||||
offset_bottom = 39.0
|
||||
offset_left = 270.0
|
||||
offset_top = -10.0
|
||||
offset_right = 297.0
|
||||
offset_bottom = 21.0
|
||||
text = "+5"
|
||||
|
||||
[node name="HoneydewCounter" parent="." instance=ExtResource("3_8onrx")]
|
||||
@ -70,3 +42,31 @@ offset_left = 13.0
|
||||
offset_top = 22.0
|
||||
offset_right = 232.0
|
||||
offset_bottom = 55.0
|
||||
|
||||
[node name="AntBuyButton" type="TextureButton" parent="."]
|
||||
modulate = Color(0.81, 0.748035, 0.5913, 1)
|
||||
layout_mode = 0
|
||||
offset_left = 241.0
|
||||
offset_top = 13.0
|
||||
offset_right = 321.0
|
||||
offset_bottom = 63.0
|
||||
texture_normal = ExtResource("4_b8264")
|
||||
texture_pressed = ExtResource("4_b8264")
|
||||
texture_hover = ExtResource("5_f3si0")
|
||||
ignore_texture_size = true
|
||||
stretch_mode = 0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="AntBuyButton"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -41.5
|
||||
offset_top = -24.5
|
||||
offset_right = 41.5
|
||||
offset_bottom = 24.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("AtlasTexture_nwfun")
|
||||
|
||||
@ -33,6 +33,8 @@ func _process(delta: float) -> void:
|
||||
move_to,
|
||||
(1 - moving_timer),
|
||||
)
|
||||
if carried:
|
||||
hover_sprite.visible = false
|
||||
|
||||
|
||||
func set_carried(on: bool) -> void:
|
||||
|
||||
@ -1,26 +1,21 @@
|
||||
extends FollowingUi
|
||||
extends FollowingUI
|
||||
class_name AnthillInfo
|
||||
|
||||
var anthill: Anthill
|
||||
|
||||
@onready var label: Label = $Label
|
||||
@onready var nitwit_button: Button = $NitwitButton
|
||||
@onready var gatherer_button: Button = $GathererButton
|
||||
@onready var add_one_button: Button = $AddOneButton
|
||||
@onready var add_five_button: Button = $AddFiveButton
|
||||
@onready var ant_buy_button: BaseButton = $AntBuyButton
|
||||
@onready var add_one_button: BaseButton = $AddOneButton
|
||||
@onready var add_five_button: BaseButton = $AddFiveButton
|
||||
@onready var counter: HoneydewCounter = $HoneydewCounter
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
assert(label != null, "label missing!")
|
||||
assert(nitwit_button != null, "nitwit_button missing!")
|
||||
assert(gatherer_button != null, "gatherer_button missing!")
|
||||
assert(ant_buy_button != null, "ant_buy_button missing!")
|
||||
assert(add_one_button != null, "add_one_button missing!")
|
||||
assert(add_five_button != null, "add_five_button missing!")
|
||||
assert(counter != null, "counter missing!")
|
||||
super._ready()
|
||||
nitwit_button.pressed.connect(_on_nitwit_button_pressed)
|
||||
gatherer_button.pressed.connect(_on_gatherer_button_pressed)
|
||||
ant_buy_button.pressed.connect(_on_ant_buy_button_pressed)
|
||||
add_one_button.pressed.connect(_on_add_one_button_pressed)
|
||||
add_five_button.pressed.connect(_on_add_five_button_pressed)
|
||||
|
||||
@ -29,7 +24,6 @@ func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
if anthill == null or not visible:
|
||||
return
|
||||
label.text = 'honeydew: ' + str(anthill.honeydew)
|
||||
counter.update_counter(anthill.honeydew)
|
||||
|
||||
|
||||
@ -44,12 +38,8 @@ func close() -> void:
|
||||
anthill = null
|
||||
|
||||
|
||||
func _on_nitwit_button_pressed() -> void:
|
||||
anthill.spawn_nitwit()
|
||||
|
||||
|
||||
func _on_gatherer_button_pressed() -> void:
|
||||
anthill.spawn_gatherer()
|
||||
func _on_ant_buy_button_pressed() -> void:
|
||||
print('AAAAAA')
|
||||
|
||||
|
||||
func _on_add_one_button_pressed() -> void:
|
||||
|
||||
34
scripts/ui/closeable_ui.gd
Normal file
34
scripts/ui/closeable_ui.gd
Normal file
@ -0,0 +1,34 @@
|
||||
extends Control
|
||||
class_name CloseableUI
|
||||
|
||||
var is_mouse_over: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
visible = false
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not visible:
|
||||
return
|
||||
|
||||
if event is InputEventMouseButton and not is_mouse_over:
|
||||
var button_event := event as InputEventMouseButton
|
||||
if not button_event.pressed:
|
||||
return
|
||||
if (
|
||||
button_event.button_index == MOUSE_BUTTON_RIGHT
|
||||
or button_event.button_index == MOUSE_BUTTON_LEFT
|
||||
):
|
||||
close()
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
var motion_event := event as InputEventMouseMotion
|
||||
is_mouse_over = (
|
||||
Rect2(global_position, size)
|
||||
.has_point(motion_event.position)
|
||||
)
|
||||
|
||||
|
||||
func close() -> void:
|
||||
visible = false
|
||||
@ -1,16 +1,15 @@
|
||||
extends Control
|
||||
class_name FollowingUi
|
||||
extends CloseableUI
|
||||
class_name FollowingUI
|
||||
|
||||
const EDGE_MARGIN = 10
|
||||
|
||||
var target: Node3D
|
||||
var is_mouse_over: bool = false
|
||||
|
||||
@onready var camera: Camera3D = get_viewport().get_camera_3d()
|
||||
|
||||
func _ready() -> void:
|
||||
assert(camera != null, "camera missing!")
|
||||
visible = false
|
||||
super._ready()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
@ -27,33 +26,11 @@ func _process(_delta: float) -> void:
|
||||
position = (pos - pivot_offset).clamp(corner_1, corner_2)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not visible:
|
||||
return
|
||||
|
||||
if event is InputEventMouseButton and not is_mouse_over:
|
||||
var button_event := event as InputEventMouseButton
|
||||
if not button_event.pressed:
|
||||
return
|
||||
if (
|
||||
button_event.button_index == MOUSE_BUTTON_RIGHT
|
||||
or button_event.button_index == MOUSE_BUTTON_LEFT
|
||||
):
|
||||
close()
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
var motion_event := event as InputEventMouseMotion
|
||||
is_mouse_over = (
|
||||
Rect2(global_position, size)
|
||||
.has_point(motion_event.position)
|
||||
)
|
||||
|
||||
|
||||
func set_target(to: Node3D) -> void:
|
||||
visible = true
|
||||
target = to
|
||||
|
||||
|
||||
func close() -> void:
|
||||
visible = false
|
||||
super.close()
|
||||
target = null
|
||||
|
||||
@ -92,7 +92,7 @@ func stop_all_gathering() -> void:
|
||||
func get_nth_pile_pos(n: int) -> Vector3:
|
||||
return (
|
||||
global_position
|
||||
+ (Vector3.UP * 0.5)
|
||||
+ (Vector3.UP * 0.45)
|
||||
+ (Vector3.UP * 0.1 * n)
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user