Move files and folders to new repo format to enable multi-project format
This commit is contained in:
85
Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs
Normal file
85
Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DataViewer : Control
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
public IInstantiator Instantiator { get; set; } = default!;
|
||||
|
||||
[Export]
|
||||
public float _cameraSpeed = 0.01f;
|
||||
|
||||
[Node] public Node3D CameraPivot { get; set; } = default!;
|
||||
|
||||
[Node] public Camera3D Camera3D { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D ModelPivot { get; set; } = default!;
|
||||
|
||||
[Node] public DataViewerRepository DataViewerRepository { get; set; } = default!;
|
||||
|
||||
#region UI
|
||||
[Node] public RichTextLabel EnemyName { get; set; } = default!;
|
||||
[Node] public RichTextLabel Description { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
private EnemyModelView2D _currentModel;
|
||||
|
||||
private int _modelIndex = 0;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
LoadModel();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionPressed(GameInputs.MoveLeft))
|
||||
CameraPivot.RotateY(_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.MoveRight))
|
||||
CameraPivot.RotateY(-_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeLeft))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, (float)delta * 2f);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeRight))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, -(float)delta * 2f);
|
||||
|
||||
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, 1), new Vector3(0, 0, 4));
|
||||
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
|
||||
_currentModel.RotateModel(_currentModel.Basis, CameraPivot.Basis.Z, 0.75f, 0.5f, false);
|
||||
|
||||
if (Input.IsActionJustPressed(GameInputs.Attack))
|
||||
{
|
||||
_currentModel.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
if (Input.IsActionJustPressed(GameInputs.Next))
|
||||
{
|
||||
// Load next model
|
||||
_currentModel.CallDeferred(MethodName.QueueFree);
|
||||
_modelIndex = (_modelIndex + 1) % DataViewerRepository.ModelRepository.Count;
|
||||
GD.Print(_modelIndex);
|
||||
CallDeferred(MethodName.LoadModel);
|
||||
}
|
||||
if (Input.IsActionJustPressed(GameInputs.Previous))
|
||||
{
|
||||
// Load previous model
|
||||
_currentModel.CallDeferred(MethodName.QueueFree);
|
||||
_modelIndex = (_modelIndex - 1 < 0 ? DataViewerRepository.ModelRepository.Count : _modelIndex) - 1;
|
||||
CallDeferred(MethodName.LoadModel);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadModel()
|
||||
{
|
||||
var modelScene = DataViewerRepository.ModelRepository.ElementAt(_modelIndex);
|
||||
_currentModel = modelScene.Instantiate<EnemyModelView2D>();
|
||||
ModelPivot.AddChild(_currentModel);
|
||||
EnemyName.Text = _currentModel.EnemyLoreInfo.Name;
|
||||
Description.Text = _currentModel.EnemyLoreInfo.Description;
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/data_viewer/DataViewer.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bgaflnnur26vk
|
||||
146
Zennysoft.Game.Ma/src/data_viewer/DataViewer.tscn
Normal file
146
Zennysoft.Game.Ma/src/data_viewer/DataViewer.tscn
Normal file
@@ -0,0 +1,146 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://c7wjbgbrdivol"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bgaflnnur26vk" path="res://src/data_viewer/DataViewer.cs" id="1_1qako"]
|
||||
[ext_resource type="Theme" uid="uid://daxuhpmyxwxck" path="res://src/inventory_menu/InventoryDialogueSelectionStyle.tres" id="2_bef6s"]
|
||||
[ext_resource type="PackedScene" uid="uid://c16i1gmg6yu5a" path="res://src/data_viewer/DataViewerRepository.tscn" id="3_ejdn0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bh0crf4qonrh5" path="res://src/map/dungeon/models/Set A/03. Antechamber A/ANTECHAMBER_TYPE1_VER2_8311.png" id="3_hpkd1"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjg8wyvp8q6oc" path="res://src/enemy/enemy_types/02. michael/MichaelModelView.tscn" id="4_bef6s"]
|
||||
[ext_resource type="PackedScene" uid="uid://bli0t0d6ommvi" path="res://src/enemy/enemy_types/01. sproingy/SproingyModelView.tscn" id="5_hpkd1"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dvixg"]
|
||||
albedo_texture = ExtResource("3_hpkd1")
|
||||
shading_mode = 0
|
||||
|
||||
[node name="DataViewer" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_1qako")
|
||||
_cameraSpeed = 0.015
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="LeftPanel" type="Panel" parent="CenterContainer/VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(390, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="EnemyName" type="RichTextLabel" parent="CenterContainer/VBoxContainer/HBoxContainer/LeftPanel"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_bef6s")
|
||||
text = "Placeholder Text"
|
||||
|
||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="CenterContainer/VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(500, 500)
|
||||
layout_mode = 2
|
||||
stretch = true
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer"]
|
||||
handle_input_locally = false
|
||||
size = Vector2i(500, 500)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="ModelPivot" type="Node3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.82392, 0)
|
||||
|
||||
[node name="CameraPivot" type="Node3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1, 0)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport/CameraPivot"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.82023e-08, 0, 3.1233)
|
||||
|
||||
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.47154, 0)
|
||||
radius = 1.5
|
||||
height = 5.46951
|
||||
material = SubResource("StandardMaterial3D_dvixg")
|
||||
|
||||
[node name="SpotLight3D" type="SpotLight3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.0417012, 0.99913, 0, -0.99913, 0.0417012, 0, 4.88492, 0)
|
||||
|
||||
[node name="RightPanel" type="Panel" parent="CenterContainer/VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(390, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="TextEdit" type="RichTextLabel" parent="CenterContainer/VBoxContainer/HBoxContainer/RightPanel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_bef6s")
|
||||
text = "Placeholder Text"
|
||||
|
||||
[node name="BottomPanel" type="Panel" parent="CenterContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 460)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="CenterContainer/VBoxContainer/BottomPanel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Description" type="RichTextLabel" parent="CenterContainer/VBoxContainer/BottomPanel"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_bef6s")
|
||||
text = "Placeholder Text"
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer/BottomPanel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -369.0
|
||||
offset_top = -76.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
theme = ExtResource("2_bef6s")
|
||||
text = "Press ○ to exit"
|
||||
|
||||
[node name="DataViewerRepository" parent="." instance=ExtResource("3_ejdn0")]
|
||||
unique_name_in_owner = true
|
||||
ModelRepository = Array[PackedScene]([ExtResource("5_hpkd1"), ExtResource("4_bef6s")])
|
||||
12
Zennysoft.Game.Ma/src/data_viewer/DataViewerRepository.cs
Normal file
12
Zennysoft.Game.Ma/src/data_viewer/DataViewerRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DataViewerRepository : Node
|
||||
{
|
||||
[Export]
|
||||
public Godot.Collections.Array<PackedScene> ModelRepository;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://03k48fke03vu
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c16i1gmg6yu5a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://03k48fke03vu" path="res://src/data_viewer/DataViewerRepository.cs" id="1_1cvot"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjg8wyvp8q6oc" path="res://src/enemy/enemy_types/02. michael/MichaelModelView.tscn" id="2_8autu"]
|
||||
[ext_resource type="PackedScene" uid="uid://bli0t0d6ommvi" path="res://src/enemy/enemy_types/01. sproingy/SproingyModelView.tscn" id="3_0bpmu"]
|
||||
|
||||
[node name="DataViewerRepository" type="Node"]
|
||||
script = ExtResource("1_1cvot")
|
||||
_modelsToDisplay = [ExtResource("2_8autu"), ExtResource("3_0bpmu")]
|
||||
Reference in New Issue
Block a user