将Spline移出Plugin,以调整SplineRenderer的OnWillCameraRender

This commit is contained in:
SoulliesOfficial
2025-03-01 22:58:20 -05:00
parent 860d7393fb
commit 5d775ae687
529 changed files with 237 additions and 119 deletions

View File

@@ -0,0 +1,170 @@
namespace Dreamteck
{
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
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 List<int> layerNumbers = new List<int>();
public static readonly GUIStyle labelText = null;
private static float scale = -1f;
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);
}
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 label, LayerMask layerMask)
{
string[] layers = UnityEditorInternal.InternalEditorUtility.layers;
layerNumbers.Clear();
for (int i = 0; i < layers.Length; i++)
{
layerNumbers.Add(LayerMask.NameToLayer(layers[i]));
}
int maskWithoutEmpty = 0;
for (int i = 0; i < layerNumbers.Count; i++)
{
if (((1 << layerNumbers[i]) & layerMask.value) > 0)
{
maskWithoutEmpty |= (1 << i);
}
}
maskWithoutEmpty = EditorGUILayout.MaskField(label, maskWithoutEmpty, layers);
int mask = 0;
for (int i = 0; i < layerNumbers.Count; i++)
{
if ((maskWithoutEmpty & (1 << i)) > 0)
{
mask |= (1 << layerNumbers[i]);
}
}
layerMask.value = mask;
return layerMask;
}
public static bool DropArea<T>(Rect rect, out T[] content, bool acceptProjectAssets = false)
{
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 (acceptProjectAssets || !AssetDatabase.Contains(gameObject))
{
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)
{
return EditorGUILayout.GradientField(label, gradient, options);
}
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,113 @@
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 bool v = 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;
if (e.keyCode == KeyCode.V) v = true;
break;
case EventType.KeyUp:
if (onKeyUp != null) onKeyUp(e.keyCode);
if (e.keyCode == KeyCode.V) v = false;
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,66 @@
namespace Dreamteck
{
using UnityEngine;
using System;
using System.Reflection;
using System.Collections.Generic;
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())
{
bool exclude = false;
foreach (string S in aExcludeAssemblies)
{
if (A.GetName().FullName.StartsWith(S))
{
exclude = true;
break;
}
}
if (exclude)
{
continue;
}
try
{
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);
}
}
}
} catch
{
Debug.LogWarning("Dreamteck was unable to scan " + A.FullName + " for derived classes");
}
}
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: 3.0 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: 2.9 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: 3.0 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: 3.1 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: 3.0 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: 4.8 KiB

View File

@@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 3cd14c6e15dcfdb41b9a79ef8554198d
timeCreated: 1477254890
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: 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: 3.0 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: 3.5 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: 3.6 KiB

View File

@@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 46f43b30b6801ed4d85d58179e7ab3b0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
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
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: 8a25750cc3c734140b2fd9dac637a8b3
timeCreated: 1522495055
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:

View File

@@ -0,0 +1,199 @@
namespace Dreamteck.Editor
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using UnityEditor;
public class ModuleInstaller
{
protected const string DREAMTECK_FOLDER_NAME = "Dreamteck";
/// <summary>
/// Local directory within the Dreamteck folder of the unitypackage
/// </summary>
private string _packageDirectory = "";
private string _packageName = "";
private List<string> _scriptingDefines = new List<string>();
private List<string> _uninstallDirectories = new List<string>();
private Dictionary<string, List<string>> _assemblyLinks = new Dictionary<string, List<string>>();
public ModuleInstaller(string packageDirectory, string packageName)
{
_packageDirectory = packageDirectory;
_packageName = packageName;
}
public void AddAssemblyLink(string dreamteckAssemblyDirectory, string dreamteckAssemblyName, string addedAssemblyName)
{
string localFilePath = Path.Combine(DREAMTECK_FOLDER_NAME, dreamteckAssemblyDirectory, dreamteckAssemblyName + ".asmdef");
if (_assemblyLinks.ContainsKey(localFilePath))
{
_assemblyLinks[localFilePath].Add(addedAssemblyName);
} else
{
_assemblyLinks.Add(localFilePath, new List<string>(new string[] { addedAssemblyName }));
}
}
public void AddUninstallDirectory(string dreamteckLocalDirectory)
{
if (!_uninstallDirectories.Contains(dreamteckLocalDirectory))
{
_uninstallDirectories.Add(dreamteckLocalDirectory);
}
}
public void AddScriptingDefine(string define)
{
if (!_scriptingDefines.Contains(define))
{
_scriptingDefines.Add(define);
}
}
public void Install()
{
string globalPath = ResourceUtility.FindFolder(Application.dataPath, DREAMTECK_FOLDER_NAME + "/" + _packageDirectory);
if (!Directory.Exists(globalPath))
{
EditorUtility.DisplayDialog("Missing Package", "Package directory not found: " + _packageDirectory, "OK");
return;
}
globalPath = Path.Combine(globalPath, _packageName + ".unitypackage");
if (!File.Exists(globalPath))
{
EditorUtility.DisplayDialog("Missing Package", "Package file not found: " + _packageDirectory, "OK");
return;
}
foreach (var key in _assemblyLinks.Keys)
{
for (int i = 0; i < _assemblyLinks[key].Count; i++)
{
AddAssemblyReference(key, _assemblyLinks[key][i]);
}
}
AssetDatabase.ImportPackage(globalPath, false);
EditorUtility.DisplayDialog("Import Complete", _packageName + " is now installed.", "OK");
for (int i = 0; i < _scriptingDefines.Count; i++)
{
ScriptingDefineUtility.Add(_scriptingDefines[i], EditorUserBuildSettings.selectedBuildTargetGroup, true);
}
}
public void Uninstall()
{
string dialogText = "The assets in the following folders will be removed: \n";
for (int i = 0; i < _uninstallDirectories.Count; i++)
{
dialogText += _uninstallDirectories[i] + "\n";
}
bool result = EditorUtility.DisplayDialog("Uninstalling", dialogText, "OK", "Cancel");
if (!result) return;
for (int i = 0; i < _uninstallDirectories.Count; i++)
{
string globalPath = ResourceUtility.FindFolder(Application.dataPath, DREAMTECK_FOLDER_NAME + "/" + _uninstallDirectories[i]);
string relativePath = "Assets" + globalPath.Substring(Application.dataPath.Length);
Debug.Log("Uninstalling " + relativePath);
AssetDatabase.DeleteAsset(relativePath);
}
foreach (var key in _assemblyLinks.Keys)
{
for (int i = 0; i < _assemblyLinks[key].Count; i++)
{
RemoveAssemblyReference(key, _assemblyLinks[key][i]);
}
}
for (int i = 0; i < _scriptingDefines.Count; i++)
{
ScriptingDefineUtility.Remove(_scriptingDefines[i], EditorUserBuildSettings.selectedBuildTargetGroup, true);
}
}
private static void AddAssemblyReference(string dreamteckAssemblyPath, string addedAssemblyName)
{
var path = Path.Combine(Application.dataPath, dreamteckAssemblyPath);
var data = "";
using (var reader = new StreamReader(path))
{
data = reader.ReadToEnd();
}
var asmDef = AssemblyDefinition.CreateFromJSON(data);
foreach (var reference in asmDef.references)
{
if (reference == addedAssemblyName) return;
}
ArrayUtility.Add(ref asmDef.references, addedAssemblyName);
Debug.Log("Adding " + addedAssemblyName + " to assembly " + dreamteckAssemblyPath);
using (var writer = new StreamWriter(path, false))
{
writer.Write(asmDef.ToString());
}
}
private static void RemoveAssemblyReference(string dreamteckAssemblyPath, string addedAssemblyName)
{
var path = Path.Combine(Application.dataPath, dreamteckAssemblyPath);
var data = "";
using (var reader = new StreamReader(path))
{
data = reader.ReadToEnd();
}
var asmDef = AssemblyDefinition.CreateFromJSON(data);
bool contains = false;
foreach (var reference in asmDef.references)
{
if (reference != addedAssemblyName) continue;
contains = true;
break;
}
if (!contains) return;
ArrayUtility.Remove(ref asmDef.references, addedAssemblyName);
Debug.Log("Removing " + addedAssemblyName + " from assembly " + dreamteckAssemblyPath);
using (var writer = new StreamWriter(path, false))
{
writer.Write(asmDef.ToString());
}
}
[System.Serializable]
public struct AssemblyDefinition
{
public string name;
public string rootNamespace;
public string[] references;
public string[] includePlatforms;
public string[] exludePlatforms;
public bool allowUnsafeCode;
public bool overrideReferences;
public string precompiledReferences;
public bool autoReferenced;
public string[] defineConstraints;
public string[] versionDefines;
public bool noEngineReferences;
public static AssemblyDefinition CreateFromJSON(string json)
{
return JsonUtility.FromJson<AssemblyDefinition>(json);
}
public override string ToString()
{
return JsonUtility.ToJson(this, true);
}
}
}
}

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -0,0 +1,30 @@
namespace Dreamteck.Editor
{
using UnityEngine;
using UnityEditor;
public static class ScriptingDefineUtility
{
public static void Add(string define, BuildTargetGroup target, bool log = false)
{
string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(target);
if (definesString.Contains(define)) return;
string[] allDefines = definesString.Split(';');
ArrayUtility.Add(ref allDefines, define);
definesString = string.Join(";", allDefines);
PlayerSettings.SetScriptingDefineSymbolsForGroup(target, definesString);
Debug.Log("Added \"" + define + "\" from " + EditorUserBuildSettings.selectedBuildTargetGroup + " Scripting define in Player Settings");
}
public static void Remove(string define, BuildTargetGroup target, bool log = false)
{
string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(target);
if (!definesString.Contains(define)) return;
string[] allDefines = definesString.Split(';');
ArrayUtility.Remove(ref allDefines, define);
definesString = string.Join(";", allDefines);
PlayerSettings.SetScriptingDefineSymbolsForGroup(target, definesString);
Debug.Log("Removed \""+ define + "\" from " + EditorUserBuildSettings.selectedBuildTargetGroup + " Scripting define in Player Settings");
}
}
}

View File

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

View File

@@ -0,0 +1,64 @@
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 Toolbar(GUIContent[] contents, float elementWidth = 0f)
{
this.elementWidth = elementWidth;
allContent = new GUIContent[contents.Length * 2];
shownContent = new GUIContent[contents.Length];
contents.CopyTo(allContent, 0);
contents.CopyTo(allContent, contents.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,555 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
namespace Dreamteck
{
public class WelcomeWindow : EditorWindow
{
public delegate void EmptyHandler();
protected WindowPanel[] panels = new WindowPanel[0];
protected Texture2D header;
protected static GUIStyle wrapText;
protected static GUIStyle buttonTitleText;
protected static GUIStyle warningText;
protected static GUIStyle titleText;
protected bool _hasSentImageRequest;
protected List<UnityWebRequest> _textureWebRequests;
protected Data _bannerData;
protected string headerTitle = "";
private static bool init = true;
protected virtual Vector2 _windowSize => new Vector2(450, 500);
public virtual void Load()
{
minSize = maxSize = _windowSize;
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;
init = false;
}
protected virtual void SetTitle(string titleBar, string header)
{
titleContent = new GUIContent(titleBar);
headerTitle = header;
}
protected virtual void GetHeader()
{
header = null;
}
protected void OnEnable()
{
init = true;
}
protected void OnGUI()
{
if (init)
{
Load();
}
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();
}
protected Data LoadBannersData(string url, string savePrefKey)
{
var data = default(Data);
using (var mainDataReq = UnityWebRequest.Get(url))
{
mainDataReq.SendWebRequest();
while (!mainDataReq.isDone || mainDataReq.result == UnityWebRequest.Result.InProgress)
{
}
if (mainDataReq.result == UnityWebRequest.Result.ProtocolError ||
mainDataReq.result == UnityWebRequest.Result.DataProcessingError ||
mainDataReq.result == UnityWebRequest.Result.ConnectionError)
{
Debug.LogError("An error occured while fetching the banners data.");
}
else
{
var jObj = JsonUtility.FromJson<Data>(mainDataReq.downloadHandler.text);
data = new Data();
data.version = jObj.version;
data.banners = jObj.banners;
var currentVersion = EditorPrefs.GetInt(savePrefKey, -1);
if (currentVersion < 0 || currentVersion < data.version)
{
EditorPrefs.SetInt(savePrefKey, data.version);
}
}
}
return data;
}
protected void OnEditorUpdate()
{
if (!_hasSentImageRequest)
{
_hasSentImageRequest = false;
EditorApplication.update -= OnEditorUpdate;
return;
}
for (int i = 0; i < _textureWebRequests.Count; i++)
{
var request = _textureWebRequests[i];
if (!request.isDone || request.result == UnityWebRequest.Result.InProgress)
{
if (request.result == UnityWebRequest.Result.ConnectionError ||
request.result == UnityWebRequest.Result.ProtocolError ||
request.result == UnityWebRequest.Result.DataProcessingError)
{
_textureWebRequests.RemoveAt(i);
i--;
Debug.LogError("A banner request failed for the spline welcome screen! Please investigate!");
}
return;
}
}
for (int i = 0; i < _textureWebRequests.Count; i++)
{
var request = _textureWebRequests[i];
if (request.result == UnityWebRequest.Result.Success)
{
var texture = DownloadHandlerTexture.GetContent(request);
var data = _bannerData.banners[i];
var banner = new WindowPanel.Banner(texture, data.title, data.description, 400f, 70f, new ActionLink(data.forwardUrl));
panels[0].elements.Add(new WindowPanel.Space(400, 10));
panels[0].elements.Add(banner);
request.Dispose();
}
}
DrawFooter();
_hasSentImageRequest = false;
_textureWebRequests.Clear();
_textureWebRequests = null;
EditorApplication.update -= OnEditorUpdate;
}
protected virtual void DrawFooter()
{
}
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 Banner : Element
{
private string _title;
private string _description;
private Texture _image;
public Banner(float x, float y, ActionLink a = null) : base(x, y, a) { }
public Banner(Texture image, string title, string description, float x, float y, ActionLink a = null) : this(x, y, a)
{
_title = title;
_description = description;
_image = image;
size = new Vector2(image.width, image.height);
}
internal override void Draw()
{
Rect rect = GUILayoutUtility.GetRect(size.x, size.y);
EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
GUI.BeginGroup(rect);
if (GUI.Button(new Rect(0, 0, size.x, size.y), "")) action.Do();
GUI.DrawTexture(new Rect(Vector2.one, size), _image, ScaleMode.StretchToFill);
var hoverRect = new Rect(0, 0, size.x, size.y);
if (hoverRect.Contains(Event.current.mousePosition))
{
EditorGUI.DrawRect(hoverRect, new Color(1, 1, 1, 0.5f));
}
var titleStyle = new GUIStyle();
titleStyle.fontSize = 19;
titleStyle.fontStyle = FontStyle.Bold;
titleStyle.alignment = TextAnchor.MiddleLeft;
titleStyle.normal.textColor = Color.white;
EditorGUI.DropShadowLabel(new Rect(6, 5, 370 - 65, 18), _title, titleStyle);
var descriptionStyle = new GUIStyle();
descriptionStyle.fontSize = 11;
descriptionStyle.wordWrap = true;
descriptionStyle.fontStyle = FontStyle.Bold;
descriptionStyle.alignment = TextAnchor.MiddleLeft;
descriptionStyle.normal.textColor = Color.white;
EditorGUI.DropShadowLabel(new Rect(6, 20, 380, 40), _description, descriptionStyle);
GUI.EndGroup();
GUILayout.Space(5);
}
}
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 = 60) : base(x, y, a)
{
title = t;
description = d;
thumbnailPath = path;
thumbnailName = fileName;
thumbnail = ResourceUtility.EditorLoadTexture(thumbnailPath, thumbnailName);
}
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)
{
Vector2 offset = new Vector2(5, (size.y - 50) / 2);
GUI.DrawTexture(new Rect(offset, Vector2.one * 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(5);
}
}
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);
}
}
}
[System.Serializable]
public class Data
{
public BannerData[] banners;
public int version;
}
[System.Serializable]
public class BannerData
{
public string title;
public string description;
public string bannerUrl;
public string forwardUrl;
public int height;
}
}
}

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: