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:
|
||||
|
||||
Reference in New Issue
Block a user