diff --git a/game/main/element_manager/custom_element/custom_element.gd b/game/main/element_manager/custom_element/custom_element.gd new file mode 100644 index 0000000..f37df0c --- /dev/null +++ b/game/main/element_manager/custom_element/custom_element.gd @@ -0,0 +1,19 @@ +class_name CustomElement +extends Resource + +@export var display_name: String +@export var id: int +# 0: flat, 1: fancy +@export var style: int +@export var color_a: Color +@export var color_b: Color +@export var color_c: Color +# 0: powder, 1: solid, 2: liquid, 3: gas +@export var state: int +@export var density: float = 0.2 +@export var viscosity: float = 0.5 +@export var conductivity: float = 0.0 +@export var temperature: float = 0.5 +@export var flammability: float = 0.0 +@export var reactivity: float = 0.5 +@export var durability: float = 0.5 diff --git a/game/main/element_manager/element_material/types/fluid.gd b/game/main/element_manager/element_material/types/fluid.gd index 6dd0491..ca5532a 100644 --- a/game/main/element_manager/element_material/types/fluid.gd +++ b/game/main/element_manager/element_material/types/fluid.gd @@ -1,18 +1,6 @@ extends Element class_name Fluid -@export_enum("WATER", "FIRE", "CRYSTAL") var noise_texture: int @export var color_a: Color @export var color_b: Color @export var color_c: Color - -@export var noise_scale: float = 2.0 -@export var noise_speed: float = 15.0 -@export var current_size: float = 16.0 -@export var wave_cycle: float = 3.0 -@export var contraction_size: float = 16.0 -@export var wave_density: float = 2.0 -@export var shimmer_speed: float = 24.0 -@export var shimmer_density: float = 1.5 -@export var shimmer_opacity: float = 0.5 -@export var shimmer_cycle: float = 2.0 diff --git a/game/main/ui/_icons/icon_circle.png b/game/main/ui/_icons/icon_circle.png new file mode 100644 index 0000000..e591d31 Binary files /dev/null and b/game/main/ui/_icons/icon_circle.png differ diff --git a/game/main/ui/_icons/icon_circle.png.import b/game/main/ui/_icons/icon_circle.png.import new file mode 100644 index 0000000..f9c2d22 --- /dev/null +++ b/game/main/ui/_icons/icon_circle.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://l1h1lwsmjxdv" +path="res://.godot/imported/icon_circle.png-a254992dfc200b87316861d4ced5fa20.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://main/ui/_icons/icon_circle.png" +dest_files=["res://.godot/imported/icon_circle.png-a254992dfc200b87316861d4ced5fa20.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/game/main/ui/_icons/icon_circle2.png b/game/main/ui/_icons/icon_circle2.png new file mode 100644 index 0000000..9c51519 Binary files /dev/null and b/game/main/ui/_icons/icon_circle2.png differ diff --git a/game/main/ui/_icons/icon_circle2.png.import b/game/main/ui/_icons/icon_circle2.png.import new file mode 100644 index 0000000..225b458 --- /dev/null +++ b/game/main/ui/_icons/icon_circle2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cwrw6b4hfr57h" +path="res://.godot/imported/icon_circle2.png-66203458bd9959c80b999bc3d3521e6e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://main/ui/_icons/icon_circle2.png" +dest_files=["res://.godot/imported/icon_circle2.png-66203458bd9959c80b999bc3d3521e6e.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/game/main/ui/_theme/theme.tres b/game/main/ui/_theme/theme.tres index 560528f..c5906d0 100644 --- a/game/main/ui/_theme/theme.tres +++ b/game/main/ui/_theme/theme.tres @@ -1,5 +1,6 @@ -[gd_resource type="Theme" load_steps=9 format=3 uid="uid://co20v1mxv2dfm"] +[gd_resource type="Theme" load_steps=10 format=3 uid="uid://co20v1mxv2dfm"] +[ext_resource type="Texture2D" uid="uid://l1h1lwsmjxdv" path="res://main/ui/_icons/icon_circle.png" id="1_mvg4m"] [ext_resource type="FontFile" uid="uid://b8lxwo5dkwrs4" path="res://main/ui/_theme/font/Poppins-Regular.ttf" id="1_p73bs"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dsk6v"] @@ -67,6 +68,7 @@ CheckBox/styles/hover = SubResource("StyleBoxFlat_11w6c") CheckBox/styles/normal = SubResource("StyleBoxFlat_xa765") CheckBox/styles/pressed = SubResource("StyleBoxFlat_us5ki") MenuButton/styles/hover = SubResource("StyleBoxFlat_11w6c") +PopupMenu/icons/radio_unchecked = ExtResource("1_mvg4m") PopupMenu/styles/hover = SubResource("StyleBoxFlat_11w6c") PopupMenu/styles/panel = SubResource("StyleBoxFlat_jpob4") VScrollBar/styles/grabber = SubResource("StyleBoxFlat_xyiyu") diff --git a/game/main/ui/submenu/element_editor/ElementEditor.tscn b/game/main/ui/submenu/element_editor/ElementEditor.tscn index df3fe05..9ee671d 100644 --- a/game/main/ui/submenu/element_editor/ElementEditor.tscn +++ b/game/main/ui/submenu/element_editor/ElementEditor.tscn @@ -251,7 +251,7 @@ size_flags_horizontal = 3 size_flags_vertical = 3 theme_override_constants/separation = 8 -[node name="ApperanceLabel" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] +[node name="AppearanceLabel" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] layout_mode = 2 text = "Appearance" horizontal_alignment = 1 @@ -265,7 +265,8 @@ layout_mode = 2 size_flags_horizontal = 3 text = "name" -[node name="LineEdit" type="LineEdit" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/NameGrouping"] +[node name="Name" type="LineEdit" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/NameGrouping"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_styles/normal = SubResource("StyleBoxFlat_oid3n") @@ -281,7 +282,8 @@ layout_mode = 2 size_flags_horizontal = 3 text = "style" -[node name="OptionButton" type="OptionButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ColorStyleGrouping"] +[node name="Style" type="OptionButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ColorStyleGrouping"] +unique_name_in_owner = true custom_minimum_size = Vector2(150, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -302,9 +304,9 @@ theme_override_constants/separation = 8 [node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlatColorGrouping"] layout_mode = 2 size_flags_horizontal = 3 -text = "color" +text = "base color" -[node name="FlatColor" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlatColorGrouping" groups=["color_picker"]] +[node name="ColorA" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlatColorGrouping" groups=["color_picker"]] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 @@ -317,22 +319,6 @@ unique_name_in_owner = true layout_mode = 2 theme_override_constants/separation = 8 -[node name="BaseColor" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping"] -layout_mode = 2 - -[node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping/BaseColor"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "base color 1" - -[node name="BaseColor1" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping/BaseColor" groups=["color_picker"]] -unique_name_in_owner = true -layout_mode = 2 -size_flags_horizontal = 3 -focus_mode = 0 -color = Color(0.243137, 0.352941, 1, 1) -edit_alpha = false - [node name="BaseColor2" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping"] layout_mode = 2 @@ -341,7 +327,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "base color 2" -[node name="BaseColor2" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping/BaseColor2" groups=["color_picker"]] +[node name="ColorB" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping/BaseColor2" groups=["color_picker"]] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 @@ -357,7 +343,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "outline color" -[node name="OutlineColor" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping/OutlineColor" groups=["color_picker"]] +[node name="ColorC" type="ColorPickerButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FancyColorGrouping/OutlineColor" groups=["color_picker"]] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 @@ -378,7 +364,8 @@ layout_mode = 2 size_flags_horizontal = 3 text = "state" -[node name="OptionButton" type="OptionButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/StateGrouping"] +[node name="State" type="OptionButton" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/StateGrouping"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 focus_mode = 0 @@ -415,6 +402,28 @@ step = 0.01 value = 0.5 tick_count = 4 +[node name="ViscosityGrouping" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 + +[node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ViscosityGrouping"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "viscosity" + +[node name="Viscosity" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ViscosityGrouping"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +theme_override_styles/slider = SubResource("StyleBoxFlat_70ulr") +theme_override_styles/grabber_area = SubResource("StyleBoxFlat_o5yxv") +theme_override_styles/grabber_area_highlight = SubResource("StyleBoxFlat_5uj0p") +max_value = 1.0 +step = 0.01 +value = 0.5 +tick_count = 4 + [node name="ConductivityGrouping" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 @@ -424,7 +433,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "conductivity" -[node name="HSlider" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ConductivityGrouping"] +[node name="Conductivity" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ConductivityGrouping"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -444,7 +453,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "temperature" -[node name="HSlider" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/TemperatureGrouping"] +[node name="Temperature" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/TemperatureGrouping"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -453,7 +462,8 @@ theme_override_styles/grabber_area = SubResource("StyleBoxFlat_o5yxv") theme_override_styles/grabber_area_highlight = SubResource("StyleBoxFlat_5uj0p") max_value = 1.0 step = 0.01 -tick_count = 4 +value = 0.5 +tick_count = 3 [node name="FlammabilityGrouping" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] unique_name_in_owner = true @@ -464,7 +474,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "flammability" -[node name="HSlider" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlammabilityGrouping"] +[node name="Flammability" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlammabilityGrouping"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -475,16 +485,16 @@ max_value = 1.0 step = 0.01 tick_count = 4 -[node name="FlammabilityGrouping2" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] +[node name="ReactivityGrouping" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 -[node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlammabilityGrouping2"] +[node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ReactivityGrouping"] layout_mode = 2 size_flags_horizontal = 3 text = "reactivity" -[node name="HSlider" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlammabilityGrouping2"] +[node name="Reactivity" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/ReactivityGrouping"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -493,18 +503,19 @@ theme_override_styles/grabber_area = SubResource("StyleBoxFlat_o5yxv") theme_override_styles/grabber_area_highlight = SubResource("StyleBoxFlat_5uj0p") max_value = 1.0 step = 0.01 +value = 0.75 tick_count = 4 -[node name="FlammabilityGrouping3" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] +[node name="DurabilityGrouping" type="HBoxContainer" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 -[node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlammabilityGrouping3"] +[node name="Label" type="Label" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/DurabilityGrouping"] layout_mode = 2 size_flags_horizontal = 3 text = "durability" -[node name="HSlider" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/FlammabilityGrouping3"] +[node name="Durability" type="HSlider" parent="SettingsContainer/PanelContainer/VBoxContainer/ScrollContainer/VBoxContainer/DurabilityGrouping"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -513,6 +524,7 @@ theme_override_styles/grabber_area = SubResource("StyleBoxFlat_o5yxv") theme_override_styles/grabber_area_highlight = SubResource("StyleBoxFlat_5uj0p") max_value = 1.0 step = 0.01 +value = 0.25 tick_count = 4 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] diff --git a/game/main/ui/submenu/element_editor/element_editor_menu.gd b/game/main/ui/submenu/element_editor/element_editor_menu.gd index 55e9f49..4657495 100644 --- a/game/main/ui/submenu/element_editor/element_editor_menu.gd +++ b/game/main/ui/submenu/element_editor/element_editor_menu.gd @@ -2,7 +2,11 @@ extends Submenu class_name ElementEditorMenu # Submenu for simulation settings +var current: CustomElement + func _ready() -> void: + #visible = false + #modulate.a = 0.0 for node in get_tree().get_nodes_in_group("color_picker"): var color_picker_button: ColorPickerButton = node as ColorPickerButton var color_picker: ColorPicker = color_picker_button.get_picker() @@ -11,6 +15,54 @@ func _ready() -> void: color_picker.sliders_visible = false color_picker.hex_visible = false color_picker.presets_visible = false - print(color_picker) - #visible = false - #modulate.a = 0.0 + %Style.item_selected.connect(_on_style_selected) + %State.item_selected.connect(_on_state_selected) + +func _on_style_selected(idx: int) -> void: + match idx: + 0: + %FancyColorGrouping.visible = false + 1: + %FancyColorGrouping.visible = true + +func _on_state_selected(idx: int) -> void: + match idx: + 2: + %ViscosityGrouping.visible = true + _: + %ViscosityGrouping.visible = false + +func edit_element(element: CustomElement) -> void: + current = element + initialize() + +func initialize() -> void: + %Name.text = current.display_name + %Style.selected = current.style + %ColorA.color = current.color_a + %ColorB.color = current.color_b + %ColorC.color = current.color_c + %State.selected = current.state + %Density.value = current.density + %Viscosity.value = current.viscosity + %Conductivity.value = current.conductivity + %Flammability.value = current.flammability + %Reacivity.value = current.reactivity + %Durability.value = current.durability + + _on_state_selected(%State.selected) + _on_style_selected(%Style.selected) + +func save_changes() -> void: + current.display_name = %Name.text + current.style = %Style.selected + current.color_a = %ColorA.color + current.color_b = %ColorB.color + current.color_c = %ColorC.color + current.state = %State.selected + current.density = %Density.value + current.viscosity = %Viscosity.value + current.conductivity = %Conductivity.value + current.flammability = %Flammability.value + current.reactivity = %Reacivity.value + current.durability = %Durability.value