plante part pour ermit et tropical
[dev] upgrade sprite tester (choix de mutation)
This commit is contained in:
@@ -14,7 +14,9 @@ extends Node
|
||||
|
||||
@export var camera_speed := 1000.0
|
||||
|
||||
var test_progression_data: TestProgressionData
|
||||
var input_dir := Vector2.ZERO
|
||||
var checkBoxes: Dictionary[String, CheckBox]
|
||||
|
||||
func _ready():
|
||||
%Speed.value = camera_speed
|
||||
@@ -28,6 +30,19 @@ func _ready():
|
||||
%EndAge.visible = random_state
|
||||
%MinLvl.value = min_level
|
||||
%MaxLvl.value = max_level
|
||||
test_progression_data = TestProgressionData.new()
|
||||
GameInfo.game_data.progression_data = test_progression_data
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
var lineContainer := HBoxContainer.new()
|
||||
var checkBox := CheckBox.new()
|
||||
checkBox.button_pressed = true
|
||||
checkBox.toggled.connect(func(toggled_on): toggle_mutation_available(m, toggled_on))
|
||||
checkBoxes[m.id] = checkBox
|
||||
lineContainer.add_child(checkBox)
|
||||
var label := Label.new()
|
||||
label.text = m.id
|
||||
lineContainer.add_child(label)
|
||||
%PossibleMutationContainer.add_child(lineContainer)
|
||||
generate_plants();
|
||||
|
||||
func _unhandled_key_input(_event) -> void:
|
||||
@@ -67,7 +82,6 @@ func generate_plants():
|
||||
var plant: Plant = Plant.new(plant_data)
|
||||
print(plant.data.plant_name)
|
||||
%Plants.add_child(plant)
|
||||
# plant.set_owner(self )
|
||||
plant.global_position = plant_position
|
||||
|
||||
func generate_seeds():
|
||||
@@ -139,3 +153,33 @@ func _on_min_lvl_value_changed(value: float) -> void:
|
||||
|
||||
func _on_max_lvl_value_changed(value: float) -> void:
|
||||
max_level = int(value)
|
||||
|
||||
func toggle_mutation_available(mutation: PlantMutation, toggled_on: bool):
|
||||
if toggled_on:
|
||||
test_progression_data.discover_mutation(mutation)
|
||||
else:
|
||||
test_progression_data.lock_mutation(mutation)
|
||||
checkBoxes[mutation.id].set_pressed_no_signal(toggled_on)
|
||||
|
||||
func _on_toggle_on_all() -> void:
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
test_progression_data.discover_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(true)
|
||||
|
||||
func _on_toggle_off_all() -> void:
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
test_progression_data.lock_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(false)
|
||||
|
||||
func _on_toggle_all() -> void:
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
if test_progression_data.mutations_available.has(m.id):
|
||||
test_progression_data.lock_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(false)
|
||||
else:
|
||||
test_progression_data.discover_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(true)
|
||||
|
||||
func update_checkboxes() -> void:
|
||||
for key in checkBoxes:
|
||||
checkBoxes[key].set_pressed_no_signal(test_progression_data.mutations_available.has(key))
|
||||
|
||||
Reference in New Issue
Block a user