something

This commit is contained in:
2025-06-17 23:39:51 +02:00
parent 76b2c8c1bf
commit 518fd29d75
29 changed files with 118 additions and 101 deletions

View File

@@ -23,7 +23,7 @@ namespace RebootKitEditor.PropertyDrawers {
}
public string BuildGuidString(SerializedProperty[] parts) {
StringBuilder sb = new();
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0:X8}", parts[0].uintValue);
sb.AppendFormat("{0:X8}", parts[1].uintValue);
sb.AppendFormat("{0:X8}", parts[2].uintValue);

View File

@@ -10,7 +10,7 @@ namespace RebootKitEditor.RebootWindow {
}
public VisualElement Build() {
ScrollView scrollView = new() {
ScrollView scrollView = new ScrollView {
style = {
flexGrow = 1
}
@@ -19,7 +19,7 @@ namespace RebootKitEditor.RebootWindow {
ConfigVarsContainer.Init();
foreach (ConfigVar cvar in ConfigVarsContainer.All()) {
VisualElement varContainer = new() {
VisualElement varContainer = new VisualElement {
style = {
marginBottom = 8,
paddingBottom = 8,
@@ -28,14 +28,14 @@ namespace RebootKitEditor.RebootWindow {
}
};
VisualElement valueContainer = new() {
VisualElement valueContainer = new VisualElement {
style = {
flexDirection = FlexDirection.Row
}
};
varContainer.Add(valueContainer);
Label nameLabel = new(cvar.name) {
Label nameLabel = new Label(cvar.name) {
style = {
color = new Color(0.7f, 0.9f, 0.9f),
unityFontStyleAndWeight = FontStyle.Bold
@@ -43,7 +43,7 @@ namespace RebootKitEditor.RebootWindow {
};
valueContainer.Add(nameLabel);
Label valueLabel = new(cvar.ToString()) {
Label valueLabel = new Label(cvar.ToString()) {
style = {
color = RTheme.s_FirstColor
}
@@ -66,7 +66,7 @@ namespace RebootKitEditor.RebootWindow {
valueContainer.Add(CreateFlagLabel("ReadOnly", new Color(0.13f, 0.07f, 0.47f)));
}
Label descLabel = new(cvar.description) {
Label descLabel = new Label(cvar.description) {
style = {
fontSize = 10,
color = new Color(0.7f, 0.7f, 0.7f)
@@ -81,7 +81,7 @@ namespace RebootKitEditor.RebootWindow {
}
VisualElement CreateFlagLabel(string text, Color color) {
Label label = new(text) {
Label label = new Label(text) {
style = {
fontSize = 12,
color = new Color(0.7f, 0.7f, 0.7f),

View File

@@ -11,7 +11,7 @@ namespace RebootKitEditor.RebootWindow {
public class GameServicesView : IView {
VisualElement m_RootElement;
readonly List<Editor> m_ServiceEditors = new();
readonly List<Editor> m_ServiceEditors = new List<Editor>();
[Inject] EngineConfigAsset m_EngineConfigAsset;
@@ -49,7 +49,7 @@ namespace RebootKitEditor.RebootWindow {
}
VisualElement CreateServicesView<T>(ServiceAsset<T> serviceAsset) where T : class, IService {
VisualElement root = new() {
VisualElement root = new VisualElement {
style = {
paddingBottom = 4,
paddingTop = 4,
@@ -60,7 +60,7 @@ namespace RebootKitEditor.RebootWindow {
}
};
VisualElement header = new() {
VisualElement header = new VisualElement {
style = {
backgroundColor = new Color(0.2f, 0.2f, 0.2f),
paddingLeft = 8,
@@ -73,7 +73,7 @@ namespace RebootKitEditor.RebootWindow {
};
root.Add(header);
Label nameLabel = new(serviceAsset.name) {
Label nameLabel = new Label(serviceAsset.name) {
style = {
color = new Color(0.7f, 0.9f, 0.9f),
unityFontStyleAndWeight = FontStyle.Bold
@@ -81,7 +81,7 @@ namespace RebootKitEditor.RebootWindow {
};
header.Add(nameLabel);
VisualElement editorView = new() {
VisualElement editorView = new VisualElement {
style = {
backgroundColor = new Color(0.3f, 0.3f, 0.3f),
paddingLeft = 10,
@@ -96,7 +96,7 @@ namespace RebootKitEditor.RebootWindow {
Editor editor = Editor.CreateEditor(serviceAsset);
m_ServiceEditors.Add(editor);
InspectorElement inspectorElement = new(editor);
InspectorElement inspectorElement = new InspectorElement(editor);
editorView.Add(inspectorElement);
return root;

View File

@@ -11,14 +11,14 @@ namespace RebootKitEditor.RebootWindow {
}
public VisualElement Build() {
VisualElement rootContainer = new() {
VisualElement rootContainer = new VisualElement {
style = {
flexGrow = 1,
fontSize = 14
}
};
Label label = new($"{Application.productName} {Application.version}") {
Label label = new Label($"{Application.productName} {Application.version}") {
style = {
fontSize = 18,
unityFontStyleAndWeight = FontStyle.Bold
@@ -26,7 +26,7 @@ namespace RebootKitEditor.RebootWindow {
};
rootContainer.Add(label);
VisualElement persistentPathContainer = new() {
VisualElement persistentPathContainer = new VisualElement {
style = {
marginTop = 8,
marginBottom = 8,
@@ -40,7 +40,7 @@ namespace RebootKitEditor.RebootWindow {
}
};
Label persistentPathLabel = new($"Persistent Path: {Application.persistentDataPath}") {
Label persistentPathLabel = new Label($"Persistent Path: {Application.persistentDataPath}") {
style = {
fontSize = 12,
color = new Color(0.7f, 0.9f, 0.9f)
@@ -48,7 +48,9 @@ namespace RebootKitEditor.RebootWindow {
};
persistentPathContainer.Add(persistentPathLabel);
Button openPersistentPathButton = new(() => { Application.OpenURL(Application.persistentDataPath); }) {
Button openPersistentPathButton = new Button(() => {
Application.OpenURL(Application.persistentDataPath);
}) {
style = {
fontSize = 12,
width = 48
@@ -59,7 +61,7 @@ namespace RebootKitEditor.RebootWindow {
rootContainer.Add(persistentPathContainer);
Label onGameRunScriptLabel = new("On Game Run Script (User):") {
Label onGameRunScriptLabel = new Label("On Game Run Script (User):") {
style = {
fontSize = 12,
color = new Color(0.7f, 0.9f, 0.9f)
@@ -67,7 +69,7 @@ namespace RebootKitEditor.RebootWindow {
};
rootContainer.Add(onGameRunScriptLabel);
TextField onGameRunScriptTextField = new() {
TextField onGameRunScriptTextField = new TextField {
style = {
fontSize = 12,
},
@@ -80,7 +82,7 @@ namespace RebootKitEditor.RebootWindow {
});
rootContainer.Add(onGameRunScriptTextField);
Label consoleCommandsLabel = new("Console Commands:") {
Label consoleCommandsLabel = new Label("Console Commands:") {
style = {
fontSize = 12,
color = new Color(0.7f, 0.9f, 0.9f)
@@ -90,7 +92,7 @@ namespace RebootKitEditor.RebootWindow {
ConsoleService.ConsoleCommand[] consoleCommands = ConsoleService.GenerateCommandsToRegister();
foreach (ConsoleService.ConsoleCommand consoleCommand in consoleCommands) {
VisualElement commandContainer = new() {
VisualElement commandContainer = new VisualElement {
style = {
flexDirection = FlexDirection.Row,
marginTop = 4,
@@ -101,7 +103,7 @@ namespace RebootKitEditor.RebootWindow {
paddingBottom = 4,
}
};
Label commandLabel = new(consoleCommand.name) {
Label commandLabel = new Label(consoleCommand.name) {
style = {
fontSize = 12,
color = new Color(0.7f, 0.9f, 0.9f)
@@ -109,7 +111,7 @@ namespace RebootKitEditor.RebootWindow {
};
commandContainer.Add(commandLabel);
Label descriptionLabel = new(consoleCommand.description) {
Label descriptionLabel = new Label(consoleCommand.description) {
style = {
fontSize = 12,
color = new Color(0.5f, 0.7f, 0.7f)

View File

@@ -24,7 +24,7 @@ namespace RebootKitEditor.RebootWindow {
}
public class RebootEditorWindow : EditorWindow {
static readonly Logger s_logger = new(nameof(RebootEditorWindow));
static readonly Logger s_logger = new Logger(nameof(RebootEditorWindow));
EngineConfigAsset m_EngineConfigAsset;
DIContext m_DIContext;

View File

@@ -12,16 +12,16 @@ namespace RebootKitEditor.RebootWindow {
public VisualElement container;
}
readonly List<Tab> m_Tabs = new();
readonly List<VisualElement> m_TabContents = new();
readonly List<Button> m_TabButtons = new();
readonly List<Tab> m_Tabs = new List<Tab>();
readonly List<VisualElement> m_TabContents = new List<VisualElement>();
readonly List<Button> m_TabButtons = new List<Button>();
int m_CurrentTabIndex = -1;
public void Dispose() {
}
public VisualElement Build() {
VisualElement rootContainer = new() {
VisualElement rootContainer = new VisualElement {
style = {
flexDirection = FlexDirection.Row,
flexGrow = 1,
@@ -31,7 +31,7 @@ namespace RebootKitEditor.RebootWindow {
}
};
VisualElement tabContainer = new() {
VisualElement tabContainer = new VisualElement {
style = {
flexDirection = FlexDirection.Row,
width = new StyleLength(new Length(100, LengthUnit.Percent)),
@@ -39,7 +39,7 @@ namespace RebootKitEditor.RebootWindow {
};
rootContainer.Add(tabContainer);
VisualElement tabButtonsContainer = new() {
VisualElement tabButtonsContainer = new VisualElement {
style = {
flexDirection = FlexDirection.Column,
borderRightWidth = 1,
@@ -51,7 +51,7 @@ namespace RebootKitEditor.RebootWindow {
};
tabContainer.Add(tabButtonsContainer);
VisualElement contentContainer = new() {
VisualElement contentContainer = new VisualElement {
style = {
flexGrow = 1,
paddingLeft = 4,
@@ -66,7 +66,7 @@ namespace RebootKitEditor.RebootWindow {
Tab tab = m_Tabs[i];
int index = i;
Button button = new(() => SetActiveTab(index)) {
Button button = new Button(() => SetActiveTab(index)) {
text = tab.name,
style = {
paddingLeft = 8,
@@ -94,7 +94,7 @@ namespace RebootKitEditor.RebootWindow {
}
public void AddTab(string name, IView view) {
VisualElement tabContainer = new() {
VisualElement tabContainer = new VisualElement {
name = "rr_tab__container",
style = {
flexGrow = 1

View File

@@ -14,7 +14,7 @@ namespace RebootKitEditor.RebootWindow {
}
public VisualElement Build() {
VisualElement root = new() {
VisualElement root = new VisualElement {
style = {
paddingBottom = 4,
paddingTop = 4,
@@ -33,7 +33,7 @@ namespace RebootKitEditor.RebootWindow {
}
VisualElement CreateWorldView(WorldConfigAsset worldConfigAsset) {
VisualElement root = new() {
VisualElement root = new VisualElement {
style = {
backgroundColor = new Color(0.1f, 0.1f, 0.1f),
paddingBottom = 4,
@@ -45,7 +45,7 @@ namespace RebootKitEditor.RebootWindow {
}
};
Label label = new(worldConfigAsset.name) {
Label label = new Label(worldConfigAsset.name) {
style = {
color = new Color(0.7f, 0.9f, 0.9f),
unityFontStyleAndWeight = FontStyle.Bold
@@ -53,7 +53,7 @@ namespace RebootKitEditor.RebootWindow {
};
root.Add(label);
Button openButton = new(() => OpenWorldScenes(worldConfigAsset)) {
Button openButton = new Button(() => OpenWorldScenes(worldConfigAsset)) {
text = "Open",
style = {
backgroundColor = new Color(0.2f, 0.2f, 0.2f),

View File

@@ -21,7 +21,7 @@ namespace RebootKitEditor.Utils {
const string k_CVarDefaultValueStringValueProperty = "stringValue";
public static CVarSerializedProperties Find(SerializedProperty cvar) {
CVarSerializedProperties properties = new();
CVarSerializedProperties properties = new CVarSerializedProperties();
properties.flags = cvar.FindPropertyRelative(k_CVarFlagsProperty);
properties.name = cvar.FindPropertyRelative(k_CVarNameProperty);
properties.description = cvar.FindPropertyRelative(k_CVarDescriptionProperty);

View File

@@ -29,13 +29,13 @@ namespace SzafaKitEditor.VisualElements {
}
void CreateInlineField() {
VisualElement box = new() {
VisualElement box = new VisualElement {
style = {
height = 48
}
};
Label nameLabel = new("NAME") {
Label nameLabel = new Label("NAME") {
style = {
unityFontStyleAndWeight = FontStyle.Bold,
backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f)
@@ -43,7 +43,7 @@ namespace SzafaKitEditor.VisualElements {
};
box.Add(nameLabel);
Button button = new(ToggleDetails) {
Button button = new Button(ToggleDetails) {
text = "...",
style = {
width = new StyleLength(new Length(64.0f, LengthUnit.Pixel)),
@@ -62,10 +62,10 @@ namespace SzafaKitEditor.VisualElements {
}
void CreateDetailsBox() {
PropertyField nameField = new(_nameProperty);
PropertyField defaultValueKindField = new(_defaultValueKindProperty);
PropertyField numberField = new(_defaultValueNumberProperty);
PropertyField stringField = new(_defaultValueStringProperty);
PropertyField nameField = new PropertyField(_nameProperty);
PropertyField defaultValueKindField = new PropertyField(_defaultValueKindProperty);
PropertyField numberField = new PropertyField(_defaultValueNumberProperty);
PropertyField stringField = new PropertyField(_defaultValueStringProperty);
_details = new VisualElement {
style = {