您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
82 行
2.3 KiB
82 行
2.3 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
using UnityEditor.Callbacks;
|
|
|
|
namespace GameplayIngredients.Editor
|
|
{
|
|
public class DiscoverAsset : ScriptableObject
|
|
{
|
|
[MenuItem("Assets/Create/Discover Asset", priority = 202)]
|
|
static void Create()
|
|
{
|
|
AssetFactory.CreateAssetInProjectWindow<DiscoverAsset>(null, "New DiscoverAsset.asset");
|
|
}
|
|
|
|
[OnOpenAsset]
|
|
static bool OpenAsset(int instanceID, int line)
|
|
{
|
|
var asset = EditorUtility.InstanceIDToObject(instanceID);
|
|
if (asset is DiscoverAsset)
|
|
{
|
|
DiscoverWindow.ShowDiscoverWindow(asset as DiscoverAsset);
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
[Header("General Properties")]
|
|
public string WindowTitle = "Discover";
|
|
public Texture2D HeaderTexture;
|
|
public bool dockable = false;
|
|
|
|
[Tooltip("Width of the Window, in pixels")]
|
|
public int WindowWidth = 640;
|
|
[Tooltip("Height of the Window, in pixels")]
|
|
public int WindowHeight = 520;
|
|
[Tooltip("Width of the Discover List, in pixels")]
|
|
public int DiscoverListWidth = 180;
|
|
|
|
[Header("Show At Startup")]
|
|
public bool EnableShowAtStartup = true;
|
|
[Tooltip("The name of the preference for auto showing at startup, will be ")]
|
|
public string PreferenceName = "Discover";
|
|
|
|
[Header("Filter Content")]
|
|
public FilterMode filterMode = FilterMode.ShowAll;
|
|
public string Tags = "";
|
|
|
|
public enum FilterMode
|
|
{
|
|
ShowAll,
|
|
IncludeTags,
|
|
ExcludeTags
|
|
}
|
|
|
|
[Header("Content")]
|
|
public string Title = "Welcome!";
|
|
public Texture2D Image;
|
|
[Multiline]
|
|
public string Description = "This is a sample body for your discover window.";
|
|
[Header("Scenes")]
|
|
public DiscoverSceneInfo[] Scenes;
|
|
|
|
[Header("Debug")]
|
|
public bool Debug = false;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct DiscoverSceneInfo
|
|
{
|
|
public string Title;
|
|
public Texture2D Image;
|
|
[Multiline]
|
|
public string Description;
|
|
public EditorSceneSetup[] SceneSetups;
|
|
public SceneAsset[] SingleScenes;
|
|
}
|
|
}
|
|
|
|
|