Storyline+Dialog初步

This commit is contained in:
SoulliesOfficial
2026-07-05 16:08:23 -04:00
parent afa8a56e1d
commit d031afd075
464 changed files with 25716 additions and 4209 deletions

View File

@@ -0,0 +1,30 @@
using UnityEditor;
using UnityEngine;
namespace SubAssetsToolbox.Editor
{
public static class MenuItems
{
[InitializeOnLoadMethod]
public static void CheckShowWelcomeScreen()
{
if (!SubAssetsToolboxSettings.WelcomeWindowSeen.value)
{
EditorApplication.delayCall += WelcomeScreen.Init;
SubAssetsToolboxSettings.WelcomeWindowSeen.SetValue(true, true);
}
}
[MenuItem(Constants.MenuItemBaseName + "Documentation", false, 100)]
public static void OpenDocumentation() => Application.OpenURL(Constants.DocumentationUrl);
[MenuItem(Constants.MenuItemBaseName + "Email support", false, 101)]
public static void EmailSupport() => Application.OpenURL(Constants.SupportEmail);
[MenuItem(Constants.MenuItemBaseName + "Join Discord", false, 102)]
public static void JoinDiscord() => Application.OpenURL(Constants.ReviewUrl);
[MenuItem(Constants.MenuItemBaseName + "Write a review", false, 105)]
public static void LeaveAReview() => Application.OpenURL(Constants.ReviewUrl);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: fcfb5b3277a0f43c292486d6198f002b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 284154
packageName: SubAssets Toolbox
packageVersion: 1.1.0
assetPath: Packages/io.continis.subassets/Editor/WindowsAndMenus/MenuItems.cs
uploadId: 869944

View File

@@ -0,0 +1,87 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace SubAssetsToolbox.Editor
{
internal class RenameSubAssetWindow : EditorWindow
{
[SerializeField] private VisualTreeAsset _visualTreeAsset;
private Object _target;
private TextField _nameField;
private Button _renameButton;
public static void Open(Object subAsset)
{
RenameSubAssetWindow window = GetWindow<RenameSubAssetWindow>(true, "Rename Sub-Asset");
window._target = subAsset;
window.minSize = new Vector2(300f, 70f);
window.maxSize = new Vector2(300f, 70f);
window.Populate();
window.Show();
}
private void CreateGUI()
{
VisualElement root = rootVisualElement;
VisualElement template = _visualTreeAsset.Instantiate();
template.style.flexGrow = 1f;
_nameField = template.Q<TextField>("NameField");
_nameField.selectAllOnFocus = true;
_nameField.RegisterValueChangedCallback(_ => UpdateRenameButton());
_nameField.RegisterCallback<KeyUpEvent>(OnKeyUp);
template.Q<Button>("CancelBtn").clicked += Close;
_renameButton = template.Q<Button>("RenameBtn");
_renameButton.clicked += PerformRename;
root.Add(template);
UpdateRenameButton();
}
private void OnKeyUp(KeyUpEvent evt)
{
switch (evt.keyCode)
{
case KeyCode.Return:
case KeyCode.KeypadEnter:
PerformRename();
break;
case KeyCode.Escape:
Close();
break;
}
}
private void Populate()
{
_nameField.value = _target != null ? _target.name : "";
UpdateRenameButton();
_nameField.schedule.Execute(() =>
{
_nameField.Focus();
_nameField.SelectAll();
});
}
private void UpdateRenameButton()
{
bool valid = _target != null
&& !string.IsNullOrWhiteSpace(_nameField.value)
&& _nameField.value != _target.name;
_renameButton.SetEnabled(valid);
}
private void PerformRename()
{
_target.name = _nameField.value;
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Close();
}
}
}

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: d6c1e8c8d4e4648ff89db9289140ebc1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- _visualTreeAsset: {fileID: 9197481963319205126, guid: b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7,
type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 284154
packageName: SubAssets Toolbox
packageVersion: 1.1.0
assetPath: Packages/io.continis.subassets/Editor/WindowsAndMenus/RenameSubAssetWindow.cs
uploadId: 869944

View File

@@ -0,0 +1,37 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace SubAssetsToolbox.Editor
{
public class WelcomeScreen : EditorWindow
{
[SerializeField] private VisualTreeAsset _visualTreeAsset;
private static WelcomeScreen _window;
[MenuItem(Constants.MenuItemBaseName + "Welcome screen", false, 0)]
public static void Init()
{
_window = GetWindow<WelcomeScreen>(true);
_window.titleContent = new GUIContent("SubAssets Toolbox");
_window.minSize = new Vector2(300f, 400f);
_window.maxSize = new Vector2(300f, 400f);
_window.Show();
}
private void CreateGUI()
{
VisualElement root = rootVisualElement;
VisualElement templateWindow = _visualTreeAsset.Instantiate();
templateWindow.style.flexGrow = 1f;
templateWindow.Q<Button>("DocsBtn").clicked += () => Application.OpenURL(Constants.DocumentationUrl);
templateWindow.Q<Button>("EmailBtn").clicked += () => Application.OpenURL(Constants.SupportEmail);
templateWindow.Q<Button>("DiscordBtn").clicked += () => Application.OpenURL(Constants.DiscordUrl);
templateWindow.Q<Button>("OtherToolsBtn").clicked += () => Application.OpenURL(Constants.OtherToolsUrl);
templateWindow.Q<Button>("ReviewBtn").clicked += () => Application.OpenURL(Constants.ReviewUrl);
root.Add(templateWindow);
}
}
}

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: a17879cf1b9d14c45a1c43136fa833e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- _visualTreeAsset: {fileID: 9197481963319205126, guid: 1ad4f2b6f50fc4b74a7886c0f754da60,
type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 284154
packageName: SubAssets Toolbox
packageVersion: 1.1.0
assetPath: Packages/io.continis.subassets/Editor/WindowsAndMenus/WelcomeScreen.cs
uploadId: 869944