more fixes

This commit is contained in:
Jan Racek
2026-03-28 01:32:36 +01:00
parent 13ed569eaf
commit a251eeaed5
13 changed files with 83 additions and 53 deletions

View File

@@ -12,21 +12,21 @@ namespace SplashEdit.EditorCode
{
private bool _interactionFoldout = true;
private bool _advancedFoldout = false;
private SerializedProperty _interactionRadius;
private SerializedProperty _interactButton;
private SerializedProperty _isRepeatable;
private SerializedProperty _cooldownFrames;
private SerializedProperty _showPrompt;
private SerializedProperty _promptCanvasName;
private SerializedProperty _requireLineOfSight;
private SerializedProperty _interactionOffset;
private static readonly string[] ButtonNames =
private static readonly string[] ButtonNames =
{
"Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left",
"L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"
};
private void OnEnable()
{
_interactionRadius = serializedObject.FindProperty("interactionRadius");
@@ -34,10 +34,10 @@ namespace SplashEdit.EditorCode
_isRepeatable = serializedObject.FindProperty("isRepeatable");
_cooldownFrames = serializedObject.FindProperty("cooldownFrames");
_showPrompt = serializedObject.FindProperty("showPrompt");
_promptCanvasName = serializedObject.FindProperty("promptCanvasName");
_requireLineOfSight = serializedObject.FindProperty("requireLineOfSight");
_interactionOffset = serializedObject.FindProperty("interactionOffset");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
@@ -76,15 +76,35 @@ namespace SplashEdit.EditorCode
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(_showPrompt);
EditorGUILayout.Space(4);
EditorGUILayout.PropertyField(_showPrompt, new GUIContent("Show Prompt Canvas"));
if (_showPrompt.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_promptCanvasName, new GUIContent("Canvas Name"));
if (string.IsNullOrEmpty(_promptCanvasName.stringValue))
{
EditorGUILayout.HelpBox(
"Enter the name of a PSXCanvas that will be shown when the player is in range and hidden when they leave.",
MessageType.Info);
}
if (_promptCanvasName.stringValue != null && _promptCanvasName.stringValue.Length > 15)
{
EditorGUILayout.HelpBox("Canvas name is limited to 15 characters.", MessageType.Warning);
}
EditorGUI.indentLevel--;
}
});
EditorGUILayout.Space(2);
_advancedFoldout = PSXEditorStyles.DrawFoldoutCard("Advanced", _advancedFoldout, () =>
{
EditorGUILayout.PropertyField(_requireLineOfSight);
EditorGUILayout.PropertyField(_interactionOffset);
EditorGUILayout.PropertyField(_requireLineOfSight,
new GUIContent("Require Facing",
"Player must be facing the object to interact. Uses a forward-direction check."));
});
EditorGUILayout.Space(4);

View File

@@ -1,3 +1,6 @@
// I raged that my scrollwheel was broken while writing this and that's why it's 2 files.
using UnityEngine;
using UnityEditor;
using SplashEdit.RuntimeCode;