Compare commits
3 Commits
39630c4f78
...
386e83e2dc
Author | SHA1 | Date | |
---|---|---|---|
386e83e2dc | |||
2bf4beb5ae | |||
6e32342bd9 |
3
Editor/Constant.meta
Normal file
3
Editor/Constant.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b754973ba11c47d69820bf13f57d73fc
|
||||||
|
timeCreated: 1753701166
|
7
Editor/Constant/UXGUIConfig.cs
Normal file
7
Editor/Constant/UXGUIConfig.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
internal class UXGUIConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
public static readonly string RootPath = "Packages/com.alicizax.unity.ui.extension/";
|
||||||
|
public static readonly string GUIPath = RootPath + "Runtime/Res/UX-GUI/";
|
||||||
|
public static readonly string UIDefaultMatPath = GUIPath + "UX_ImageDefault.mat";
|
||||||
|
}
|
3
Editor/Constant/UXGUIConfig.cs.meta
Normal file
3
Editor/Constant/UXGUIConfig.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8524035785784316be7145b02ae2d658
|
||||||
|
timeCreated: 1753701173
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
3
Editor/Inspector.meta
Normal file
3
Editor/Inspector.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7fbc70da0ad64703a6ad7f8deadede84
|
||||||
|
timeCreated: 1753700883
|
105
Editor/Inspector/UIEffectWrapDrawer.cs
Normal file
105
Editor/Inspector/UIEffectWrapDrawer.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace UnityEngine.UI
|
||||||
|
{
|
||||||
|
public static class UIEffectWrapDrawer
|
||||||
|
{
|
||||||
|
static string LabelStr;
|
||||||
|
static string ShadowStr;
|
||||||
|
static string OutlineStr;
|
||||||
|
|
||||||
|
public static void InitInspectorString()
|
||||||
|
{
|
||||||
|
LabelStr = "Effect";
|
||||||
|
ShadowStr = "Shadow";
|
||||||
|
OutlineStr = "Outline";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void Draw(Rect position, GameObject target)
|
||||||
|
{
|
||||||
|
var nameRect = new Rect(position)
|
||||||
|
{
|
||||||
|
width = position.width / 2
|
||||||
|
};
|
||||||
|
|
||||||
|
EditorGUI.LabelField(nameRect, LabelStr);
|
||||||
|
|
||||||
|
var shadowRect = new Rect(position)
|
||||||
|
{
|
||||||
|
x = position.x + EditorGUIUtility.labelWidth + 2,
|
||||||
|
width = 60
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GUI.Button(shadowRect, ShadowStr))
|
||||||
|
{
|
||||||
|
if (target.GetComponent<UXTextMeshPro>() != null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else if (target.GetComponent<UXImage>() != null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GenShadowComponent(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
var outlineRect = new Rect(position)
|
||||||
|
{
|
||||||
|
x = shadowRect.x + 50 + 20,
|
||||||
|
width = 60
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GUI.Button(outlineRect, OutlineStr))
|
||||||
|
{
|
||||||
|
if (target.GetComponent<UXTextMeshPro>() != null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else if (target.GetComponent<UXImage>() != null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GenOutLineComponent(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GenOutLineComponent(GameObject target)
|
||||||
|
{
|
||||||
|
target.TryAddComponent<Outline>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GenShadowComponent(GameObject target)
|
||||||
|
{
|
||||||
|
//暂时无法处理 有继承关系的Component 单独判定区分outline
|
||||||
|
//target.TryAddComponent<Shadow>();
|
||||||
|
// Shadow[] components = target.GetComponents<Shadow>();
|
||||||
|
|
||||||
|
// bool hasShadow = false;
|
||||||
|
// for (int i = 0; i < components.Length; i++)
|
||||||
|
// {
|
||||||
|
// Outline outline = components[i] as Outline;
|
||||||
|
// //有一个不是OutLine就认为是Shadow
|
||||||
|
// if (outline == null)
|
||||||
|
// {
|
||||||
|
// hasShadow = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//if (!hasShadow)
|
||||||
|
//{
|
||||||
|
target.AddComponent<Shadow>();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static T TryAddComponent<T>(this GameObject target) where T : Component
|
||||||
|
{
|
||||||
|
//暂时无法处理 有继承关系的Component 挠头
|
||||||
|
target.TryGetComponent<T>(out T component);
|
||||||
|
//if (component == null)
|
||||||
|
//{
|
||||||
|
component = target.AddComponent<T>();
|
||||||
|
//}
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Inspector/UIEffectWrapDrawer.cs.meta
Normal file
3
Editor/Inspector/UIEffectWrapDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4040cba561a84d028e6210fb189703b6
|
||||||
|
timeCreated: 1753700892
|
73
Editor/Inspector/UXUIEditor.cs
Normal file
73
Editor/Inspector/UXUIEditor.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using TMPro.EditorUtilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
|
||||||
|
public class UXUIEditor : Editor
|
||||||
|
{
|
||||||
|
static object InvokeMethod(Type type, string methodName, object[] parameters = null)
|
||||||
|
{
|
||||||
|
if (parameters == null)
|
||||||
|
{
|
||||||
|
return type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).Invoke(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type[] types = new Type[parameters.Length];
|
||||||
|
for (int i = 0; i < parameters.Length; i++)
|
||||||
|
{
|
||||||
|
types[i] = parameters[i].GetType();
|
||||||
|
}
|
||||||
|
|
||||||
|
return type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static, null, types, null).Invoke(null, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("GameObject/UI/UXImage")]
|
||||||
|
public static void CreateUXImage(MenuCommand menuCommand)
|
||||||
|
{
|
||||||
|
Type MenuOptionsType = typeof(UnityEditor.UI.ImageEditor).Assembly.GetType("UnityEditor.UI.MenuOptions");
|
||||||
|
InvokeMethod(MenuOptionsType, "AddImage", new object[] { menuCommand });
|
||||||
|
GameObject obj = Selection.activeGameObject;
|
||||||
|
obj.name = "UXImage";
|
||||||
|
DestroyImmediate(obj.GetComponent<Image>());
|
||||||
|
var image = obj.AddComponent<UXImage>();
|
||||||
|
image.material = AssetDatabase.LoadAssetAtPath<Material>(UXGUIConfig.UIDefaultMatPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[MenuItem("GameObject/UI/UXTextMeshPro")]
|
||||||
|
private static void CreateUXTextMeshPro(MenuCommand menuCommand)
|
||||||
|
{
|
||||||
|
Type MenuOptionsType = typeof(UnityEditor.UI.ImageEditor).Assembly.GetType("UnityEditor.UI.MenuOptions");
|
||||||
|
InvokeMethod(MenuOptionsType, "AddText", new object[] { menuCommand });
|
||||||
|
GameObject obj = Selection.activeGameObject;
|
||||||
|
obj.name = "UXTextMeshPro";
|
||||||
|
DestroyImmediate(obj.GetComponent<Text>());
|
||||||
|
obj.AddComponent<UXTextMeshPro>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("GameObject/UI/UXButton")]
|
||||||
|
public static void CreateUXButton(MenuCommand menuCommand)
|
||||||
|
{
|
||||||
|
Type MenuOptionsType = typeof(TMPro.EditorUtilities.TMPro_CreateObjectMenu).Assembly.GetType("TMPro.EditorUtilities.TMPro_CreateObjectMenu");
|
||||||
|
InvokeMethod(MenuOptionsType, "AddButton", new object[] { menuCommand });
|
||||||
|
GameObject obj = Selection.activeGameObject;
|
||||||
|
obj.name = "UXButton";
|
||||||
|
DestroyImmediate(obj.GetComponent<Button>());
|
||||||
|
obj.AddComponent<UXButton>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("GameObject/UI/UXScrollView")]
|
||||||
|
private static void CreateUxRecyclerView()
|
||||||
|
{
|
||||||
|
GameObject selectionObject = Selection.activeGameObject;
|
||||||
|
if (selectionObject == null) return;
|
||||||
|
const string prefabPath = "Packages/com.alicizax.unity.ui.extension/Editor/RecyclerView/Res/ScrollView.prefab";
|
||||||
|
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
|
||||||
|
GameObject instance = (GameObject)PrefabUtility.InstantiatePrefab(prefab, selectionObject.transform);
|
||||||
|
PrefabUtility.UnpackPrefabInstance(instance, PrefabUnpackMode.Completely, InteractionMode.UserAction);
|
||||||
|
Selection.activeGameObject = instance;
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Inspector/UXUIEditor.cs.meta
Normal file
3
Editor/Inspector/UXUIEditor.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 585fa8e63ef44921940a43bb7c663bcb
|
||||||
|
timeCreated: 1753701116
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a9fd90c759c54481924b9549fa2d0330
|
|
||||||
timeCreated: 1743598816
|
|
@ -1,37 +0,0 @@
|
|||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace AlicizaX.UI.Extension.Editor
|
|
||||||
{
|
|
||||||
internal static class MenuExtension
|
|
||||||
{
|
|
||||||
[MenuItem("GameObject/UX/UXTextMeshPro", false, -1)]
|
|
||||||
private static void CreateUxTextMeshProUx()
|
|
||||||
{
|
|
||||||
GameObject selectionObject = Selection.activeGameObject;
|
|
||||||
var gameObject = new GameObject("UXTextMeshPro", typeof(UXTextMeshPro));
|
|
||||||
gameObject.transform.SetParent(selectionObject.transform);
|
|
||||||
var rectTransform = gameObject.GetComponent<RectTransform>();
|
|
||||||
var uxTextMeshPro = gameObject.GetComponent<UXTextMeshPro>();
|
|
||||||
uxTextMeshPro.text = "UXTextMeshPro";
|
|
||||||
rectTransform.anchoredPosition = Vector2.zero;
|
|
||||||
rectTransform.localPosition = Vector3.zero;
|
|
||||||
rectTransform.pivot = new Vector2(0.5f, 0.5f);
|
|
||||||
rectTransform.localScale = Vector3.one;
|
|
||||||
Selection.activeGameObject = gameObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MenuItem("GameObject/UX/RecyclerView", false, -1)]
|
|
||||||
private static void CreateUxRecyclerView()
|
|
||||||
{
|
|
||||||
GameObject selectionObject = Selection.activeGameObject;
|
|
||||||
if (selectionObject == null) return;
|
|
||||||
const string prefabPath = "Packages/com.alicizax.unity.ui.extension/Editor/RecyclerView/Res/ScrollView.prefab";
|
|
||||||
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
|
|
||||||
GameObject instance = (GameObject)PrefabUtility.InstantiatePrefab(prefab, selectionObject.transform);
|
|
||||||
PrefabUtility.UnpackPrefabInstance(instance, PrefabUnpackMode.Completely, InteractionMode.UserAction);
|
|
||||||
Selection.activeGameObject = instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a33cf28b887a48c3970fca2a7720b876
|
|
||||||
timeCreated: 1743598823
|
|
BIN
Editor/Res/Image Icon.png
Normal file
BIN
Editor/Res/Image Icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 584 B |
117
Editor/Res/Image Icon.png.meta
Normal file
117
Editor/Res/Image Icon.png.meta
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 15ee3f6b1f0782146bd77f1a10e869db
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
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
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 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: 1
|
||||||
|
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: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
customData:
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spriteCustomMetadata:
|
||||||
|
entries: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3a2c1fc8ad7d457abaf67dae3d5005de
|
|
||||||
timeCreated: 1738832149
|
|
843
Editor/UX/UXImageEditor.cs
Normal file
843
Editor/UX/UXImageEditor.cs
Normal file
@ -0,0 +1,843 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEditorInternal;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEditor.AnimatedValues;
|
||||||
|
|
||||||
|
namespace UnityEngine.UI
|
||||||
|
{
|
||||||
|
[CustomEditor(typeof(UXImage), true)]
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
public class UXImageEditor : Editor
|
||||||
|
{
|
||||||
|
private GameObject go;
|
||||||
|
|
||||||
|
private SerializedProperty m_Color;
|
||||||
|
private SerializedProperty m_RaycastTarget;
|
||||||
|
protected SerializedProperty m_RaycastPadding;
|
||||||
|
private SerializedProperty m_MaskAble;
|
||||||
|
private SerializedProperty m_Sprite;
|
||||||
|
private SerializedProperty m_Type;
|
||||||
|
private SerializedProperty m_Material;
|
||||||
|
private SerializedProperty m_sourceImage;
|
||||||
|
private SerializedProperty m_ColorType;
|
||||||
|
private SerializedProperty m_Direction;
|
||||||
|
|
||||||
|
SerializedProperty m_UseSpriteMesh;
|
||||||
|
SerializedProperty m_PreserveAspect;
|
||||||
|
SerializedProperty m_FillCenter;
|
||||||
|
SerializedProperty m_PixelsPerUnitMultiplier;
|
||||||
|
SerializedProperty m_FillMethod;
|
||||||
|
SerializedProperty m_FillOrigin;
|
||||||
|
SerializedProperty m_FillAmount;
|
||||||
|
SerializedProperty m_FillClockwise;
|
||||||
|
|
||||||
|
SerializedProperty m_FlipMode;
|
||||||
|
SerializedProperty m_FlipWithCopy;
|
||||||
|
SerializedProperty m_FlipEdgeHorizontal;
|
||||||
|
SerializedProperty m_FlipEdgeVertical;
|
||||||
|
SerializedProperty m_FlipFillCenter;
|
||||||
|
SerializedProperty m_GradientColor;
|
||||||
|
GUIContent m_ClockwiseContent;
|
||||||
|
GUIContent m_SpriteFlipContent;
|
||||||
|
GUIContent m_FlipModeContent;
|
||||||
|
GUIContent m_FlipEdgeContent;
|
||||||
|
GUIContent m_FlipFillContent;
|
||||||
|
|
||||||
|
|
||||||
|
private UXImage m_targetObject;
|
||||||
|
private GameObject m_CloneObj;
|
||||||
|
private string m_Origin_name;
|
||||||
|
private Sprite m_Need_replace;
|
||||||
|
private bool m_InitialHide;
|
||||||
|
#if UNITY_2021_1_OR_NEWER
|
||||||
|
private bool m_bIsDriven;
|
||||||
|
#endif
|
||||||
|
GUIContent m_SpriteContent;
|
||||||
|
GUIContent m_PaddingContent;
|
||||||
|
GUIContent m_LeftContent;
|
||||||
|
GUIContent m_RightContent;
|
||||||
|
GUIContent m_TopContent;
|
||||||
|
GUIContent m_BottomContent;
|
||||||
|
private GUIContent m_CorrectButtonContent;
|
||||||
|
GUIContent m_SpriteTypeContent;
|
||||||
|
|
||||||
|
AnimBool m_ShowType;
|
||||||
|
protected AnimBool m_ShowNativeSize;
|
||||||
|
AnimBool m_ShowSlicedOrTiled;
|
||||||
|
AnimBool m_ShowSliced;
|
||||||
|
AnimBool m_ShowTiled;
|
||||||
|
AnimBool m_ShowFilled;
|
||||||
|
|
||||||
|
|
||||||
|
static private bool m_ShowPadding = false;
|
||||||
|
|
||||||
|
private class Styles
|
||||||
|
{
|
||||||
|
public static GUIContent text = EditorGUIUtility.TrTextContent("Fill Origin");
|
||||||
|
|
||||||
|
public static GUIContent[] OriginHorizontalStyle =
|
||||||
|
{
|
||||||
|
EditorGUIUtility.TrTextContent("Left"),
|
||||||
|
EditorGUIUtility.TrTextContent("Right")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static GUIContent[] OriginVerticalStyle =
|
||||||
|
{
|
||||||
|
EditorGUIUtility.TrTextContent("Bottom"),
|
||||||
|
EditorGUIUtility.TrTextContent("Top")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static GUIContent[] Origin90Style =
|
||||||
|
{
|
||||||
|
EditorGUIUtility.TrTextContent("BottomLeft"),
|
||||||
|
EditorGUIUtility.TrTextContent("TopLeft"),
|
||||||
|
EditorGUIUtility.TrTextContent("TopRight"),
|
||||||
|
EditorGUIUtility.TrTextContent("BottomRight")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static GUIContent[] Origin180Style =
|
||||||
|
{
|
||||||
|
EditorGUIUtility.TrTextContent("Bottom"),
|
||||||
|
EditorGUIUtility.TrTextContent("Left"),
|
||||||
|
EditorGUIUtility.TrTextContent("Top"),
|
||||||
|
EditorGUIUtility.TrTextContent("Right")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static GUIContent[] Origin360Style =
|
||||||
|
{
|
||||||
|
EditorGUIUtility.TrTextContent("Bottom"),
|
||||||
|
EditorGUIUtility.TrTextContent("Right"),
|
||||||
|
EditorGUIUtility.TrTextContent("Top"),
|
||||||
|
EditorGUIUtility.TrTextContent("Left")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
Image image = target as Image;
|
||||||
|
go = image.gameObject;
|
||||||
|
UIEffectWrapDrawer.InitInspectorString();
|
||||||
|
m_Color = serializedObject.FindProperty("m_Color");
|
||||||
|
m_Sprite = serializedObject.FindProperty("m_Sprite");
|
||||||
|
m_Type = serializedObject.FindProperty("m_Type");
|
||||||
|
m_Material = serializedObject.FindProperty("m_Material");
|
||||||
|
m_RaycastTarget = serializedObject.FindProperty("m_RaycastTarget");
|
||||||
|
m_RaycastPadding = serializedObject.FindProperty("m_RaycastPadding");
|
||||||
|
m_sourceImage = serializedObject.FindProperty("m_Sprite");
|
||||||
|
m_MaskAble = serializedObject.FindProperty("m_Maskable");
|
||||||
|
//spriteContent = new GUIContent("Source Image");
|
||||||
|
m_targetObject = serializedObject.targetObject as UXImage;
|
||||||
|
m_Origin_name = m_Sprite.objectReferenceValue?.name;
|
||||||
|
m_Need_replace = Resources.Load<Sprite>("need_replace");
|
||||||
|
|
||||||
|
|
||||||
|
m_ColorType = serializedObject.FindProperty("m_ColorType");
|
||||||
|
m_GradientColor = serializedObject.FindProperty("m_GradientColor");
|
||||||
|
m_Direction = serializedObject.FindProperty("m_Direction");
|
||||||
|
|
||||||
|
m_UseSpriteMesh = serializedObject.FindProperty("m_UseSpriteMesh");
|
||||||
|
m_PreserveAspect = serializedObject.FindProperty("m_PreserveAspect");
|
||||||
|
m_FillCenter = serializedObject.FindProperty("m_FillCenter");
|
||||||
|
m_PixelsPerUnitMultiplier = serializedObject.FindProperty("m_PixelsPerUnitMultiplier");
|
||||||
|
m_FillMethod = serializedObject.FindProperty("m_FillMethod");
|
||||||
|
m_FillOrigin = serializedObject.FindProperty("m_FillOrigin");
|
||||||
|
m_FillClockwise = serializedObject.FindProperty("m_FillClockwise");
|
||||||
|
m_FillAmount = serializedObject.FindProperty("m_FillAmount");
|
||||||
|
|
||||||
|
m_FlipModeContent = new GUIContent("FlipMode");
|
||||||
|
m_FlipEdgeContent = new GUIContent("FlipEdge");
|
||||||
|
m_FlipFillContent = new GUIContent("FlipFill");
|
||||||
|
|
||||||
|
m_FlipMode = serializedObject.FindProperty("m_FlipMode");
|
||||||
|
m_FlipWithCopy = serializedObject.FindProperty("m_FlipWithCopy");
|
||||||
|
m_FlipEdgeHorizontal = serializedObject.FindProperty("m_FlipEdgeHorizontal");
|
||||||
|
m_FlipEdgeVertical = serializedObject.FindProperty("m_FlipEdgeVertical");
|
||||||
|
m_FlipFillCenter = serializedObject.FindProperty("m_FlipFillCenter");
|
||||||
|
|
||||||
|
#if UNITY_2021_1_OR_NEWER
|
||||||
|
m_bIsDriven = false;
|
||||||
|
#endif
|
||||||
|
m_PaddingContent = EditorGUIUtility.TrTextContent("Raycast Padding");
|
||||||
|
m_LeftContent = EditorGUIUtility.TrTextContent("Left");
|
||||||
|
m_RightContent = EditorGUIUtility.TrTextContent("Right");
|
||||||
|
m_TopContent = EditorGUIUtility.TrTextContent("Top");
|
||||||
|
m_BottomContent = EditorGUIUtility.TrTextContent("Bottom");
|
||||||
|
m_CorrectButtonContent = EditorGUIUtility.TrTextContent("Set Native Size", "Sets the size to match the content.");
|
||||||
|
m_SpriteTypeContent = EditorGUIUtility.TrTextContent("Image Type");
|
||||||
|
m_ClockwiseContent = EditorGUIUtility.TrTextContent("Clockwise");
|
||||||
|
m_SpriteContent = EditorGUIUtility.TrTextContent("Source Image");
|
||||||
|
|
||||||
|
m_ShowType = new AnimBool(m_Sprite.objectReferenceValue != null);
|
||||||
|
m_ShowType.valueChanged.AddListener(Repaint);
|
||||||
|
m_ShowNativeSize = new AnimBool(false);
|
||||||
|
m_ShowNativeSize.valueChanged.AddListener(Repaint);
|
||||||
|
|
||||||
|
var typeEnum = (Image.Type)m_Type.enumValueIndex;
|
||||||
|
m_ShowSlicedOrTiled = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Sliced);
|
||||||
|
m_ShowSliced = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Sliced);
|
||||||
|
m_ShowTiled = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Tiled);
|
||||||
|
m_ShowFilled = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Filled);
|
||||||
|
m_ShowSlicedOrTiled.valueChanged.AddListener(Repaint);
|
||||||
|
m_ShowSliced.valueChanged.AddListener(Repaint);
|
||||||
|
m_ShowTiled.valueChanged.AddListener(Repaint);
|
||||||
|
m_ShowFilled.valueChanged.AddListener(Repaint);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
if (m_CloneObj != null)
|
||||||
|
{
|
||||||
|
DestroyImmediate(m_CloneObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m_ShowType.valueChanged.RemoveListener(Repaint);
|
||||||
|
m_ShowNativeSize.valueChanged.RemoveListener(Repaint);
|
||||||
|
m_ShowSlicedOrTiled.valueChanged.RemoveListener(Repaint);
|
||||||
|
m_ShowSliced.valueChanged.RemoveListener(Repaint);
|
||||||
|
m_ShowTiled.valueChanged.RemoveListener(Repaint);
|
||||||
|
m_ShowFilled.valueChanged.RemoveListener(Repaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
serializedObject.Update();
|
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
//base.OnInspectorGUI();
|
||||||
|
//CustomEditorGUILayout.PropertyField(sourceImage);
|
||||||
|
//CustomEditorGUILayout.PropertyField(color);
|
||||||
|
//CustomEditorGUILayout.PropertyField(material);
|
||||||
|
//CustomEditorGUILayout.PropertyField(raycastTarget);
|
||||||
|
//CustomEditorGUILayout.PropertyField(maskAble);
|
||||||
|
serializedObject.Update();
|
||||||
|
|
||||||
|
Image image = target as Image;
|
||||||
|
RectTransform rect = image.GetComponent<RectTransform>();
|
||||||
|
#if UNITY_2021_1_OR_NEWER
|
||||||
|
m_bIsDriven = (rect.drivenByObject as Slider)?.fillRect == rect;
|
||||||
|
#endif
|
||||||
|
SpriteGUI();
|
||||||
|
AppearanceControlsGUI();
|
||||||
|
RaycastControlsGUI();
|
||||||
|
MaskableControlsGUI();
|
||||||
|
|
||||||
|
//m_ShowType.target = m_Sprite.objectReferenceValue != null;
|
||||||
|
//if (EditorGUILayout.BeginFadeGroup(m_ShowType.faded))
|
||||||
|
TypeGUI();
|
||||||
|
//EditorGUILayout.EndFadeGroup();
|
||||||
|
|
||||||
|
SetShowNativeSize(false);
|
||||||
|
if (EditorGUILayout.BeginFadeGroup(m_ShowNativeSize.faded))
|
||||||
|
{
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
|
||||||
|
if ((Image.Type)m_Type.enumValueIndex == Image.Type.Simple)
|
||||||
|
EditorGUILayout.PropertyField(m_UseSpriteMesh);
|
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_PreserveAspect);
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndFadeGroup();
|
||||||
|
NativeSizeButtonGUI();
|
||||||
|
|
||||||
|
FlipGUI();
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
|
||||||
|
Rect effectWarpRect = EditorGUILayout.GetControlRect();
|
||||||
|
UIEffectWrapDrawer.Draw(effectWarpRect, go);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SpriteGUI()
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
EditorGUILayout.PropertyField(m_Sprite, m_SpriteContent);
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
var newSprite = m_Sprite.objectReferenceValue as Sprite;
|
||||||
|
if (newSprite)
|
||||||
|
{
|
||||||
|
UXImage.Type oldType = (UXImage.Type)m_Type.enumValueIndex;
|
||||||
|
if (newSprite.border.SqrMagnitude() > 0)
|
||||||
|
{
|
||||||
|
m_Type.enumValueIndex = (int)UXImage.Type.Sliced;
|
||||||
|
}
|
||||||
|
else if (oldType == UXImage.Type.Sliced)
|
||||||
|
{
|
||||||
|
m_Type.enumValueIndex = (int)UXImage.Type.Simple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void MaskableControlsGUI()
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(m_MaskAble);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AppearanceControlsGUI()
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
string[] labels = {"Solid_Color", "Gradient_Color" };
|
||||||
|
var type = (UXImage.ColorType)EnumPopupLayoutEx("ColorType", typeof(UXImage.ColorType), m_ColorType.intValue, labels);
|
||||||
|
// EditorGUILayout.EnumPopup(EditorLocalization.GetLocalization("UXImage", "m_ColorType"), (UXImage.ColorType)m_ColorType.intValue);
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
|
||||||
|
m_ColorType.intValue = (int)type;
|
||||||
|
if ((int)type == 1 && m_Type.intValue != 0)
|
||||||
|
{
|
||||||
|
m_Type.intValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)type == 1 && m_FlipMode.intValue != 0)
|
||||||
|
{
|
||||||
|
m_FlipMode.intValue = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||||
|
if (GUILayout.Button("UseUIColorConfig", EditorStyles.miniButton))
|
||||||
|
{
|
||||||
|
//弹窗
|
||||||
|
if (type == UXImage.ColorType.Solid_Color)
|
||||||
|
{
|
||||||
|
// ColorChooseWindow.OpenWindow();
|
||||||
|
// ColorChooseWindow.r_window.target = (UXImage)target;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == UXImage.ColorType.Gradient_Color)
|
||||||
|
{
|
||||||
|
// GradientChooseWindow.OpenWindow();
|
||||||
|
// GradientChooseWindow.r_window.target = (UXImage)target;
|
||||||
|
}
|
||||||
|
//m_Color.colorValue = UIColorChooseWindow.r_window.usecolor;
|
||||||
|
//m_GradientColor.
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
if (type == UXImage.ColorType.Solid_Color)
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(m_Color);
|
||||||
|
}
|
||||||
|
else if (type == UXImage.ColorType.Gradient_Color)
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
string[] labels2 = {"Vertical", "Horizontal"};
|
||||||
|
var direction = (UXImage.GradientDirection)EnumPopupLayoutEx("m_Direction", typeof(UXImage.GradientDirection), m_Direction.intValue, labels2);
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
m_Direction.intValue = (int)direction;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//EditorGUILayout.ColorField(m_Color);
|
||||||
|
EditorGUILayout.PropertyField(m_GradientColor, new GUIContent("Gradient_Color"));
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_Material);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void RaycastControlsGUI()
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(m_RaycastTarget);
|
||||||
|
|
||||||
|
float height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
if (m_ShowPadding)
|
||||||
|
height += (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 4;
|
||||||
|
|
||||||
|
var rect = EditorGUILayout.GetControlRect(true, height);
|
||||||
|
if (m_RaycastPadding != null)
|
||||||
|
{
|
||||||
|
EditorGUI.BeginProperty(rect, m_PaddingContent, m_RaycastPadding);
|
||||||
|
rect.height = EditorGUIUtility.singleLineHeight;
|
||||||
|
|
||||||
|
using (var check = new EditorGUI.ChangeCheckScope())
|
||||||
|
{
|
||||||
|
m_ShowPadding = EditorGUI.Foldout(rect, m_ShowPadding, m_PaddingContent, true);
|
||||||
|
if (check.changed)
|
||||||
|
{
|
||||||
|
SceneView.RepaintAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ShowPadding)
|
||||||
|
{
|
||||||
|
using (var check = new EditorGUI.ChangeCheckScope())
|
||||||
|
{
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
Vector4 newPadding = m_RaycastPadding.vector4Value;
|
||||||
|
|
||||||
|
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
newPadding.x = EditorGUI.FloatField(rect, m_LeftContent, newPadding.x);
|
||||||
|
|
||||||
|
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
newPadding.y = EditorGUI.FloatField(rect, m_BottomContent, newPadding.y);
|
||||||
|
|
||||||
|
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
newPadding.z = EditorGUI.FloatField(rect, m_RightContent, newPadding.z);
|
||||||
|
|
||||||
|
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
newPadding.w = EditorGUI.FloatField(rect, m_TopContent, newPadding.w);
|
||||||
|
|
||||||
|
if (check.changed)
|
||||||
|
{
|
||||||
|
m_RaycastPadding.vector4Value = newPadding;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUI.EndProperty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void TypeGUI()
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
EditorGUILayout.PropertyField(m_Type, m_SpriteTypeContent);
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
if (m_Type.intValue != 0 && m_ColorType.intValue == 1)
|
||||||
|
{
|
||||||
|
m_ColorType.intValue = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
{
|
||||||
|
Image.Type typeEnum = (Image.Type)m_Type.enumValueIndex;
|
||||||
|
|
||||||
|
bool showSlicedOrTiled = (!m_Type.hasMultipleDifferentValues && (typeEnum == Image.Type.Sliced || typeEnum == Image.Type.Tiled));
|
||||||
|
if (showSlicedOrTiled && targets.Length > 1)
|
||||||
|
showSlicedOrTiled = targets.Select(obj => obj as Image).All(img => img.hasBorder);
|
||||||
|
|
||||||
|
m_ShowSlicedOrTiled.target = showSlicedOrTiled;
|
||||||
|
m_ShowSliced.target = (showSlicedOrTiled && !m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Sliced);
|
||||||
|
m_ShowTiled.target = (showSlicedOrTiled && !m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Tiled);
|
||||||
|
m_ShowFilled.target = (!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Filled);
|
||||||
|
|
||||||
|
Image image = target as Image;
|
||||||
|
if (EditorGUILayout.BeginFadeGroup(m_ShowSlicedOrTiled.faded))
|
||||||
|
{
|
||||||
|
if (image.hasBorder)
|
||||||
|
EditorGUILayout.PropertyField(m_FillCenter);
|
||||||
|
EditorGUILayout.PropertyField(m_PixelsPerUnitMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndFadeGroup();
|
||||||
|
|
||||||
|
if (EditorGUILayout.BeginFadeGroup(m_ShowSliced.faded))
|
||||||
|
{
|
||||||
|
if (image.sprite != null && !image.hasBorder)
|
||||||
|
EditorGUILayout.HelpBox("This Image doesn't have a border.", MessageType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndFadeGroup();
|
||||||
|
|
||||||
|
if (EditorGUILayout.BeginFadeGroup(m_ShowTiled.faded))
|
||||||
|
{
|
||||||
|
if (image.sprite != null && !image.hasBorder && (image.sprite.texture.wrapMode != TextureWrapMode.Repeat || image.sprite.packed))
|
||||||
|
EditorGUILayout.HelpBox("It looks like you want to tile a sprite with no border. It would be more efficient to modify the Sprite properties, clear the Packing tag and set the Wrap mode to Repeat.", MessageType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndFadeGroup();
|
||||||
|
|
||||||
|
if (EditorGUILayout.BeginFadeGroup(m_ShowFilled.faded))
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
EditorGUILayout.PropertyField(m_FillMethod);
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
m_FillOrigin.intValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var shapeRect = EditorGUILayout.GetControlRect(true);
|
||||||
|
switch ((Image.FillMethod)m_FillMethod.enumValueIndex)
|
||||||
|
{
|
||||||
|
case Image.FillMethod.Horizontal:
|
||||||
|
m_FillOrigin.intValue = EditorGUI.Popup(shapeRect, Styles.text, m_FillOrigin.intValue, Styles.OriginHorizontalStyle);
|
||||||
|
break;
|
||||||
|
case Image.FillMethod.Vertical:
|
||||||
|
m_FillOrigin.intValue = EditorGUI.Popup(shapeRect, Styles.text, m_FillOrigin.intValue, Styles.OriginVerticalStyle);
|
||||||
|
break;
|
||||||
|
case Image.FillMethod.Radial90:
|
||||||
|
m_FillOrigin.intValue = EditorGUI.Popup(shapeRect, Styles.text, m_FillOrigin.intValue, Styles.Origin90Style);
|
||||||
|
break;
|
||||||
|
case Image.FillMethod.Radial180:
|
||||||
|
m_FillOrigin.intValue = EditorGUI.Popup(shapeRect, Styles.text, m_FillOrigin.intValue, Styles.Origin180Style);
|
||||||
|
break;
|
||||||
|
case Image.FillMethod.Radial360:
|
||||||
|
m_FillOrigin.intValue = EditorGUI.Popup(shapeRect, Styles.text, m_FillOrigin.intValue, Styles.Origin360Style);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#if UNITY_2021_1_OR_NEWER
|
||||||
|
if (m_bIsDriven)
|
||||||
|
EditorGUILayout.HelpBox("The Fill amount property is driven by Slider.", MessageType.None);
|
||||||
|
using (new EditorGUI.DisabledScope(m_bIsDriven))
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(m_FillAmount);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
EditorGUILayout.PropertyField(m_FillAmount);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((Image.FillMethod)m_FillMethod.enumValueIndex > Image.FillMethod.Vertical)
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(m_FillClockwise, m_ClockwiseContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndFadeGroup();
|
||||||
|
}
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FlipGUI()
|
||||||
|
{
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
//EditorGUILayout.PropertyField(m_gradientMode, m_SpriteGradientContent);
|
||||||
|
|
||||||
|
UXImage.FlipMode flipmodeEnumOld = (UXImage.FlipMode)m_FlipMode.enumValueIndex;
|
||||||
|
bool flipWithCopyOld = m_FlipWithCopy.boolValue;
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
UXImage.FlipEdgeVertical edgeVerticalOld = (UXImage.FlipEdgeVertical)(m_FlipEdgeVertical.enumValueFlag);
|
||||||
|
#else
|
||||||
|
UXImage.FlipEdgeVertical edgeVerticalOld = (UXImage.FlipEdgeVertical)(m_FlipEdgeVertical.enumValueIndex + 3);
|
||||||
|
#endif
|
||||||
|
UXImage.FlipEdgeHorizontal edgeHorizontalOld = (UXImage.FlipEdgeHorizontal)m_FlipEdgeHorizontal.enumValueIndex;
|
||||||
|
|
||||||
|
string[] labels =
|
||||||
|
{
|
||||||
|
"None", "Horizontal",
|
||||||
|
"Vertical", "FourCorner"
|
||||||
|
};
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
m_FlipMode.intValue = EnumPopupLayoutEx(m_FlipModeContent.text, typeof(UXImage.FlipMode), m_FlipMode.intValue, labels);
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
if (m_FlipMode.intValue != 0 && m_ColorType.intValue == 1)
|
||||||
|
{
|
||||||
|
m_ColorType.intValue = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//EditorGUILayout.PropertyField(m_FlipMode, m_FlipModeContent);
|
||||||
|
UXImage.FlipMode flipmodeEnum = (UXImage.FlipMode)m_FlipMode.enumValueIndex;
|
||||||
|
switch (flipmodeEnum)
|
||||||
|
{
|
||||||
|
case UXImage.FlipMode.Horziontal:
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
bool iscopy1 = m_FlipWithCopy.boolValue;
|
||||||
|
m_FlipWithCopy.boolValue = EditorGUILayout.Toggle("Copy", m_FlipWithCopy.boolValue);
|
||||||
|
if (iscopy1 == true && m_FlipWithCopy.boolValue == false)
|
||||||
|
{
|
||||||
|
if (m_FlipEdgeHorizontal.intValue == 0)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 4);
|
||||||
|
}
|
||||||
|
else if (m_FlipEdgeHorizontal.intValue == 2)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_FlipWithCopy.boolValue)
|
||||||
|
{
|
||||||
|
int last = m_FlipEdgeHorizontal.intValue;
|
||||||
|
if (iscopy1 == false)
|
||||||
|
{
|
||||||
|
if (last == 0)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
}
|
||||||
|
else if (last == 2)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] labels2 =
|
||||||
|
{
|
||||||
|
"Left", "Middle",
|
||||||
|
"Right"
|
||||||
|
};
|
||||||
|
m_FlipEdgeHorizontal.intValue = EnumPopupLayoutEx(m_FlipEdgeContent.text, typeof(UXImage.FlipEdgeHorizontal), m_FlipEdgeHorizontal.intValue, labels2);
|
||||||
|
//EditorGUILayout.PropertyField(m_FlipEdgeHorizontal, m_FlipEdgeContent);
|
||||||
|
int now = m_FlipEdgeHorizontal.intValue;
|
||||||
|
|
||||||
|
if (last != now)
|
||||||
|
{
|
||||||
|
if ((last == 0 && now == 1))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 4);
|
||||||
|
}
|
||||||
|
else if ((last == 2 && now == 1))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 4);
|
||||||
|
}
|
||||||
|
else if (last == 0 && now == 2 || (last == 1 && now == 2))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
}
|
||||||
|
else if ((last == 1 && now == 0) || (last == 2 && now == 0))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
break;
|
||||||
|
case UXImage.FlipMode.Vertical:
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
bool iscopy = m_FlipWithCopy.boolValue;
|
||||||
|
m_FlipWithCopy.boolValue = EditorGUILayout.Toggle("Copy", m_FlipWithCopy.boolValue);
|
||||||
|
if (iscopy == true && m_FlipWithCopy.boolValue == false)
|
||||||
|
{
|
||||||
|
if (m_FlipEdgeVertical.intValue == 3)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 4);
|
||||||
|
}
|
||||||
|
else if (m_FlipEdgeVertical.intValue == 5)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_FlipWithCopy.boolValue)
|
||||||
|
{
|
||||||
|
int last = m_FlipEdgeVertical.intValue;
|
||||||
|
if (iscopy == false)
|
||||||
|
{
|
||||||
|
if (last == 3)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
}
|
||||||
|
else if (last == 5)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] labels2 =
|
||||||
|
{
|
||||||
|
"Up", "Middle",
|
||||||
|
"Down"
|
||||||
|
};
|
||||||
|
m_FlipEdgeVertical.intValue = EnumPopupLayoutEx(m_FlipEdgeContent.text, typeof(UXImage.FlipEdgeVertical), m_FlipEdgeVertical.intValue, labels2);
|
||||||
|
//EditorGUILayout.PropertyField(m_FlipEdgeVertical, m_FlipEdgeContent);
|
||||||
|
int now = m_FlipEdgeVertical.intValue;
|
||||||
|
if (last != now)
|
||||||
|
{
|
||||||
|
if ((last == 3 && now == 4))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 4);
|
||||||
|
}
|
||||||
|
else if ((last == 5 && now == 4))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 4);
|
||||||
|
}
|
||||||
|
else if (last == 3 && now == 5 || (last == 4 && now == 5))
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
}
|
||||||
|
else if ((last == 4 && now == 3) || last == 5 && now == 3)
|
||||||
|
{
|
||||||
|
go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
break;
|
||||||
|
case UXImage.FlipMode.FourCorner:
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
int lastC = m_FlipFillCenter.intValue;
|
||||||
|
string[] labels3 = { "LeftTop", "RightTop", "RightBottom", "LeftBottom" };
|
||||||
|
m_FlipFillCenter.intValue = EnumPopupLayoutEx(m_FlipFillContent.text, typeof(UXImage.FlipFillCenter), m_FlipFillCenter.intValue, labels3);
|
||||||
|
//EditorGUILayout.PropertyField(m_FlipFillCenter, m_FlipFillContent);
|
||||||
|
int nowC = m_FlipFillCenter.intValue;
|
||||||
|
// if (lastC != nowC)
|
||||||
|
// {
|
||||||
|
// if(lastC==0&&nowC==1||(lastC==3&&nowC==2)){
|
||||||
|
// go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==0&& nowC==2){
|
||||||
|
// go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
// go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==0&& nowC==3 || (lastC==1&&nowC==2)){
|
||||||
|
// go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==1&&nowC==0||(lastC==2&&nowC==3)){
|
||||||
|
// go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==1&&nowC==3){
|
||||||
|
// go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
// go.transform.Translate(Vector3.down * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==2&&nowC==1||(lastC==3&&nowC==0)){
|
||||||
|
// go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==2&&nowC==0){
|
||||||
|
// go.transform.Translate(Vector3.left * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
// go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
// }
|
||||||
|
// else if(lastC==3&&nowC==1){
|
||||||
|
// go.transform.Translate(Vector3.right * go.GetComponent<RectTransform>().rect.width / 2);
|
||||||
|
// go.transform.Translate(Vector3.up * go.GetComponent<RectTransform>().rect.height / 2);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
int OldWidthScaler = 1;
|
||||||
|
int OldHeightScaler = 1;
|
||||||
|
int NewWidthScaler = 1;
|
||||||
|
int NewHeightScaler = 1;
|
||||||
|
|
||||||
|
|
||||||
|
if (flipmodeEnumOld != flipmodeEnum)
|
||||||
|
{
|
||||||
|
m_FlipWithCopy.boolValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipmodeEnumOld == UXImage.FlipMode.Horziontal)
|
||||||
|
{
|
||||||
|
GetSizeScaler(flipmodeEnumOld, flipWithCopyOld, (UXImage.FlipEdge)(int)edgeHorizontalOld, ref OldWidthScaler, ref OldHeightScaler);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipmodeEnumOld == UXImage.FlipMode.Vertical)
|
||||||
|
{
|
||||||
|
GetSizeScaler(flipmodeEnumOld, flipWithCopyOld, (UXImage.FlipEdge)(int)edgeVerticalOld, ref OldWidthScaler, ref OldHeightScaler);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipmodeEnumOld == UXImage.FlipMode.FourCorner)
|
||||||
|
{
|
||||||
|
GetSizeScaler(flipmodeEnumOld, flipWithCopyOld, UXImage.FlipEdge.None, ref OldWidthScaler, ref OldHeightScaler);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipmodeEnum == UXImage.FlipMode.Horziontal)
|
||||||
|
{
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
GetSizeScaler(flipmodeEnum, m_FlipWithCopy.boolValue, (UXImage.FlipEdge)(int)m_FlipEdgeHorizontal.enumValueFlag, ref NewWidthScaler, ref NewHeightScaler);
|
||||||
|
#else
|
||||||
|
GetSizeScaler(flipmodeEnum, m_FlipWithCopy.boolValue, (UXImage.FlipEdge)(int)m_FlipEdgeHorizontal.enumValueIndex, ref NewWidthScaler, ref NewHeightScaler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipmodeEnum == UXImage.FlipMode.Vertical)
|
||||||
|
{
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
GetSizeScaler(flipmodeEnum, m_FlipWithCopy.boolValue, (UXImage.FlipEdge)(int)m_FlipEdgeVertical.enumValueFlag, ref NewWidthScaler, ref NewHeightScaler);
|
||||||
|
#else
|
||||||
|
GetSizeScaler(flipmodeEnum, m_FlipWithCopy.boolValue, (UXImage.FlipEdge)(int)(m_FlipEdgeVertical.enumValueIndex + 3), ref NewWidthScaler, ref NewHeightScaler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipmodeEnum == UXImage.FlipMode.FourCorner)
|
||||||
|
{
|
||||||
|
GetSizeScaler(flipmodeEnum, m_FlipWithCopy.boolValue, UXImage.FlipEdge.None, ref NewWidthScaler, ref NewHeightScaler);
|
||||||
|
}
|
||||||
|
|
||||||
|
UXImage image = target as UXImage;
|
||||||
|
float width = image.rectTransform.rect.width * ((float)NewWidthScaler / OldWidthScaler);
|
||||||
|
float height = image.rectTransform.rect.height * ((float)NewHeightScaler / OldHeightScaler);
|
||||||
|
image.rectTransform.sizeDelta = new Vector2(width, height);
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetSizeScaler(UXImage.FlipMode flipMode, bool flipWithCopy, UXImage.FlipEdge flipEdge, ref int widthScaler, ref int heightScaler)
|
||||||
|
{
|
||||||
|
if (flipMode == UXImage.FlipMode.FourCorner)
|
||||||
|
{
|
||||||
|
widthScaler = 2;
|
||||||
|
heightScaler = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipMode == UXImage.FlipMode.Vertical)
|
||||||
|
{
|
||||||
|
if (flipWithCopy && flipEdge != UXImage.FlipEdge.VertMiddle)
|
||||||
|
{
|
||||||
|
widthScaler = 1;
|
||||||
|
heightScaler = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flipMode == UXImage.FlipMode.Horziontal)
|
||||||
|
{
|
||||||
|
if (flipWithCopy && flipEdge != UXImage.FlipEdge.HorzMiddle)
|
||||||
|
{
|
||||||
|
widthScaler = 2;
|
||||||
|
heightScaler = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetShowNativeSize(bool instant)
|
||||||
|
{
|
||||||
|
Image.Type type = (Image.Type)m_Type.enumValueIndex;
|
||||||
|
bool showNativeSize = (type == Image.Type.Simple || type == Image.Type.Filled) && m_Sprite.objectReferenceValue != null;
|
||||||
|
if (instant)
|
||||||
|
m_ShowNativeSize.value = showNativeSize;
|
||||||
|
else
|
||||||
|
m_ShowNativeSize.target = showNativeSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void NativeSizeButtonGUI()
|
||||||
|
{
|
||||||
|
if (EditorGUILayout.BeginFadeGroup(m_ShowNativeSize.faded))
|
||||||
|
{
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
{
|
||||||
|
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||||
|
if (GUILayout.Button(m_CorrectButtonContent, EditorStyles.miniButton))
|
||||||
|
{
|
||||||
|
foreach (Graphic graphic in targets.Select(obj => obj as Graphic))
|
||||||
|
{
|
||||||
|
Undo.RecordObject(graphic.rectTransform, "Set Native Size");
|
||||||
|
graphic.SetNativeSize();
|
||||||
|
EditorUtility.SetDirty(graphic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndFadeGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int EnumPopupLayoutEx(string label, Type type, int enumValueIndex, string[] labels)
|
||||||
|
{
|
||||||
|
int[] ints = (int[])Enum.GetValues(type);
|
||||||
|
string[] strings = Enum.GetNames(type);
|
||||||
|
if (labels.Length != ints.Length)
|
||||||
|
{
|
||||||
|
return EditorGUILayout.IntPopup(label, enumValueIndex, strings, ints);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return EditorGUILayout.IntPopup(label, enumValueIndex, labels, ints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/UX/UXImageEditor.cs.meta
Normal file
3
Editor/UX/UXImageEditor.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8eb0b2e28e9b4e6ca1d68517f1f41224
|
||||||
|
timeCreated: 1753695090
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 9ae5a45a9c60593458ff7937ccef2268
|
guid: 6ad169dfa726c8c419c099c533423c2e
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
8
Runtime/Res/UX-GUI.meta
Normal file
8
Runtime/Res/UX-GUI.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e46656b40717a314fad4af62362ef834
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
35
Runtime/Res/UX-GUI/UX_ImageDefault.mat
Normal file
35
Runtime/Res/UX-GUI/UX_ImageDefault.mat
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: UX_ImageDefault
|
||||||
|
m_Shader: {fileID: 4800000, guid: be26d7eaccb48ea43a343b69357edb55, type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- _ColorMask: 15
|
||||||
|
- _Stencil: 0
|
||||||
|
- _StencilComp: 8
|
||||||
|
- _StencilOp: 0
|
||||||
|
- _StencilReadMask: 255
|
||||||
|
- _StencilWriteMask: 255
|
||||||
|
- _UseUIAlphaClip: 0
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
8
Runtime/Res/UX-GUI/UX_ImageDefault.mat.meta
Normal file
8
Runtime/Res/UX-GUI/UX_ImageDefault.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 624af9784554f4047997278dfbb22e47
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
149
Runtime/Res/UX-GUI/UX_ImageDefault.shader
Normal file
149
Runtime/Res/UX-GUI/UX_ImageDefault.shader
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||||
|
|
||||||
|
Shader "UX/ImageDefault"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||||
|
_Color ("Tint", Color) = (1,1,1,1)
|
||||||
|
|
||||||
|
_StencilComp ("Stencil Comparison", Float) = 8
|
||||||
|
_Stencil ("Stencil ID", Float) = 0
|
||||||
|
_StencilOp ("Stencil Operation", Float) = 0
|
||||||
|
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||||
|
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||||
|
|
||||||
|
_ColorMask ("Color Mask", Float) = 15
|
||||||
|
|
||||||
|
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
Tags
|
||||||
|
{
|
||||||
|
"Queue"="Transparent"
|
||||||
|
"IgnoreProjector"="True"
|
||||||
|
"RenderType"="Transparent"
|
||||||
|
"PreviewType"="Plane"
|
||||||
|
"CanUseSpriteAtlas"="True"
|
||||||
|
}
|
||||||
|
|
||||||
|
Stencil
|
||||||
|
{
|
||||||
|
Ref [_Stencil]
|
||||||
|
Comp [_StencilComp]
|
||||||
|
Pass [_StencilOp]
|
||||||
|
ReadMask [_StencilReadMask]
|
||||||
|
WriteMask [_StencilWriteMask]
|
||||||
|
}
|
||||||
|
|
||||||
|
Cull Off
|
||||||
|
Lighting Off
|
||||||
|
ZWrite Off
|
||||||
|
ZTest [unity_GUIZTestMode]
|
||||||
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
ColorMask [_ColorMask]
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
Name "Default"
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
#pragma target 2.0
|
||||||
|
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
#include "UnityUI.cginc"
|
||||||
|
|
||||||
|
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
|
||||||
|
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
|
||||||
|
uniform int type;
|
||||||
|
static float3x3 color_matrices[4] = {
|
||||||
|
// normal vision - identity matrix
|
||||||
|
float3x3(
|
||||||
|
1.0f,0.0f,0.0f,
|
||||||
|
0.0f,1.0f,0.0f,
|
||||||
|
0.0f,0.0f,1.0f),
|
||||||
|
// Protanopia - blindness to long wavelengths
|
||||||
|
float3x3(
|
||||||
|
0.567f,0.433f,0.0f,
|
||||||
|
0.558f,0.442f,0.0f,
|
||||||
|
0.0f,0.242f,0.758f),
|
||||||
|
// Deuteranopia - blindness to medium wavelengths
|
||||||
|
float3x3(
|
||||||
|
0.625f,0.375f,0.0f,
|
||||||
|
0.7f,0.3f,0.0f,
|
||||||
|
0.0f,0.3f,0.7f),
|
||||||
|
// Tritanopie - blindness to short wavelengths
|
||||||
|
float3x3(
|
||||||
|
0.95f,0.05f,0.0f,
|
||||||
|
0.0f,0.433f,0.567f,
|
||||||
|
0.0f,0.475f,0.525f)
|
||||||
|
};
|
||||||
|
struct appdata_t
|
||||||
|
{
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
float4 color : COLOR;
|
||||||
|
float2 texcoord : TEXCOORD0;
|
||||||
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f
|
||||||
|
{
|
||||||
|
float4 vertex : SV_POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float2 texcoord : TEXCOORD0;
|
||||||
|
float4 worldPosition : TEXCOORD1;
|
||||||
|
half4 mask : TEXCOORD2;
|
||||||
|
UNITY_VERTEX_OUTPUT_STEREO
|
||||||
|
};
|
||||||
|
|
||||||
|
sampler2D _MainTex;
|
||||||
|
fixed4 _Color;
|
||||||
|
fixed4 _TextureSampleAdd;
|
||||||
|
float4 _ClipRect;
|
||||||
|
float4 _MainTex_ST;
|
||||||
|
float _UIMaskSoftnessX;
|
||||||
|
float _UIMaskSoftnessY;
|
||||||
|
|
||||||
|
v2f vert(appdata_t v)
|
||||||
|
{
|
||||||
|
v2f OUT;
|
||||||
|
UNITY_SETUP_INSTANCE_ID(v);
|
||||||
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||||
|
float4 vPosition = UnityObjectToClipPos(v.vertex);
|
||||||
|
OUT.worldPosition = v.vertex;
|
||||||
|
OUT.vertex = vPosition;
|
||||||
|
|
||||||
|
float2 pixelSize = vPosition.w;
|
||||||
|
pixelSize /= float2(1, 1) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
|
||||||
|
|
||||||
|
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
|
||||||
|
float2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
|
||||||
|
OUT.texcoord = TRANSFORM_TEX(v.texcoord.xy, _MainTex);
|
||||||
|
OUT.mask = half4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy)));
|
||||||
|
|
||||||
|
OUT.color = v.color * _Color;
|
||||||
|
return OUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed4 frag(v2f IN) : SV_Target
|
||||||
|
{
|
||||||
|
half4 color = IN.color * (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
|
||||||
|
|
||||||
|
#ifdef UNITY_UI_CLIP_RECT
|
||||||
|
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
|
||||||
|
color.a *= m.x * m.y;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNITY_UI_ALPHACLIP
|
||||||
|
clip (color.a - 0.001);
|
||||||
|
#endif
|
||||||
|
float3 x = mul(color.rgb, color_matrices[type]);
|
||||||
|
return fixed4(x, color.a);
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
Runtime/Res/UX-GUI/UX_ImageDefault.shader.meta
Normal file
9
Runtime/Res/UX-GUI/UX_ImageDefault.shader.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: be26d7eaccb48ea43a343b69357edb55
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Runtime/Resources.meta
Normal file
8
Runtime/Resources.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cb3597fa68f346444a19a69ec27e3470
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Runtime/Resources/need_replace.png
Normal file
BIN
Runtime/Resources/need_replace.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1a5e8524f56413f47ae857979df91503
|
guid: b9975f2be09eab4449a3f00368f0da41
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -23,8 +23,6 @@ TextureImporter:
|
|||||||
isReadable: 0
|
isReadable: 0
|
||||||
streamingMipmaps: 0
|
streamingMipmaps: 0
|
||||||
streamingMipmapsPriority: 0
|
streamingMipmapsPriority: 0
|
||||||
vTOnly: 0
|
|
||||||
ignoreMasterTextureLimit: 0
|
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 6
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
@ -38,7 +36,7 @@ TextureImporter:
|
|||||||
mipBias: 0
|
mipBias: 0
|
||||||
wrapU: 1
|
wrapU: 1
|
||||||
wrapV: 1
|
wrapV: 1
|
||||||
wrapW: 1
|
wrapW: 0
|
||||||
nPOTScale: 0
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
@ -53,15 +51,12 @@ TextureImporter:
|
|||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 1
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 2
|
textureType: 8
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
singleChannelComponent: 0
|
singleChannelComponent: 0
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
maxTextureSizeSet: 0
|
||||||
compressionQualitySet: 0
|
compressionQualitySet: 0
|
||||||
textureFormatSet: 0
|
textureFormatSet: 0
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
applyGammaDecoding: 0
|
||||||
platformSettings:
|
platformSettings:
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
@ -69,18 +64,6 @@ TextureImporter:
|
|||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
textureCompression: 0
|
|
||||||
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
|
textureCompression: 1
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
crunchedCompression: 0
|
crunchedCompression: 0
|
||||||
@ -89,7 +72,7 @@ TextureImporter:
|
|||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
buildTarget: Server
|
buildTarget: Standalone
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
@ -113,17 +96,9 @@ TextureImporter:
|
|||||||
edges: []
|
edges: []
|
||||||
weights: []
|
weights: []
|
||||||
secondaryTextures: []
|
secondaryTextures: []
|
||||||
nameFileIdTable: {}
|
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
pSDRemoveMatte: 0
|
pSDRemoveMatte: 0
|
||||||
pSDShowRemoveMatteOption: 0
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
AssetOrigin:
|
|
||||||
serializedVersion: 1
|
|
||||||
productId: 264857
|
|
||||||
packageName: Heat - Complete Modern UI
|
|
||||||
packageVersion: 1.0.4
|
|
||||||
assetPath: Assets/Heat - Complete Modern UI/Editor/Icons/EditorBackground.png
|
|
||||||
uploadId: 629893
|
|
2548
Runtime/UGUIExtension/UX/UXImage.cs
Normal file
2548
Runtime/UGUIExtension/UX/UXImage.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Runtime/UGUIExtension/UX/UXImage.cs.meta
Normal file
11
Runtime/UGUIExtension/UX/UXImage.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: af0993b503fa4dd1adf519458df05486
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 2800000, guid: 15ee3f6b1f0782146bd77f1a10e869db, type: 3}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user