Inspectable mutation screen
This commit is contained in:
@@ -4,23 +4,8 @@ class_name MutationElement
|
||||
@export var mutation: PlantMutation: set = set_mutation
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if mutation:
|
||||
var viewport := get_viewport() as SubViewport
|
||||
var viewport_parent = viewport.get_parent()
|
||||
var new_pos := global_position
|
||||
var viewport_size := viewport.size
|
||||
new_pos = viewport_parent.global_position
|
||||
|
||||
var position_2D = get_parent().global_position
|
||||
new_pos.z += position_2D.x / viewport_size.x
|
||||
new_pos.y -= position_2D.y / viewport_size.y
|
||||
global_position = new_pos
|
||||
|
||||
func set_mutation(m: PlantMutation) -> void:
|
||||
mutation = m
|
||||
interactable = false
|
||||
inspectable = true
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
if mutation:
|
||||
|
||||
+9
-78
@@ -6,108 +6,39 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cul11ab04vf8i" path="res://common/icons/hexagon-lock.svg" id="3_udmux"]
|
||||
[ext_resource type="Texture2D" uid="uid://cwewx7cdy085h" path="res://common/icons/help-hexagon.svg" id="4_0ou8m"]
|
||||
[ext_resource type="Script" uid="uid://cf0b6gm06fvy1" path="res://entities/interactables/mutation_element/mutation_element.gd" id="6_0ou8m"]
|
||||
[ext_resource type="PackedScene" uid="uid://i28ngc4hgq85" path="res://stages/3d_scenes/cockpit_scene/assets/3d/furnitures/screen.blend" id="7_fw2k7"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_g4v7s"]
|
||||
radius = 0.037951604
|
||||
radius = 0.34253976
|
||||
|
||||
[node name="MutationDiscoveryElement" type="Control" unique_id=701137276]
|
||||
custom_minimum_size = Vector2(80, 80)
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
[node name="MutationDiscoveryElement" type="Node3D" unique_id=878058622]
|
||||
transform = Transform3D(-4.808253e-09, 0, 0.11, 0, 0.11, 0, -0.11, 0, -4.808253e-09, 0, 0, 0)
|
||||
script = ExtResource("1_udmux")
|
||||
state = 0
|
||||
metadata/_custom_type_script = "uid://dsjd6wkrtjwsa"
|
||||
|
||||
[node name="BackgroundHexagon" type="TextureRect" parent="." unique_id=1761030872]
|
||||
[node name="BackgroundHexagon" type="Sprite3D" parent="." unique_id=905336687]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.605261e-10, 0, -0.012823343)
|
||||
modulate = Color(1, 0.6509804, 0.09019608, 1)
|
||||
custom_minimum_size = Vector2(80, 80)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -30.0
|
||||
offset_top = -30.0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1_wfsg0")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="BackgroundHexagonQuestion" type="TextureRect" parent="." unique_id=1955995284]
|
||||
[node name="BackgroundHexagonQuestion" type="Sprite3D" parent="." unique_id=789745739]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(80, 80)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -30.0
|
||||
offset_top = -30.0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("4_0ou8m")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="BackgroundHexagonLocked" type="TextureRect" parent="." unique_id=786605518]
|
||||
[node name="BackgroundHexagonLocked" type="Sprite3D" parent="." unique_id=485550950]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(80, 80)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -30.0
|
||||
offset_top = -30.0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("3_udmux")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="MutationTexture" type="TextureRect" parent="." unique_id=585232428]
|
||||
[node name="MutationTexture" type="Sprite3D" parent="." unique_id=1932614651]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1_d34h0")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="MutationElement" type="Area3D" parent="." unique_id=1075272683]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("6_0ou8m")
|
||||
interactable = false
|
||||
inspectable = true
|
||||
metadata/_custom_type_script = "uid://cf0b6gm06fvy1"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="MutationElement" unique_id=1480063396]
|
||||
shape = SubResource("SphereShape3D_g4v7s")
|
||||
|
||||
[node name="ScreenModel" parent="MutationElement" unique_id=1206832173 instance=ExtResource("7_fw2k7")]
|
||||
transform = Transform3D(0.075, 0, 0, 0, 0.075, 0, 0, 0, 0.075, 0, 0, 0)
|
||||
|
||||
+3
-25
@@ -74,30 +74,8 @@ label_settings = SubResource("LabelSettings_dv1aj")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1919294387]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -0.011004656, -0.022848502, 0.011004657)
|
||||
pixel_size = 0.001
|
||||
texture = SubResource("ViewportTexture_c5x8t")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=1983077856]
|
||||
disable_3d = true
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
size = Vector2i(813, 592)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Sprite3D/SubViewport" unique_id=28002807]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 16
|
||||
alignment = 1
|
||||
|
||||
[node name="MutationContainer" type="HFlowContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=1675692211]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
last_wrap_alignment = 2
|
||||
[node name="Icons" type="Node3D" parent="." unique_id=1135877944]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.029785365, 0.36184862)
|
||||
|
||||
[node name="ScreenModel" parent="." unique_id=1871285491 instance=ExtResource("3_5fpja")]
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
@tool
|
||||
extends Control
|
||||
extends Node3D
|
||||
class_name MutationDiscoveryElement
|
||||
|
||||
enum State {DISCOVERED, UNDISCOVERED, LOCKED}
|
||||
@@ -11,7 +11,6 @@ enum State {DISCOVERED, UNDISCOVERED, LOCKED}
|
||||
@export var mutation: PlantMutation:
|
||||
set(v):
|
||||
mutation = v
|
||||
%MutationElement.mutation = mutation
|
||||
update()
|
||||
|
||||
func _ready():
|
||||
@@ -25,3 +24,6 @@ func update():
|
||||
%BackgroundHexagonLocked.visible = state == State.LOCKED
|
||||
if mutation:
|
||||
%MutationTexture.texture = mutation.get_icon()
|
||||
%MutationElement.mutation = mutation
|
||||
if state == State.DISCOVERED:
|
||||
%MutationElement.inspectable = true
|
||||
|
||||
+14
-3
@@ -19,9 +19,15 @@ func _ready():
|
||||
|
||||
func update():
|
||||
if is_node_ready():
|
||||
for c in %MutationContainer.get_children():
|
||||
for c in %Icons.get_children():
|
||||
c.queue_free()
|
||||
for i in range(len(all_mutations)):
|
||||
var n_mutation := len(all_mutations)
|
||||
var offset := .105
|
||||
var n_columns := 8
|
||||
var n_expected_rows := floori(float(n_mutation) / n_columns) + 1
|
||||
var n_missing_mutation = n_expected_rows * n_columns - n_mutation
|
||||
print(n_missing_mutation)
|
||||
for i in range(n_mutation):
|
||||
var el := MUTATION_DISCOVERY_ELEMENT_SCENE.instantiate() as MutationDiscoveryElement
|
||||
if i < mutations_unlocked:
|
||||
el.mutation = all_mutations[i]
|
||||
@@ -31,4 +37,9 @@ func update():
|
||||
el.state = MutationDiscoveryElement.State.UNDISCOVERED
|
||||
else:
|
||||
el.state = MutationDiscoveryElement.State.LOCKED
|
||||
%MutationContainer.add_child(el)
|
||||
%Icons.add_child(el)
|
||||
var row_ind := floori(float(i) / n_columns)
|
||||
el.position.y = - offset * row_ind
|
||||
el.position.z = - (i % n_columns) * offset
|
||||
if row_ind == n_expected_rows - 1:
|
||||
el.position.z -= .5 * offset * n_missing_mutation
|
||||
|
||||
Reference in New Issue
Block a user