trait lists
This commit is contained in:
@@ -2,6 +2,17 @@ extends Area2D
|
||||
class_name List
|
||||
|
||||
var current_item = 0
|
||||
var mask_list: Array[MaskResource]
|
||||
var guest_list: Array[CharacterResource]
|
||||
var items: Array
|
||||
|
||||
var pref_score_name: Dictionary[CharacterResource.Preference, String] = {
|
||||
CharacterResource.Preference.LOVE: "Loves ",
|
||||
CharacterResource.Preference.APPROVE: "Likes ",
|
||||
CharacterResource.Preference.DONT_CARE: "Doesn't care about ",
|
||||
CharacterResource.Preference.DISAPPROVE: "Disapproves ",
|
||||
CharacterResource.Preference.HATE: "Hates ",
|
||||
}
|
||||
|
||||
@onready var label: Label = $Label
|
||||
|
||||
@@ -14,23 +25,38 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func set_mask_list(items: Array[MaskResource]):
|
||||
print(items)
|
||||
func set_list(_items):
|
||||
print(name)
|
||||
for i in _items:
|
||||
print(i.name)
|
||||
|
||||
current_item = 0
|
||||
if items.size() == 0:
|
||||
label.text = "..."
|
||||
|
||||
func set_chara_list(items: Array[CharacterResource]):
|
||||
print(items)
|
||||
current_item = 0
|
||||
if items.size() == 0:
|
||||
label.text = "..."
|
||||
if _items.size() == 0:
|
||||
items = []
|
||||
label.text = "...\n...\n..."
|
||||
return
|
||||
items = _items
|
||||
cycle_through_items()
|
||||
|
||||
|
||||
func cycle_through_items() -> void:
|
||||
if items.size() == 0:
|
||||
label.text = "...\n...\n..."
|
||||
return
|
||||
|
||||
current_item += 1
|
||||
print(current_item)
|
||||
var index = current_item % items.size()
|
||||
var item = items.get(index)
|
||||
if item is MaskResource:
|
||||
label.text = "\n\n\n\n" + item.name + "\n\n" + item.description
|
||||
elif item is CharacterResource:
|
||||
label.text = item.name + "\n\nTraits\n"
|
||||
for guest_trait: Trait in item.traits:
|
||||
label.text += guest_trait.name + ", "
|
||||
label.text += "\n\nPreferences\n"
|
||||
for other_trait in item.preferences:
|
||||
var pref = item.preferences[other_trait]
|
||||
label.text += pref_score_name[pref] + other_trait.name + ", "
|
||||
|
||||
|
||||
func _on_mouse_entered() -> void:
|
||||
|
||||
@@ -14,14 +14,16 @@ shape = SubResource("CapsuleShape2D_trceg")
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=1624172949]
|
||||
z_index = 10
|
||||
custom_minimum_size = Vector2(360, 0)
|
||||
offset_left = -179.0
|
||||
offset_top = -257.0
|
||||
offset_right = 121.0
|
||||
offset_bottom = -209.0
|
||||
offset_left = -150.0
|
||||
offset_top = -430.0
|
||||
offset_right = 195.41
|
||||
offset_bottom = -280.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/line_spacing = 1
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "..."
|
||||
text = "...
|
||||
...
|
||||
..."
|
||||
autowrap_mode = 3
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cl1a50j64nnlh" path="res://assets/decor/guest_page_held.png" id="36_62f45"]
|
||||
[ext_resource type="Texture2D" uid="uid://coahojeky8ul7" path="res://assets/decor/bell.png" id="37_6g32y"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgl8g5eqy8xm0" path="res://assets/decor/hand_bell.png" id="39_62f45"]
|
||||
[ext_resource type="Texture2D" uid="uid://dj267xgqniy2i" path="res://assets/decor/table_item_a_2.png" id="43_jucdw"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4u3o7fyryxxq" path="res://assets/decor/table_item_a.png" id="44_6miv3"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_gkmcc"]
|
||||
random_pitch = 1.122462
|
||||
@@ -460,13 +462,23 @@ position = Vector2(95, 156)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("35_62f45")
|
||||
|
||||
[node name="TableItemA2" type="Sprite2D" parent="." unique_id=611798307]
|
||||
position = Vector2(-933, 164)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("43_jucdw")
|
||||
|
||||
[node name="TableItemA" type="Sprite2D" parent="." unique_id=1146510015]
|
||||
position = Vector2(911.00006, 385.00003)
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("44_6miv3")
|
||||
|
||||
[node name="MaskList" parent="." unique_id=437192154 instance=ExtResource("25_6llfj")]
|
||||
position = Vector2(409, 523)
|
||||
rotation = 0.1675516
|
||||
scale = Vector2(0.99999994, 0.99999994)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="MaskList" unique_id=1216540471]
|
||||
position = Vector2(209.40524, 188.72063)
|
||||
position = Vector2(213.79706, 100.75635)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("35_1k3ck")
|
||||
flip_h = true
|
||||
@@ -476,8 +488,8 @@ position = Vector2(-409, 523)
|
||||
rotation = -0.16732943
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="GuestList" unique_id=2026369586]
|
||||
position = Vector2(-218.29799, 139.59222)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
position = Vector2(-224.08743, 155.85515)
|
||||
scale = Vector2(0.6, 0.6)
|
||||
texture = ExtResource("36_62f45")
|
||||
|
||||
[node name="ReadyBell" type="Area2D" parent="." unique_id=1350504622]
|
||||
|
||||
@@ -32,6 +32,7 @@ class_name GameManager
|
||||
@export_category("Random levels")
|
||||
@export var current_level: Levels = Levels.LVL1
|
||||
@export var max_number_guests: int = 9
|
||||
@export var no_mask_probability: float = 0.2
|
||||
@export var dual_mask_probability: float = 0.2
|
||||
@export_tool_button("Create chara roster") var create_roster_action = create_new_roster
|
||||
|
||||
@@ -70,6 +71,11 @@ func create_new_roster() -> void:
|
||||
|
||||
var mouth_mask: MaskResource
|
||||
var eyes_mask: MaskResource
|
||||
var no_masked = randf() <= no_mask_probability
|
||||
if (no_masked):
|
||||
current_chara_roster.append(MaskedChara.new(chara, eyes_mask, mouth_mask))
|
||||
continue
|
||||
|
||||
var should_pick_eye_mask = randi_range(0, 1) == 1
|
||||
var dual_masked = randf() <= dual_mask_probability
|
||||
if (should_pick_eye_mask):
|
||||
@@ -81,10 +87,6 @@ func create_new_roster() -> void:
|
||||
if dual_masked:
|
||||
eyes_mask = face_mask_roster.pick_random()
|
||||
|
||||
# Associate a single mask (for now) to the character
|
||||
# var mask: MaskResource = mask_roster.pick_random()
|
||||
# var face_mask = mask if mask.region == MaskResource.Region.EYES else null
|
||||
# var mouth_mask = mask if mask.region == MaskResource.Region.MOUTH else null
|
||||
var masked_chara = MaskedChara.new(chara, eyes_mask, mouth_mask)
|
||||
|
||||
current_chara_roster.append(masked_chara)
|
||||
@@ -174,13 +176,13 @@ func on_ready_bell_pressed() -> void:
|
||||
var all_masks_in_current_roster: Array[MaskResource] = []
|
||||
for masked_chara in current_chara_roster:
|
||||
all_chara_in_current_roster.append(masked_chara.character)
|
||||
if masked_chara.face_mask != null and masked_chara.face_mask.resource_name:
|
||||
if masked_chara.face_mask != null:
|
||||
all_masks_in_current_roster.append(masked_chara.face_mask)
|
||||
if masked_chara.mouth_mask != null and masked_chara.mouth_mask.resource_name:
|
||||
if masked_chara.mouth_mask != null:
|
||||
all_masks_in_current_roster.append(masked_chara.mouth_mask)
|
||||
|
||||
mask_list.set_mask_list(all_masks_in_current_roster)
|
||||
guest_list.set_chara_list(all_chara_in_current_roster)
|
||||
mask_list.set_list(all_masks_in_current_roster)
|
||||
guest_list.set_list(all_chara_in_current_roster)
|
||||
|
||||
current_game_state = GameState.GUEST_REVIEW
|
||||
bell_anim_player.stop()
|
||||
|
||||
@@ -8,6 +8,9 @@ enum Region {
|
||||
}
|
||||
|
||||
@export_category("General")
|
||||
@export var name: String
|
||||
@export var description: String
|
||||
|
||||
@export var mask_sprite: Texture2D:
|
||||
set(value):
|
||||
mask_sprite = value
|
||||
|
||||
@@ -2,20 +2,61 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://cuojjiwxidmwu" path="res://scenes/seat/seat.gd" id="1_pceab"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvpyqyftqhy45" path="res://scenes/character/character.tscn" id="3_dxmy0"]
|
||||
[ext_resource type="Resource" uid="uid://c87odmn680x7" path="res://resources/characters/duchex.tres" id="4_ipxud"]
|
||||
[ext_resource type="Texture2D" uid="uid://cftllq6l7xclt" path="res://icon.svg" id="4_wnjs1"]
|
||||
[ext_resource type="Texture2D" uid="uid://belkmlrr588ki" path="res://assets/ui/seat_selector.png" id="3_wnjs1"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wnjs1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dxmy0"]
|
||||
resource_name = "idle"
|
||||
length = 3.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.5000001),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, -30)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wnjs1"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_wnjs1"),
|
||||
&"idle": SubResource("Animation_dxmy0")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rofvo"]
|
||||
size = Vector2(128, 128)
|
||||
size = Vector2(128, 256)
|
||||
|
||||
[node name="Seat" type="Area2D" unique_id=1604639021]
|
||||
script = ExtResource("1_pceab")
|
||||
|
||||
[node name="Character" parent="." unique_id=138741531 instance=ExtResource("3_dxmy0")]
|
||||
chara_resource = ExtResource("4_ipxud")
|
||||
|
||||
[node name="Empty" type="Sprite2D" parent="." unique_id=357649392]
|
||||
texture = ExtResource("4_wnjs1")
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("3_wnjs1")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Empty" unique_id=288853041]
|
||||
libraries/ = SubResource("AnimationLibrary_wnjs1")
|
||||
autoplay = &"idle"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1054126207]
|
||||
shape = SubResource("RectangleShape2D_rofvo")
|
||||
|
||||
Reference in New Issue
Block a user