This commit is contained in:
corn
2026-06-07 22:59:32 +08:00
commit a62ff7379b
7171 changed files with 10015624 additions and 0 deletions

View File

@@ -0,0 +1,743 @@
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Dreamteck.Blenda.Editor {
public static class AudioUtility {
public static void PlayClip(AudioClip clip , int startSample , bool loop) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"PlayClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip),
typeof(Int32),
typeof(Boolean)
},
null
);
method.Invoke(
null,
new object[] {
clip,
startSample,
loop
}
);
}
public static void PlayClip(AudioClip clip , int startSample) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"PlayClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip),
typeof(Int32)
},
null
);
method.Invoke(
null,
new object[] {
clip,
startSample
}
);
}
public static void PlayClip(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"PlayClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip)
},
null
);
method.Invoke(
null,
new object[] {
clip
}
);
}
public static void StopClip(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"StopClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip)
},
null
);
method.Invoke(
null,
new object[] {
clip
}
);
}
public static void PauseClip(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"PauseClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip)
},
null
);
method.Invoke(
null,
new object[] {
clip
}
);
}
public static void ResumeClip(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"ResumeClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip)
},
null
);
method.Invoke(
null,
new object[] {
clip
}
);
}
public static void LoopClip(AudioClip clip , bool on) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"LoopClip",
BindingFlags.Static | BindingFlags.Public,
null,
new System.Type[] {
typeof(AudioClip),
typeof(bool)
},
null
);
method.Invoke(
null,
new object[] {
clip,
on
}
);
}
public static bool IsClipPlaying(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"IsClipPlaying",
BindingFlags.Static | BindingFlags.Public
);
bool playing = (bool)method.Invoke(
null,
new object[] {
clip,
}
);
return playing;
}
public static void StopAllClips () {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"StopAllClips",
BindingFlags.Static | BindingFlags.Public
);
method.Invoke(
null,
null
);
}
public static float GetClipPosition(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetClipPosition",
BindingFlags.Static | BindingFlags.Public
);
float position = (float)method.Invoke(
null,
new object[] {
clip
}
);
return position;
}
public static int GetClipSamplePosition(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetClipSamplePosition",
BindingFlags.Static | BindingFlags.Public
);
int position = (int)method.Invoke(
null,
new object[] {
clip
}
);
return position;
}
public static void SetClipSamplePosition(AudioClip clip , int iSamplePosition) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"SetClipSamplePosition",
BindingFlags.Static | BindingFlags.Public
);
method.Invoke(
null,
new object[] {
clip,
iSamplePosition
}
);
}
public static int GetSampleCount(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetSampleCount",
BindingFlags.Static | BindingFlags.Public
);
int samples = (int)method.Invoke(
null,
new object[] {
clip
}
);
return samples;
}
public static int GetChannelCount(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetChannelCount",
BindingFlags.Static | BindingFlags.Public
);
int channels = (int)method.Invoke(
null,
new object[] {
clip
}
);
return channels;
}
public static int GetBitRate(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetChannelCount",
BindingFlags.Static | BindingFlags.Public
);
int bitRate = (int)method.Invoke(
null,
new object[] {
clip
}
);
return bitRate;
}
public static int GetBitsPerSample(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetBitsPerSample",
BindingFlags.Static | BindingFlags.Public
);
int bits = (int)method.Invoke(
null,
new object[] {
clip
}
);
return bits;
}
public static int GetFrequency(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetFrequency",
BindingFlags.Static | BindingFlags.Public
);
int frequency = (int)method.Invoke(
null,
new object[] {
clip
}
);
return frequency;
}
public static int GetSoundSize(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetSoundSize",
BindingFlags.Static | BindingFlags.Public
);
int size = (int)method.Invoke(
null,
new object[] {
clip
}
);
return size;
}
public static Texture2D GetWaveForm(AudioClip clip , int channel , float width , float height) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod("GetWaveForm", BindingFlags.Static | BindingFlags.Public);
string path = AssetDatabase.GetAssetPath(clip);
AudioImporter importer = (AudioImporter)AssetImporter.GetAtPath(path);
Texture2D texture = (Texture2D)method.Invoke(null, new object[] {clip, importer, channel, width, height});
return texture;
}
public static Texture2D GetWaveFormFast(AudioClip clip , int channel , int fromSample , int toSample, float width , float height) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod("GetWaveFormFast", BindingFlags.Static | BindingFlags.Public);
Texture2D texture = (Texture2D)method.Invoke(null, new object[] { clip, channel, fromSample, toSample, width, height });
return texture;
}
public static void ClearWaveForm(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod("ClearWaveForm", BindingFlags.Static | BindingFlags.Public);
method.Invoke(null, new object[] { clip });
}
public static bool HasPreview(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetSoundSize",
BindingFlags.Static | BindingFlags.Public
);
bool hasPreview = (bool)method.Invoke(
null,
new object[] {
clip
}
);
return hasPreview;
}
public static bool IsCompressed(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"IsCompressed",
BindingFlags.Static | BindingFlags.Public
);
bool isCompressed = (bool)method.Invoke(
null,
new object[] {
clip
}
);
return isCompressed;
}
public static bool IsStramed(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"IsStramed",
BindingFlags.Static | BindingFlags.Public
);
bool isStreamed = (bool)method.Invoke(
null,
new object[] {
clip
}
);
return isStreamed;
}
public static double GetDuration(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetDuration",
BindingFlags.Static | BindingFlags.Public
);
double duration = (double)method.Invoke(
null,
new object[] {
clip
}
);
return duration;
}
public static int GetFMODMemoryAllocated() {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetFMODMemoryAllocated",
BindingFlags.Static | BindingFlags.Public
);
int memoryAllocated = (int)method.Invoke(
null,
null
);
return memoryAllocated;
}
public static float GetFMODCPUUsage() {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetFMODCPUUsage",
BindingFlags.Static | BindingFlags.Public
);
float cpuUsage = (float)method.Invoke(
null,
null
);
return cpuUsage;
}
public static bool Is3D(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"Is3D",
BindingFlags.Static | BindingFlags.Public
);
bool is3D = (bool)method.Invoke(
null,
new object[] {
clip
}
);
return is3D;
}
public static bool IsMovieAudio(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"IsMovieAudio",
BindingFlags.Static | BindingFlags.Public
);
bool isMovieAudio = (bool)method.Invoke(
null,
new object[] {
clip
}
);
return isMovieAudio;
}
public static bool IsMOD(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"IsMOD",
BindingFlags.Static | BindingFlags.Public
);
bool isMOD = (bool)method.Invoke(
null,
new object[] {
clip
}
);
return isMOD;
}
public static int GetMODChannelCount() {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetMODChannelCount",
BindingFlags.Static | BindingFlags.Public
);
int channels = (int)method.Invoke(
null,
null
);
return channels;
}
public static AnimationCurve GetLowpassCurve(AudioLowPassFilter lowPassFilter) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetLowpassCurve",
BindingFlags.Static | BindingFlags.Public
);
AnimationCurve curve = (AnimationCurve)method.Invoke(
null,
new object[] {
lowPassFilter
}
);
return curve;
}
public static Vector3 GetListenerPos() {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetListenerPos",
BindingFlags.Static | BindingFlags.Public
);
Vector3 position = (Vector3)method.Invoke(
null,
null
);
return position;
}
public static void UpdateAudio() {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"UpdateAudio",
BindingFlags.Static | BindingFlags.Public
);
method.Invoke(
null,
null
);
}
public static void SetListenerTransform(Transform t) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"SetListenerTransform",
BindingFlags.Static | BindingFlags.Public
);
method.Invoke(
null,
new object[] {
t
}
);
}
public static AudioType GetClipType(AudioClip clip) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetClipType",
BindingFlags.Static | BindingFlags.Public
);
AudioType type = (AudioType)method.Invoke(
null,
new object[] {
clip
}
);
return type;
}
public static AudioType GetPlatformConversionType(AudioType inType , BuildTargetGroup targetGroup , AudioCompressionFormat format) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetPlatformConversionType",
BindingFlags.Static | BindingFlags.Public
);
AudioType type = (AudioType)method.Invoke(
null,
new object[] {
inType,
targetGroup,
format
}
);
return type;
}
public static bool HaveAudioCallback(MonoBehaviour behaviour) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"HaveAudioCallback",
BindingFlags.Static | BindingFlags.Public
);
bool hasCallback = (bool)method.Invoke(
null,
new object[] {
behaviour
}
);
return hasCallback;
}
public static int GetCustomFilterChannelCount(MonoBehaviour behaviour) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetCustomFilterChannelCount",
BindingFlags.Static | BindingFlags.Public
);
int channels = (int)method.Invoke(
null,
new object[] {
behaviour
}
);
return channels;
}
public static int GetCustomFilterProcessTime(MonoBehaviour behaviour) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetCustomFilterProcessTime",
BindingFlags.Static | BindingFlags.Public
);
int processTime = (int)method.Invoke(
null,
new object[] {
behaviour
}
);
return processTime;
}
public static float GetCustomFilterMaxIn(MonoBehaviour behaviour , int channel) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetCustomFilterMaxIn",
BindingFlags.Static | BindingFlags.Public
);
float maxIn = (float)method.Invoke(
null,
new object[] {
behaviour,
channel
}
);
return maxIn;
}
public static float GetCustomFilterMaxOut(MonoBehaviour behaviour , int channel) {
Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
MethodInfo method = audioUtilClass.GetMethod(
"GetCustomFilterMaxOut",
BindingFlags.Static | BindingFlags.Public
);
float maxOut = (float)method.Invoke(
null,
new object[] {
behaviour,
channel
}
);
return maxOut;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: b7999cc19883fd6488211f59f41f4ae1
timeCreated: 1511002726
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,199 @@
namespace Dreamteck
{
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
#if !UNITY_2018_3_OR_NEWER
using System.Reflection;
using Type = System.Type;
#endif
public static class DreamteckEditorGUI
{
public static Texture2D blankImage
{
get
{
if (_blankImage == null)
{
_blankImage = new Texture2D(1, 1);
_blankImage.SetPixel(0, 0, Color.white);
_blankImage.Apply();
}
return _blankImage;
}
}
private static Texture2D _blankImage = null;
public static readonly Color backgroundColor = new Color(0.95f, 0.95f, 0.95f);
public static Color iconColor = Color.black;
public static readonly Color highlightColor = new Color(0f, 0.564f, 1f, 1f);
public static readonly Color highlightContentColor = new Color(1f, 1f, 1f, 0.95f);
public static readonly Color inactiveColor = new Color(0.7f, 0.7f, 0.7f, 0.5f);
public static readonly Color activeColor = new Color(1f, 1f, 1f, 1f);
public static readonly Color baseColor = Color.white;
public static readonly Color lightColor = Color.white;
public static readonly Color lightDarkColor = Color.white;
public static readonly Color darkColor = Color.white;
public static readonly Color borderColor = Color.white;
private static string[] layerNames = new string[0];
private static int[] layerIndices = new int[0];
public static readonly GUIStyle labelText = null;
private static float scale = -1f;
#if !UNITY_2018_3_OR_NEWER
private static MethodInfo gradientFieldMethod;
#endif
static DreamteckEditorGUI()
{
baseColor = EditorGUIUtility.isProSkin ? new Color32(56, 56, 56, 255) : new Color32(194, 194, 194, 255);
lightColor = EditorGUIUtility.isProSkin ? new Color32(84, 84, 84, 255) : new Color32(222, 222, 222, 255);
lightDarkColor = EditorGUIUtility.isProSkin ? new Color32(30, 30, 30, 255) : new Color32(180, 180, 180, 255);
darkColor = EditorGUIUtility.isProSkin ? new Color32(15, 15, 15, 255) : new Color32(152, 152, 152, 255);
borderColor = EditorGUIUtility.isProSkin ? new Color32(5, 5, 5, 255) : new Color32(100, 100, 100, 255);
backgroundColor = baseColor;
backgroundColor -= new Color(0.1f, 0.1f, 0.1f, 0f);
iconColor = GUI.skin.label.normal.textColor;
labelText = new GUIStyle(GUI.skin.GetStyle("label"));
labelText.fontStyle = FontStyle.Bold;
labelText.alignment = TextAnchor.MiddleRight;
labelText.normal.textColor = Color.white;
SetScale(1f);
#if !UNITY_2018_3_OR_NEWER
Type tyEditorGUILayout = typeof(EditorGUILayout);
gradientFieldMethod = tyEditorGUILayout.GetMethod("GradientField", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(string), typeof(Gradient), typeof(GUILayoutOption[]) }, null);
#endif
}
public static void SetScale(float newScale)
{
if (scale == newScale) return;
scale = newScale;
labelText.fontSize = Mathf.RoundToInt(12f * scale);
}
public static void Label(Rect position, string text, bool active = true, GUIStyle style = null)
{
if (style == null) style = labelText;
if (!active) GUI.color = inactiveColor;
else GUI.color = activeColor;
GUI.color = new Color(0f, 0f, 0f, GUI.color.a * 0.5f);
GUI.Label(new Rect(position.x - 1, position.y + 1, position.width, position.height), text, style);
if (!active) GUI.color = inactiveColor;
else GUI.color = activeColor;
GUI.Label(position, text, style);
}
public static LayerMask LayermaskField(string name, LayerMask input)
{
int layersCount = 0;
for (int i = 0; i < 32; i++)
{
if (LayerMask.LayerToName(i) != "") layersCount++;
}
if(layerNames.Length != layersCount)
{
layerNames = new string[layersCount];
layerIndices = new int[layersCount];
}
int index = 0;
for (int i = 0; i < 32; i++)
{
string layerName = LayerMask.LayerToName(i);
if (layerName != null)
{
if (index >= layerName.Length) continue;
layerNames[index] = layerName;
layerIndices[index] = i;
index++;
}
}
int maskWithoutEmpty = 0;
for (int i = 0; i < layerIndices.Length; i++)
{
if (((1 << layerIndices[i]) & input.value) > 0)
maskWithoutEmpty |= (1 << i);
}
maskWithoutEmpty = EditorGUILayout.MaskField(name, maskWithoutEmpty, layerNames);
int mask = 0;
for (int i = 0; i < layerIndices.Length; i++)
{
if ((maskWithoutEmpty & (1 << i)) > 0)
mask |= (1 << layerIndices[i]);
}
return mask;
}
public static bool DropArea<T>(Rect rect, out T[] content)
{
content = new T[0];
switch (Event.current.type)
{
case EventType.DragUpdated:
case EventType.DragPerform:
if (!rect.Contains(Event.current.mousePosition)) return false;
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
if (Event.current.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
List<T> contentList = new List<T>();
foreach (object dragged_object in DragAndDrop.objectReferences)
{
if (dragged_object is GameObject)
{
GameObject gameObject = (GameObject)dragged_object;
#if UNITY_2018_3_OR_NEWER
bool isNotAprefab = PrefabUtility.GetPrefabAssetType(gameObject) == PrefabAssetType.NotAPrefab;
#else
bool isNotAprefab = PrefabUtility.GetPrefabType(gameObject) == PrefabType.None;
#endif
if (isNotAprefab)
{
if (gameObject.GetComponent<T>() != null) contentList.Add(gameObject.GetComponent<T>());
}
}
}
content = contentList.ToArray();
return true;
}
else return false;
}
return false;
}
public static Gradient GradientField(string label, Gradient gradient, params GUILayoutOption[] options)
{
#if UNITY_2018_3_OR_NEWER
return EditorGUILayout.GradientField(label, gradient, options);
#else
gradient = (Gradient)gradientFieldMethod.Invoke(null, new object[] { label, gradient, options });
return gradient;
#endif
}
public static void DrawSeparator()
{
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
Rect rect = GUILayoutUtility.GetRect(Screen.width / 2f, 2f);
EditorGUI.DrawRect(rect, darkColor);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
}
}
}

View File

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

View File

@@ -0,0 +1,110 @@
using UnityEngine;
using UnityEditor;
namespace Dreamteck
{
public class EditorGUIEvents
{
public bool mouseLeft = false;
public bool mouseRight = false;
public bool mouseLeftDown = false;
public bool mouseRightDown = false;
public bool mouseLeftUp = false;
public bool mouseRightUp = false;
public bool control = false;
public bool shift = false;
public bool alt = false;
public bool enterDown = false;
public Vector2 mousPos = Vector2.zero;
public Vector2 lastClickPoint = Vector2.zero;
public Vector2 mouseClickDelta
{
get
{
return Event.current.mousePosition - lastClickPoint;
}
}
public delegate void CommandHandler(string command);
public delegate void KeyCodeHandler(KeyCode code);
public delegate void MouseHandler(int button);
public delegate void EmptyHandler();
public event CommandHandler onCommand;
public event KeyCodeHandler onkeyDown;
public event KeyCodeHandler onKeyUp;
public event MouseHandler onMouseDown;
public event MouseHandler onMouseUp;
public void Use()
{
mouseLeft = false;
mouseRight = false;
mouseLeftDown = false;
mouseRightDown = false;
mouseLeftUp = false;
mouseRightUp = false;
control = false;
shift = false;
alt = false;
Event.current.Use();
}
public void Update()
{
ListenInput(Event.current);
}
public void Update(Event current)
{
ListenInput(current);
}
void ListenInput(Event e)
{
//int controlID = GUIUtility.GetControlID(FocusType.Passive);
mousPos = e.mousePosition;
mouseLeftDown = mouseLeftUp = mouseRightDown = mouseRightUp = false;
control = e.control;
shift = e.shift;
alt = e.alt;
enterDown = false;
switch (e.type)
{
case EventType.MouseDown:
if (e.button == 0)
{
mouseLeftDown = true;
mouseLeft = true;
lastClickPoint = e.mousePosition;
}
if (e.button == 1) mouseRightDown = mouseRight = true;
if (onMouseDown != null) onMouseDown(e.button);
break;
case EventType.MouseUp:
if (e.button == 0)
{
mouseLeftUp = true;
mouseLeft = false;
}
if (e.button == 1)
{
mouseRightDown = true;
mouseRight = false;
}
if (onMouseUp != null) onMouseUp(e.button);
break;
case EventType.KeyDown:
if (onkeyDown != null) onkeyDown(e.keyCode);
if (e.keyCode == KeyCode.Return || e.keyCode == KeyCode.KeypadEnter) enterDown = true;
break;
case EventType.KeyUp:
if (onKeyUp != null) onKeyUp(e.keyCode);
break;
}
if (onCommand != null && e.commandName != "") onCommand(e.commandName);
}
}
}

View File

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

View File

@@ -0,0 +1,53 @@
using UnityEngine;
using System.Collections;
using System;
using System.Reflection;
using System.Collections.Generic;
namespace Dreamteck
{
public static class FindDerivedClasses
{
public static List<Type> GetAllDerivedClasses(this Type aBaseClass, string[] aExcludeAssemblies)
{
List<Type> result = new List<Type>();
foreach (Assembly A in AppDomain.CurrentDomain.GetAssemblies())
{
if (A is System.Reflection.Emit.AssemblyBuilder) continue;
bool exclude = false;
foreach (string S in aExcludeAssemblies)
{
if (A.GetName().FullName.StartsWith(S))
{
exclude = true;
break;
}
}
if (exclude)
continue;
if (aBaseClass.IsInterface)
{
foreach (Type C in A.GetExportedTypes())
foreach (Type I in C.GetInterfaces())
if (aBaseClass == I)
{
result.Add(C);
break;
}
}
else
{
foreach (Type C in A.GetExportedTypes())
if (C.IsSubclassOf(aBaseClass))
result.Add(C);
}
}
return result;
}
public static List<Type> GetAllDerivedClasses(this Type aBaseClass)
{
return GetAllDerivedClasses(aBaseClass, new string[0]);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 12a29dbe4d6c3f648aae86fce0402487
timeCreated: 1450553632
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: aa46a23fd0180d240bea350783ff82b5
folderAsset: yes
timeCreated: 1522493680
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: 703957d2518de2c47a715a045b142ec6
timeCreated: 1522535496
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: ca2ec96e04914514ca532b6d55c85db4
timeCreated: 1522493758
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: efab8674905315440a387b05c0ce5ff4
timeCreated: 1522534229
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: af24004f75afd39469d2be2087678650
timeCreated: 1522495632
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 7004b4ab0ebf5ea43bd227e21913ba75
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: 3ad88cea831f74448b8fbce9f906c4ae
timeCreated: 1522495786
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 2d408c4aeee3cf742a05436998ade025
timeCreated: 1477248547
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 645a8bd65986fe24d863511d1d8ddc60
timeCreated: 1477247161
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 1c2813fa4a97ab442b80f29592282375
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
namespace Dreamteck.Editor
{
using UnityEngine;
using UnityEditor;
public class Toolbar
{
GUIContent[] shownContent;
GUIContent[] allContent;
public bool center = true;
public bool newLine = true;
public float elementWidth = 0f;
public float elementHeight = 23f;
public Toolbar(GUIContent[] iconsNormal, GUIContent[] iconsSelected, float elementWidth = 0f)
{
this.elementWidth = elementWidth;
if(iconsNormal.Length != iconsSelected.Length)
{
Debug.LogError("Invalid icon count for toolbar ");
return;
}
allContent = new GUIContent[iconsNormal.Length * 2];
shownContent = new GUIContent[iconsNormal.Length];
iconsNormal.CopyTo(allContent, 0);
iconsSelected.CopyTo(allContent, iconsNormal.Length);
}
public void SetContent(int index, GUIContent content)
{
allContent[index] = content;
allContent[shownContent.Length + index] = content;
}
public void SetContent(int index, GUIContent content, GUIContent contentSelected)
{
allContent[index] = content;
allContent[shownContent.Length + index] = contentSelected;
}
public void Draw(ref int selected)
{
for (int i = 0; i < shownContent.Length; i++)
{
shownContent[i] = selected == i ? allContent[shownContent.Length + i] : allContent[i];
}
if(newLine) EditorGUILayout.BeginHorizontal();
if(center) GUILayout.FlexibleSpace();
if(elementWidth > 0f) selected = GUILayout.Toolbar(selected, shownContent, GUILayout.Width(elementWidth * shownContent.Length), GUILayout.Height(elementHeight));
else selected = GUILayout.Toolbar(selected, shownContent, GUILayout.Height(elementHeight));
if (center) GUILayout.FlexibleSpace();
if (newLine) EditorGUILayout.EndHorizontal();
}
}
}

View File

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

View File

@@ -0,0 +1,377 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace Dreamteck
{
public class WelcomeWindow : EditorWindow
{
public delegate void EmptyHandler();
protected WindowPanel[] panels = new WindowPanel[0];
protected Texture2D header;
private bool init = false;
protected static GUIStyle wrapText;
protected static GUIStyle buttonTitleText;
protected static GUIStyle warningText;
protected static GUIStyle titleText;
protected string headerTitle = "";
public virtual void Load()
{
init = false;
minSize = maxSize = new Vector2(450, 500);
}
protected virtual void SetTitle(string titleBar, string header)
{
titleContent = new GUIContent(titleBar);
headerTitle = header;
}
protected virtual void GetHeader()
{
header = null;
}
protected void OnGUI()
{
if (!init)
{
buttonTitleText = new GUIStyle(GUI.skin.GetStyle("label"));
buttonTitleText.fontStyle = FontStyle.Bold;
titleText = new GUIStyle(GUI.skin.GetStyle("label"));
titleText.fontSize = 25;
titleText.fontStyle = FontStyle.Bold;
titleText.alignment = TextAnchor.MiddleLeft;
titleText.normal.textColor = Color.white;
warningText = new GUIStyle(GUI.skin.GetStyle("label"));
warningText.fontSize = 18;
warningText.fontStyle = FontStyle.Bold;
warningText.normal.textColor = Color.red;
warningText.alignment = TextAnchor.MiddleCenter;
wrapText = new GUIStyle(GUI.skin.GetStyle("label"));
wrapText.wordWrap = true;
Load();
init = true;
}
if (header == null) GetHeader();
GUI.DrawTexture(new Rect(0, 0, maxSize.x, 82), header, ScaleMode.StretchToFill);
GUI.Label(new Rect(90, 15, Screen.width - 95, 50), headerTitle, titleText);
for (int i = 0; i < panels.Length; i++) panels[i].Draw();
Repaint();
}
public class WindowPanel
{
public WindowPanel back = null;
public float slideStart = 0f;
public float slideDuration = 1f;
public enum SlideDiretion { Left, Right, Up, Down }
public SlideDiretion openDirection = SlideDiretion.Left;
public SlideDiretion closeDirection = SlideDiretion.Right;
private Vector2 origin = Vector2.zero;
private bool open = false;
private bool goingBack = false;
public List<Element> elements = new List<Element>();
public WindowPanel(string title, bool o, float slideDur = 1f)
{
slideDuration = slideDur;
SetState(o, false);
}
public WindowPanel(string title, bool o, WindowPanel backPanel, float slideDur = 1f)
{
slideDuration = slideDur;
SetState(o, false);
back = backPanel;
}
public bool isActive
{
get
{
return open || Time.realtimeSinceStartup - slideStart <= slideDuration;
}
}
public void Back()
{
Close(true, true);
back.Open(true, true);
}
public void Close(bool useTransition, bool goBack = false)
{
SetState(false, useTransition, goBack);
}
public void Open(bool useTransition, bool goBack = false)
{
goingBack = false;
SetState(true, useTransition, goBack);
}
Vector2 GetSize()
{
return new Vector2(Screen.width, Screen.height- 82);
}
void HandleOrigin()
{
float percent = Mathf.Clamp01((Time.realtimeSinceStartup - slideStart) / slideDuration);
Vector2 size = GetSize();
SlideDiretion dir = openDirection;
if (goingBack) dir = closeDirection;
if (open)
{
switch (dir)
{
case SlideDiretion.Left:
origin.x = Mathf.SmoothStep(size.x, 0f, percent);
origin.y = 0f;
break;
case SlideDiretion.Right:
origin.x = Mathf.SmoothStep(-size.x, 0f, percent);
origin.y = 0f;
break;
case SlideDiretion.Up:
origin.x = 0f;
origin.y = Mathf.SmoothStep(size.y, 0f, percent);
break;
case SlideDiretion.Down:
origin.x = 0f;
origin.y = Mathf.SmoothStep(-size.y, 0f, percent);
break;
}
}
else
{
switch (dir)
{
case SlideDiretion.Left:
origin.x = Mathf.SmoothStep(0f, -size.x, percent);
origin.y = 0f;
break;
case SlideDiretion.Right:
origin.x = Mathf.SmoothStep(0f, size.x, percent);
origin.y = 0f;
break;
case SlideDiretion.Up:
origin.x = 0f;
origin.y = Mathf.SmoothStep(0f, -size.y, percent);
break;
case SlideDiretion.Down:
origin.x = 0f;
origin.y = Mathf.SmoothStep(0f, -size.y, percent);
break;
}
}
}
void SetState(bool state, bool useTransition, bool goBack = false)
{
if (open == state) return;
open = state;
if (useTransition) slideStart = Time.realtimeSinceStartup;
else slideStart = Time.realtimeSinceStartup + slideDuration;
goingBack = goBack;
}
public void Draw()
{
if (!isActive) return;
HandleOrigin();
Vector2 size = GetSize();
GUILayout.BeginArea(new Rect(origin.x + 25, origin.y + 85, size.x - 25, size.y));
//Back button
if (back != null)
{
if (GUILayout.Button("◄", GUILayout.Width(45), GUILayout.Height(25)))
{
Back();
}
}
for (int i = 0; i < elements.Count; i++) elements[i].Draw();
GUILayout.EndArea();
}
public class Element
{
protected Vector2 size = Vector2.zero;
public ActionLink action = null;
public Element(float x, float y, ActionLink a = null)
{
size = new Vector2(x, y);
action = a;
}
internal virtual void Draw()
{
}
}
public class Space : Element
{
public Space(float x, float y) : base(x, y)
{
}
internal override void Draw()
{
GUILayoutUtility.GetRect(size.x, size.y);
}
}
public class Button : Element
{
string text = "";
public Button(float x, float y, string t, ActionLink a) : base(x, y, a)
{
text = t;
}
internal override void Draw()
{
base.Draw();
if(GUILayout.Button(text, GUILayout.Width(size.x), GUILayout.Height(size.y)))
{
if (action != null) action.Do();
}
}
}
public class Thumbnail : Element
{
private string thumbnailPath = "";
private string thumbnailName = "";
private Texture2D thumbnail = null;
public string title = "";
public string description = "";
public Thumbnail(string path, string fileName, string t, string d, ActionLink a, float x = 400, float y = 50) : base(x, y, a)
{
title = t;
description = d;
thumbnailPath = path;
thumbnailName = fileName;
thumbnail = ImageDB.GetImage(thumbnailName, thumbnailPath);
}
internal override void Draw()
{
Rect rect = GUILayoutUtility.GetRect(size.x, size.y);
Color buttonColor = Color.clear;
if (rect.Contains(Event.current.mousePosition)) buttonColor = Color.white;
GUI.BeginGroup(rect);
GUI.color = buttonColor;
if (GUI.Button(new Rect(0, 0, size.x, size.y), "")) action.Do();
GUI.color = Color.white;
if (thumbnail != null) GUI.DrawTexture(new Rect(0, 0, 50, 50), thumbnail, ScaleMode.StretchToFill);
GUI.Label(new Rect(60, 5, 370 - 65, 16), title, buttonTitleText);
GUI.Label(new Rect(60, 20, 370 - 65, 40), description, wrapText);
GUI.EndGroup();
GUILayout.Space(10);
}
}
public class ScrollText : Element
{
Vector2 scroll = Vector2.zero;
string text = "";
public ScrollText(float x, float y, string t) : base(x, y)
{
text = t;
}
internal override void Draw()
{
base.Draw();
scroll = GUILayout.BeginScrollView(scroll, GUILayout.Width(size.x), GUILayout.MaxHeight(size.y));
EditorGUILayout.LabelField(text, wrapText, GUILayout.Width(size.x - 30));
GUILayout.EndScrollView();
}
}
public class Label : Element
{
string text = "";
Color color;
GUIStyle style = null;
public Label(string t, GUIStyle s, Color col) : base(400, 30)
{
color = col;
text = t;
style = s;
}
public Label(string t, GUIStyle s, Color col, float x, float y) : base(x, y)
{
color = col;
text = t;
style = s;
}
internal override void Draw()
{
base.Draw();
Color prev = GUI.color;
GUI.color = color;
if(style == null) EditorGUILayout.LabelField(text, GUILayout.Width(size.x), GUILayout.Height(size.y));
else EditorGUILayout.LabelField(text, style, GUILayout.Width(size.x), GUILayout.Height(size.y));
GUI.color = prev;
}
}
}
public class ActionLink {
private string URL = "";
private WindowPanel currentPanel = null;
private WindowPanel targetPanel = null;
private EmptyHandler customHandler = null;
public ActionLink(string u)
{
URL = u;
}
public ActionLink(EmptyHandler handler)
{
customHandler = handler;
}
public ActionLink(WindowPanel target, WindowPanel current)
{
currentPanel = current;
targetPanel = target;
}
public void Do()
{
if (customHandler != null) customHandler();
else if(URL != "") Application.OpenURL(URL);
else if(targetPanel != null && currentPanel != null)
{
currentPanel.Close(true);
targetPanel.Open(true);
}
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: bada76b30269a9144848e487cf253360
timeCreated: 1522397149
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: