This commit is contained in:
Kirill
2025-11-20 10:02:20 +03:00
parent aecce7d1c4
commit 9f94114aa2
30 changed files with 294 additions and 129 deletions
+1
View File
@@ -1,2 +1,3 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
*.png filter=lfs diff=lfs merge=lfs -text
+1
View File
@@ -1,6 +1,7 @@
# Godot 4+ specific ignores
.godot/
/android/
*.import
# MacOS specific ignores
.DS_Store
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dg15dpxiepicb"]
[ext_resource type="Texture2D" uid="uid://chxxghyul1im7" path="res://UI/Border/border-2px.png" id="1_6kaf8"]
[node name="Border" type="TextureRect"]
texture = ExtResource("1_6kaf8")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
class_name TopMenu extends HBoxContainer
signal button_pressed(button_name: String)
@export_group("Menu Items")
@export var BurgerButton: TextureButton
@export var DateTime: Label
@export var Info: Label
@export var TopMenuButtons: Dictionary[String, TextureButton]
func set_datetime(value: String):
DateTime.text = value
func set_info(value: String):
Info.text = value
func enable_buttons(button_state: Array):
for button_name in TopMenuButtons:
TopMenuButtons[button_name].visible = button_state.has(button_name)
func on_putton_pressed(button_name: String):
emit_signal("button_pressed", button_name)
+1
View File
@@ -0,0 +1 @@
uid://co14qmemlpt4a
+129
View File
@@ -0,0 +1,129 @@
[gd_scene load_steps=15 format=3 uid="uid://cdbqh3hvqvpab"]
[ext_resource type="Texture2D" uid="uid://5f80g4i46ycl" path="res://UI/TopMenu/BurgerButton/button.burger.normal.png" id="1_0ttbs"]
[ext_resource type="Script" uid="uid://co14qmemlpt4a" path="res://UI/TopMenu/top_menu.gd" id="1_jcwb6"]
[ext_resource type="Texture2D" uid="uid://cimgueu70lvqi" path="res://UI/TopMenu/BurgerButton/button.burger.focused.png" id="4_5mkgh"]
[ext_resource type="FontFile" uid="uid://deij0htxjmcs7" path="res://fonts/Roboto-Light.ttf" id="5_14pnr"]
[ext_resource type="Texture2D" uid="uid://dygbsqhhj1w0m" path="res://UI/TopMenu/DialogButton/button.dialog.normal.png" id="6_akqby"]
[ext_resource type="Texture2D" uid="uid://bc585jglf0ume" path="res://UI/TopMenu/DialogButton/button.dialog.focused.png" id="9_akek1"]
[ext_resource type="Texture2D" uid="uid://ddugmu7pri15w" path="res://UI/TopMenu/TravelButton/button.travel.normal.png" id="10_ec2ci"]
[ext_resource type="Texture2D" uid="uid://dl3hpyplnussi" path="res://UI/TopMenu/TravelButton/button.travel.focused.png" id="13_h3b68"]
[ext_resource type="Texture2D" uid="uid://cbyhnnkn05e7a" path="res://UI/TopMenu/CharsheetButton/button.charsheet.normal.png" id="14_tsmx8"]
[ext_resource type="Texture2D" uid="uid://k0dapodv6m1k" path="res://UI/TopMenu/CharsheetButton/button.charsheet.focused.png" id="17_44eei"]
[ext_resource type="Texture2D" uid="uid://wiqor0lfvlrg" path="res://UI/TopMenu/QuestlogButton/button.questlog.normal.png" id="18_17uyj"]
[ext_resource type="Texture2D" uid="uid://cwec0al16niw5" path="res://UI/TopMenu/QuestlogButton/button.questlog.focused.png" id="21_3ydck"]
[ext_resource type="Texture2D" uid="uid://cv6ikoaydi525" path="res://UI/TopMenu/StarshipButton/button.starship.normal.png" id="22_tt6k1"]
[ext_resource type="Texture2D" uid="uid://dhiwe7nueowle" path="res://UI/TopMenu/StarshipButton/button.starship.focused.png" id="25_my5kp"]
[node name="TopMenu" type="HBoxContainer" node_paths=PackedStringArray("BurgerButton", "DateTime", "Info", "TopMenuButtons")]
custom_minimum_size = Vector2(0, 128)
theme_override_constants/separation = 0
script = ExtResource("1_jcwb6")
BurgerButton = NodePath("BurgerButton")
DateTime = NodePath("InfoPanel/DateTime")
Info = NodePath("InfoPanel/Info")
TopMenuButtons = {
"Charsheet": NodePath("Control/CharsheetButton"),
"Dialog": NodePath("Control/DialogButton"),
"Questlog": NodePath("Control/QuestlogButton"),
"Starship": NodePath("Control/StarshipButton"),
"Travel": NodePath("Control/TravelButton")
}
[node name="BurgerButton" type="TextureButton" parent="."]
custom_minimum_size = Vector2(128, 128)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("1_0ttbs")
texture_focused = ExtResource("4_5mkgh")
[node name="InfoPanel" type="VBoxContainer" parent="."]
custom_minimum_size = Vector2(256, 0)
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 0
[node name="DateTime" type="Label" parent="InfoPanel"]
custom_minimum_size = Vector2(240, 64)
layout_mode = 2
theme_override_colors/font_color = Color(0, 0.6862745, 0, 1)
theme_override_fonts/font = ExtResource("5_14pnr")
theme_override_font_sizes/font_size = 36
text = "2025.11.16 09:23"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Info" type="Label" parent="InfoPanel"]
custom_minimum_size = Vector2(240, 64)
layout_mode = 2
theme_override_colors/font_color = Color(0, 0.6862745, 0, 1)
theme_override_fonts/font = ExtResource("5_14pnr")
theme_override_font_sizes/font_size = 36
horizontal_alignment = 1
vertical_alignment = 1
[node name="Control" type="Control" parent="."]
custom_minimum_size = Vector2(640, 128)
layout_mode = 2
[node name="DialogButton" type="TextureButton" parent="Control"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 0
offset_right = 128.0
offset_bottom = 128.0
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("6_akqby")
texture_focused = ExtResource("9_akek1")
[node name="TravelButton" type="TextureButton" parent="Control"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 0
offset_left = 128.0
offset_right = 256.0
offset_bottom = 128.0
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("10_ec2ci")
texture_focused = ExtResource("13_h3b68")
[node name="CharsheetButton" type="TextureButton" parent="Control"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 0
offset_left = 256.0
offset_right = 384.0
offset_bottom = 128.0
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("14_tsmx8")
texture_focused = ExtResource("17_44eei")
[node name="QuestlogButton" type="TextureButton" parent="Control"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 0
offset_left = 384.0
offset_right = 512.0
offset_bottom = 128.0
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("18_17uyj")
texture_focused = ExtResource("21_3ydck")
[node name="StarshipButton" type="TextureButton" parent="Control"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 0
offset_left = 512.0
offset_right = 640.0
offset_bottom = 128.0
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("22_tt6k1")
texture_focused = ExtResource("25_my5kp")
[connection signal="pressed" from="BurgerButton" to="." method="on_putton_pressed" binds= ["Burger"]]
[connection signal="pressed" from="Control/DialogButton" to="." method="on_putton_pressed" binds= ["Dialog"]]
[connection signal="pressed" from="Control/TravelButton" to="." method="on_putton_pressed" binds= ["Travel"]]
[connection signal="pressed" from="Control/CharsheetButton" to="." method="on_putton_pressed" binds= ["Charsheet"]]
[connection signal="pressed" from="Control/QuestlogButton" to="." method="on_putton_pressed" binds= ["Questlog"]]
[connection signal="pressed" from="Control/StarshipButton" to="." method="on_putton_pressed" binds= ["Starship"]]
+4
View File
@@ -0,0 +1,4 @@
extends Node
func print_smth(smth: String):
print(smth)
+1
View File
@@ -0,0 +1 @@
uid://xte4iwvipeve
+1 -1
View File
@@ -9,7 +9,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../../Sync/Owad/Builds/Owniverse Adventure/owad-20251112.exe"
export_path="../../../Sync/Owad/Builds/Owniverse Adventure/owad-20251119.exe"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
Binary file not shown.
+2 -1
View File
@@ -19,8 +19,9 @@ config/icon="res://icon.svg"
window/size/viewport_width=1080
window/size/viewport_height=1920
window/size/resizable=false
window/size/borderless=true
window/size/extend_to_title=true
window/stretch/mode="viewport"
window/handheld/orientation=1
[rendering]
+46 -11
View File
@@ -1,21 +1,56 @@
[gd_scene load_steps=4 format=3 uid="uid://bv384dpmvjv8o"]
[gd_scene load_steps=6 format=3 uid="uid://bv384dpmvjv8o"]
[ext_resource type="Script" uid="uid://d2wrwichuoncd" path="res://world/Background/background.gd" id="1_fj7yv"]
[ext_resource type="PackedScene" uid="uid://cdbqh3hvqvpab" path="res://UI/TopMenu/top_menu.tscn" id="3_036b0"]
[ext_resource type="PackedScene" uid="uid://icbk3la71t7h" path="res://world/Background/starry_sky_layer.tscn" id="3_aqk2v"]
[ext_resource type="Script" uid="uid://b823gkreu47t3" path="res://world/Background/starry_sky_dynamic_bg.gd" id="3_tlwt5"]
[ext_resource type="Script" uid="uid://xte4iwvipeve" path="res://command_processor.gd" id="5_036b0"]
[ext_resource type="PackedScene" uid="uid://dg15dpxiepicb" path="res://UI/Border/border.tscn" id="28_o3ebs"]
[node name="World" type="Node2D"]
[node name="BackgroundLayer" type="Node2D" parent="." node_paths=PackedStringArray("Parallax_2d")]
[node name="Background" type="Node2D" parent="."]
script = ExtResource("1_fj7yv")
STARRY_SKY_LAYER = ExtResource("3_aqk2v")
Parallax_2d = NodePath("Parallax2D")
[node name="Parallax2D" type="Parallax2D" parent="BackgroundLayer"]
repeat_size = Vector2(2048, 2048)
[node name="MainScreen" type="Control" parent="."]
custom_minimum_size = Vector2(1080, 1920)
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
size_flags_horizontal = 4
size_flags_vertical = 3
[node name="StarrySkyDynamicBG" type="Node2D" parent="BackgroundLayer/Parallax2D"]
visible = false
script = ExtResource("3_tlwt5")
Star_Count = 2000
Background_Image_Size = Vector2(2048, 2048)
[node name="MainRows" type="VBoxContainer" parent="MainScreen"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 128.0
grow_horizontal = 2
size_flags_horizontal = 3
theme_override_constants/separation = 0
[node name="TopMenu" parent="MainScreen/MainRows" node_paths=PackedStringArray("TopMenuButtons") instance=ExtResource("3_036b0")]
layout_mode = 2
TopMenuButtons = {
"Charsheet": NodePath("Control/CharsheetButton"),
"Dialog": NodePath("Control/DialogButton"),
"Equipment": null,
"Questlog": NodePath("Control/QuestlogButton"),
"Starship": NodePath("Control/StarshipButton"),
"Trade": null,
"Travel": NodePath("Control/TravelButton"),
"Worm": null
}
[node name="TopMenuBorder" parent="MainScreen/MainRows" instance=ExtResource("28_o3ebs")]
layout_mode = 2
[node name="CommandProcessor" type="Node" parent="."]
script = ExtResource("5_036b0")
[node name="Tree" type="Tree" parent="CommandProcessor"]
offset_right = 16.0
offset_bottom = 17.0
[connection signal="button_pressed" from="MainScreen/MainRows/TopMenu" to="CommandProcessor" method="print_smth"]
+32 -47
View File
@@ -1,21 +1,21 @@
extends Node2D
@export var STARRY_SKY_LAYER: PackedScene
@export_group("Visual Settings")
@export var Parallax_2d: Parallax2D
#@export var Node_2d: Node2D
@export var Star_Count: int = 6000: set = set_star_count
@export var Background_Image_Size: Vector2 = Vector2(4096, 4096):
@export var STARRY_SKY_LAYER: PackedScene
@export var Star_Count: int = 2000: set = set_star_count
@export var Background_Image_Size: Vector2 = Vector2(1080, 1920):
set = set_Background_Image_Size
@export var Background_Layers: Array [StarrySkyLayer]
var Stars_by_Layers: Dictionary = {}
const BACKGROUND_COLOR: Color = Color.BLACK
const X_SCROLL_RANGE: Vector2 = Vector2(3, 10)
const Y_SCROLL_RANGE: Vector2 = Vector2(1, 5)
const SCALE_FACTOR = 1
const STAR_COLOR_DISTRIBUTION = [
[700, '#8FA8FFFF', 0 ],
[1700, '#8FA8FFD8', 0 ],
@@ -55,30 +55,17 @@ const STAR_COLOR_DISTRIBUTION = [
[1_000_000, '#E8F4FF28', 2 ],
]
var x_offset: int = 20
var y_offset: int = 20
var _random
func _ready() -> void:
_random = RandomNumberGenerator.new()
x_offset = _random_offset_x() * _random_sign()
y_offset = _random_offset_y() * _random_sign()
Parallax_2d.autoscroll = Vector2(x_offset, y_offset)
initiate_layers()
randomize_parallax()
generate_layers()
#layer.queue_redraw()
func _process(delta: float) -> void:
#Parallax_2d.scroll_offset.x += x_offset * delta
#Parallax_2d.scroll_offset.y += y_offset * delta
if _random.randi_range(0, 2096) == 0:
if _random_sign() == 1:
x_offset = _random_offset_x() * _random_sign()
else:
y_offset = _random_offset_y() * _random_sign()
Parallax_2d.autoscroll = Vector2(x_offset, y_offset)
if randi_range(0, 1000) == 0:
randomize_parallax()
func _draw() -> void:
draw_rect(Rect2(Vector2.ZERO, Background_Image_Size), BACKGROUND_COLOR)
func generate_layers():
var max_rnd_seed = STAR_COLOR_DISTRIBUTION[-1][0]
@@ -97,42 +84,40 @@ func generate_layers():
"color": star_color,
})
break
#draw_circle(star_coords, 1, star_color)
for it1 in Background_Layers:
print(len(it1.Stars))
it1.queue_redraw()
func initiate_layers():
var layer_count = 0
for item:Array in STAR_COLOR_DISTRIBUTION:
if item[2] > layer_count:
layer_count = item[2]
for ind in range(layer_count + 1):
for ind1 in range(layer_count + 1):
var new_star_layer:StarrySkyLayer = STARRY_SKY_LAYER.instantiate()
Parallax_2d.add_child(new_star_layer)
add_child(new_star_layer)
new_star_layer.Background_Image_Size = Background_Image_Size
#new_star_layer.autoscroll = (ind1 + 1) * DEFAULT_AUTOSCROL
Background_Layers.append(new_star_layer)
func draw_layer(layer):
print(layer)
pass
func randomize_parallax():
var x_offset = 0
var y_offset = 0
if _random_sign() == 1:
x_offset = _random_offset(X_SCROLL_RANGE) * _random_sign()
else:
y_offset = _random_offset(Y_SCROLL_RANGE) * _random_sign()
var scale_factor = 1
for layer in Background_Layers:
layer.autoscroll = Vector2(x_offset, y_offset) * scale_factor
scale_factor += SCALE_FACTOR
#region Random offset
func _random_offset_x() -> int:
return _random.randi_range(15, 25)
func _random_offset_y() -> int:
return _random.randi_range(5, 10)
func _random_offset(rng: Vector2i) -> int:
return randi_range(rng.x, rng.y)
func _random_sign() -> int:
if _random.randi_range(1, 2) == 1:
return 1
else:
return -1
return [1, -1].pick_random()
#endregion
#region Сеттеры для автоматического обновления
-54
View File
@@ -1,54 +0,0 @@
extends Node2D
@export_group("Visual Settings")
@export var Star_Count: int = 5000: set = set_star_count
@export var Background_Image_Size: Vector2 = Vector2(4096, 4096):
set = set_Background_Image_Size
@export var background_color: Color = Color.BLACK
#@export_group("Animation")
#@export var auto_rotate: bool = false
#@export var rotation_speed: float = 0.1
var rotation_angle: float = 0.0
func _ready():
queue_redraw()
func _draw():
draw_rect(Rect2(Vector2.ZERO, Background_Image_Size), background_color)
# Сохраняем текущее состояние трансформации
var transform = Transform2D().rotated(rotation_angle)
draw_set_transform_matrix(transform)
draw_galaxy()
func draw_galaxy():
for ind1 in range(Star_Count):
var star_coords = Vector2(randi_range(0, Background_Image_Size.x),
randi_range(0, Background_Image_Size.y))
#draw_star(star_coords)
func _process(delta):
if Engine.is_editor_hint():
queue_redraw()
#func draw_star(star_coords: Vector2):
#var rnd_seed = randi_range(0, STAR_COLOR_DISTRIBUTION[-1][0])
#for item:Array in STAR_COLOR_DISTRIBUTION:
#if rnd_seed <= item[0]:
#var star_color = Color.html(item[1])
#draw_circle(star_coords, 1, star_color)
#region Сеттеры для автоматического обновления
func set_Background_Image_Size(value: Vector2):
Background_Image_Size = value
queue_redraw()
func set_star_count(value: int):
Star_Count = value
queue_redraw()
#endregion
@@ -1 +0,0 @@
uid://b823gkreu47t3
+3 -13
View File
@@ -1,21 +1,11 @@
class_name StarrySkyLayer extends Node2D
class_name StarrySkyLayer extends Parallax2D
var Background_Image_Size: Vector2 = Vector2.ZERO
var Stars: Array = []
const BACKGROUND_COLOR: Color = Color.BLACK
func _ready():
pass
#queue_redraw()
const BACKGROUND_COLOR: Color = Color.TRANSPARENT
func _draw():
draw_rect(Rect2(Vector2.ZERO, Background_Image_Size), BACKGROUND_COLOR)
for star in Stars:
draw_circle(star.coords, 4, star.color)
#draw_rect(Rect2(Vector2.ZERO, Background_Image_Size), background_color)
print("Drawn: ", len(Stars))
draw_circle(star.coords, 2, star.color)
+4 -1
View File
@@ -2,5 +2,8 @@
[ext_resource type="Script" uid="uid://bq7xkdvq4iejn" path="res://world/Background/starry_sky_layer.gd" id="1_st4ay"]
[node name="StarrySkyLayer" type="Node2D"]
[node name="StarrySkyLayer" type="Parallax2D"]
scroll_offset = Vector2(1080, 1920)
repeat_size = Vector2(1080, 1920)
repeat_times = 3
script = ExtResource("1_st4ay")