This commit is contained in:
CortexCore
2023-07-02 02:20:40 +08:00
parent dfbcd03756
commit 6df4649c64
13 changed files with 194 additions and 70 deletions

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UIElements;
namespace BITKit
{
public class BITEditorForUnity : EditorWindow
{
private Slider _timeScaleSlider;
private Button _resetTimeScaleButton;
[MenuItem("Tools/Common Editor")]
private static void OpenEditor()
{
var window = GetWindow<BITEditorForUnity>();
window.titleContent = new GUIContent("BIT Editor");
window.Show();
}
private void OnEnable()
{
rootVisualElement.styleSheets.Add(BITEditorUtils.InspectorStyleSheet);
_timeScaleSlider = new Slider()
{
label = "TimeScale",
showInputField = true,
value = Time.timeScale
};
_timeScaleSlider.RegisterValueChangedCallback(x => { Time.timeScale = x.newValue; });
_resetTimeScaleButton = new Button()
{
text = "Reset TimeScale",
};
_resetTimeScaleButton.clicked += () =>
{
Time.timeScale = 1;
_timeScaleSlider.value = 1;
};
rootVisualElement.Add(_timeScaleSlider);
rootVisualElement.Add(_resetTimeScaleButton);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4af8b62f1e9db2045a42831c3cb3ab77
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: