mirror of
https://github.com/HarmonyHoney/ROTA.git
synced 2026-07-17 16:46:17 +00:00
Visual Hair selection in MenuMakeover! ^.^<3
This commit is contained in:
parent
495636cfd7
commit
20a17450bc
9 changed files with 141 additions and 93 deletions
|
|
@ -21,6 +21,8 @@ export var dist_scale := Vector2(0.9, 0.9)
|
|||
export var offset := Vector2(100, 0)
|
||||
var dir_x := 1.0
|
||||
|
||||
export var hide_distance := 50.0
|
||||
|
||||
func _ready():
|
||||
MenuMakeover.connect("closed", self, "closed")
|
||||
get_tree().connect("idle_frame", self, "idle_frame")
|
||||
|
|
@ -58,16 +60,10 @@ func create_rig():
|
|||
from.append(i[0])
|
||||
to.append(i[1])
|
||||
|
||||
for i in get_all_children(sprites.get_node("Root/Body/Hair")):
|
||||
for i in Shared.get_all_children(sprites.get_node("Root/Body/Hair")):
|
||||
if i.has_method("scale_x"):
|
||||
p.connect("scale_x", i, "scale_x")
|
||||
|
||||
func get_all_children(in_node, arr := []):
|
||||
arr.push_back(in_node)
|
||||
for child in in_node.get_children():
|
||||
arr = get_all_children(child, arr)
|
||||
return arr
|
||||
|
||||
func _on_Arrow_open():
|
||||
MenuMakeover.is_open = true
|
||||
arrow.is_locked = true
|
||||
|
|
@ -89,7 +85,7 @@ func idle_frame():
|
|||
|
||||
dist = to_local(p.global_position)
|
||||
rig.position = dist + (offset * dir_x)
|
||||
rig.visible = color_rect.get_rect().grow(40).has_point(rig.position)
|
||||
rig.visible = color_rect.get_rect().grow(hide_distance).has_point(rig.position)
|
||||
|
||||
if abs(dist.x) > 200:
|
||||
dir_x = -sign(dist.x)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ z_index = -5
|
|||
script = ExtResource( 1 )
|
||||
dist_scale = Vector2( 0.7, 1 )
|
||||
offset = Vector2( 70, 0 )
|
||||
hide_distance = 100.0
|
||||
|
||||
[node name="Arrow" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
|
|
|
|||
|
|
@ -284,6 +284,12 @@ func burst_screenshot(count := 30, viewport := get_tree().root):
|
|||
images[i].save_png("user://snap/" + s + "snap" + str(i) + ".png")
|
||||
yield(get_tree(), "idle_frame")
|
||||
|
||||
func get_all_children(n, a := []):
|
||||
a.append(n)
|
||||
for i in n.get_children():
|
||||
a = get_all_children(i, a)
|
||||
return a
|
||||
|
||||
### Gems
|
||||
|
||||
func collect_gem():
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
extends Scroll
|
||||
|
||||
export(String, "back", "front") var order = "back"
|
||||
|
||||
func set_value():
|
||||
Shared.player.set("hairstyle_" + order, cursor)
|
||||
|
|
@ -33,7 +33,7 @@ func random():
|
|||
|
||||
for i in items:
|
||||
if i.is_in_group("color") or i.is_in_group("hair"):
|
||||
i.cursor = l.pop_back() if i.is_in_group("color") else randi() % i.list.size()
|
||||
i.cursor = l.pop_back() if i.is_in_group("color") else randi() % (i.count + 1)
|
||||
|
||||
func outfit(l := pale):
|
||||
for i in l.size():
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://media/font/mini-wakuwaku.otf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://src/menu/MenuMakeover.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/menu/options/scroll/Hairstyle.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/menu/options/scroll/Color.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://media/font/profile/OptionsItem.tres" type="DynamicFont" id=5]
|
||||
[ext_resource path="res://src/menu/HairStyle.gd" type="Script" id=6]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 1, 1, 1, 1 )
|
||||
|
|
@ -57,7 +56,7 @@ margin_bottom = -80.0
|
|||
rect_pivot_offset = Vector2( -618, -18 )
|
||||
|
||||
[node name="Panel" type="Panel" parent="Dialog"]
|
||||
modulate = Color( 0, 0, 0, 0.5 )
|
||||
modulate = Color( 0, 0, 0, 0.4 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -30.0
|
||||
|
|
@ -80,10 +79,11 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="w" type="Panel" parent="Dialog"]
|
||||
modulate = Color( 0.74902, 0.376471, 0.380392, 1 )
|
||||
margin_left = 342.0
|
||||
margin_top = 140.0
|
||||
margin_top = -20.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 440.0
|
||||
margin_bottom = 495.0
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
|
|
@ -96,105 +96,58 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
custom_constants/separation = 10
|
||||
alignment = 1
|
||||
|
||||
[node name="HairBack" type="Control" parent="Dialog/List" groups=["hair"]]
|
||||
margin_right = 560.0
|
||||
margin_bottom = 70.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
is_loop = true
|
||||
list = PoolStringArray( "None", "Short", "Medium", "Long", "Braid", "Braids", "Afro" )
|
||||
[node name="HairBack" parent="Dialog/List" instance=ExtResource( 3 )]
|
||||
margin_top = 2.0
|
||||
margin_bottom = 72.0
|
||||
list = PoolStringArray( )
|
||||
|
||||
[node name="Label" type="Label" parent="Dialog/List/HairBack"]
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 5 )
|
||||
text = "Hair Back"
|
||||
valign = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="Dialog/List/HairBack"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 5 )
|
||||
text = "< OFF >"
|
||||
align = 2
|
||||
valign = 1
|
||||
[node name="HairFront" parent="Dialog/List" instance=ExtResource( 3 )]
|
||||
margin_top = 82.0
|
||||
margin_bottom = 152.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
||||
[node name="HairFront" type="Control" parent="Dialog/List" groups=["hair"]]
|
||||
margin_top = 74.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 144.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
is_loop = true
|
||||
list = PoolStringArray( "none", "Short", "Long", "Two Short", "Two Long", "Bun", "Buns", "Mohawk", "Flat Top", "Bangs" )
|
||||
count = 9
|
||||
order = "front"
|
||||
|
||||
[node name="Label" type="Label" parent="Dialog/List/HairFront"]
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 5 )
|
||||
text = "Hair Front"
|
||||
valign = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="Dialog/List/HairFront"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 5 )
|
||||
text = "< OFF >"
|
||||
align = 2
|
||||
valign = 1
|
||||
scenes = [ "", "res://src/actor/hair/front/OneShort.tscn", "res://src/actor/hair/front/OneLong.tscn", "res://src/actor/hair/front/TwoShort.tscn", "res://src/actor/hair/front/TwoLong.tscn", "res://src/actor/hair/front/Bun.tscn", "res://src/actor/hair/front/Buns.tscn", "res://src/actor/hair/front/Mohawk.tscn", "res://src/actor/hair/front/FlatTop.tscn", "res://src/actor/hair/front/Bangs.tscn" ]
|
||||
|
||||
[node name="Color" parent="Dialog/List" instance=ExtResource( 4 )]
|
||||
margin_top = 148.0
|
||||
margin_top = 162.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 218.0
|
||||
margin_bottom = 232.0
|
||||
|
||||
[node name="Color2" parent="Dialog/List" instance=ExtResource( 4 )]
|
||||
margin_top = 222.0
|
||||
margin_top = 242.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 292.0
|
||||
margin_bottom = 312.0
|
||||
part = "skin"
|
||||
|
||||
[node name="Color3" parent="Dialog/List" instance=ExtResource( 4 )]
|
||||
margin_top = 296.0
|
||||
margin_top = 322.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 366.0
|
||||
margin_bottom = 392.0
|
||||
part = "fit"
|
||||
|
||||
[node name="Color4" parent="Dialog/List" instance=ExtResource( 4 )]
|
||||
margin_top = 370.0
|
||||
margin_top = 402.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 440.0
|
||||
margin_bottom = 472.0
|
||||
part = "eye"
|
||||
|
||||
[node name="Spacer" type="Control" parent="Dialog/List" groups=["no_item"]]
|
||||
margin_top = 444.0
|
||||
margin_top = 482.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 514.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
margin_bottom = 497.0
|
||||
rect_min_size = Vector2( 0, 15 )
|
||||
|
||||
[node name="Random" type="Label" parent="Dialog/List"]
|
||||
margin_left = 179.0
|
||||
margin_top = 518.0
|
||||
margin_top = 507.0
|
||||
margin_right = 381.0
|
||||
margin_bottom = 569.0
|
||||
margin_bottom = 558.0
|
||||
size_flags_horizontal = 4
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Random"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ anchor_right = 0.5
|
|||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Hair"
|
||||
text = "Color"
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
|
|
|
|||
47
src/menu/options/scroll/Hairstyle.gd
Normal file
47
src/menu/options/scroll/Hairstyle.gd
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
extends Scroll
|
||||
|
||||
export(String, "back", "front") var order = "back"
|
||||
|
||||
export(Array, String, FILE) var scenes := []
|
||||
|
||||
onready var hbox := $HBoxContainer
|
||||
onready var circle := $HBoxContainer/Circle
|
||||
var items := []
|
||||
var styles := []
|
||||
|
||||
func _ready():
|
||||
label_desc.text = order.capitalize()
|
||||
for i in scenes.size():
|
||||
if i == 0: continue
|
||||
|
||||
var c = circle.duplicate()
|
||||
hbox.add_child(c)
|
||||
|
||||
var s = load(scenes[i]).instance()
|
||||
|
||||
if order == "back":
|
||||
s.show_behind_parent = true
|
||||
|
||||
s.position = Vector2(35, 35)
|
||||
c.add_child(s)
|
||||
|
||||
items = hbox.get_children()
|
||||
|
||||
for i in items.size():
|
||||
items[i].visible = i < 5
|
||||
|
||||
# specific mohawk fix
|
||||
for i in Shared.get_all_children(hbox):
|
||||
if i.get("z_index") and i.z_index == -2:
|
||||
i.z_index = 0
|
||||
|
||||
func set_value():
|
||||
Shared.player.set("hairstyle_" + order, cursor)
|
||||
|
||||
for i in items:
|
||||
i.visible = false
|
||||
|
||||
for i in 5:
|
||||
var p = posmod(cursor + (i - 2), items.size())
|
||||
hbox.move_child(items[p], i)
|
||||
items[p].visible = true
|
||||
51
src/menu/options/scroll/Hairstyle.tscn
Normal file
51
src/menu/options/scroll/Hairstyle.tscn
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/actor/Circle.gd" type="Script" id=1]
|
||||
[ext_resource path="res://media/font/profile/OptionsItem.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://src/menu/options/scroll/Hairstyle.gd" type="Script" id=3]
|
||||
|
||||
[node name="Hairstyle" type="Control" groups=["hair"]]
|
||||
margin_right = 560.0
|
||||
margin_bottom = 70.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
script = ExtResource( 3 )
|
||||
is_loop = true
|
||||
count = 6
|
||||
scenes = [ "", "res://src/actor/hair/back/Short.tscn", "res://src/actor/hair/back/Medium.tscn", "res://src/actor/hair/back/Long.tscn", "res://src/actor/hair/back/Braid.tscn", "res://src/actor/hair/back/Braids.tscn", "res://src/actor/hair/back/Afro.tscn" ]
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Hair"
|
||||
valign = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "< OFF >"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
alignment = 2
|
||||
|
||||
[node name="Circle" type="Control" parent="HBoxContainer"]
|
||||
self_modulate = Color( 0, 0, 0, 1 )
|
||||
margin_left = 490.0
|
||||
margin_right = 560.0
|
||||
margin_bottom = 70.0
|
||||
rect_min_size = Vector2( 70, 70 )
|
||||
script = ExtResource( 1 )
|
||||
radius = 20.0
|
||||
offset = Vector2( 35, 35 )
|
||||
Loading…
Add table
Add a link
Reference in a new issue