diff --git a/src/assets/autoload/helpers.gd b/src/assets/autoload/helpers.gd new file mode 100644 index 00000000..92e1bdea --- /dev/null +++ b/src/assets/autoload/helpers.gd @@ -0,0 +1,11 @@ +extends Node + +func string_join(string_array: Array, separator: String) -> String: + var combined_string: String = "" + for index in range(len(string_array) - 1): + combined_string += string_array[index] + separator + combined_string += string_array[-1] + return combined_string + +func map(in_value: float, in_value_min: float, in_value_max: float, out_value_min: float, out_value_max: float) -> float: + return (in_value - in_value_min) * (out_value_max - out_value_min) / (in_value_max - in_value_min) + out_value_min diff --git a/src/assets/player/player.tscn b/src/assets/player/player.tscn index 79969674..474d5994 100644 --- a/src/assets/player/player.tscn +++ b/src/assets/player/player.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=42 format=2] [ext_resource path="res://assets/player/player.gd" type="Script" id=1] +[ext_resource path="res://assets/player/textures/characters/customizable/02-body/body.png" type="Texture" id=2] [ext_resource path="res://assets/player/death_handler.gd" type="Script" id=3] [ext_resource path="res://assets/player/textures/characters/customizable/05-pants/white-shirt-red-sweater.png" type="Texture" id=13] [ext_resource path="res://assets/player/textures/characters/customizable/07-clothes/white-shirt-red-sweater.png" type="Texture" id=14] [ext_resource path="res://assets/player/textures/light.png" type="Texture" id=15] [ext_resource path="res://assets/player/interactarea.gd" type="Script" id=16] [ext_resource path="res://assets/common/shaders/player.shader" type="Shader" id=17] -[ext_resource path="res://assets/player/textures/characters/customizable/02-body/body02.png" type="Texture" id=18] [ext_resource path="res://assets/player/textures/characters/customizable/01-left-arm/white-shirt-red-sweater.png" type="Texture" id=19] [ext_resource path="res://assets/player/textures/characters/customizable/08-right-arm/white-shirt-red-sweater.png" type="Texture" id=20] [ext_resource path="res://assets/player/textures/characters/customizable/06-right-leg/white-shirt-red-sweater.png" type="Texture" id=21] @@ -2299,7 +2299,7 @@ __meta__ = { [node name="Body" type="Polygon2D" parent="Skeleton"] position = Vector2( -19.201, -51.6115 ) scale = Vector2( 0.05, 0.05 ) -texture = ExtResource( 18 ) +texture = ExtResource( 2 ) skeleton = NodePath("../Skeleton") polygon = PoolVector2Array( 340, 100, 420, 100, 550, 100, 610, 100, 610, 550, 610, 640, 610, 710, 610, 790, 610, 850, 610, 890, 550, 890, 420, 890, 340, 890, 240, 890, 140, 890, 140, 850, 140, 790, 140, 710, 140, 640, 140, 550, 140, 100, 320, 550, 470, 550, 470, 570, 320, 570, 320, 530, 470, 530, 320, 640, 470, 640, 470, 620, 320, 620, 320, 660, 470, 660, 320, 710, 470, 710, 470, 690, 320, 690, 320, 730, 470, 730, 320, 790, 320, 770, 470, 770, 470, 790, 470, 810, 320, 810, 220, 230, 360, 160, 400, 160, 550, 230, 230, 550, 560, 550, 560, 640, 230, 640, 230, 710, 230, 790, 230, 850, 560, 850, 560, 790, 560, 710, 320, 850, 470, 850 ) uv = PoolVector2Array( 340, 100, 420, 100, 550, 100, 610, 100, 610, 550, 610, 640, 610, 710, 610, 790, 610, 850, 610, 890, 550, 890, 420, 890, 340, 890, 240, 890, 140, 890, 140, 850, 140, 790, 140, 710, 140, 640, 140, 550, 140, 100, 330, 550, 410, 550, 410, 570, 330, 570, 330, 520, 410, 520, 330, 640, 410, 640, 410, 630, 330, 620, 330, 660, 410, 660, 330, 710, 410, 710, 410, 690, 330, 690, 330, 730, 410, 730, 330, 790, 330, 780, 400, 770, 410, 790, 410, 810, 330, 810, 220, 230, 360, 160, 400, 160, 550, 230, 230, 550, 560, 550, 560, 640, 230, 640, 230, 710, 230, 790, 230, 850, 560, 850, 560, 790, 560, 710, 320, 850, 470, 850 ) diff --git a/src/assets/player/textures/characters/customizable/02-body/body.png b/src/assets/player/textures/characters/customizable/02-body/body.png new file mode 100644 index 00000000..df4b4a38 --- /dev/null +++ b/src/assets/player/textures/characters/customizable/02-body/body.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efaa3eda6ae35e9b7382e698302682ab75e815f44050b5fb34391fffa74c7621 +size 21260 diff --git a/src/assets/player/textures/characters/customizable/02-body/body.png.import b/src/assets/player/textures/characters/customizable/02-body/body.png.import new file mode 100644 index 00000000..06974692 --- /dev/null +++ b/src/assets/player/textures/characters/customizable/02-body/body.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/body.png-cbb41d3673d87446b5239c620b6ea2be.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/player/textures/characters/customizable/02-body/body.png" +dest_files=[ "res://.import/body.png-cbb41d3673d87446b5239c620b6ea2be.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/mainmenu/mainmenu.gd b/src/assets/ui/mainmenu/mainmenu.gd index 2a44cd9b..7ab2d2cf 100644 --- a/src/assets/ui/mainmenu/mainmenu.gd +++ b/src/assets/ui/mainmenu/mainmenu.gd @@ -32,3 +32,6 @@ func _on_Back_pressed() -> void: func _on_MenuArea_returnToMainMenu(): default_state() + +func _on_Appearence_pressed() -> void: + show_only("AppearanceEditor") diff --git a/src/assets/ui/submenus/appearance_editor/appearance_editor.gd b/src/assets/ui/submenus/appearance_editor/appearance_editor.gd new file mode 100644 index 00000000..96bf781e --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/appearance_editor.gd @@ -0,0 +1,229 @@ +extends Control + +onready var part_selector_scene: PackedScene = preload("res://assets/ui/submenus/appearance_editor/part_selector.tscn") + +onready var appearance_hbox: HBoxContainer = $MarginContainer/AppearanceHBox +onready var customization_vbox: VBoxContainer = appearance_hbox.get_node("CustomizationVBox") +onready var skin_color_selector: Control = customization_vbox.get_node("SkinColorSelector") +onready var skin_tone_range: TextureRect = skin_color_selector.get_node("SkinToneRange") +onready var skin_color_range: TextureRect = skin_color_selector.get_node("SkinColorRange") +onready var cursor: Sprite = skin_color_selector.get_node("Cursor") +onready var color_preview: ColorRect = cursor.get_node("ColorPreview") +onready var preview_buttons_vbox: VBoxContainer = appearance_hbox.get_node("PreviewButtonsVBox") +onready var player: KinematicBody2D = preview_buttons_vbox.get_node("PlayerContainer/Player") +onready var buttons_hbox: HBoxContainer = preview_buttons_vbox.get_node("ButtonsHBox") +onready var root: Viewport = get_tree().get_root() + +onready var player_left_leg: Polygon2D +onready var player_left_arm: Polygon2D +onready var player_body: Polygon2D +onready var player_clothes: Sprite +onready var player_pants: Sprite +onready var player_facial_hair: Sprite +onready var player_face_wear: Sprite +onready var player_hat_hair: Sprite +onready var player_mouth: Sprite +onready var player_right_leg: Polygon2D +onready var player_right_arm: Polygon2D + +export (String) var player_parts_prefix := "res://assets/player/textures/characters/customizable" +export (Array, String) var player_parts_directories := [ + "01-left-arm", + "02-body", + "03-mouth", + "04-left-leg", + "05-pants", + "06-right-leg", + "07-clothes", + "08-right-arm", + "09-facial-hair", + "10-face-wear", + "11-hat-hair", +] + +var player_part_options: Dictionary = { + "Clothes": [], + "Facial Hair": [], + "Face Wear": [], + "Hat/Hair": [], + "Mouth": [], +} + +var selected_skin_color: Color +var selecting_skin_color: bool + +class PlayerPart: + var part_group: String + var texture: Texture + var texture_path: String + +class PartOption: + var part_name: String + var part_texture: Texture + +class PlayerClothes extends PartOption: + var left_leg_texture: Texture + var left_arm_texture: Texture + var right_leg_texture: Texture + var right_arm_texture: Texture + var clothes_texture: Texture + var pants_texture: Texture + +func _ready() -> void: + # Center cursor in the middle of the skin color picker + cursor.position = skin_color_selector.rect_position + (skin_color_selector.rect_size / 2.0) + + var player_parts_paths: Array = [] + for player_parts_directory in player_parts_directories: + player_parts_paths.append(Helpers.string_join([player_parts_prefix, player_parts_directory], "/")) + + var player_parts: Array = [] + for path in player_parts_paths: + var files: Array = _list_directory(path) + for file in files: + if file.ends_with("import"): + continue + var part_group: String = file.replace(".png", "") + var texture_path: String = Helpers.string_join([path, file], "/") + var player_part := PlayerPart.new() + player_part.part_group = part_group + player_part.texture = load(texture_path) + player_part.texture_path = texture_path + player_parts.append(player_part) + + var grouped_player_parts: Dictionary = {} + for part in player_parts: + if grouped_player_parts.has(part.part_group): + grouped_player_parts[part.part_group].append(part) + else: + grouped_player_parts[part.part_group] = [part] + + var part_options: Dictionary = {} + for grouped_part in grouped_player_parts: + # Player clothes are grouped together + if len(grouped_player_parts[grouped_part]) > 1: + var player_clothes := PlayerClothes.new() + for part in grouped_player_parts[grouped_part]: + if "left" in part.texture_path: + if "arm" in part.texture_path: + player_clothes.left_arm_texture = part.texture + elif "leg" in part.texture_path: + player_clothes.left_leg_texture = part.texture + elif "right" in part.texture_path: + if "arm" in part.texture_path: + player_clothes.right_arm_texture = part.texture + elif "leg" in part.texture_path: + player_clothes.right_leg_texture = part.texture + elif "clothes" in part.texture_path: + player_clothes.clothes_texture = part.texture + player_clothes.part_name = part.part_group + elif "pants" in part.texture_path: + player_clothes.pants_texture = part.texture + player_part_options["Clothes"].append(player_clothes) + else: + var part: PlayerPart = grouped_player_parts[grouped_part][0] + var part_option := PartOption.new() + part_option.part_name = part.part_group + part_option.part_texture = part.texture + if "facial" in part.texture_path.to_lower() and "hair" in part.texture_path.to_lower(): + player_part_options["Facial Hair"].append(part_option) + elif "face" in part.texture_path.to_lower() and "wear" in part.texture_path.to_lower(): + player_part_options["Face Wear"].append(part_option) + elif "hat" in part.texture_path.to_lower() and "hair" in part.texture_path.to_lower(): + player_part_options["Hat/Hair"].append(part_option) + elif "mouth" in part.texture_path.to_lower(): + player_part_options["Mouth"].append(part_option) + + for part_option in player_part_options: + var part_selector: HBoxContainer = part_selector_scene.instance() + part_selector.get_node("PartLabel").text = part_option + for part in player_part_options[part_option]: + part_selector.parts.append(part.part_name) + part_selector.get_node("CurrentPartLabel").text = part_selector.parts[0] + part_selector.connect("part_changed", self, "_on_part_changed") + customization_vbox.add_child(part_selector) + + player.get_node("Camera2D").queue_free() + player.set_scale(Vector2.ONE * 5.0) + var skeleton: Node2D = player.get_node("Skeleton") + player_left_leg = skeleton.get_node("LeftLeg") + player_left_arm = skeleton.get_node("LeftArm") + player_body = skeleton.get_node("Body") + player_right_leg = skeleton.get_node("RightLeg") + player_right_arm = skeleton.get_node("RightArm") + var spine: Bone2D = skeleton.get_node("Skeleton/Spine") + player_clothes = spine.get_node("Clothes") + player_pants = spine.get_node("Pants") + player_facial_hair = spine.get_node("FacialHair") + player_face_wear = spine.get_node("FaceWear") + player_hat_hair = spine.get_node("HatHair") + player_mouth = spine.get_node("Mouth") + +func _list_directory(path: String, recursive: bool = false) -> Array: + var directory := Directory.new() + assert(directory.open(path) == OK) + var files: Array = [] + directory.list_dir_begin(true) + var file_name: String = directory.get_next() + while file_name != "": + if directory.current_is_dir() and recursive: + _list_directory(file_name, recursive) + else: + files.append(file_name) + file_name = directory.get_next() + return files + +func _choose_skin_color(coords: Vector2) -> void: + if coords.x > 1 and coords.x < skin_color_selector.rect_size.x - 1 and \ + coords.y > 1 and coords.y < skin_color_selector.rect_size.y - 1: + color_preview.show() + var viewport_texture_data: Image = get_viewport().get_texture().get_data() + var offset: Vector2 = skin_color_selector.rect_global_position + viewport_texture_data.flip_y() + viewport_texture_data.lock() + selected_skin_color = viewport_texture_data.get_pixelv(coords) + cursor.set_position(coords) + color_preview.color = selected_skin_color + player_body.modulate = selected_skin_color + else: + color_preview.hide() + +func _on_SkinColorSelector_gui_input(event: InputEvent) -> void: + if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: + selecting_skin_color = event.pressed + _choose_skin_color(event.position) + if not event.pressed: + color_preview.hide() + elif selecting_skin_color and event is InputEventMouseMotion: + _choose_skin_color(event.position) + +func _on_part_changed(new_part: String, part_name: String) -> void: + var part_options: Array = player_part_options[part_name] + var part_option: PartOption = null + for option in part_options: + if option.part_name == new_part: + part_option = option + if part_option == null: + return + match part_name: + "Clothes": + player_left_leg.texture = part_option.left_leg_texture + player_left_arm.texture = part_option.left_arm_texture + player_right_leg.texture = part_option.right_leg_texture + player_right_arm.texture = part_option.right_arm_texture + player_clothes.texture = part_option.clothes_texture + player_pants.texture = part_option.pants_texture + "Facial Hair": + player_facial_hair.texture = part_option.part_texture + "Face Wear": + player_face_wear.texture = part_option.part_texture + "Hat/Hair": + player_hat_hair.texture = part_option.part_texture + "Mouth": + player_mouth.texture = part_option.part_texture + +func _on_CancelButton_pressed() -> void: + pass # Replace with function body. + +func _on_SaveButton_pressed() -> void: + pass # Replace with function body. diff --git a/src/assets/ui/submenus/appearance_editor/appearance_editor.tscn b/src/assets/ui/submenus/appearance_editor/appearance_editor.tscn new file mode 100644 index 00000000..61f74991 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/appearance_editor.tscn @@ -0,0 +1,199 @@ +[gd_scene load_steps=18 format=2] + +[ext_resource path="res://assets/common/themes/iso_dark.theme" type="Theme" id=1] +[ext_resource path="res://assets/ui/submenus/appearance_editor/appearance_editor.gd" type="Script" id=2] +[ext_resource path="res://assets/ui/submenus/appearance_editor/textures/cursor.png" type="Texture" id=3] +[ext_resource path="res://assets/ui/submenus/appearance_editor/skin_color_range.gd" type="Script" id=4] +[ext_resource path="res://assets/player/player.tscn" type="PackedScene" id=5] +[ext_resource path="res://assets/common/shaders/player.shader" type="Shader" id=6] + +[sub_resource type="Shader" id=8] +code = "shader_type canvas_item; +render_mode blend_disabled; + +void fragment() +{ + +}" + +[sub_resource type="ShaderMaterial" id=9] +shader = SubResource( 8 ) + +[sub_resource type="Gradient" id=1] +colors = PoolColorArray( 1, 1, 1, 1, 0, 0, 0, 1 ) + +[sub_resource type="GradientTexture" id=2] +gradient = SubResource( 1 ) + +[sub_resource type="Shader" id=6] +code = "shader_type canvas_item; +render_mode blend_disabled; + +uniform vec4 color_tone: hint_color = vec4(1.0); + +void fragment() +{ + +}" + +[sub_resource type="ShaderMaterial" id=7] +shader = SubResource( 6 ) +shader_param/color_tone = Color( 1, 1, 1, 1 ) + +[sub_resource type="Gradient" id=3] +colors = PoolColorArray( 0.917647, 0.823529, 0.596078, 1, 0.117647, 0.00392157, 0.00392157, 1 ) + +[sub_resource type="GradientTexture" id=4] +gradient = SubResource( 3 ) + +[sub_resource type="AnimationNodeStateMachinePlayback" id=10] + +[sub_resource type="ShaderMaterial" id=11] +resource_local_to_scene = true +shader = ExtResource( 6 ) +shader_param/line_color = Color( 1, 1, 1, 0 ) +shader_param/line_thickness = 5.0 + +[sub_resource type="ViewportTexture" id=12] +viewport_path = NodePath("SpritesViewport") + +[node name="AppearanceEditor" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme = ExtResource( 1 ) +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -0.943878 +custom_constants/margin_right = 64 +custom_constants/margin_top = 64 +custom_constants/margin_left = 64 +custom_constants/margin_bottom = 64 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="AppearanceHBox" type="HBoxContainer" parent="MarginContainer"] +margin_left = 64.0 +margin_top = 64.0 +margin_right = 960.0 +margin_bottom = 536.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="CustomizationVBox" type="VBoxContainer" parent="MarginContainer/AppearanceHBox"] +margin_right = 446.0 +margin_bottom = 472.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="SkinColorSelector" type="Control" parent="MarginContainer/AppearanceHBox/CustomizationVBox"] +margin_right = 446.0 +margin_bottom = 472.0 +size_flags_horizontal = 3 +size_flags_vertical = 11 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SkinToneRange" type="TextureRect" parent="MarginContainer/AppearanceHBox/CustomizationVBox/SkinColorSelector"] +material = SubResource( 9 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 11 +texture = SubResource( 2 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SkinColorRange" type="TextureRect" parent="MarginContainer/AppearanceHBox/CustomizationVBox/SkinColorSelector"] +modulate = Color( 1, 1, 1, 0.498039 ) +material = SubResource( 7 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 446.0 +margin_right = 471.0 +margin_bottom = -27.0 +rect_rotation = 90.0 +size_flags_horizontal = 3 +size_flags_vertical = 11 +texture = SubResource( 4 ) +expand = true +script = ExtResource( 4 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Cursor" type="Sprite" parent="MarginContainer/AppearanceHBox/CustomizationVBox/SkinColorSelector"] +texture = ExtResource( 3 ) + +[node name="ColorPreview" type="ColorRect" parent="MarginContainer/AppearanceHBox/CustomizationVBox/SkinColorSelector/Cursor"] +visible = false +margin_left = 8.0 +margin_top = 8.0 +margin_right = 72.0 +margin_bottom = 72.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PreviewButtonsVBox" type="VBoxContainer" parent="MarginContainer/AppearanceHBox"] +margin_left = 450.0 +margin_right = 896.0 +margin_bottom = 472.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 + +[node name="PlayerContainer" type="CenterContainer" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox"] +margin_right = 446.0 +margin_bottom = 434.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Player" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox/PlayerContainer" instance=ExtResource( 5 )] +position = Vector2( 221.193, 328.221 ) +scale = Vector2( 5, 5 ) +script = null + +[node name="AnimationTree" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox/PlayerContainer/Player/Skeleton/AnimationPlayer" index="0"] +parameters/playback = SubResource( 10 ) + +[node name="ViewportTextureTarget" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox/PlayerContainer/Player" index="7"] +material = SubResource( 11 ) +texture = SubResource( 12 ) + +[node name="ButtonsHBox" type="HBoxContainer" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox"] +margin_top = 438.0 +margin_right = 446.0 +margin_bottom = 472.0 +alignment = 1 + +[node name="CancelButton" type="Button" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox/ButtonsHBox"] +margin_right = 221.0 +margin_bottom = 34.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Cancel" + +[node name="SaveButton" type="Button" parent="MarginContainer/AppearanceHBox/PreviewButtonsVBox/ButtonsHBox"] +margin_left = 225.0 +margin_right = 446.0 +margin_bottom = 34.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Save" +[connection signal="gui_input" from="MarginContainer/AppearanceHBox/CustomizationVBox/SkinColorSelector" to="." method="_on_SkinColorSelector_gui_input"] +[connection signal="pressed" from="MarginContainer/AppearanceHBox/PreviewButtonsVBox/ButtonsHBox/CancelButton" to="." method="_on_CancelButton_pressed"] +[connection signal="pressed" from="MarginContainer/AppearanceHBox/PreviewButtonsVBox/ButtonsHBox/SaveButton" to="." method="_on_SaveButton_pressed"] + +[editable path="MarginContainer/AppearanceHBox/PreviewButtonsVBox/PlayerContainer/Player"] diff --git a/src/assets/ui/submenus/appearance_editor/part_selector.gd b/src/assets/ui/submenus/appearance_editor/part_selector.gd new file mode 100644 index 00000000..b0b61f4f --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/part_selector.gd @@ -0,0 +1,19 @@ +extends Control + +onready var current_part_label: Label = $CurrentPartLabel +onready var part_label: Label = $PartLabel + +signal part_changed(new_part, part_name) + +var parts: Array = [] +var part_index: int + +func _on_LeftButton_pressed() -> void: + part_index = (part_index - 1) % len(parts) + current_part_label.text = parts[part_index] + emit_signal("part_changed", parts[part_index], part_label.text) + +func _on_RightButton_pressed() -> void: + part_index = (part_index + 1) % len(parts) + current_part_label.text = parts[part_index] + emit_signal("part_changed", parts[part_index], part_label.text) diff --git a/src/assets/ui/submenus/appearance_editor/part_selector.tscn b/src/assets/ui/submenus/appearance_editor/part_selector.tscn new file mode 100644 index 00000000..5b3f1e83 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/part_selector.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png" type="Texture" id=1] +[ext_resource path="res://assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png" type="Texture" id=2] +[ext_resource path="res://assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png" type="Texture" id=3] +[ext_resource path="res://assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png" type="Texture" id=4] +[ext_resource path="res://assets/ui/submenus/appearance_editor/part_selector.gd" type="Script" id=5] + +[node name="PartSelector" type="HBoxContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +custom_constants/separation = 10 +script = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PartLabel" type="Label" parent="."] +margin_top = 289.0 +margin_right = 30.0 +margin_bottom = 311.0 +text = "Part" + +[node name="LeftButtonContainer" type="CenterContainer" parent="."] +margin_left = 40.0 +margin_right = 72.0 +margin_bottom = 600.0 + +[node name="LeftButton" type="TextureButton" parent="LeftButtonContainer"] +margin_top = 284.0 +margin_right = 32.0 +margin_bottom = 316.0 +texture_normal = ExtResource( 1 ) +texture_pressed = ExtResource( 2 ) + +[node name="CurrentPartLabel" type="Label" parent="."] +margin_left = 82.0 +margin_top = 289.0 +margin_right = 112.0 +margin_bottom = 311.0 +text = "Part" + +[node name="RightButtonContainer" type="CenterContainer" parent="."] +margin_left = 122.0 +margin_right = 154.0 +margin_bottom = 600.0 + +[node name="RightButton" type="TextureButton" parent="RightButtonContainer"] +margin_top = 284.0 +margin_right = 32.0 +margin_bottom = 316.0 +texture_normal = ExtResource( 3 ) +texture_pressed = ExtResource( 4 ) +[connection signal="pressed" from="LeftButtonContainer/LeftButton" to="." method="_on_LeftButton_pressed"] +[connection signal="pressed" from="RightButtonContainer/RightButton" to="." method="_on_RightButton_pressed"] diff --git a/src/assets/ui/submenus/appearance_editor/skin_color_range.gd b/src/assets/ui/submenus/appearance_editor/skin_color_range.gd new file mode 100644 index 00000000..641e7800 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/skin_color_range.gd @@ -0,0 +1,10 @@ +extends TextureRect + +onready var selector: Control = get_parent() + +func _process(delta: float) -> void: + # Since this TextureRect is rotated, it scales differently so we'll manually + # set its size and position here + var selector_size: Vector2 = selector.rect_size + rect_size = Vector2(selector_size.y, selector_size.x) + rect_position = Vector2(selector_size.x, 0.0) diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow.png.import new file mode 100644 index 00000000..040eb2f4 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow.png-67960a7c1550322b14f789ea36eb881c.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow.png" +dest_files=[ "res://.import/arrow.png-67960a7c1550322b14f789ea36eb881c.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png new file mode 100644 index 00000000..b4bda946 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c598063498c78bc64b24b2b6b2d4aa09698061d203d963b56e0449de3a56df41 +size 394 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png.import new file mode 100644 index 00000000..b15083a2 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow_left_normal.png-bb35d737399e01c1b76110b7e21471ae.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow_left_normal.png" +dest_files=[ "res://.import/arrow_left_normal.png-bb35d737399e01c1b76110b7e21471ae.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png new file mode 100644 index 00000000..b0d68d11 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe220c1cbb19215769c918dca22d74bdfaf851361e2a6b46d2813fd342fe929d +size 447 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png.import new file mode 100644 index 00000000..d65c38d6 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow_left_pressed.png-7a94840734c54741662f52c93b197131.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow_left_pressed.png" +dest_files=[ "res://.import/arrow_left_pressed.png-7a94840734c54741662f52c93b197131.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_normal.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow_normal.png.import new file mode 100644 index 00000000..f02b3ae7 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_normal.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow_normal.png-84f2fc53fa9d99929604622693d009f2.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow_normal.png" +dest_files=[ "res://.import/arrow_normal.png-84f2fc53fa9d99929604622693d009f2.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_pressed.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow_pressed.png.import new file mode 100644 index 00000000..61b91a39 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_pressed.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow_pressed.png-0515f82d1446dc188492b74b07351090.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow_pressed.png" +dest_files=[ "res://.import/arrow_pressed.png-0515f82d1446dc188492b74b07351090.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png new file mode 100644 index 00000000..94b00f57 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca61b93ab97f1790f55baef7c8a6b18b6e2cf6498f08ae859c39007acec62bae +size 401 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png.import new file mode 100644 index 00000000..60c8ebfc --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow_right_normal.png-7099da4130163135dec6f65a4abf77d4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow_right_normal.png" +dest_files=[ "res://.import/arrow_right_normal.png-7099da4130163135dec6f65a4abf77d4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png new file mode 100644 index 00000000..a8d9a56d --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da57ffa8d2ec8dc38340f4a326d894c9fe631a9e1eccc9e69beb3e227b5837bd +size 432 diff --git a/src/assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png.import b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png.import new file mode 100644 index 00000000..c0a9f019 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/arrow_right_pressed.png-0d050dab036ff9acb2747f5f29561763.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/arrow_right_pressed.png" +dest_files=[ "res://.import/arrow_right_pressed.png-0d050dab036ff9acb2747f5f29561763.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/assets/ui/submenus/appearance_editor/textures/cursor.png b/src/assets/ui/submenus/appearance_editor/textures/cursor.png new file mode 100644 index 00000000..b63d6dd7 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/cursor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7806221f4d56079b63987f637774874a1a3db7a51ac5bd825a9701f94012da7 +size 878 diff --git a/src/assets/ui/submenus/appearance_editor/textures/cursor.png.import b/src/assets/ui/submenus/appearance_editor/textures/cursor.png.import new file mode 100644 index 00000000..58dc7fd6 --- /dev/null +++ b/src/assets/ui/submenus/appearance_editor/textures/cursor.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/cursor.png-b6c2888130b662e5fa6de4b61f8b3f4f.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/submenus/appearance_editor/textures/cursor.png" +dest_files=[ "res://.import/cursor.png-b6c2888130b662e5fa6de4b61f8b3f4f.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/project.godot b/src/project.godot index 74c16ccb..44416a2f 100644 --- a/src/project.godot +++ b/src/project.godot @@ -66,6 +66,7 @@ SceneManager="*res://assets/autoload/scenemanager.gd" UIManager="*res://assets/autoload/uimanager.gd" MapManager="*res://assets/autoload/mapmanager.gd" TaskManager="*res://assets/autoload/taskmanager.gd" +Helpers="*res://assets/autoload/helpers.gd" [display]