This commit is contained in:
2025-03-30 16:06:57 +02:00
parent e62bd2aa6d
commit 623ba3f621
148 changed files with 2773 additions and 1441 deletions

View File

@@ -5,16 +5,16 @@ using UnityEngine.UIElements;
namespace SzafaKitEditor.VisualElements {
public class CVarPropertyField : VisualElement {
private SerializedProperty _cvarProperty;
private SerializedProperty _nameProperty;
private SerializedProperty _defaultValueProperty;
private SerializedProperty _defaultValueKindProperty;
private SerializedProperty _defaultValueNumberProperty;
private SerializedProperty _defaultValueStringProperty;
readonly SerializedProperty _cvarProperty;
readonly SerializedProperty _defaultValueKindProperty;
readonly SerializedProperty _defaultValueNumberProperty;
readonly SerializedProperty _defaultValueProperty;
readonly SerializedProperty _defaultValueStringProperty;
private VisualElement _details;
VisualElement _details;
private bool _expand;
bool _expand;
readonly SerializedProperty _nameProperty;
public CVarPropertyField(SerializedProperty cvarProperty) {
_cvarProperty = cvarProperty;
@@ -28,14 +28,14 @@ namespace SzafaKitEditor.VisualElements {
CreateDetailsBox();
}
private void CreateInlineField() {
VisualElement box = new VisualElement() {
void CreateInlineField() {
VisualElement box = new() {
style = {
height = 48
}
};
Label nameLabel = new Label("NAME") {
Label nameLabel = new("NAME") {
style = {
unityFontStyleAndWeight = FontStyle.Bold,
backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f)
@@ -47,29 +47,29 @@ namespace SzafaKitEditor.VisualElements {
text = "...",
style = {
width = new StyleLength(new Length(64.0f, LengthUnit.Pixel)),
height = new StyleLength(new Length(64.0f, LengthUnit.Pixel)),
height = new StyleLength(new Length(64.0f, LengthUnit.Pixel))
}
};
box.Add(button);
Add(box);
}
private void ToggleDetails() {
void ToggleDetails() {
_expand = !_expand;
_details.visible = _expand;
_details.style.display = DisplayStyle.None;
}
private void CreateDetailsBox() {
void CreateDetailsBox() {
PropertyField nameField = new(_nameProperty);
PropertyField defaultValueKindField = new(_defaultValueKindProperty);
PropertyField numberField = new(_defaultValueNumberProperty);
PropertyField stringField = new(_defaultValueStringProperty);
_details = new VisualElement() {
_details = new VisualElement {
style = {
backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f),
backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f)
}
};
_details.Add(nameField);