first
This commit is contained in:
3
Editor.meta
Normal file
3
Editor.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da2067e6cabc478f8fe1208899716db5
|
||||
timeCreated: 1740883415
|
||||
3
Editor/Inspectors.meta
Normal file
3
Editor/Inspectors.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea037ce7419341d8a7961be6343fd957
|
||||
timeCreated: 1741641033
|
||||
55
Editor/Inspectors/CVarAssetInspector.cs
Normal file
55
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Editor/Inspectors/CVarAssetInspector.cs.meta
Normal file
3
Editor/Inspectors/CVarAssetInspector.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43a78b204a01438ea8e99757046c213d
|
||||
timeCreated: 1741641043
|
||||
8
Editor/Oracle.meta
Normal file
8
Editor/Oracle.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e148f21299f99ad4fa76c50598092230
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Editor/Oracle/OracleWindow.cs
Normal file
23
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
Editor/Oracle/OracleWindow.cs.meta
Normal file
13
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
Editor/Oracle/OracleWindow.uss
Normal file
5
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
Editor/Oracle/OracleWindow.uss.meta
Normal file
11
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
Editor/Oracle/OracleWindow.uxml
Normal file
10
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
Editor/Oracle/OracleWindow.uxml.meta
Normal file
10
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
Editor/Oracle/SzKEngineEditor.cs
Normal file
26
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
Editor/Oracle/SzKEngineEditor.cs.meta
Normal file
3
Editor/Oracle/SzKEngineEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f2d98247b7f40e88946af3956c54a5e
|
||||
timeCreated: 1741081201
|
||||
3
Editor/PropertyDrawers.meta
Normal file
3
Editor/PropertyDrawers.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 414970014f9e4b1fba3725979f3b233c
|
||||
timeCreated: 1740883435
|
||||
61
Editor/PropertyDrawers/CVar.cs
Normal file
61
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
Editor/PropertyDrawers/CVar.cs.meta
Normal file
3
Editor/PropertyDrawers/CVar.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a74897e28b94404bb62b8238d2b6d8f
|
||||
timeCreated: 1740883519
|
||||
18
Editor/RebootKitEditor.asmdef
Normal file
18
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
Editor/RebootKitEditor.asmdef.meta
Normal file
7
Editor/RebootKitEditor.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95410b99fc8386148854e8c3124ed7b9
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Editor/Theme.meta
Normal file
3
Editor/Theme.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e389af561a242dba68aea66075684fd
|
||||
timeCreated: 1740888613
|
||||
3
Editor/VisualElements.meta
Normal file
3
Editor/VisualElements.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 324efa93f4e643aa8fbf93d6d96455bd
|
||||
timeCreated: 1740886974
|
||||
86
Editor/VisualElements/CVarPropertyField.cs
Normal file
86
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Editor/VisualElements/CVarPropertyField.cs.meta
Normal file
3
Editor/VisualElements/CVarPropertyField.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bac230b436364350b64ba3970f41c02d
|
||||
timeCreated: 1740886987
|
||||
3
Runtime.meta
Normal file
3
Runtime.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bee7c50ad9834de5a8bc3b9e155b3e60
|
||||
timeCreated: 1740878541
|
||||
3
Runtime/Engine.meta
Normal file
3
Runtime/Engine.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcfdd8485399488baf4c1fdced226f29
|
||||
timeCreated: 1741791358
|
||||
8
Runtime/Engine/Assets.meta
Normal file
8
Runtime/Engine/Assets.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f27dfdf558decd4dac7564885b0bb5d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Runtime/Engine/Assets/Fonts.meta
Normal file
8
Runtime/Engine/Assets/Fonts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1669c143c5f6ba94e970d836b20d1a55
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Runtime/Engine/Assets/Input Action Toggle Console.asset
Normal file
31
Runtime/Engine/Assets/Input Action Toggle Console.asset
Normal file
@@ -0,0 +1,31 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Input Action Toggle Console
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 1
|
||||
m_ExpectedControlType: Button
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: 8195e9d6-52a1-473e-9294-52401e109f50
|
||||
m_Path: <Keyboard>/backquote
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c5aabf95d7e5d949af83d0a4c686e95
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
258
Runtime/Engine/Assets/RealityKitControls.inputactions
Normal file
258
Runtime/Engine/Assets/RealityKitControls.inputactions
Normal file
@@ -0,0 +1,258 @@
|
||||
{
|
||||
"name": "RealityKitControls",
|
||||
"maps": [
|
||||
{
|
||||
"name": "FPP",
|
||||
"id": "b0bcb628-1df3-4a2c-b682-23bb146d08d6",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Move",
|
||||
"type": "Value",
|
||||
"id": "3c626577-80b8-479c-9f89-3de5215ff88e",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Look",
|
||||
"type": "Value",
|
||||
"id": "248f8f05-7290-4f55-aee3-cc25577f9bf8",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Jump",
|
||||
"type": "Button",
|
||||
"id": "8de4d981-bcae-4100-af76-05d381d961a6",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "PhysicsDrag",
|
||||
"type": "Button",
|
||||
"id": "bf3d1155-8050-482a-ae55-fa8d47c95e94",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Primary",
|
||||
"type": "Button",
|
||||
"id": "b00af1dd-1084-4763-8751-fdde9810b2eb",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Secondary",
|
||||
"type": "Button",
|
||||
"id": "982c57c9-6862-436b-9e85-41fcbd047312",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Use",
|
||||
"type": "Button",
|
||||
"id": "3284ff03-949a-4f12-913b-1b74b99a599e",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Menu0",
|
||||
"type": "Button",
|
||||
"id": "f861a8bc-4861-44ae-bb4f-e3bca9efae2c",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Menu1",
|
||||
"type": "Button",
|
||||
"id": "925a66f6-64a7-4bbf-9eee-a6138e6372c3",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Menu2",
|
||||
"type": "Button",
|
||||
"id": "c4f819fc-4f38-4782-b5dc-d3f59cbcafc7",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "7856b569-f241-4d9d-86ef-3f2f43c93730",
|
||||
"path": "<Mouse>/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "dd672a14-64ba-4cf6-a7b6-dbd4ac779d9f",
|
||||
"path": "<Keyboard>/space",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "095c0e94-6900-442e-8bad-a61430bfead1",
|
||||
"path": "<Keyboard>/f",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "PhysicsDrag",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d01e2a9b-4e4a-439f-892d-db8521ed0028",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Primary",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "0f8ae92e-c66e-4807-b95d-2fab59bd4e81",
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Secondary",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "WASD",
|
||||
"id": "3151504d-248f-47a2-b1c6-c62f5582beea",
|
||||
"path": "2DVector",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "7bb02b96-4858-48c7-b3f9-52975278ccfa",
|
||||
"path": "<Keyboard>/w",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "e2eda81d-db6a-4785-b6ea-adf41d23f1f4",
|
||||
"path": "<Keyboard>/s",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "784f8cb3-6b5c-4234-8fdd-d439d0a4353e",
|
||||
"path": "<Keyboard>/a",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "8c6bd391-705d-471d-a2d9-de82963f0c63",
|
||||
"path": "<Keyboard>/d",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "358c81fe-cbfe-455a-8828-a6d166426430",
|
||||
"path": "<Keyboard>/e",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Use",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "352a96ce-7752-40ca-8ee7-dcc84bbdebd2",
|
||||
"path": "<Keyboard>/i",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Menu0",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "956136b4-30ff-49d2-bd98-b42bd8944543",
|
||||
"path": "<Keyboard>/m",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Menu1",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ad048d87-67fa-434f-a0ed-cce955e68659",
|
||||
"path": "<Keyboard>/b",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Menu2",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": []
|
||||
}
|
||||
14
Runtime/Engine/Assets/RealityKitControls.inputactions.meta
Normal file
14
Runtime/Engine/Assets/RealityKitControls.inputactions.meta
Normal file
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f991e9abd9a53ee4b94b329a5ce96cb2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 0
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
8
Runtime/Engine/Assets/Services.meta
Normal file
8
Runtime/Engine/Assets/Services.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de04d80b0e009df488b07763a923887c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Runtime/Engine/Assets/Services/Console.asset
Normal file
20
Runtime/Engine/Assets/Services/Console.asset
Normal file
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 577b018c25510774aaccba06137e264d, type: 3}
|
||||
m_Name: Console
|
||||
m_EditorClassIdentifier:
|
||||
_config:
|
||||
ConsoleUIPrefab: {fileID: 1375678557884231458, guid: f83916a033d3c4b45b40ee51f7f62a5c,
|
||||
type: 3}
|
||||
ToggleAction: {fileID: 11400000, guid: 1c5aabf95d7e5d949af83d0a4c686e95, type: 2}
|
||||
_initialCVars: []
|
||||
_loadCVarsFromResources: 1
|
||||
8
Runtime/Engine/Assets/Services/Console.asset.meta
Normal file
8
Runtime/Engine/Assets/Services/Console.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5c519d68547d704da8672695e382c08
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Runtime/Engine/Assets/Services/ConsoleUI.prefab
Normal file
68
Runtime/Engine/Assets/Services/ConsoleUI.prefab
Normal file
@@ -0,0 +1,68 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3601716648929981382
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1331948412974115855}
|
||||
- component: {fileID: 1375678557884231458}
|
||||
- component: {fileID: 8622248495270372400}
|
||||
m_Layer: 5
|
||||
m_Name: ConsoleUI
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1331948412974115855
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3601716648929981382}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 9, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1375678557884231458
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3601716648929981382}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ca844a0157054677b2f129fdbf6ddc45, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_document: {fileID: 8622248495270372400}
|
||||
--- !u!114 &8622248495270372400
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3601716648929981382}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_PanelSettings: {fileID: 11400000, guid: c4c93f1ef3cc3324696c439305139cbb, type: 2}
|
||||
m_ParentUI: {fileID: 0}
|
||||
sourceAsset: {fileID: 9197481963319205126, guid: 15eee085e73feee4eba58c073b1455c5,
|
||||
type: 3}
|
||||
m_SortingOrder: 0
|
||||
m_WorldSpaceSizeMode: 1
|
||||
m_WorldSpaceWidth: 1920
|
||||
m_WorldSpaceHeight: 1080
|
||||
7
Runtime/Engine/Assets/Services/ConsoleUI.prefab.meta
Normal file
7
Runtime/Engine/Assets/Services/ConsoleUI.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f83916a033d3c4b45b40ee51f7f62a5c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
Runtime/Engine/Assets/Services/Game.asset
Normal file
14
Runtime/Engine/Assets/Services/Game.asset
Normal file
@@ -0,0 +1,14 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 51f134b6c2abcd34fa8e376b3afc757d, type: 3}
|
||||
m_Name: Game
|
||||
m_EditorClassIdentifier:
|
||||
8
Runtime/Engine/Assets/Services/Game.asset.meta
Normal file
8
Runtime/Engine/Assets/Services/Game.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75254d95c14787546b733dc1b448fb3d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Runtime/Engine/Assets/Services/Input.asset
Normal file
17
Runtime/Engine/Assets/Services/Input.asset
Normal file
@@ -0,0 +1,17 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8fcf71fe79ef1ed4cbfdefde09e708d9, type: 3}
|
||||
m_Name: Input
|
||||
m_EditorClassIdentifier:
|
||||
_config:
|
||||
InputAsset: {fileID: -944628639613478452, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
8
Runtime/Engine/Assets/Services/Input.asset.meta
Normal file
8
Runtime/Engine/Assets/Services/Input.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64a8b10c553e44f488e183dd04990761
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
Runtime/Engine/Assets/Services/World.asset
Normal file
14
Runtime/Engine/Assets/Services/World.asset
Normal file
@@ -0,0 +1,14 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3f449396a11e05e41990dbddfb992815, type: 3}
|
||||
m_Name: World
|
||||
m_EditorClassIdentifier:
|
||||
8
Runtime/Engine/Assets/Services/World.asset.meta
Normal file
8
Runtime/Engine/Assets/Services/World.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6d951b44dc41664fb301e470fac8f80
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Runtime/Engine/Assets/UI.meta
Normal file
8
Runtime/Engine/Assets/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd2c2b8df7a65af4a9d64aa75ee34f5d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Runtime/Engine/Assets/UI/Panel Settings.asset
Normal file
47
Runtime/Engine/Assets/UI/Panel Settings.asset
Normal file
@@ -0,0 +1,47 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: Panel Settings
|
||||
m_EditorClassIdentifier:
|
||||
themeUss: {fileID: -4733365628477956816, guid: 5dd55e8f9f3419144b6d6fc3fcc478d0,
|
||||
type: 3}
|
||||
m_DisableNoThemeWarning: 0
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_WorldSpaceLayer: 0
|
||||
m_ScaleMode: 0
|
||||
m_ReferenceSpritePixelsPerUnit: 1
|
||||
m_PixelsPerUnit: 100
|
||||
m_Scale: 1
|
||||
m_ReferenceDpi: 96
|
||||
m_FallbackDpi: 96
|
||||
m_ReferenceResolution: {x: 1200, y: 800}
|
||||
m_ScreenMatchMode: 0
|
||||
m_Match: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
m_BindingLogLevel: 0
|
||||
m_ClearDepthStencil: 1
|
||||
m_ClearColor: 0
|
||||
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_VertexBudget: 0
|
||||
m_DynamicAtlasSettings:
|
||||
m_MinAtlasSize: 64
|
||||
m_MaxAtlasSize: 4096
|
||||
m_MaxSubTextureSize: 64
|
||||
m_ActiveFilters: -1
|
||||
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ICUDataAsset: {fileID: 0}
|
||||
forceGammaRendering: 0
|
||||
textSettings: {fileID: 0}
|
||||
8
Runtime/Engine/Assets/UI/Panel Settings.asset.meta
Normal file
8
Runtime/Engine/Assets/UI/Panel Settings.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4c93f1ef3cc3324696c439305139cbb
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
99
Runtime/Engine/Assets/UI/tss_rebootkit.tss
Normal file
99
Runtime/Engine/Assets/UI/tss_rebootkit.tss
Normal file
@@ -0,0 +1,99 @@
|
||||
@import url("/Assets/UI Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss");
|
||||
|
||||
|
||||
|
||||
.rr-base {
|
||||
color: #dedede;
|
||||
}
|
||||
|
||||
.rr-label {
|
||||
}
|
||||
|
||||
.rr-button {
|
||||
background-color: #191919;
|
||||
border-color: #373737;
|
||||
border-radius: 3px;
|
||||
border-width: 1px;
|
||||
|
||||
-unity-font-style: bold;
|
||||
-unity-text-align: middle-center;
|
||||
|
||||
font-size: 13px;
|
||||
|
||||
height: 32px;
|
||||
|
||||
padding: 4px;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
.rr-button:hover {
|
||||
background-color: #202020;
|
||||
}
|
||||
|
||||
.rr-button:focus {
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
.rr-text-field {
|
||||
background-color: #191919;
|
||||
border-color: #373737;
|
||||
border-radius: 3px;
|
||||
border-width: 1px;
|
||||
|
||||
font-size: 13px;
|
||||
|
||||
-unity-text-align: middle-left;
|
||||
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
|
||||
padding: 4px;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
.rr-scroll-view {
|
||||
background-color: #232323;
|
||||
border-color: #373737;
|
||||
border-radius: 3px;
|
||||
border-width: 1px;
|
||||
|
||||
padding: 4px;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
.window-bg {
|
||||
border-width: 2px;
|
||||
border-color: #373737;
|
||||
background-color: #212121;
|
||||
}
|
||||
|
||||
.window-content {
|
||||
border-color: #373737;
|
||||
border-width: 1px;
|
||||
background-color: #272727;
|
||||
margin: 12px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
#console-window {
|
||||
max-height: 60%;
|
||||
}
|
||||
|
||||
#console-scrollview {
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
#console-bottomrow {
|
||||
flex-direction: row;
|
||||
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
|
||||
height: auto;
|
||||
min-height: 32px;
|
||||
max-height: 32px;
|
||||
}
|
||||
|
||||
#console-btn-submit {
|
||||
width: 72px;
|
||||
}
|
||||
11
Runtime/Engine/Assets/UI/tss_rebootkit.tss.meta
Normal file
11
Runtime/Engine/Assets/UI/tss_rebootkit.tss.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5dd55e8f9f3419144b6d6fc3fcc478d0
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12388, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
15
Runtime/Engine/Assets/UI/ui_console.uxml
Normal file
15
Runtime/Engine/Assets/UI/ui_console.uxml
Normal file
@@ -0,0 +1,15 @@
|
||||
<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">
|
||||
<engine:VisualElement style="flex-grow: 1; background-color: rgba(176, 137, 137, 0.69); max-height: 100%; max-width: none; height: 100%;">
|
||||
<engine:VisualElement name="console-window" enabled="true" class="window-bg" style="flex-grow: 1; text-shadow: 0 0 0 rgba(255, 255, 255, 0); position: relative; width: 100%; height: 100%; max-height: 100%;">
|
||||
<engine:VisualElement name="VisualElement" enabled="true" class="window-content rr-base" style="flex-grow: 1; align-content: stretch; align-self: auto; justify-content: flex-start; align-items: stretch;">
|
||||
<engine:ScrollView name="console-scrollview" class="rr-scroll-view" style="max-height: none; height: 100%;">
|
||||
<engine:Label text="Label" />
|
||||
</engine:ScrollView>
|
||||
<engine:VisualElement name="console-bottomrow" style="flex-grow: 1; flex-basis: auto; flex-direction: row; align-items: center; justify-content: flex-end; align-self: stretch; align-content: stretch; flex-wrap: nowrap;">
|
||||
<engine:TextField name="console-textfield" class="rr-text-field" style="width: 92%;" />
|
||||
<engine:Button text="Submit" name="console-btn-submit" class="rr-button" />
|
||||
</engine:VisualElement>
|
||||
</engine:VisualElement>
|
||||
</engine:VisualElement>
|
||||
</engine:VisualElement>
|
||||
</engine:UXML>
|
||||
10
Runtime/Engine/Assets/UI/ui_console.uxml.meta
Normal file
10
Runtime/Engine/Assets/UI/ui_console.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15eee085e73feee4eba58c073b1455c5
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
3
Runtime/Engine/Code.meta
Normal file
3
Runtime/Engine/Code.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66b39ad7c1e045199564ccc5af4ffd14
|
||||
timeCreated: 1741791481
|
||||
22
Runtime/Engine/Code/EngineConfigAsset.cs
Normal file
22
Runtime/Engine/Code/EngineConfigAsset.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using RebootKit.Engine.Foundation;
|
||||
using RebootKit.Engine.Services.Console;
|
||||
using RebootKit.Engine.Services.Game;
|
||||
using RebootKit.Engine.Services.Input;
|
||||
using RebootKit.Engine.Services.Simulation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine {
|
||||
[CreateAssetMenu(menuName = RConsts.AssetMenu + RConsts.EngineConfigAssetName, fileName = RConsts.EngineConfigAssetName)]
|
||||
public class EngineConfigAsset : ScriptableObject {
|
||||
[Header("<color=#ff0000>REQUIRED</color>: core assets")]
|
||||
public ServiceAsset<ConsoleService> ConsoleService;
|
||||
public ServiceAsset<InputService> InputService;
|
||||
public ServiceAsset<WorldService> WorldService;
|
||||
public ServiceAsset<GameService> GameService;
|
||||
|
||||
[Space]
|
||||
public ServiceAsset[] Services;
|
||||
|
||||
public GameModeAsset StartingGameMode;
|
||||
}
|
||||
}
|
||||
2
Runtime/Engine/Code/EngineConfigAsset.cs.meta
Normal file
2
Runtime/Engine/Code/EngineConfigAsset.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae5fb4e9fdf89f64b8d2e2d147cb0231
|
||||
3
Runtime/Engine/Code/Foundation.meta
Normal file
3
Runtime/Engine/Code/Foundation.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68a77eab007d4aa39f16e9cc3485fab9
|
||||
timeCreated: 1740755614
|
||||
13
Runtime/Engine/Code/Foundation/ControllerAsset.cs
Normal file
13
Runtime/Engine/Code/Foundation/ControllerAsset.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Foundation
|
||||
{
|
||||
public abstract class ControllerAsset<TController> : ScriptableObject where TController : IController
|
||||
{
|
||||
public abstract TController Create();
|
||||
}
|
||||
|
||||
public abstract class ControllerAsset : ControllerAsset<IController>
|
||||
{
|
||||
}
|
||||
}
|
||||
2
Runtime/Engine/Code/Foundation/ControllerAsset.cs.meta
Normal file
2
Runtime/Engine/Code/Foundation/ControllerAsset.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44e7c0513ef44634cbe6c6814772bfe1
|
||||
51
Runtime/Engine/Code/Foundation/EntryPoint.cs
Normal file
51
Runtime/Engine/Code/Foundation/EntryPoint.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace RebootKit.Engine.Foundation {
|
||||
public static class EntryPoint {
|
||||
private static readonly Logger _logger = new(nameof(EntryPoint));
|
||||
|
||||
private static CancellationTokenSource _cancellationTokenSource;
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
|
||||
public static void Start() {
|
||||
if (_cancellationTokenSource != null) {
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
RR.Shared = null;
|
||||
ServicesLocator.Shared.UnRegisterAll();
|
||||
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
SceneManager.LoadScene(0, LoadSceneMode.Single);
|
||||
|
||||
RunAsync(_cancellationTokenSource.Token).Forget();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
static void OnPlayerModeState(UnityEditor.PlayModeStateChange state) {
|
||||
if (state == UnityEditor.PlayModeStateChange.ExitingPlayMode) {
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
UnityEditor.EditorApplication.playModeStateChanged -= OnPlayerModeState;
|
||||
UnityEditor.EditorApplication.playModeStateChanged += OnPlayerModeState;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static async UniTask RunAsync(CancellationToken cancellationToken) {
|
||||
using RR instance = new RR();
|
||||
|
||||
RR.Shared = instance;
|
||||
|
||||
_logger.Debug("running");
|
||||
|
||||
await instance.Init(cancellationToken);
|
||||
await instance.Run(cancellationToken);
|
||||
|
||||
_logger.Debug("stopped");
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Foundation/EntryPoint.cs.meta
Normal file
3
Runtime/Engine/Code/Foundation/EntryPoint.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83bc8a98e30147babef3641863699cd9
|
||||
timeCreated: 1740670775
|
||||
93
Runtime/Engine/Code/Foundation/IController.cs
Normal file
93
Runtime/Engine/Code/Foundation/IController.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace RebootKit.Engine.Foundation {
|
||||
public interface IController : IDisposable {
|
||||
UniTask OnStart(CancellationToken cancellationToken);
|
||||
void OnStop();
|
||||
void OnTick();
|
||||
}
|
||||
|
||||
public class ControllersManager : IDisposable {
|
||||
private readonly List<IController> _controllers = new();
|
||||
private bool _isRunning;
|
||||
|
||||
private readonly CancellationToken _cancellationToken;
|
||||
|
||||
public ControllersManager(CancellationToken cancellationToken) {
|
||||
_cancellationToken = cancellationToken;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
foreach (IController controller in _controllers) {
|
||||
controller.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(IController controller) {
|
||||
_controllers.Add(controller);
|
||||
|
||||
if (_isRunning) {
|
||||
controller.OnStart(_cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(IController controller) {
|
||||
if (_isRunning) {
|
||||
controller.OnStop();
|
||||
}
|
||||
|
||||
_controllers.Remove(controller);
|
||||
}
|
||||
|
||||
public async UniTask Start(CancellationToken cancellationToken) {
|
||||
if (_isRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (IController controller in _controllers) {
|
||||
await controller.OnStart(cancellationToken);
|
||||
}
|
||||
|
||||
_isRunning = true;
|
||||
}
|
||||
|
||||
public void Stop() {
|
||||
if (!_isRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (IController controller in _controllers) {
|
||||
controller.OnStop();
|
||||
}
|
||||
|
||||
_isRunning = false;
|
||||
}
|
||||
|
||||
public void Tick() {
|
||||
foreach (IController controller in _controllers) {
|
||||
controller.OnTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ControllersManagerUtils {
|
||||
public static void Add(this ControllersManager manager, ControllerAsset controllerAsset) {
|
||||
manager.Add(controllerAsset.Create());
|
||||
}
|
||||
|
||||
public static void Add(this ControllersManager manager, List<ControllerAsset> controllerAsset) {
|
||||
foreach (ControllerAsset asset in controllerAsset) {
|
||||
manager.Add(asset.Create());
|
||||
}
|
||||
}
|
||||
|
||||
public static void Add(this ControllersManager manager, ControllerAsset[] controllerAsset) {
|
||||
foreach (ControllerAsset asset in controllerAsset) {
|
||||
manager.Add(asset.Create());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Foundation/IController.cs.meta
Normal file
3
Runtime/Engine/Code/Foundation/IController.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a78e7e501a24257a006967827a937ab
|
||||
timeCreated: 1740757906
|
||||
85
Runtime/Engine/Code/Foundation/Logger.cs
Normal file
85
Runtime/Engine/Code/Foundation/Logger.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace RebootKit.Engine.Foundation {
|
||||
public enum LogLevel {
|
||||
Info,
|
||||
Debug,
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
|
||||
public readonly struct Logger {
|
||||
private readonly string _name;
|
||||
|
||||
public Logger(string name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public void Log(LogLevel level, string message) {
|
||||
switch (level) {
|
||||
case LogLevel.Info:
|
||||
UnityEngine.Debug.Log(FormatMessage(level, _name, message, true));
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
UnityEngine.Debug.Log(FormatMessage(level, _name, message, true));
|
||||
break;
|
||||
case LogLevel.Warning:
|
||||
UnityEngine.Debug.LogWarning(FormatMessage(level, _name, message, true));
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
UnityEngine.Debug.LogError(FormatMessage(level, _name, message, true));
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(level), level, null);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional(RConsts.BuildFlagDebug)]
|
||||
public void Info(string message) {
|
||||
Log(LogLevel.Info, message);
|
||||
}
|
||||
|
||||
[Conditional(RConsts.BuildFlagDebug)]
|
||||
public void Debug(string message) {
|
||||
Log(LogLevel.Debug, message);
|
||||
}
|
||||
|
||||
[Conditional(RConsts.BuildFlagDebug)]
|
||||
public void Warning(string message) {
|
||||
Log(LogLevel.Warning, message);
|
||||
}
|
||||
|
||||
public void Error(string message) {
|
||||
Log(LogLevel.Error, message);
|
||||
}
|
||||
|
||||
private static string FormatMessage(LogLevel level, string name, string message, bool richText) {
|
||||
if (!richText) {
|
||||
string prefix = level switch {
|
||||
LogLevel.Info => "",
|
||||
LogLevel.Debug => "[DEBUG]",
|
||||
LogLevel.Warning => "[WARNING]",
|
||||
LogLevel.Error => "[ERROR]",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
|
||||
};
|
||||
return $"{prefix}[{name}] {message}";
|
||||
}
|
||||
|
||||
switch (level) {
|
||||
case LogLevel.Info:
|
||||
return $"[<b>{name}</b>] {message}";
|
||||
case LogLevel.Debug:
|
||||
return $"[D][<b>{name}</b>] <color=#ffffff>{message}</color>";
|
||||
case LogLevel.Warning:
|
||||
return $"[W][<b>{name}</b>] <color=#ffffff>{message}</color>";
|
||||
case LogLevel.Error:
|
||||
return $"[<b><color=#ff0000>ERROR</color></b>][<b>{name}</b>] <color=#ffffff>{message}</color>";
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(level), level, null);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Foundation/Logger.cs.meta
Normal file
3
Runtime/Engine/Code/Foundation/Logger.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8a58e1bf60c4db6a35171b65538fcea
|
||||
timeCreated: 1741027327
|
||||
94
Runtime/Engine/Code/Foundation/ServicesLocator.cs
Normal file
94
Runtime/Engine/Code/Foundation/ServicesLocator.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Foundation {
|
||||
public interface IService : IDisposable {
|
||||
UniTask OnInit(CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public abstract class ServiceMonoBehaviour : MonoBehaviour, IService {
|
||||
public abstract UniTask OnInit(CancellationToken cancellationToken);
|
||||
public abstract void Dispose();
|
||||
}
|
||||
|
||||
public abstract class ServiceAsset<T> : ScriptableObject where T : IService {
|
||||
public abstract T Create();
|
||||
}
|
||||
|
||||
public abstract class ServiceAsset : ServiceAsset<IService> {
|
||||
}
|
||||
|
||||
public class ServicesLocator {
|
||||
private static readonly Logger _logger = new(nameof(ServicesLocator));
|
||||
|
||||
private static ServicesLocator _shared;
|
||||
|
||||
public static ServicesLocator Shared {
|
||||
get {
|
||||
if (_shared == null) {
|
||||
_shared = new ServicesLocator();
|
||||
}
|
||||
|
||||
return _shared;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Dictionary<Type, IService> _servicesMap = new();
|
||||
|
||||
public void Register(IService service, Type type) {
|
||||
if (!_servicesMap.TryAdd(type, service)) {
|
||||
_logger.Error($"There is already game service of type `{type}`");
|
||||
return;
|
||||
}
|
||||
|
||||
service.OnInit(default);
|
||||
|
||||
_logger.Info($"Registered service of type {type.Name}");
|
||||
}
|
||||
|
||||
public void Register<T>(T service) where T : IService {
|
||||
Register(service, service.GetType());
|
||||
}
|
||||
|
||||
public async UniTask RegisterAsync<T>(T service, CancellationToken cancellationToken = default) where T : IService {
|
||||
if (!_servicesMap.TryAdd(typeof(T), service)) {
|
||||
_logger.Error($"There is already game service of type `{typeof(T).Name}`");
|
||||
return;
|
||||
}
|
||||
|
||||
await service.OnInit(cancellationToken);
|
||||
_logger.Info($"Registered service of type {typeof(T).Name}");
|
||||
}
|
||||
|
||||
public void UnRegister(Type type) {
|
||||
if (_servicesMap.TryGetValue(type, out IService service)) {
|
||||
service.Dispose();
|
||||
_servicesMap.Remove(type);
|
||||
_logger.Info($"Unregistered service of type {type.Name}");
|
||||
}
|
||||
}
|
||||
|
||||
public void UnRegisterAll() {
|
||||
foreach (IService service in _servicesMap.Values) {
|
||||
service.Dispose();
|
||||
}
|
||||
_servicesMap.Clear();
|
||||
}
|
||||
|
||||
public IService Get(Type type) {
|
||||
if (_servicesMap.TryGetValue(type, out IService service)) {
|
||||
return service;
|
||||
}
|
||||
|
||||
Debug.LogAssertionFormat($"Couldn't find service of type `{type}`");
|
||||
return null;
|
||||
}
|
||||
|
||||
public T Get<T>() where T : IService {
|
||||
return (T) Get(typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Foundation/ServicesLocator.cs.meta
Normal file
3
Runtime/Engine/Code/Foundation/ServicesLocator.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db549c154c4b413587c25dbfbadb7f49
|
||||
timeCreated: 1741119753
|
||||
8
Runtime/Engine/Code/Graphics.meta
Normal file
8
Runtime/Engine/Code/Graphics.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bad8b2bb3b0c0447bd252702e9503a3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Runtime/Engine/Code/Graphics/CRT.meta
Normal file
8
Runtime/Engine/Code/Graphics/CRT.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 162830275afaa9a40b54532a4a597593
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
136
Runtime/Engine/Code/Graphics/CRT/M_CRT_Default.mat
Normal file
136
Runtime/Engine/Code/Graphics/CRT/M_CRT_Default.mat
Normal file
@@ -0,0 +1,136 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: M_CRT_Default
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 4d0e8896444a6f84690b4862dc0f7452,
|
||||
type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BlurOffset: 0.00179
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _NumberOfScanLines: 200
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _ScanLinesSpeed: -0.001
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 16.948381, g: 16.948381, b: 16.948381, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &7239824129281003057
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 7
|
||||
8
Runtime/Engine/Code/Graphics/CRT/M_CRT_Default.mat.meta
Normal file
8
Runtime/Engine/Code/Graphics/CRT/M_CRT_Default.mat.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 212bec7ca33591a489a68c541995db87
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5127
Runtime/Engine/Code/Graphics/CRT/SG_CRT.shadergraph
Normal file
5127
Runtime/Engine/Code/Graphics/CRT/SG_CRT.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
10
Runtime/Engine/Code/Graphics/CRT/SG_CRT.shadergraph.meta
Normal file
10
Runtime/Engine/Code/Graphics/CRT/SG_CRT.shadergraph.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d0e8896444a6f84690b4862dc0f7452
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
18
Runtime/Engine/Code/Graphics/MainCameraService.cs
Normal file
18
Runtime/Engine/Code/Graphics/MainCameraService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RebootKit.Engine.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Graphics {
|
||||
public class MainCameraService : ServiceMonoBehaviour {
|
||||
[field: SerializeField]
|
||||
public Camera Camera { get; private set; }
|
||||
|
||||
public override async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Graphics/MainCameraService.cs.meta
Normal file
3
Runtime/Engine/Code/Graphics/MainCameraService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 351d6b8577644d599058e76fa02a11c0
|
||||
timeCreated: 1740769963
|
||||
8
Runtime/Engine/Code/Graphics/Pixelize.meta
Normal file
8
Runtime/Engine/Code/Graphics/Pixelize.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48eb2fb8f4d8a2445a73abbb9623838f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Runtime/Engine/Code/Graphics/Pixelize/Pixelize.shader
Normal file
68
Runtime/Engine/Code/Graphics/Pixelize/Pixelize.shader
Normal file
@@ -0,0 +1,68 @@
|
||||
Shader "Hidden/Szafa/Pixelize"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white"
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
TEXTURE2D(_MainTex);
|
||||
float4 _MainTex_TexelSize;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
SamplerState sampler_point_clamp;
|
||||
|
||||
uniform float2 _BlockCount;
|
||||
uniform float2 _BlockSize;
|
||||
uniform float2 _HalfBlockSize;
|
||||
|
||||
Varyings vert(Attributes IN)
|
||||
{
|
||||
Varyings OUT;
|
||||
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _MainTex);
|
||||
return OUT;
|
||||
}
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Pixelation"
|
||||
|
||||
HLSLPROGRAM
|
||||
half4 frag(Varyings IN) : SV_TARGET
|
||||
{
|
||||
float2 blockPos = floor(IN.uv * _BlockCount);
|
||||
float2 blockCenter = blockPos * _BlockSize + _HalfBlockSize;
|
||||
|
||||
float4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_point_clamp, blockCenter);
|
||||
return tex;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 782df0a61dfc4acf8fe4ec5a7204f205
|
||||
timeCreated: 1740752799
|
||||
37
Runtime/Engine/Code/Graphics/Pixelize/PixelizeFeature.cs
Normal file
37
Runtime/Engine/Code/Graphics/Pixelize/PixelizeFeature.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace RebootKit.Engine.Graphics.Pixelize
|
||||
{
|
||||
public class PixelizeFeature : ScriptableRendererFeature
|
||||
{
|
||||
[Serializable]
|
||||
public class PassSettings
|
||||
{
|
||||
public RenderPassEvent RenderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing;
|
||||
public int FrameHeight = 240;
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private PassSettings _settings;
|
||||
|
||||
private PixelizePass _pass;
|
||||
|
||||
public override void Create()
|
||||
{
|
||||
_pass = new PixelizePass(_settings);
|
||||
}
|
||||
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (renderingData.cameraData.isSceneViewCamera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
renderer.EnqueuePass(_pass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dde9574f26949228f5a5ac71254a478
|
||||
timeCreated: 1740752516
|
||||
69
Runtime/Engine/Code/Graphics/Pixelize/PixelizePass.cs
Normal file
69
Runtime/Engine/Code/Graphics/Pixelize/PixelizePass.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace RebootKit.Engine.Graphics.Pixelize
|
||||
{
|
||||
public class PixelizePass : ScriptableRenderPass
|
||||
{
|
||||
private static int PixelBufferID = Shader.PropertyToID("_PixelBuffer");
|
||||
|
||||
private PixelizeFeature.PassSettings _settings;
|
||||
|
||||
private RenderTargetIdentifier _colorBuffer;
|
||||
private RenderTargetIdentifier _pixelBuffer;
|
||||
|
||||
private Material _material;
|
||||
private int _frameWidth;
|
||||
private int _frameHeight;
|
||||
|
||||
public PixelizePass(PixelizeFeature.PassSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
renderPassEvent = settings.RenderPassEvent;
|
||||
_material = CoreUtils.CreateEngineMaterial("Hidden/Szafa/Pixelize");
|
||||
}
|
||||
|
||||
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
|
||||
{
|
||||
_colorBuffer = renderingData.cameraData.renderer.cameraColorTargetHandle;
|
||||
RenderTextureDescriptor descriptor = renderingData.cameraData.cameraTargetDescriptor;
|
||||
|
||||
_frameHeight = _settings.FrameHeight;
|
||||
_frameWidth = (int) (_frameHeight * renderingData.cameraData.camera.aspect + 0.5f);
|
||||
|
||||
_material.SetVector("_BlockCount", new Vector2(_frameWidth, _frameHeight));
|
||||
_material.SetVector("_BlockSize", new Vector2(1.0f / _frameWidth, 1.0f / _frameHeight));
|
||||
_material.SetVector("_HalfBlockSize", new Vector2(0.5f / _frameWidth, 0.5f / _frameHeight));
|
||||
|
||||
descriptor.height = _frameWidth;
|
||||
descriptor.width = _frameWidth;
|
||||
|
||||
cmd.GetTemporaryRT(PixelBufferID, descriptor, FilterMode.Point);
|
||||
_pixelBuffer = new RenderTargetIdentifier(PixelBufferID);
|
||||
}
|
||||
|
||||
public override void OnCameraCleanup(CommandBuffer cmd)
|
||||
{
|
||||
if (cmd == null)
|
||||
{
|
||||
throw new System.ArgumentNullException(nameof(cmd));
|
||||
}
|
||||
|
||||
cmd.ReleaseTemporaryRT(PixelBufferID);
|
||||
}
|
||||
|
||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
||||
{
|
||||
CommandBuffer cmd = CommandBufferPool.Get();
|
||||
using (new ProfilingScope(cmd, new ProfilingSampler("Pixelize Pass")))
|
||||
{
|
||||
// Blit(cmd, _colorBuffer, _pixelBuffer, _material);
|
||||
// Blit(cmd, _pixelBuffer, _colorBuffer);
|
||||
}
|
||||
|
||||
context.ExecuteCommandBuffer(cmd);
|
||||
CommandBufferPool.Release(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5eb50486f41a47bb96c549c3cba1865d
|
||||
timeCreated: 1740752552
|
||||
18
Runtime/Engine/Code/RConsts.cs
Normal file
18
Runtime/Engine/Code/RConsts.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace RebootKit.Engine
|
||||
{
|
||||
public static class RConsts {
|
||||
public const int MainSceneBuildIndex = 0;
|
||||
|
||||
public const string EngineConfigAssetName = "RealityRebootKit";
|
||||
public const string EngineConfigResourcesPath = "TheGame/" + EngineConfigAssetName;
|
||||
|
||||
public const string AssetMenu = "Reboot Reality/";
|
||||
public const string FPPKitAssetMenu = AssetMenu + "FPP Kit/";
|
||||
public const string ServiceAssetMenu = AssetMenu + "Services/";
|
||||
public const string UnitsAssetMenu = AssetMenu + "Units/";
|
||||
public const string GameModeAssetMenu = AssetMenu + "GameModes/";
|
||||
public const string WorldAssetMenu = AssetMenu + "World/";
|
||||
|
||||
public const string BuildFlagDebug = "RR_DEBUG";
|
||||
}
|
||||
}
|
||||
2
Runtime/Engine/Code/RConsts.cs.meta
Normal file
2
Runtime/Engine/Code/RConsts.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 273e7245d4cf02b4295f0f1e158a9c54
|
||||
154
Runtime/Engine/Code/RR.cs
Normal file
154
Runtime/Engine/Code/RR.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RebootKit.Engine.Foundation;
|
||||
using RebootKit.Engine.Services.Console;
|
||||
using RebootKit.Engine.Services.Game;
|
||||
using RebootKit.Engine.Services.Input;
|
||||
using RebootKit.Engine.Services.Simulation;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Logger = RebootKit.Engine.Foundation.Logger;
|
||||
|
||||
namespace RebootKit.Engine {
|
||||
|
||||
public abstract class RAsset : ScriptableObject {
|
||||
|
||||
}
|
||||
|
||||
public class RR : IDisposable {
|
||||
public static RR Shared { get; set; }
|
||||
|
||||
private static readonly Logger _logger = new Logger("RR");
|
||||
|
||||
private EngineConfigAsset _engineConfigAsset;
|
||||
|
||||
private ConsoleService _consoleService;
|
||||
private InputService _inputService;
|
||||
private WorldService _worldService;
|
||||
private GameService _gameService;
|
||||
|
||||
public void Dispose() {
|
||||
}
|
||||
|
||||
public async UniTask Init(CancellationToken cancellationToken) {
|
||||
_logger.Info("Waking up");
|
||||
|
||||
_logger.Info("Loading engine config");
|
||||
_engineConfigAsset = Resources.Load<EngineConfigAsset>(RConsts.EngineConfigResourcesPath);
|
||||
if (_engineConfigAsset == null) {
|
||||
_logger.Error($"Couldn't load engine config from resources: {RConsts.EngineConfigResourcesPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.Info("Loading engine found");
|
||||
|
||||
await CreateCoreServices(cancellationToken);
|
||||
await RegisterServiceAssetsFromConfig(cancellationToken);
|
||||
await RegisterServicesFromMainSceneAsync(cancellationToken);
|
||||
}
|
||||
|
||||
public async UniTask Run(CancellationToken cancellationToken) {
|
||||
_logger.Info($"Starting initial game mode");
|
||||
await _gameService.Start(_engineConfigAsset.StartingGameMode, cancellationToken);
|
||||
}
|
||||
|
||||
private async UniTask<TService> CreateServiceAsync<TService>(ServiceAsset<TService> asset, CancellationToken cancellationToken = default) where TService : IService {
|
||||
TService service = asset.Create();
|
||||
await ServicesLocator.Shared.RegisterAsync(service, cancellationToken);
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
private async UniTask CreateCoreServices(CancellationToken cancellationToken) {
|
||||
_logger.Debug("Registering core services");
|
||||
|
||||
_consoleService = await CreateServiceAsync(_engineConfigAsset.ConsoleService, cancellationToken);
|
||||
_inputService = await CreateServiceAsync(_engineConfigAsset.InputService, cancellationToken);
|
||||
_worldService = await CreateServiceAsync(_engineConfigAsset.WorldService, cancellationToken);
|
||||
_gameService = await CreateServiceAsync(_engineConfigAsset.GameService, cancellationToken);
|
||||
}
|
||||
|
||||
private async UniTask RegisterServiceAssetsFromConfig(CancellationToken cancellationToken = default) {
|
||||
if (_engineConfigAsset.Services.Length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.Info($"Registering {_engineConfigAsset.Services.Length} services");
|
||||
foreach (ServiceAsset service in _engineConfigAsset.Services) {
|
||||
await ServicesLocator.Shared.RegisterAsync(service.Create(), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
private async UniTask RegisterServicesFromMainSceneAsync(CancellationToken cancellationToken = default) {
|
||||
_logger.Info("Looking for services in mainscene");
|
||||
int foundCount = 0;
|
||||
|
||||
GameObject[] gameObjects = SceneManager.GetSceneByBuildIndex(RConsts.MainSceneBuildIndex).GetRootGameObjects();
|
||||
|
||||
if (gameObjects.Length == 0) {
|
||||
_logger.Info("No services found in main scene");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (GameObject root in gameObjects) {
|
||||
ServiceMonoBehaviour[] services = root.GetComponentsInChildren<ServiceMonoBehaviour>();
|
||||
|
||||
foreach (ServiceMonoBehaviour service in services) {
|
||||
await ServicesLocator.Shared.RegisterAsync(service, cancellationToken);
|
||||
foundCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
_logger.Info($"Found and registered {foundCount} services from active scene");
|
||||
}
|
||||
|
||||
//
|
||||
// API
|
||||
//
|
||||
|
||||
/// Services
|
||||
public static T Service<T>() where T : IService {
|
||||
return ServicesLocator.Shared.Get<T>();
|
||||
}
|
||||
|
||||
public static ConsoleService Console() => Shared._consoleService;
|
||||
public static InputService Input() => Shared._inputService;
|
||||
public static WorldService World() => Shared._worldService;
|
||||
public static GameService Game() => Shared._gameService;
|
||||
|
||||
/// CVars
|
||||
public static CVar CVarIndex(string name, int defaultValue = -1) {
|
||||
CVar cvar = Console().GetCVar(name);
|
||||
if (cvar != null) {
|
||||
return cvar;
|
||||
}
|
||||
|
||||
cvar = new CVar(name, defaultValue);
|
||||
Console().Replace(cvar);
|
||||
return cvar;
|
||||
}
|
||||
|
||||
public static CVar CVarNumber(string name, double defaultValue = 0) {
|
||||
CVar cvar = Console().GetCVar(name);
|
||||
if (cvar != null) {
|
||||
return cvar;
|
||||
}
|
||||
|
||||
cvar = new CVar(name, defaultValue);
|
||||
Console().Replace(cvar);
|
||||
return cvar;
|
||||
}
|
||||
|
||||
public static CVar CVarString(string name, string defaultValue = "") {
|
||||
CVar cvar = Console().GetCVar(name);
|
||||
if (cvar != null) {
|
||||
return cvar;
|
||||
}
|
||||
|
||||
cvar = new CVar(name, defaultValue);
|
||||
Console().Replace(cvar);
|
||||
return cvar;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Runtime/Engine/Code/RR.cs.meta
Normal file
2
Runtime/Engine/Code/RR.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56749d0dd0042ce41b20d46fc486476c
|
||||
3
Runtime/Engine/Code/Services.meta
Normal file
3
Runtime/Engine/Code/Services.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac31ad3431a84354ab7c73a84039be3f
|
||||
timeCreated: 1741791385
|
||||
3
Runtime/Engine/Code/Services/Console.meta
Normal file
3
Runtime/Engine/Code/Services/Console.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d059b7f04b524c6fbd39c7b14af4a299
|
||||
timeCreated: 1740779746
|
||||
169
Runtime/Engine/Code/Services/Console/CVar.cs
Normal file
169
Runtime/Engine/Code/Services/Console/CVar.cs
Normal file
@@ -0,0 +1,169 @@
|
||||
using System;
|
||||
|
||||
namespace RebootKit.Engine.Services.Console {
|
||||
public enum CVarValueKind {
|
||||
Number, String
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct CVarValue {
|
||||
public CVarValueKind Kind;
|
||||
|
||||
public double NumberValue;
|
||||
public string StringValue;
|
||||
|
||||
public CVarValue(int value) {
|
||||
Kind = CVarValueKind.Number;
|
||||
NumberValue = value;
|
||||
StringValue = null;
|
||||
}
|
||||
|
||||
public CVarValue(float value) {
|
||||
Kind = CVarValueKind.Number;
|
||||
NumberValue = value;
|
||||
StringValue = null;
|
||||
}
|
||||
|
||||
public CVarValue(double value) {
|
||||
Kind = CVarValueKind.Number;
|
||||
NumberValue = value;
|
||||
StringValue = null;
|
||||
}
|
||||
|
||||
public CVarValue(string value) {
|
||||
Kind = CVarValueKind.String;
|
||||
NumberValue = 0;
|
||||
StringValue = value;
|
||||
}
|
||||
|
||||
public void CopyFrom(CVarValue value) {
|
||||
Kind = value.Kind;
|
||||
NumberValue = value.NumberValue;
|
||||
StringValue = value.StringValue;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return Kind switch {
|
||||
CVarValueKind.Number => NumberValue.ToString(),
|
||||
CVarValueKind.String => $"\"{StringValue}\"",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum CVarFlags {
|
||||
None, Persistent, ReadOnly
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class CVar {
|
||||
public CVarFlags Flags;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public CVarValue DefaultValue;
|
||||
public CVarValue Value { get; private set; }
|
||||
|
||||
public int IndexValue => (int) Value.NumberValue;
|
||||
public float FloatValue => (float) Value.NumberValue;
|
||||
public double NumberValue => Value.NumberValue;
|
||||
public string StringValue => Value.StringValue;
|
||||
|
||||
public event Action OnChanged = delegate { };
|
||||
|
||||
public CVar(CVar other) {
|
||||
Flags = other.Flags;
|
||||
Name = other.Name;
|
||||
Description = other.Description;
|
||||
DefaultValue = other.DefaultValue;
|
||||
Value = other.Value;
|
||||
}
|
||||
|
||||
public CVar(string name, CVarValue value, string description = "") {
|
||||
Name = name;
|
||||
Description = description;
|
||||
DefaultValue = value;
|
||||
Value = DefaultValue;
|
||||
}
|
||||
|
||||
public CVar(string name, int value, string description = "") {
|
||||
Name = name;
|
||||
Description = description;
|
||||
DefaultValue = new CVarValue(value);
|
||||
Value = DefaultValue;
|
||||
}
|
||||
|
||||
public CVar(string name, float value, string description = "") {
|
||||
Name = name;
|
||||
Description = description;
|
||||
DefaultValue = new CVarValue(value);
|
||||
Value = DefaultValue;
|
||||
}
|
||||
|
||||
public CVar(string name, double value, string description = "") {
|
||||
Name = name;
|
||||
Description = description;
|
||||
DefaultValue = new CVarValue(value);
|
||||
Value = DefaultValue;
|
||||
}
|
||||
|
||||
public CVar(string name, string value, string description = "") {
|
||||
Name = name;
|
||||
Description = description;
|
||||
DefaultValue = new CVarValue(value);
|
||||
Value = DefaultValue;
|
||||
}
|
||||
|
||||
public void Set(int value) {
|
||||
if (Flags.HasFlag(CVarFlags.ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Value = new CVarValue(value);
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(float value) {
|
||||
if (Flags.HasFlag(CVarFlags.ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Value = new CVarValue(value);
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(string value) {
|
||||
if (Flags.HasFlag(CVarFlags.ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Value = new CVarValue(value);
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void ParseFromString(string str) {
|
||||
if (Flags.HasFlag(CVarFlags.ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (float.TryParse(str, out float f)) {
|
||||
Set(f);
|
||||
} else {
|
||||
Set(str);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
if (Flags.HasFlag(CVarFlags.ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Value = DefaultValue;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return Value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Services/Console/CVar.cs.meta
Normal file
3
Runtime/Engine/Code/Services/Console/CVar.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f560b25a893456c90fac62ad278c02b
|
||||
timeCreated: 1740779755
|
||||
19
Runtime/Engine/Code/Services/Console/CVarAsset.cs
Normal file
19
Runtime/Engine/Code/Services/Console/CVarAsset.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Console {
|
||||
[CreateAssetMenu(fileName = RConsts.AssetMenu + "cvar")]
|
||||
public class CVarAsset : ScriptableObject {
|
||||
[SerializeField]
|
||||
private CVar _cvar;
|
||||
|
||||
public CVar Create(string name = null) {
|
||||
CVar cvar = new CVar(_cvar);
|
||||
|
||||
if (name != null) {
|
||||
cvar.Name = name;
|
||||
}
|
||||
|
||||
return cvar;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Services/Console/CVarAsset.cs.meta
Normal file
3
Runtime/Engine/Code/Services/Console/CVarAsset.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 443a66c3a441450d96d222872a567df0
|
||||
timeCreated: 1741639598
|
||||
193
Runtime/Engine/Code/Services/Console/ConsoleService.cs
Normal file
193
Runtime/Engine/Code/Services/Console/ConsoleService.cs
Normal file
@@ -0,0 +1,193 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RebootKit.Engine.Foundation;
|
||||
using RebootKit.Engine.Services.Input;
|
||||
using UnityEngine.InputSystem;
|
||||
using Logger = RebootKit.Engine.Foundation.Logger;
|
||||
|
||||
namespace RebootKit.Engine.Services.Console {
|
||||
public interface IConsoleCommand {
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
void Execute(string[] args);
|
||||
}
|
||||
|
||||
public class HelpCommand : IConsoleCommand {
|
||||
public string Name { get; } = "help";
|
||||
public string Description { get; } = "Prints available commands/cvars and their descriptions.";
|
||||
|
||||
public void Execute(string[] args) {
|
||||
RR.Console().PrintHelp();
|
||||
}
|
||||
}
|
||||
|
||||
public class ConsoleService : IService {
|
||||
private static readonly Logger _logger = new(nameof(ConsoleService));
|
||||
|
||||
[Serializable]
|
||||
public class Config {
|
||||
public ConsoleUI ConsoleUIPrefab;
|
||||
public ScriptableInputAction ToggleAction;
|
||||
}
|
||||
|
||||
private ConsoleUI _ui;
|
||||
private Config _config;
|
||||
|
||||
private List<IConsoleCommand> _commands = new();
|
||||
private List<CVar> _cvars = new();
|
||||
|
||||
public bool IsVisible => _ui.IsVisible;
|
||||
|
||||
public ConsoleService(Config config) {
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
_logger.Info("Waking up");
|
||||
|
||||
_ui = UnityEngine.Object.Instantiate(_config.ConsoleUIPrefab);
|
||||
UnityEngine.Object.DontDestroyOnLoad(_ui.gameObject);
|
||||
await UniTask.Yield(cancellationToken);
|
||||
|
||||
_config.ToggleAction.Action.Enable();
|
||||
_config.ToggleAction.Action.performed += OnToggleAction;
|
||||
|
||||
RegisterCommand(new HelpCommand());
|
||||
|
||||
_ui.SetVisibility(false);
|
||||
_ui.Clear();
|
||||
_ui.Write("Hello shelf\n");
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
if (_ui != null) {
|
||||
UnityEngine.Object.Destroy(_ui);
|
||||
_ui = null;
|
||||
}
|
||||
|
||||
_config.ToggleAction.Action.performed -= OnToggleAction;
|
||||
}
|
||||
|
||||
public CVar GetCVar(string name) {
|
||||
foreach (CVar cvar in _cvars) {
|
||||
if (cvar.Name.Equals(name)) {
|
||||
return cvar;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CVar ReplaceOrDefault(CVar cvar) {
|
||||
CVar foundCVar = GetCVar(cvar.Name);
|
||||
if (foundCVar != null) {
|
||||
return foundCVar;
|
||||
}
|
||||
|
||||
_cvars.Add(cvar);
|
||||
return cvar;
|
||||
}
|
||||
|
||||
public void Replace(CVar cvar) {
|
||||
CVar foundCVar = GetCVar(cvar.Name);
|
||||
if (foundCVar != null) {
|
||||
_cvars.Remove(foundCVar);
|
||||
}
|
||||
|
||||
_cvars.Add(cvar);
|
||||
}
|
||||
|
||||
private string[] ParseCommandInputArguments(string text) {
|
||||
if (text.Length == 0) {
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
return new string[] {text};
|
||||
}
|
||||
|
||||
public void Execute(string input) {
|
||||
if (input.Length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
string commandName = input;
|
||||
if (input.IndexOf(' ') != -1) {
|
||||
commandName = input.Substring(0, input.IndexOf(' '));
|
||||
}
|
||||
|
||||
string[] arguments = ParseCommandInputArguments(input.Substring(commandName.Length));
|
||||
|
||||
foreach (IConsoleCommand command in _commands) {
|
||||
if (command.Name.Equals(commandName)) {
|
||||
command.Execute(arguments);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CVar cvar in _cvars) {
|
||||
if (cvar.Name.Equals(commandName)) {
|
||||
if (arguments.Length == 1) {
|
||||
cvar.ParseFromString(arguments[0]);
|
||||
}
|
||||
|
||||
_ui.Write($"<b>{cvar.Name}</b> - {cvar.ToString()}\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ui.Write($"ERROR: Command/CVar `{commandName}` not found.");
|
||||
}
|
||||
|
||||
public void ToggleVisibility() {
|
||||
_ui.SetVisibility(!_ui.IsVisible);
|
||||
|
||||
if (_ui.IsVisible) {
|
||||
// RR.Input().DisableControls();
|
||||
} else {
|
||||
RR.Input().EnableControls();
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterCommand(IConsoleCommand command) {
|
||||
if (_commands.Any(t => t.Name.Equals(command.Name))) {
|
||||
_logger.Error($"`{command.Name}` command is already registered");
|
||||
return;
|
||||
}
|
||||
|
||||
_commands.Add(command);
|
||||
_logger.Info($"Registered command: {command.Name}");
|
||||
}
|
||||
|
||||
public void PrintHelp() {
|
||||
StringBuilder message = new();
|
||||
|
||||
message.AppendLine("Available commands:");
|
||||
foreach (IConsoleCommand command in _commands) {
|
||||
message.Append(" ");
|
||||
message.Append(command.Name);
|
||||
message.Append(" - ");
|
||||
message.Append(command.Description);
|
||||
message.AppendLine();
|
||||
}
|
||||
|
||||
message.AppendLine("Available cvars:");
|
||||
foreach (CVar cvar in _cvars) {
|
||||
message.Append(" ");
|
||||
message.Append(cvar.Name);
|
||||
message.Append(" - ");
|
||||
message.Append(cvar.Description);
|
||||
message.AppendLine();
|
||||
}
|
||||
|
||||
_ui.Write(message.ToString());
|
||||
}
|
||||
|
||||
private void OnToggleAction(InputAction.CallbackContext obj) {
|
||||
ToggleVisibility();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b841238f225048e88d8d8d89cfeafaa7
|
||||
timeCreated: 1740884588
|
||||
34
Runtime/Engine/Code/Services/Console/ConsoleServiceAsset.cs
Normal file
34
Runtime/Engine/Code/Services/Console/ConsoleServiceAsset.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using RebootKit.Engine.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Console {
|
||||
[CreateAssetMenu(menuName = RConsts.ServiceAssetMenu + "Console")]
|
||||
public class ConsoleServiceAsset : ServiceAsset<ConsoleService> {
|
||||
[SerializeField]
|
||||
private ConsoleService.Config _config;
|
||||
|
||||
[SerializeField]
|
||||
private CVar[] _initialCVars;
|
||||
|
||||
[SerializeField]
|
||||
private bool _loadCVarsFromResources = true;
|
||||
|
||||
public override ConsoleService Create() {
|
||||
ConsoleService service = new(_config);
|
||||
foreach (CVar cvar in _initialCVars) {
|
||||
service.Replace(cvar);
|
||||
cvar.Reset();
|
||||
}
|
||||
|
||||
if (_loadCVarsFromResources) {
|
||||
CVarAsset[] cvarsAssets = Resources.LoadAll<CVarAsset>("cvar");
|
||||
foreach (CVarAsset cvarAsset in cvarsAssets) {
|
||||
CVar cvar = cvarAsset.Create();
|
||||
service.Replace(cvar);
|
||||
}
|
||||
}
|
||||
|
||||
return new ConsoleService(_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 577b018c25510774aaccba06137e264d
|
||||
52
Runtime/Engine/Code/Services/Console/ConsoleUI.cs
Normal file
52
Runtime/Engine/Code/Services/Console/ConsoleUI.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace RebootKit.Engine.Services.Console {
|
||||
public class ConsoleUI : MonoBehaviour {
|
||||
private StringBuilder _content = new();
|
||||
|
||||
[SerializeField]
|
||||
private UIDocument _document;
|
||||
|
||||
private TextField _textField;
|
||||
private Button _submitButton;
|
||||
|
||||
public bool IsVisible { get; private set; }
|
||||
|
||||
private void Awake() {
|
||||
|
||||
VisualElement root = _document.rootVisualElement;
|
||||
return;
|
||||
// _textField = root.Q<TextField>("console-text-field");
|
||||
// _submitButton = root.Q<Button>("console-btn-submit");
|
||||
// _submitButton.clicked += OnSubmitButtonClicked;
|
||||
}
|
||||
|
||||
private void OnSubmit(string input) {
|
||||
RR.Console().Execute(input);
|
||||
_textField.value = input;
|
||||
}
|
||||
|
||||
public void SetVisibility(bool visible) {
|
||||
_document.enabled = visible;
|
||||
}
|
||||
|
||||
public void Write(string message) {
|
||||
_content.Append(message);
|
||||
//_textField.value = _content.ToString();
|
||||
}
|
||||
|
||||
public void Clear() {
|
||||
_content.Clear();
|
||||
|
||||
if (_textField != null) {
|
||||
_textField.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSubmitButtonClicked() {
|
||||
OnSubmit(_textField.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Services/Console/ConsoleUI.cs.meta
Normal file
3
Runtime/Engine/Code/Services/Console/ConsoleUI.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca844a0157054677b2f129fdbf6ddc45
|
||||
timeCreated: 1740780314
|
||||
8
Runtime/Engine/Code/Services/Game.meta
Normal file
8
Runtime/Engine/Code/Services/Game.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1177ea3903bdba5419ad3347250cb3b7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Runtime/Engine/Code/Services/Game/GameMode.cs
Normal file
68
Runtime/Engine/Code/Services/Game/GameMode.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using RebootKit.Engine.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Game {
|
||||
[Serializable]
|
||||
public class GameModeConfig {
|
||||
public ControllerAsset[] Controllers;
|
||||
}
|
||||
|
||||
public abstract class GameModeAsset : ScriptableObject {
|
||||
[field: SerializeField]
|
||||
public GameModeConfig GameModeConfig { get; private set; }
|
||||
|
||||
public GameMode Create() {
|
||||
GameMode gameMode = new GameMode(GameModeConfig);
|
||||
ConfigureGameMode(gameMode);
|
||||
return gameMode;
|
||||
}
|
||||
|
||||
public abstract void ConfigureGameMode(GameMode gameMode);
|
||||
}
|
||||
|
||||
public class GameMode : IDisposable {
|
||||
private readonly GameModeConfig _config;
|
||||
private readonly ControllersManager _controllersManager;
|
||||
|
||||
private CancellationTokenSource _destroyCancellationTokenSource;
|
||||
|
||||
private bool _isRunning;
|
||||
|
||||
public GameMode(GameModeConfig config) {
|
||||
_config = config;
|
||||
_isRunning = false;
|
||||
|
||||
_destroyCancellationTokenSource = new CancellationTokenSource();
|
||||
_controllersManager = new ControllersManager(_destroyCancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
_destroyCancellationTokenSource.Cancel();
|
||||
_controllersManager.Dispose();
|
||||
}
|
||||
|
||||
public async Awaitable<bool> Start(CancellationToken cancellationToken) {
|
||||
_controllersManager.Add(_config.Controllers);
|
||||
await _controllersManager.Start(cancellationToken);
|
||||
|
||||
_isRunning = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Stop() {
|
||||
_isRunning = false;
|
||||
|
||||
_controllersManager.Stop();
|
||||
}
|
||||
|
||||
public void Tick() {
|
||||
_controllersManager.Tick();
|
||||
}
|
||||
|
||||
public void AddController(IController controller) {
|
||||
_controllersManager.Add(controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Runtime/Engine/Code/Services/Game/GameMode.cs.meta
Normal file
2
Runtime/Engine/Code/Services/Game/GameMode.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73f15dc489209cc4a9ff6963e0fbd2c6
|
||||
42
Runtime/Engine/Code/Services/Game/GameService.cs
Normal file
42
Runtime/Engine/Code/Services/Game/GameService.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RebootKit.Engine.Foundation;
|
||||
|
||||
namespace RebootKit.Engine.Services.Game {
|
||||
public class GameService : IService {
|
||||
private static readonly Logger _logger = new(nameof(GameService));
|
||||
|
||||
private GameModeAsset _gameModeAsset;
|
||||
private GameMode _gameMode;
|
||||
private bool _running;
|
||||
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
_running = false;
|
||||
_gameMode.Dispose();
|
||||
}
|
||||
|
||||
public async UniTask Start(GameModeAsset asset, CancellationToken cancellationToken) {
|
||||
_gameMode = asset.Create();
|
||||
await _gameMode.Start(cancellationToken);
|
||||
|
||||
Run(cancellationToken).Forget();
|
||||
}
|
||||
|
||||
private async UniTask Run(CancellationToken cancellationToken) {
|
||||
if (_gameMode == null) {
|
||||
_logger.Error("Trying to run game without game mode");
|
||||
return;
|
||||
}
|
||||
|
||||
_running = true;
|
||||
while (_running) {
|
||||
await UniTask.Yield(PlayerLoopTiming.Update, cancellationToken);
|
||||
_gameMode.Tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Runtime/Engine/Code/Services/Game/GameService.cs.meta
Normal file
2
Runtime/Engine/Code/Services/Game/GameService.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82082a4d082be274bbec52347d25b836
|
||||
11
Runtime/Engine/Code/Services/Game/GameServiceAsset.cs
Normal file
11
Runtime/Engine/Code/Services/Game/GameServiceAsset.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using RebootKit.Engine.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Game {
|
||||
[CreateAssetMenu(menuName = RConsts.ServiceAssetMenu + "Game")]
|
||||
public class GameServiceAsset : ServiceAsset<GameService> {
|
||||
public override GameService Create() {
|
||||
return new GameService();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51f134b6c2abcd34fa8e376b3afc757d
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user