initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace EasySharp.ReSharperCustomSourceTemplates
|
||||
{
|
||||
public static class ReSharperHelper
|
||||
{
|
||||
[SourceTemplate]
|
||||
public static void log(this object source)
|
||||
{
|
||||
//$Debug.Log($"$source$: {source}");$END$
|
||||
}
|
||||
|
||||
[SourceTemplate]
|
||||
public static void elog(this object source)
|
||||
{
|
||||
//$Debug.LogError($"$source$: {source}");$END$
|
||||
}
|
||||
|
||||
[SourceTemplate]
|
||||
public static void wlog(this object source)
|
||||
{
|
||||
//$Debug.LogWarning($"$source$: {source}");$END$
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c725f486e96d413bae1be99be3daf6ba
|
||||
timeCreated: 1735946217
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class SceneSwitcherEditorWindow : EditorWindow
|
||||
{
|
||||
[MenuItem("Examples/My Editor Window")]
|
||||
public static void ShowExample()
|
||||
{
|
||||
var editorWindow = GetWindow<SceneSwitcherEditorWindow>();
|
||||
editorWindow.titleContent = new GUIContent("SceneSwitcherEditor");
|
||||
}
|
||||
|
||||
public void CreateGUI()
|
||||
{
|
||||
// Each editor window contains a root VisualElement object
|
||||
VisualElement root = rootVisualElement;
|
||||
root.Clear();
|
||||
|
||||
// Create a ScrollView
|
||||
ScrollView scrollView = new ScrollView();
|
||||
root.Add(scrollView);
|
||||
|
||||
// reload button
|
||||
Button reloadButton = new Button();
|
||||
reloadButton.text = "Reload";
|
||||
reloadButton.clicked += () => CreateGUI();
|
||||
scrollView.Add(reloadButton);
|
||||
|
||||
// space
|
||||
scrollView.Add(new Label(""));
|
||||
|
||||
// Get the SceneSwitcher component
|
||||
if (SceneSwitcher.Instance == null)
|
||||
{
|
||||
Debug.LogError("SceneSwitcher component not found in the scene.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get the list of scenes
|
||||
List<(string name, int index)> scenes = SceneSwitcher.Instance.GetScenes();
|
||||
|
||||
// Create a button for each scene
|
||||
foreach (var scene in scenes)
|
||||
{
|
||||
Button button = new Button();
|
||||
button.text = scene.name;
|
||||
int sceneIndex = scene.index; // Capture the index in a local variable
|
||||
button.clicked += () => SceneSwitcher.Instance.SwitchScene(sceneIndex);
|
||||
scrollView.Add(button);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95394a5a901d4954a92e7ced9382dead
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user