destroyed proj
This commit is contained in:
3
Packages/SzafaKit/Editor/Inspectors.meta
Normal file
3
Packages/SzafaKit/Editor/Inspectors.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea037ce7419341d8a7961be6343fd957
|
||||
timeCreated: 1741641033
|
||||
55
Packages/SzafaKit/Editor/Inspectors/CVarAssetInspector.cs
Normal file
55
Packages/SzafaKit/Editor/Inspectors/CVarAssetInspector.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using RebootKit.Engine.Services.Console;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace RebootKitEditor.Inspectors {
|
||||
[CustomEditor(typeof(CVarAsset))]
|
||||
public class CVarAssetInspector : Editor {
|
||||
public override VisualElement CreateInspectorGUI() {
|
||||
SerializedProperty cvarProperty = serializedObject.FindProperty("_cvar");
|
||||
CVarSerializedProperties properties = CVarSerializedPropertiesFinder.Find(cvarProperty);
|
||||
|
||||
VisualElement container = new();
|
||||
|
||||
container.Add(new PropertyField(properties.Flags));
|
||||
container.Add(new PropertyField(properties.Name));
|
||||
|
||||
PropertyField descriptionField = new PropertyField(properties.Description);
|
||||
container.Add(descriptionField);
|
||||
|
||||
container.Add(new PropertyField(properties.ValueKind));
|
||||
container.Add(new PropertyField(properties.ValueNumber));
|
||||
container.Add(new PropertyField(properties.ValueString));
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
public struct CVarSerializedProperties {
|
||||
public SerializedProperty Flags;
|
||||
public SerializedProperty Name;
|
||||
public SerializedProperty Description;
|
||||
|
||||
public SerializedProperty ValueKind;
|
||||
public SerializedProperty ValueNumber;
|
||||
public SerializedProperty ValueString;
|
||||
}
|
||||
|
||||
public static class CVarSerializedPropertiesFinder {
|
||||
public static CVarSerializedProperties Find(SerializedProperty cvar) {
|
||||
CVarSerializedProperties properties = new();
|
||||
properties.Flags = cvar.FindPropertyRelative("Flags");
|
||||
properties.Name = cvar.FindPropertyRelative("Name");
|
||||
properties.Description = cvar.FindPropertyRelative("Description");
|
||||
|
||||
SerializedProperty value = cvar.FindPropertyRelative("DefaultValue");
|
||||
if (value != null) {
|
||||
properties.ValueKind = value.FindPropertyRelative("Kind");
|
||||
properties.ValueNumber = value.FindPropertyRelative("NumberValue");
|
||||
properties.ValueString = value.FindPropertyRelative("StringValue");
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43a78b204a01438ea8e99757046c213d
|
||||
timeCreated: 1741641043
|
||||
8
Packages/SzafaKit/Editor/Oracle.meta
Normal file
8
Packages/SzafaKit/Editor/Oracle.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e148f21299f99ad4fa76c50598092230
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Packages/SzafaKit/Editor/Oracle/OracleWindow.cs
Normal file
23
Packages/SzafaKit/Editor/Oracle/OracleWindow.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace SzafaKitEditor.Oracle {
|
||||
public class OracleWindow : EditorWindow {
|
||||
[SerializeField]
|
||||
private VisualTreeAsset m_VisualTreeAsset = default;
|
||||
|
||||
[MenuItem("Szafa/Oracle")]
|
||||
public static void ShowWindow() {
|
||||
OracleWindow wnd = GetWindow<OracleWindow>();
|
||||
wnd.titleContent = new GUIContent("OracleWindow");
|
||||
}
|
||||
|
||||
public void CreateGUI() {
|
||||
VisualElement root = rootVisualElement;
|
||||
|
||||
VisualElement labelFromUXML = m_VisualTreeAsset.Instantiate();
|
||||
root.Add(labelFromUXML);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Packages/SzafaKit/Editor/Oracle/OracleWindow.cs.meta
Normal file
13
Packages/SzafaKit/Editor/Oracle/OracleWindow.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2bd75a497487ee49a0a51cc223c552d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: 852055ed179f6f546b9f0ff34d97f4fb,
|
||||
type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5
Packages/SzafaKit/Editor/Oracle/OracleWindow.uss
Normal file
5
Packages/SzafaKit/Editor/Oracle/OracleWindow.uss
Normal file
@@ -0,0 +1,5 @@
|
||||
.custom-label {
|
||||
font-size: 20px;
|
||||
-unity-font-style: bold;
|
||||
color: rgb(68, 138, 255);
|
||||
}
|
||||
11
Packages/SzafaKit/Editor/Oracle/OracleWindow.uss.meta
Normal file
11
Packages/SzafaKit/Editor/Oracle/OracleWindow.uss.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56459608f8e71f140b0933d6689a0846
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
10
Packages/SzafaKit/Editor/Oracle/OracleWindow.uxml
Normal file
10
Packages/SzafaKit/Editor/Oracle/OracleWindow.uxml
Normal file
@@ -0,0 +1,10 @@
|
||||
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Packages/com.szafastudio.szafakit/Editor/Oracle/OracleWindow.uss?fileID=7433441132597879392&guid=56459608f8e71f140b0933d6689a0846&type=3#OracleWindow" />
|
||||
<engine:TabView>
|
||||
<engine:Tab label="General">
|
||||
<engine:Label text="Welcome to my szafa" style="-unity-font-style: bold; font-size: 48px;" />
|
||||
</engine:Tab>
|
||||
<engine:Tab label="Startup" />
|
||||
<engine:Tab label="Build" />
|
||||
</engine:TabView>
|
||||
</engine:UXML>
|
||||
10
Packages/SzafaKit/Editor/Oracle/OracleWindow.uxml.meta
Normal file
10
Packages/SzafaKit/Editor/Oracle/OracleWindow.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 852055ed179f6f546b9f0ff34d97f4fb
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
26
Packages/SzafaKit/Editor/Oracle/SzKEngineEditor.cs
Normal file
26
Packages/SzafaKit/Editor/Oracle/SzKEngineEditor.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using RebootKit.Engine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace SzafaKitEditor.Oracle {
|
||||
[CustomEditor(typeof(RR))]
|
||||
public class SzKEngineEditor : Editor {
|
||||
private EngineConfigAsset _engineConfigAsset;
|
||||
|
||||
public override VisualElement CreateInspectorGUI() {
|
||||
VisualElement inspector = new VisualElement();
|
||||
|
||||
_engineConfigAsset = Resources.Load<EngineConfigAsset>(RConsts.EngineConfigResourcesPath);
|
||||
if (_engineConfigAsset == null) {
|
||||
inspector.Add(new Label($"Couldn't load engine config from resources: {RConsts.EngineConfigResourcesPath}"));
|
||||
return inspector;
|
||||
}
|
||||
|
||||
inspector.Add(new Label("Config:"));
|
||||
InspectorElement.FillDefaultInspector(inspector, new SerializedObject(_engineConfigAsset), this);
|
||||
return inspector;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Packages/SzafaKit/Editor/Oracle/SzKEngineEditor.cs.meta
Normal file
3
Packages/SzafaKit/Editor/Oracle/SzKEngineEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f2d98247b7f40e88946af3956c54a5e
|
||||
timeCreated: 1741081201
|
||||
3
Packages/SzafaKit/Editor/PropertyDrawers.meta
Normal file
3
Packages/SzafaKit/Editor/PropertyDrawers.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 414970014f9e4b1fba3725979f3b233c
|
||||
timeCreated: 1740883435
|
||||
61
Packages/SzafaKit/Editor/PropertyDrawers/CVar.cs
Normal file
61
Packages/SzafaKit/Editor/PropertyDrawers/CVar.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using RebootKit.Engine.Services.Console;
|
||||
using SzafaKitEditor.VisualElements;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKitEditor.PropertyDrawers {
|
||||
[CustomPropertyDrawer(typeof(CVar))]
|
||||
public class CVarPropertyDrawer : PropertyDrawer {
|
||||
private bool _expand;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
|
||||
SerializedProperty nameProperty = property.FindPropertyRelative("Name");
|
||||
SerializedProperty descriptionProperty = property.FindPropertyRelative("Description");
|
||||
SerializedProperty defaultValueProperty = property.FindPropertyRelative("DefaultValue");
|
||||
SerializedProperty defaultValueKindProperty = defaultValueProperty.FindPropertyRelative("Kind");
|
||||
SerializedProperty defaultValueNumberProperty = defaultValueProperty.FindPropertyRelative("NumberValue");
|
||||
SerializedProperty defaultValueStringProperty = defaultValueProperty.FindPropertyRelative("StringValue");
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label(label, EditorStyles.miniBoldLabel);
|
||||
|
||||
nameProperty.stringValue = EditorGUILayout.TextField(nameProperty.stringValue);
|
||||
|
||||
bool isNumber = defaultValueKindProperty.enumValueIndex == (int) CVarValueKind.Number;
|
||||
string kindLabel = isNumber ? "N" : "S";
|
||||
|
||||
if (isNumber) {
|
||||
GUI.color = Color.cyan;
|
||||
} else {
|
||||
GUI.color = Color.green;
|
||||
}
|
||||
|
||||
if (GUILayout.Button(kindLabel, GUILayout.Width(32))) {
|
||||
defaultValueKindProperty.enumValueIndex = isNumber ? (int) CVarValueKind.String : (int) CVarValueKind.Number;
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
|
||||
if (isNumber) {
|
||||
defaultValueNumberProperty.doubleValue = EditorGUILayout.DoubleField(defaultValueNumberProperty.doubleValue);
|
||||
} else {
|
||||
defaultValueStringProperty.stringValue = EditorGUILayout.TextField(defaultValueStringProperty.stringValue);
|
||||
}
|
||||
|
||||
if (GUILayout.Button(_expand ? "H" : "S", GUILayout.MaxWidth(24))) {
|
||||
_expand = !_expand;
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (_expand) {
|
||||
EditorGUILayout.PropertyField(nameProperty, new GUIContent("Name"));
|
||||
EditorGUILayout.PropertyField(descriptionProperty, new GUIContent("Description"));
|
||||
EditorGUILayout.PropertyField(defaultValueKindProperty, new GUIContent("Value Kind"));
|
||||
EditorGUILayout.PropertyField(defaultValueNumberProperty, new GUIContent("Number"));
|
||||
EditorGUILayout.PropertyField(defaultValueStringProperty, new GUIContent("String"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Packages/SzafaKit/Editor/PropertyDrawers/CVar.cs.meta
Normal file
3
Packages/SzafaKit/Editor/PropertyDrawers/CVar.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a74897e28b94404bb62b8238d2b6d8f
|
||||
timeCreated: 1740883519
|
||||
18
Packages/SzafaKit/Editor/RebootKitEditor.asmdef
Normal file
18
Packages/SzafaKit/Editor/RebootKitEditor.asmdef
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "SzafaKitEditor",
|
||||
"rootNamespace": "RebootKitEditor",
|
||||
"references": [
|
||||
"GUID:284059c7949783646b281a1b815580e6"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Packages/SzafaKit/Editor/RebootKitEditor.asmdef.meta
Normal file
7
Packages/SzafaKit/Editor/RebootKitEditor.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95410b99fc8386148854e8c3124ed7b9
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Packages/SzafaKit/Editor/Theme.meta
Normal file
3
Packages/SzafaKit/Editor/Theme.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e389af561a242dba68aea66075684fd
|
||||
timeCreated: 1740888613
|
||||
3
Packages/SzafaKit/Editor/VisualElements.meta
Normal file
3
Packages/SzafaKit/Editor/VisualElements.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 324efa93f4e643aa8fbf93d6d96455bd
|
||||
timeCreated: 1740886974
|
||||
86
Packages/SzafaKit/Editor/VisualElements/CVarPropertyField.cs
Normal file
86
Packages/SzafaKit/Editor/VisualElements/CVarPropertyField.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
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;
|
||||
|
||||
private VisualElement _details;
|
||||
|
||||
private bool _expand;
|
||||
|
||||
public CVarPropertyField(SerializedProperty cvarProperty) {
|
||||
_cvarProperty = cvarProperty;
|
||||
_nameProperty = _cvarProperty.FindPropertyRelative("Name");
|
||||
_defaultValueProperty = _cvarProperty.FindPropertyRelative("DefaultValue");
|
||||
_defaultValueKindProperty = _defaultValueProperty.FindPropertyRelative("Kind");
|
||||
_defaultValueNumberProperty = _defaultValueProperty.FindPropertyRelative("NumberValue");
|
||||
_defaultValueStringProperty = _defaultValueProperty.FindPropertyRelative("StringValue");
|
||||
|
||||
CreateInlineField();
|
||||
CreateDetailsBox();
|
||||
}
|
||||
|
||||
private void CreateInlineField() {
|
||||
VisualElement box = new VisualElement() {
|
||||
style = {
|
||||
height = 48
|
||||
}
|
||||
};
|
||||
|
||||
Label nameLabel = new Label("NAME") {
|
||||
style = {
|
||||
unityFontStyleAndWeight = FontStyle.Bold,
|
||||
backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f)
|
||||
}
|
||||
};
|
||||
box.Add(nameLabel);
|
||||
|
||||
Button button = new(ToggleDetails) {
|
||||
text = "...",
|
||||
style = {
|
||||
width = 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() {
|
||||
_expand = !_expand;
|
||||
_details.visible = _expand;
|
||||
_details.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
private void CreateDetailsBox() {
|
||||
PropertyField nameField = new(_nameProperty);
|
||||
PropertyField defaultValueKindField = new(_defaultValueKindProperty);
|
||||
PropertyField numberField = new(_defaultValueNumberProperty);
|
||||
PropertyField stringField = new(_defaultValueStringProperty);
|
||||
|
||||
_details = new VisualElement() {
|
||||
style = {
|
||||
backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f),
|
||||
}
|
||||
};
|
||||
_details.Add(nameField);
|
||||
_details.Add(defaultValueKindField);
|
||||
_details.Add(numberField);
|
||||
_details.Add(stringField);
|
||||
|
||||
_details.visible = false;
|
||||
_details.style.display = DisplayStyle.None;
|
||||
|
||||
Add(_details);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bac230b436364350b64ba3970f41c02d
|
||||
timeCreated: 1740886987
|
||||
Reference in New Issue
Block a user