【m】1111

This commit is contained in:
2025-09-23 11:18:38 +08:00
parent b04e548850
commit a2e0062a34
202 changed files with 13296 additions and 56 deletions

View File

@@ -17,15 +17,15 @@ namespace Stary.Evo
Debug.Log(" 自动运行 ");
if (!PlayerPrefs.HasKey("StartUp"))
if (!EditorPrefs.HasKey("StartUp"))
{
// 通过标记记录是否已经执行过该方法
OnEditorStartUp();
PlayerPrefs.SetInt("StartUp", 1);
EditorPrefs.SetInt("StartUp", 1);
if (PlayerPrefs.GetInt("CreatDomainDirectory") == 0)
if (EditorPrefs.GetInt("CreatDomainDirectory") == 0)
{
PlayerPrefs.SetInt("CreatDomainDirectory", 1);
EditorPrefs.SetInt("CreatDomainDirectory", 1);
bool isOk = EditorUtility.DisplayDialog("提示", "发现目录存在缺失,是否检索并创建缺失目录", "是", "否");
if (isOk)
{
@@ -65,7 +65,7 @@ namespace Stary.Evo
/// </summary>
private static void OnEditorQuit()
{
PlayerPrefs.DeleteKey("StartUp");
EditorPrefs.DeleteKey("StartUp");
}
/// <summary>

View File

@@ -300,7 +300,7 @@ namespace Stary.Evo.Editor
CollectPath = assetPath,
CollectorGUID = guid,
CollectorType = ECollectorType.MainAssetCollector,
AddressRuleName = nameof(AddressByFolderAndFileName),
AddressRuleName = nameof(AddressByGroupAndFileName),
AssetTags = groupName,
};

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 65c1f47a72467004ba34ba38e7946792
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
namespace NamespaceX
{
public class ArchitectureX : Architecture<ArchitectureX>
{
protected override void Init()
{
//注册示例
//RegisterSystem<IScoreSystem>(new ScoreSystem());
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2d658df380e510e4891bee300ad300b6
guid: 87dbc7ed6b6d56d4192c57f52677788e
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,18 @@
{
"name": "MODULE_IDENT",
"rootNamespace": "ROOT_NAMESPACE",
"references": [
"GUID:d1a793c2b6959e04ea45b972eaa369c8",
"GUID:e34a5702dd353724aa315fb8011f08c3",
"GUID:f3fa071c399c4383a9ff8115e53dfefc"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0f96d3c3c5e9b98439185f95d7135c9b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 39a67460f559484da2b52def8ff05571, type: 3}
m_Name: BuildAssetDataSetting
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes: []
packageName: J0001
packageVersionX: 1
packageVersionY: 0
packageVersionZ: 0
environmentType: 1
selectedBuildPipelines: 1
packageVersion: 1.0.0
VersionType: 0
viewer:
clearBuildCacheToggle: 0
useAssetDependencyDBToggle: 1
copyBuildinFileOption: 1
copyBuildinFileParams:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0c92d0b29ec1042db972ce28367bb147
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 16995157, guid: a811bde74b26b53498b4f6d872b09b6d, type: 3}
m_Name: DOTweenSettings
m_EditorClassIdentifier:
useSafeMode: 1
safeModeOptions:
logBehaviour: 2
nestedTweenFailureBehaviour: 0
timeScale: 1
unscaledTimeScale: 1
useSmoothDeltaTime: 0
maxSmoothUnscaledTime: 0.15
rewindCallbackMode: 0
showUnityEditorReport: 0
logBehaviour: 0
drawGizmos: 1
defaultRecyclable: 0
defaultAutoPlay: 3
defaultUpdateType: 0
defaultTimeScaleIndependent: 0
defaultEaseType: 6
defaultEaseOvershootOrAmplitude: 1.70158
defaultEasePeriod: 0
defaultAutoKill: 1
defaultLoopType: 0
debugMode: 0
debugStoreTargetId: 1
showPreviewPanel: 1
storeSettingsLocation: 0
modules:
showPanel: 0
audioEnabled: 1
physicsEnabled: 1
physics2DEnabled: 1
spriteEnabled: 1
uiEnabled: 1
textMeshProEnabled: 0
tk2DEnabled: 0
deAudioEnabled: 0
deUnityExtendedEnabled: 0
epoOutlineEnabled: 0
createASMDEF: 1
showPlayingTweens: 0
showPausedTweens: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f3093ad85d81554e9bd2b48ad8107f1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
using System.Threading.Tasks;
using Stary.Evo;
using UnityEngine;
namespace NamespaceX
{
public class ClassNameXX :DomainBase,IController
{
public override void OnEnter(string param)
{
base.OnEnter(param);
Debug.Log("UnityEvo: OnEnter进入成功");
}
public override void OnExit()
{
base.OnExit();
GetArchitecture().OnDispose();
Debug.Log("UnityEvo: OnExit退出成功");
}
public override Task OnEnterAsync(string param)
{
Debug.Log("UnityEvo: OnEnterAsync进入成功");
return base.OnEnterAsync(param);
}
public override Task OnExitAsync()
{
Debug.Log("UnityEvo: OnEnterAsync退出成功");
return base.OnExitAsync();
}
public IArchitecture GetArchitecture()
{
return ReturnArchitecture.Interface;
}
}
public class ArchitectureX : Architecture<ArchitectureX>
{
protected override void Init()
{
//注册示例
//RegisterSystem<IScoreSystem>(new ScoreSystem());
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 021eede2852e4f19adfcb519fa2b7fbb
timeCreated: 1742540660

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f254dea8c7362f44786a14b71df03218
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c6cf47ade551d4a4b8f09ce0e8474a66
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: d3977e5818ca1d34092c4549ad995749
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
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: 0
wrapV: 0
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: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d48b136013127442b937e501c984804c, type: 3}
m_Name: RKImageLib
m_EditorClassIdentifier:
m_GuidLow: 5135786987047100596
m_GuidHigh: 15450990355053443760
m_DataStore:
m_Storage: []
m_Images:
- m_SerializedGuid:
m_GuidLow: 5744779408460923791
m_GuidHigh: 5634450902290279836
m_SerializedTextureGuid:
m_GuidLow: 2104334185301245528
m_GuidHigh: 5284861657280228361
m_Size: {x: 0.2, y: 0.20027064}
m_SpecifySize: 1
m_Index: 1
m_ImageQuality: 1
m_Name: shuimu
m_Texture: {fileID: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 09fdcf33d6c60744287fac84ec8dbec8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using Newtonsoft.Json;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
@@ -13,6 +14,11 @@ namespace Stary.Evo
{
private static string authorization;
static WebRequestSystem()
{
authorization = EditorPrefs.GetString("Authorization");
}
public static async Task<bool> Login(string url, string username, string password)
{
var data = new
@@ -53,7 +59,7 @@ namespace Stary.Evo
JsonConvert.DeserializeObject<AuthenticationResponse>(authResponse.data.ToString());
Debug.Log("UnityEvo:AuthenticationResponse" + authResponseData.Token);
authorization = authResponseData.Token;
PlayerPrefs.SetString("Authorization", authorization);
EditorPrefs.SetString("Authorization", authorization);
Debug.Log("UnityEvo:登录成功");
return true;
}
@@ -76,7 +82,7 @@ namespace Stary.Evo
/// <returns></returns>
public static async Task<bool> GetValidateToken(string url)
{
authorization = PlayerPrefs.GetString("Authorization");
authorization = EditorPrefs.GetString("Authorization");
try
{
using UnityWebRequest webRequest = UnityWebRequest.Get($"{url}?token={authorization}");

View File

@@ -1,6 +1,6 @@
{
"name": "com.staryevo.main",
"version": "2.0.3",
"version": "2.0.4",
"displayName": "00.StaryEvo",
"description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3",

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 837b1c9b253d1a64d95fca965f70a711
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -9,7 +9,7 @@
"GUID:e34a5702dd353724aa315fb8011f08c3",
"GUID:ff70fce64a3314305977bdf5610ed86b",
"GUID:ec45849e30ba03e4dab386099d8c697b",
"GUID:6a5d7223300a2ef48aa366288a446472"
"GUID:fad681b9bfe621d4fa07f4f69c311443"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -1,6 +1,6 @@
{
"name": "com.staryevo.tools",
"version": "1.0.8",
"version": "1.1.0",
"displayName": "00.StaryEvo.Tools",
"description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3",

View File

@@ -0,0 +1,292 @@
using System;
using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEditor;
using UnityEngine;
using UnityEngine.U2D;
using UnityEngine.UI;
namespace Stary.Evo
{
/* 获取内置图片
* AssetDatabase.GetBuiltinExtraResource
* "UI/Skin/UISprite.psd"
"UI/Skin/Background.psd"
"UI/Skin/InputFieldBackground.psd"
"UI/Skin/Knob.psd"
"UI/Skin/Checkmark.psd"
"UI/Skin/DropdownArrow.psd"
"UI/Skin/UIMask.psd"
*/
public class OverrideUICreate
{
[MenuItem("GameObject/UI/Image", true)]
public static void IgnoreImage()
{
}
[MenuItem("GameObject/UI/Image.")]
public static void CreateImage()
{
var image = Create<Image>();
image.raycastTarget = false;
image.maskable = image.GetComponentInParent<RectMask2D>() != null || image.GetComponentInParent<Mask>() != null;
image.gameObject.SetLayerRecursively(Layer.UI);
}
[MenuItem("GameObject/UI/Raw Image", true)]
public static void IgnoreRawImage()
{
}
[MenuItem("GameObject/UI/RawImage")]
public static void CreateRawImage()
{
var image = Create<RawImage>();
image.raycastTarget = false;
image.maskable = image.GetComponentInParent<RectMask2D>() != null || image.GetComponentInParent<Mask>() != null;
image.gameObject.SetLayerRecursively(Layer.UI);
}
[MenuItem("GameObject/UI/Button")]
public static void CreateButton()
{
var image = Create<Image>("Button");
var button = image.gameObject.AddComponent<Button>();
image.maskable = image.GetComponentInParent<RectMask2D>() != null || image.GetComponentInParent<Mask>() != null;
image.rectTransform.sizeDelta = new Vector2(160, 30);
image.gameObject.SetLayerRecursively(Layer.UI);
}
[MenuItem("GameObject/UI/Text - TextMeshPro", true)]
public static void IgnoreTextMeshPro()
{
}
[MenuItem("GameObject/UI/Text - TextMeshPro")]
public static void CreateTextMeshPro()
{
var textMeshPro = Create<TextMeshProUGUI>("Text");
textMeshPro.raycastTarget = false;
textMeshPro.color = Color.black;
textMeshPro.maskable = textMeshPro.GetComponentInParent<RectMask2D>() != null || textMeshPro.GetComponentInParent<Mask>() != null;
textMeshPro.gameObject.SetLayerRecursively(Layer.UI);
}
[MenuItem("GameObject/UI/Button - TextMeshPro", true)]
public static void IgnoreButtonTextMeshPro()
{
}
[MenuItem("GameObject/UI/Button - TextMeshPro")]
public static void CreateButtonTextMeshPro()
{
var image = Create<Image>("Button");
var button = image.gameObject.AddComponent<Button>();
var textMeshPro = Create<TextMeshProUGUI>("Text", button.transform);
textMeshPro.raycastTarget = false;
textMeshPro.maskable = textMeshPro.GetComponentInParent<RectMask2D>() != null || textMeshPro.GetComponentInParent<Mask>() != null;
textMeshPro.text = "Button";
textMeshPro.alignment = TextAlignmentOptions.Center;
textMeshPro.alignment = TextAlignmentOptions.Midline;
textMeshPro.rectTransform.anchorMin = Vector3.zero;
textMeshPro.rectTransform.anchorMax = Vector3.one;
textMeshPro.rectTransform.sizeDelta = Vector2.zero;
textMeshPro.color = Color.black;
textMeshPro.fontSize = 24;
image.maskable = textMeshPro.maskable;
image.rectTransform.sizeDelta = new Vector2(160, 30);
image.gameObject.SetLayerRecursively(Layer.UI);
}
#region ScrollRect
[MenuItem("GameObject/UI/Scroll View", true)]
public static void IgnoreScrollView()
{
}
[MenuItem("GameObject/UI/UIScrollView")]
public static ScrollRect CreateScrollView()
{
var image = Create<Image>("UIScrollView");
image.raycastTarget = true;
image.maskable = false;
image.rectTransform.sizeDelta = new Vector2(200, 200);
var scrollRect = image.gameObject.AddComponent<ScrollRect>();
var uIScrollView = image.gameObject.AddComponent<UIScrollView>();
var viewportImage = Create<Image>("Viewport", uIScrollView.transform);
viewportImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UIMask.psd");
viewportImage.type = Image.Type.Sliced;
viewportImage.raycastTarget = true;
viewportImage.maskable = true;
var viewport = viewportImage.transform as RectTransform;
viewport.gameObject.AddComponent<RectMask2D>();
viewport.anchorMin = Vector2.zero;
viewport.anchorMax = Vector2.one;
viewport.pivot = new Vector2(0, 1);
viewport.sizeDelta = Vector2.zero;
viewport.anchoredPosition = Vector2.zero;
scrollRect.viewport = viewport;
var content = Create<RectTransform>("Content", viewport);
content.anchorMin = new Vector2(0, 1);
content.anchorMax = new Vector2(1, 1);
content.pivot = new Vector2(0, 1);
content.sizeDelta = new Vector2(0, 300);
content.anchoredPosition = Vector2.zero;
scrollRect.content = content;
uIScrollView.m_ScrollRect = scrollRect;
uIScrollView.m_Content = content;
scrollRect.gameObject.SetLayerRecursively(Layer.UI);
return scrollRect;
}
[MenuItem("GameObject/UI/UIScrollView - Horizontal")]
public static void CreateScrollViewHorizontal()
{
var scrollRect = CreateScrollView();
scrollRect.horizontalScrollbar = CreateScrollBar("Scrollbar Horizontal", scrollRect.transform);
scrollRect.horizontalScrollbar.direction = Scrollbar.Direction.LeftToRight;
scrollRect.verticalScrollbarVisibility = scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scrollRect.verticalScrollbarSpacing = scrollRect.horizontalScrollbarSpacing = -3;
var uiScrollView = scrollRect.GetComponent<UIScrollView>();
uiScrollView.m_AxisType = RectTransform.Axis.Horizontal;
uiScrollView.m_AlignType = AlignType.Left;
scrollRect.gameObject.SetLayerRecursively(Layer.UI);
}
[MenuItem("GameObject/UI/UIScrollView - Vertical")]
public static void CreateScrollViewVertical()
{
var scrollRect = CreateScrollView();
scrollRect.verticalScrollbar = CreateScrollBar("Scrollbar Vertical", scrollRect.transform);
var verticalRect = scrollRect.verticalScrollbar.transform as RectTransform;
verticalRect.anchorMin = new Vector2(1, 0);
verticalRect.anchorMax = new Vector2(1, 1);
verticalRect.pivot = new Vector2(1, 1);
verticalRect.sizeDelta = new Vector2(20, 0);
verticalRect.anchoredPosition = Vector2.zero;
scrollRect.verticalScrollbar.direction = Scrollbar.Direction.BottomToTop;
scrollRect.verticalScrollbarVisibility = scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scrollRect.verticalScrollbarSpacing = scrollRect.horizontalScrollbarSpacing = -3;
scrollRect.gameObject.SetLayerRecursively(Layer.UI);
}
[MenuItem("GameObject/UI/UIScrollView - All")]
public static void CreateScrollViewAll()
{
var scrollRect = CreateScrollView();
scrollRect.horizontalScrollbar = CreateScrollBar("Scrollbar Horizontal", scrollRect.transform);
scrollRect.horizontalScrollbar.direction = Scrollbar.Direction.LeftToRight;
scrollRect.verticalScrollbar = CreateScrollBar("Scrollbar Vertical", scrollRect.transform);
var verticalRect = scrollRect.verticalScrollbar.transform as RectTransform;
verticalRect.anchorMin = new Vector2(1, 0);
verticalRect.anchorMax = new Vector2(1, 1);
verticalRect.pivot = new Vector2(1, 1);
verticalRect.sizeDelta = new Vector2(20, 0);
verticalRect.anchoredPosition = Vector2.zero;
scrollRect.verticalScrollbar.direction = Scrollbar.Direction.BottomToTop;
scrollRect.verticalScrollbarVisibility = scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scrollRect.verticalScrollbarSpacing = scrollRect.horizontalScrollbarSpacing = -3;
scrollRect.gameObject.SetLayerRecursively(Layer.UI);
}
public static Scrollbar CreateScrollBar(string name, Transform parent)
{
var verticalScorllImage = Create<Image>(name, parent);
verticalScorllImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/Background.psd");
verticalScorllImage.type = Image.Type.Sliced;
var verticalScroll = verticalScorllImage.gameObject.AddComponent<Scrollbar>();
var verticalRect = verticalScroll.transform as RectTransform;
verticalRect.anchorMin = Vector2.zero;
verticalRect.anchorMax = new Vector2(1, 0);
verticalRect.pivot = Vector2.zero;
verticalRect.sizeDelta = new Vector2(0, 20);
verticalRect.anchoredPosition = Vector2.zero;
var handle = Create<Image>("Handle", verticalRect.transform);
handle.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd");
handle.type = Image.Type.Sliced;
handle.rectTransform.anchorMin = Vector2.zero;
handle.rectTransform.anchorMax = Vector2.one;
handle.rectTransform.sizeDelta = Vector2.zero;
handle.rectTransform.anchoredPosition = Vector2.zero;
verticalScroll.handleRect = handle.rectTransform;
return verticalScroll;
}
#endregion
[MenuItem("GameObject/UI/Slider", true)]
public static void IgnoreSlider()
{
}
[MenuItem("GameObject/UI/Slider.")]
public static void CreateSlider()
{
var image = Create<Image>("Slider");
image.color = Color.grey;
image.rectTransform.sizeDelta = new Vector2(160, 20);
var slider = image.gameObject.AddComponent<Slider>();
slider.interactable = false;
slider.transition = Selectable.Transition.None;
var fill = Create<Image>("Fill", slider.transform);
fill.rectTransform.anchorMin = Vector2.zero;
fill.rectTransform.anchorMax = new Vector2(0, 1);
fill.rectTransform.sizeDelta = Vector2.zero;
fill.rectTransform.anchoredPosition = Vector2.zero;
slider.fillRect = fill.rectTransform;
var handle = Create<Image>("Handle", slider.transform);
handle.rectTransform.anchorMin = Vector2.zero;
handle.rectTransform.anchorMax = new Vector2(0, 1);
handle.rectTransform.sizeDelta = new Vector2(20, 0);
handle.rectTransform.anchoredPosition = Vector2.zero;
handle.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/Knob.psd");
slider.handleRect = handle.rectTransform;
image.gameObject.SetLayerRecursively(Layer.UI);
}
public static T Create<T>(string name = null, Transform parent = null) where T : Component
{
if (string.IsNullOrEmpty(name))
name = typeof(T).Name;
GameObject go = new GameObject(name);
if (parent == null)
{
go.transform.SetParent(Selection.activeTransform);
Selection.activeGameObject = go;
}
else
{
go.transform.SetParent(parent);
}
go.transform.localScale = Vector3.one;
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
return go.AddComponent<T>();
}
}
}

View File

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

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b8cd8920119b49bc95c6755ae94d1b26
timeCreated: 1758179166

View File

@@ -0,0 +1,41 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenAlpha))]
public class TweenAlphaEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenAlpha tw = target as TweenAlpha;
GUI.changed = false;
var from = EditorGUILayout.Slider("From", tw.from, 0f, 1f);
var to = EditorGUILayout.Slider("To", tw.to, 0f, 1f);
var ds = tw.autoCleanup;
var pn = tw.colorProperty;
if (tw.GetComponent<MeshRenderer>() != null)
{
ds = EditorGUILayout.Toggle("Auto-cleanup", tw.autoCleanup);
pn = EditorGUILayout.TextField("Color Property", tw.colorProperty);
}
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
tw.autoCleanup = ds;
tw.colorProperty = pn;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6ca1a2b070be6f04f9dc2b6756d084ff
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,30 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenColor))]
public class TweenColorEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenColor tw = target as TweenColor;
GUI.changed = false;
Color from = EditorGUILayout.ColorField("From", tw.from);
Color to = EditorGUILayout.ColorField("To", tw.to);
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7928b5af346eed04ba391047b8b0ddc8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,30 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenFOV))]
public class TweenFOVEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenFOV tw = target as TweenFOV;
GUI.changed = false;
float from = EditorGUILayout.Slider("From", tw.from, 1f, 180f);
float to = EditorGUILayout.Slider("To", tw.to, 1f, 180f);
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 11db62d6da2a5f34590f41ebb958bd94
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,46 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenHeight))]
public class TweenHeightEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenHeight tw = target as TweenHeight;
GUI.changed = false;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(tw.fromTarget != null);
var from = EditorGUILayout.FloatField("From", tw.from);
EditorGUI.EndDisabledGroup();
var fc = (RectTransform)EditorGUILayout.ObjectField(tw.fromTarget, typeof(RectTransform), true, GUILayout.Width(110f));
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(tw.toTarget != null);
var to = EditorGUILayout.FloatField("To", tw.to);
EditorGUI.EndDisabledGroup();
var tc = (RectTransform)EditorGUILayout.ObjectField(tw.toTarget, typeof(RectTransform), true, GUILayout.Width(110f));
EditorGUILayout.EndHorizontal();
if (from < 0) from = 0;
if (to < 0) to = 0;
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
tw.fromTarget = fc;
tw.toTarget = tc;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c135e5506eb921409b47fa6543134ec
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,33 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenOrthoSize))]
public class TweenOrthoSizeEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenOrthoSize tw = target as TweenOrthoSize;
GUI.changed = false;
float from = EditorGUILayout.FloatField("From", tw.from);
float to = EditorGUILayout.FloatField("To", tw.to);
if (from < 0f) from = 0f;
if (to < 0f) to = 0f;
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 37cda4ddb333a6d469473d36a439d20e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,30 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenPosition))]
public class TweenPositionEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenPosition tw = target as TweenPosition;
GUI.changed = false;
Vector3 from = EditorGUILayout.Vector3Field("From", tw.from);
Vector3 to = EditorGUILayout.Vector3Field("To", tw.to);
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5c3ed7d7dc3fe434d8fbe43ba848c7de
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,32 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenRotation))]
public class TweenRotationEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenRotation tw = target as TweenRotation;
GUI.changed = false;
Vector3 from = EditorGUILayout.Vector3Field("From", tw.from);
Vector3 to = EditorGUILayout.Vector3Field("To", tw.to);
var quat = EditorGUILayout.Toggle("Quaternion", tw.quaternionLerp);
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
tw.quaternionLerp = quat;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 37920e4b9f98bd44fa1250a9d995475c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,30 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenScale))]
public class TweenScaleEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenScale tw = target as TweenScale;
GUI.changed = false;
Vector3 from = EditorGUILayout.Vector3Field("From", tw.from);
Vector3 to = EditorGUILayout.Vector3Field("To", tw.to);
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 50b7b0504ae552a42b20841c085dc185
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,9 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenTransform))]
public class TweenTransformEditor : UITweenerEditor
{
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9ff6713338f44844c82de82685521dd3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,30 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenVolume))]
public class TweenVolumeEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenVolume tw = target as TweenVolume;
GUI.changed = false;
float from = EditorGUILayout.Slider("From", tw.from, 0f, 1f);
float to = EditorGUILayout.Slider("To", tw.to, 0f, 1f);
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 023e6404a70e48148b315cf9737211af
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,46 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(TweenWidth))]
public class TweenWidthEditor : UITweenerEditor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 120f;
TweenWidth tw = target as TweenWidth;
GUI.changed = false;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(tw.fromTarget != null);
var from = EditorGUILayout.FloatField("From", tw.from);
EditorGUI.EndDisabledGroup();
var fc = (RectTransform)EditorGUILayout.ObjectField(tw.fromTarget, typeof(RectTransform), true, GUILayout.Width(110f));
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(tw.toTarget != null);
var to = EditorGUILayout.FloatField("To", tw.to);
EditorGUI.EndDisabledGroup();
var tc = (RectTransform)EditorGUILayout.ObjectField(tw.toTarget, typeof(RectTransform), true, GUILayout.Width(110f));
EditorGUILayout.EndHorizontal();
if (from < 0) from = 0;
if (to < 0) to = 0;
if (GUI.changed)
{
//NGUIEditorTools.RegisterUndo("Tween Change", tw);
tw.from = from;
tw.to = to;
tw.fromTarget = fc;
tw.toTarget = tc;
//NGUITools.SetDirty(tw);
}
DrawCommonProperties();
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d35cd8e39586acb4a842a0c77019d598
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,118 @@
#if UNITY_EDITOR
//-------------------------------------------------
// NGUI: Next-Gen UI kit
// Copyright © 2011-2020 Tasharen Entertainment Inc
//-------------------------------------------------
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(UITweener), true)]
public class UITweenerEditor : Editor
{
public override void OnInspectorGUI ()
{
GUILayout.Space(6f);
EditorGUIUtility.labelWidth = 110f;
base.OnInspectorGUI();
DrawCommonProperties();
}
static public bool DrawHeader(string text, string key, bool forceOn, bool minimalistic)
{
bool state = EditorPrefs.GetBool(key, true);
if (!minimalistic) GUILayout.Space(3f);
if (!forceOn && !state) GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f);
GUILayout.BeginHorizontal();
GUI.changed = false;
if (minimalistic)
{
if (state) text = "\u25BC" + (char)0x200a + text;
else text = "\u25BA" + (char)0x200a + text;
GUILayout.BeginHorizontal();
GUI.contentColor = EditorGUIUtility.isProSkin ? new Color(1f, 1f, 1f, 0.7f) : new Color(0f, 0f, 0f, 0.7f);
if (!GUILayout.Toggle(true, text, "PreToolbar2", GUILayout.MinWidth(20f))) state = !state;
GUI.contentColor = Color.white;
GUILayout.EndHorizontal();
}
else
{
text = "<b><size=11>" + text + "</size></b>";
if (state) text = "\u25BC " + text;
else text = "\u25BA " + text;
if (!GUILayout.Toggle(true, text, "dragtab", GUILayout.MinWidth(20f))) state = !state;
}
if (GUI.changed) EditorPrefs.SetBool(key, state);
if (!minimalistic) GUILayout.Space(2f);
GUILayout.EndHorizontal();
GUI.backgroundColor = Color.white;
if (!forceOn && !state) GUILayout.Space(3f);
return state;
}
static public void BeginContents()
{
EditorGUILayout.BeginHorizontal(GUILayout.MinHeight(10f));
GUILayout.Space(10f);
GUILayout.BeginVertical();
GUILayout.Space(2f);
}
static public void EndContents()
{
GUILayout.Space(3f);
GUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
GUILayout.Space(3f);
}
protected void DrawCommonProperties ()
{
UITweener tw = target as UITweener;
if (DrawHeader("Tweener", "Tweener", false , true))
{
BeginContents();
EditorGUIUtility.labelWidth = 110f;
GUI.changed = false;
UITweener.Style style = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);
AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f));
GUILayout.BeginHorizontal();
float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f));
GUILayout.Label("seconds");
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
float del = EditorGUILayout.FloatField("Start Delay", tw.delay, GUILayout.Width(170f));
GUILayout.Label("seconds");
GUILayout.EndHorizontal();
var deff = (UITweener.DelayAffects)EditorGUILayout.EnumPopup("Delay Affects", tw.delayAffects);
int tg = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f));
bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale);
bool fx = EditorGUILayout.Toggle("Use Fixed Update", tw.useFixedUpdate);
if (GUI.changed)
{
tw.animationCurve = curve;
tw.style = style;
tw.ignoreTimeScale = ts;
tw.tweenGroup = tg;
tw.duration = dur;
tw.delay = del;
tw.delayAffects = deff;
tw.useFixedUpdate = fx;
}
EndContents();
}
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3564c93409a4aaa44a48de1e49be56ba
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 391048bfcbd4480ebaf66c91987b291f
timeCreated: 1758179210

View File

@@ -0,0 +1,252 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Linq;
namespace Stary.Evo
{
public class ControlItemDrawer
{
private UIControlDataEditor _container;
private CtrlItemData _itemData;
private bool _foldout = true;
private int _controlTypeIdx = 0;
public ControlItemDrawer(UIControlDataEditor container, CtrlItemData item)
{
_container = container;
_itemData = item;
}
public bool Draw()
{
EditorGUI.BeginChangeCheck();
Rect rect = EditorGUILayout.BeginVertical();
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("变量名 ", UIControlDataEditor.skin.label, GUILayout.Width(60f));
string newName = EditorGUILayout.TextField(_itemData.name, UIControlDataEditor.skin.textField).Trim();
if (newName != _itemData.name)
{
_itemData.name = newName;
(_container.target as UIControlData).SetDirty();
}
EditorGUILayout.Space();
_foldout = EditorGUILayout.Foldout(_foldout, _foldout ? "收起" : "展开", true);
if (GUILayout.Button("+", EditorStyles.miniButton))
{
_container.AddControlAfter(this);
return false;
}
if (GUILayout.Button("-", EditorStyles.miniButton))
{
_container.RemoveControl(this);
return false;
}
GUILayout.FlexibleSpace();
}
EditorGUILayout.EndHorizontal();
// 控件列表
if (_foldout)
{
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("变量类型 ", UIControlDataEditor.skin.label, GUILayout.Width(60f));
if (_controlTypeIdx == 0 && !string.IsNullOrEmpty(_itemData.type))
_controlTypeIdx = FindTypeIdx(_itemData.type);
if (EditorGUI.EndChangeCheck())
{
(_container.target as UIControlData).SetDirty();
}
EditorGUI.BeginChangeCheck();
_controlTypeIdx = EditorGUILayout.Popup(_controlTypeIdx, _container.allTypeNames, UIControlDataEditor.popupAlignLeft);
if (EditorGUI.EndChangeCheck())
{
if(_controlTypeIdx != 0)
{
if (!ChangeControlsTypeTo(_controlTypeIdx))
_controlTypeIdx = 0; // 切换失败,重置回自动
}
else // 被主动设置为了自动
_itemData.type = string.Empty;
(_container.target as UIControlData).SetDirty();
return false;
}
EditorGUI.BeginChangeCheck();
GUILayout.FlexibleSpace();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
for (int i = 0, imax = _itemData.targets.Length; i < imax; i++)
{
Object obj = _itemData.targets[i];
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
_itemData.targets[i] = EditorGUILayout.ObjectField(obj, typeof(Object), true);
if (EditorGUI.EndChangeCheck())
{
(_container.target as UIControlData).SetDirty();
}
EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space();
if (GUILayout.Button("+", EditorStyles.miniButton))
{
InsertItem(i + 1);
return false;
}
if (GUILayout.Button("-", EditorStyles.miniButton))
{
if(_itemData.targets.Length == 1)
{
Debug.LogError("至少应保留一个控件");
return false;
}
else
{
RemoveItem(i);
return false;
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
}
}
EditorGUILayout.EndVertical();
if (EditorGUIUtility.isProSkin)
GUI.Box(new Rect(rect.x - 10f, rect.y - 5f, rect.width + 20f, rect.height + 15f), "");
else
GUI.Box(new Rect(rect.x - 10f, rect.y - 5f, rect.width + 20f, rect.height + 15f), "", UIControlDataEditor.skin.box);
if (EditorGUI.EndChangeCheck())
{
(_container.target as UIControlData).SetDirty();
}
PostProcess();
return true;
}
private void PostProcess()
{
// 默认将新添加的第一个控件的名字作为变量名
if (_itemData.targets.Length > 0 && _itemData.targets[0] != null && string.IsNullOrEmpty(_itemData.name))
_itemData.name = _itemData.targets[0].name.Trim();
}
private int FindTypeIdx(string typeName)
{
string[] allTypeNames = _container.allTypeNames;
for (int i = 0, imax = allTypeNames.Length; i < imax; i++)
{
if(allTypeNames[i] == typeName)
return i;
}
return 0;
}
private void InsertItem(int idx)
{
Object[] newArr = new Object[_itemData.targets.Length + 1];
for(int i = 0; i < idx; i++)
{
newArr[i] = _itemData.targets[i];
}
newArr[idx] = null;
for(int i = idx + 1; i < newArr.Length; i++)
{
newArr[i] = _itemData.targets[i - 1];
}
_itemData.targets = newArr;
}
private void RemoveItem(int idx)
{
Object[] newArr = new Object[_itemData.targets.Length - 1];
for(int i = 0; i < idx; i++)
{
newArr[i] = _itemData.targets[i];
}
for(int i = idx; i < newArr.Length; i++)
{
newArr[idx] = _itemData.targets[i + 1];
}
_itemData.targets = newArr;
}
/// <summary>
/// 将控件切换到指定类型
/// </summary>
/// <param name="typeIdx"></param>
private bool ChangeControlsTypeTo(int typeIdx)
{
System.Type targetType = _container.allTypes[typeIdx];
string targetTypeName = _container.allTypeNames[typeIdx];
bool isGameObject = targetType == typeof(GameObject);
for(int i = 0, imax = _itemData.targets.Length; i < imax; i++)
{
Object obj = _itemData.targets[i];
if (obj == null)
{
Debug.LogErrorFormat("[{0}.{1}] control[{2}] is null"
, _container.target.name, _itemData.name, i);
return false;
}
if(obj.GetType() != typeof(GameObject))
{
if((obj as Component) == null)
{
Debug.LogErrorFormat("[{0}.{1}] control[{2}] [{3}] must be GameObject or a Component"
, _container.target.name, _itemData.name, i, obj.name);
return false;
}
obj = (obj as Component).gameObject;
}
GameObject go = obj as GameObject;
if (isGameObject)
_itemData.targets[i] = go;
else
{
Component comp = go.GetComponent(targetType);
if(comp == null)
{
Debug.LogErrorFormat("[{0}.{1}] control[{2}] [{3}] isn't a {4}"
, _container.target.name, _itemData.name, i, go.name, targetTypeName);
return false;
}
_itemData.targets[i] = comp;
}
}
_itemData.type = targetTypeName;
return true;
}
}
}
#endif

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 5a19fd525bc43e2439c14dac7ed67295
timeCreated: 1521794417
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Stary.Evo
{
public class SubUIItemDrawer
{
private UIControlDataEditor _container;
private SubUIItemData _itemData;
private bool _foldout = true;
public SubUIItemDrawer(UIControlDataEditor container, SubUIItemData itemData)
{
_container = container;
_itemData = itemData;
}
public bool Draw()
{
Rect rect = EditorGUILayout.BeginVertical();
{
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("子UI名 ", UIControlDataEditor.skin.label);
_itemData.name = EditorGUILayout.TextField(_itemData.name, UIControlDataEditor.skin.textField).Trim();
EditorGUILayout.Space();
_foldout = EditorGUILayout.Foldout(_foldout, _foldout ? "收起" : "展开", true);
if (GUILayout.Button("+", EditorStyles.miniButton))
{
_container.AddSubUIAfter(this);
return false;
}
if (GUILayout.Button("-", EditorStyles.miniButton))
{
_container.RemoveSubUI(this);
return false;
}
}
EditorGUILayout.EndHorizontal();
if (_foldout)
{
EditorGUILayout.Space();
_itemData.subUIData = EditorGUILayout.ObjectField(_itemData.subUIData as Object, typeof(UIControlData), true) as UIControlData;
}
}
EditorGUILayout.EndVertical();
if (EditorGUIUtility.isProSkin)
GUI.Box(new Rect(rect.x - 10f, rect.y - 5f, rect.width + 20f, rect.height + 15f), "");
else
GUI.Box(new Rect(rect.x - 10f, rect.y - 5f, rect.width + 20f, rect.height + 15f), "", UIControlDataEditor.skin.box);
PostProcess();
return true;
}
private void PostProcess()
{
// 默认将控件的名字作为变量名
if (_itemData.subUIData != null && string.IsNullOrEmpty(_itemData.name))
_itemData.name = _itemData.subUIData.name.Trim();
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,234 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
namespace Stary.Evo
{
[CustomEditor(typeof(UIControlData))]
public class UIControlDataEditor : UnityEditor.Editor
{
public static GUISkin skin;
public static GUIStyle popupAlignLeft; // TODO 挪出去一个 SkinManager
public string[] allTypeNames;
public Type[] allTypes;
private List<CtrlItemData> _ctrlItemDatas;
private List<SubUIItemData> _subUIItemDatas;
private List<ControlItemDrawer> _ctrlItemDrawers;
private List<SubUIItemDrawer> _subUIItemDrawers;
void Awake()
{
if(skin == null)
{
if (EditorGUIUtility.isProSkin)
skin = Resources.Load("Editor/UIControlDataSkinPro") as GUISkin;
else
skin = Resources.Load("Editor/UIControlDataSkinPersonal") as GUISkin;
}
if(popupAlignLeft == null)
{
popupAlignLeft = new GUIStyle("Popup");
popupAlignLeft.alignment = TextAnchor.MiddleLeft;
}
allTypeNames = UIControlData.GetAllTypeNames();
allTypes = UIControlData.GetAllTypes();
UIControlData uIControlData = target as UIControlData;
if (uIControlData != null)
{
uIControlData.CorrectComponents();
uIControlData.CheckSubUIs();
}
}
public override void OnInspectorGUI()
{
if (skin == null || skin.customStyles == null || skin.customStyles.Length == 0)
{
base.OnInspectorGUI();
return;
}
UIControlData data = target as UIControlData;
if(data.ctrlItemDatas == null)
data.ctrlItemDatas = new List<CtrlItemData>();
if(data.subUIItemDatas == null)
data.subUIItemDatas = new List<SubUIItemData>();
_ctrlItemDatas = data.ctrlItemDatas;
_subUIItemDatas = data.subUIItemDatas;
CheckDrawers();
EditorGUILayout.BeginVertical();
EditorGUILayout.Space();
// 绘制控件绑定
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("控件绑定", skin.customStyles[0]);
if(_ctrlItemDrawers.Count == 0)
{
if(GUILayout.Button("+", EditorStyles.miniButton))
{
AddControlAfter(-1);
Repaint();
return;
}
}
EditorGUILayout.EndHorizontal();
foreach (var drawer in _ctrlItemDrawers)
{
GUILayout.Space(10f);
if (!drawer.Draw())
{
Repaint();
return;
}
GUILayout.Space(10f);
}
GUILayout.Space(10f);
// 绘制子UI
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("子UI绑定", skin.customStyles[0]);
if(_subUIItemDrawers.Count == 0)
{
if (GUILayout.Button("+", EditorStyles.miniButton))
{
AddSubUIAfter(-1);
Repaint();
return;
}
}
EditorGUILayout.EndHorizontal();
foreach(var drawer in _subUIItemDrawers)
{
GUILayout.Space(10f);
if (!drawer.Draw())
{
Repaint();
return;
}
GUILayout.Space(10f);
}
EditorGUILayout.Space(); EditorGUILayout.Space();
EditorGUILayout.EndVertical();
this.Repaint();
}
public void AddControlAfter(ControlItemDrawer drawer)
{
int idx = _ctrlItemDrawers.IndexOf(drawer);
Debug.Assert(idx != -1);
AddControlAfter(idx);
}
public void AddSubUIAfter(SubUIItemDrawer drawer)
{
int idx = _subUIItemDrawers.IndexOf(drawer);
Debug.Assert(idx != -1);
AddSubUIAfter(idx);
}
public void RemoveControl(ControlItemDrawer drawer)
{
int idx = _ctrlItemDrawers.IndexOf(drawer);
Debug.Assert(idx != -1);
RemoveControl(idx);
}
public void RemoveSubUI(SubUIItemDrawer drawer)
{
int idx = _subUIItemDrawers.IndexOf(drawer);
Debug.Assert(idx != -1);
RemoveSubUI(idx);
}
#region Private
private void CheckDrawers()
{
if (_ctrlItemDrawers == null)
{
_ctrlItemDrawers = new List<ControlItemDrawer>(100);
foreach(var item in _ctrlItemDatas)
{
ControlItemDrawer drawer = new ControlItemDrawer(this, item);
_ctrlItemDrawers.Add(drawer);
}
}
if(_subUIItemDrawers == null)
{
_subUIItemDrawers = new List<SubUIItemDrawer>(100);
foreach(var item in _subUIItemDatas)
{
SubUIItemDrawer drawer = new SubUIItemDrawer(this, item);
_subUIItemDrawers.Add(drawer);
}
}
}
private void AddControlAfter(int idx)
{
CtrlItemData itemData = new CtrlItemData();
_ctrlItemDatas.Insert(idx + 1, itemData);
ControlItemDrawer drawer = new ControlItemDrawer(this, itemData);
_ctrlItemDrawers.Insert(idx + 1, drawer);
SetPrefabDirty();
}
private void AddSubUIAfter(int idx)
{
SubUIItemData itemData = new SubUIItemData();
_subUIItemDatas.Insert(idx + 1, itemData);
SubUIItemDrawer drawer = new SubUIItemDrawer(this, itemData);
_subUIItemDrawers.Insert(idx + 1, drawer);
SetPrefabDirty();
}
private void RemoveControl(int idx)
{
_ctrlItemDatas.RemoveAt(idx);
_ctrlItemDrawers.RemoveAt(idx);
SetPrefabDirty();
}
private void RemoveSubUI(int idx)
{
_subUIItemDatas.RemoveAt(idx);
_subUIItemDrawers.RemoveAt(idx);
SetPrefabDirty();
}
private void SetPrefabDirty()
{
UIControlData uIControlData = target as UIControlData;
uIControlData.SetDirty();
}
#endregion
}
}
#endif

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 27c41d595322d554a9afea0d2b516863
timeCreated: 1521786373
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,471 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Text.RegularExpressions;
using System.IO;
using Stary.Evo;
using System;
using System.Linq;
using Newtonsoft.Json;
using Stary.Evo.Editor;
public class UICreateWindow : EditorWindow
{
#region MenuItem
[MenuItem("Assets/Create/CreateUI")]
private static void CopyUI()
{
if (Selection.activeObject == null || !(Selection.activeObject is GameObject))
{
Debug.LogError("请选择UI预制体!");
return;
}
UICreateWindow.OpenWindow().uiPrefab = Selection.activeObject as GameObject;
}
[MenuItem("Tools/UI管理")]
public static UICreateWindow OpenWindow()
{
var window = GetWindow<UICreateWindow>("UI管理");
if (window == null)
{
window = CreateWindow<UICreateWindow>("UI管理");
}
window.name = "UI管理";
window.Focus();
return window;
}
#endregion
private string _mInput;
private Vector2 _scroll;
private Vector2 _scroll2;
private Vector2 _scroll3;
private string _uiViewTemplate = "UIViewTemplate";
private string _uiConfig = "UIConfig";
private string _uiName;
public GameObject uiPrefab;
private Dictionary<string, string> _uiNames = new Dictionary<string, string>();
private Dictionary<string, UIConfigJson> _uiJsonDatas = new Dictionary<string, UIConfigJson>();
private bool _isWindow = true;
private UILayer _layer = UILayer.NormalLayer;
private IEnumerable<Type> uiViews;
private string[] _domainNames;
private int _domainIndex;
private UIConfig _uiConfigObj;
private void OnEnable()
{
TryGetPath(ref _uiViewTemplate, _uiViewTemplate, ".txt");
_domainNames = CreatAssetWindow.GetCreatDomainAllName();
ValueChang();
}
private void ValueChang()
{
_uiJsonDatas.Clear();
_uiNames.Clear();
uiViews = ReflectionHelper.GetAllUIViewTypes(_domainNames[_domainIndex]);
DomainPathField();
foreach (var uiView in uiViews)
{
string str = uiView.Name;
if (str.Equals("Max")) continue;
var jsonData = GetUIJson(str);
//if (jsonData == null || string.IsNullOrEmpty(jsonData.path)) continue;
var scriptPath = GetUIScript(str, true);
_uiNames.AddOrUpdate(str, scriptPath);
}
}
private void OnGUI()
{
EditorGUILayout.LabelField("通过[Tools/UI管理]可以打开");
_scroll = EditorGUILayout.BeginScrollView(_scroll);
{
EditorGUILayout.HelpBox("UI基础文件", MessageType.Info);
{
PathField("UI模板文件.txt", ref _uiViewTemplate, nameof(_uiViewTemplate), ".txt");
DomainPathField();
EditorGUILayout.ObjectField(_uiConfig, _uiConfigObj, typeof(UIConfig), true);
}
EditorGUILayout.Space(10);
EditorGUILayout.BeginHorizontal();
{
_scroll2 = EditorGUILayout.BeginScrollView(_scroll2, "box", GUILayout.Width(position.width * 0.4f - 6));
{
var tempIndex =EditorGUILayout.Popup("Domain", _domainIndex, _domainNames);
if (tempIndex != _domainIndex)
{
ValueChang();
_domainIndex = tempIndex;
}
EditorGUILayout.HelpBox("已创建的UI", MessageType.Info);
_mInput = EditorGUILayout.TextField(_mInput, EditorStyles.toolbarSearchField, GUILayout.Height(20));
foreach (var uiView in uiViews)
{
string str = uiView.Name;
if (str.Equals("Max")) continue;
if (!string.IsNullOrEmpty(_mInput) && !str.Contains(_mInput)) continue;
var jsonData = GetUIJson(str);
var scriptPath = GetUIScript(str);
if (jsonData == null)
{
jsonData = new UIConfigJson();
}
if (string.IsNullOrEmpty(scriptPath)) continue;
var defaultColor = GUI.color;
if (str.Equals(_uiName))
{
GUI.color = Color.yellow;
}
EditorGUILayout.BeginHorizontal("box");
if (GUILayout.Button("选中"))
{
uiPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(jsonData.path);
}
EditorGUILayout.ObjectField(AssetDatabase.LoadAssetAtPath<GameObject>(jsonData.path),
typeof(GameObject), true);
EditorGUILayout.ObjectField(AssetDatabase.LoadAssetAtPath<TextAsset>(scriptPath),
typeof(TextAsset), true);
EditorGUILayout.EndHorizontal();
GUI.color = defaultColor;
}
}
EditorGUILayout.EndScrollView();
_scroll3 = EditorGUILayout.BeginScrollView(_scroll3, "box", GUILayout.Width(position.width * 0.6f - 6));
{
EditorGUILayout.HelpBox("UI操作", MessageType.Info);
uiPrefab = EditorGUILayout.ObjectField("UI预制体", uiPrefab, typeof(GameObject), true) as GameObject;
if (uiPrefab != null)
{
_uiName = uiPrefab.name;
var uiScriptPath = GetUIScript(_uiName);
if (string.IsNullOrEmpty(uiScriptPath))
{
var saveUIPath= $"Assets/Domain/{_domainNames[_domainIndex]}/Scripts/UI";
if (GUILayout.Button($"选择创建路径:{saveUIPath}"))
{
var newPath = EditorUtility.OpenFolderPanel("UI生成路径", saveUIPath, "");
saveUIPath = newPath.Replace(Application.dataPath, "Assets");
}
if (uiPrefab != null)
{
EditorGUILayout.TextField("UI生成路径", $"{saveUIPath}/{_uiName}.cs");
}
_isWindow = EditorGUILayout.Toggle("是否为窗口", _isWindow);
_layer = (UILayer)EditorGUILayout.EnumPopup("UILayer设置", _layer);
var defaultColor = GUI.color;
GUI.color = Color.green;
if (GUILayout.Button("创建UI"))
{
// 生成代码
string str = Regex.Replace(File.ReadAllText(_uiViewTemplate), "UIXXXView", _uiName);
UIControlData uiControlData = uiPrefab.GetComponent<UIControlData>();
if (uiControlData != null)
{
uiControlData.CopyCodeToClipBoardPrivate();
}
str = Regex.Replace(str, "//UIControlData",
uiControlData != null ? UnityEngine.GUIUtility.systemCopyBuffer : "");
string newPath = $"{saveUIPath}/{_uiName}.cs";
File.WriteAllText(newPath, str);
var jsonData = new UIConfigJson
{
uiType = _uiName,
pathId = $"Prefabs_{uiPrefab.name}",
path = AssetDatabase.GetAssetPath(uiPrefab),
isWindow = _isWindow,
uiLayer = _layer,
};
_uiJsonDatas.Add(_uiName, jsonData);
_uiNames.Add(_uiName, newPath);
SaveJson();
// 生成UIType
// var newStr = Regex.Replace(File.ReadAllText(_uiType), "Max,", $"{_uiName},\n\t\tMax,");
// File.Delete(_uiType);
// File.WriteAllText(_uiType, newStr);
//
// Debug.Log("生成成功:" + newPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
GUI.color = defaultColor;
}
else
{
var jsonData = GetUIJson(_uiName);
if (jsonData == null)
{
jsonData = new UIConfigJson();
jsonData.uiType = _uiName;
_uiJsonDatas.AddOrUpdate(_uiName, jsonData);
}
if (UnityEditor.PrefabUtility.IsPartOfPrefabAsset(uiPrefab))
{
// 预制体资源就是自身
jsonData.pathId = $"Prefabs_{uiPrefab.name}";
jsonData.path = UnityEditor.AssetDatabase.GetAssetPath(uiPrefab);
}
EditorGUILayout.ObjectField("已创建脚本",
AssetDatabase.LoadAssetAtPath(uiScriptPath, typeof(TextAsset)), typeof(TextAsset),
true);
jsonData.isWindow = EditorGUILayout.Toggle("是否为窗口", jsonData.isWindow);
jsonData.uiLayer = (UILayer)EditorGUILayout.EnumPopup("UILayer设置", jsonData.uiLayer);
var defaultColor = GUI.color;
GUI.color = Color.green;
if (GUILayout.Button("保存设置"))
{
SaveJson();
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
GUI.color = defaultColor;
GUI.color = Color.red;
if (GUILayout.Button("删除UI脚本"))
{
if (EditorUtility.DisplayDialog("是否确认删除",
$"请确认是否删除:\n{uiScriptPath}\n同时会清除JsonUIType中相关数据", "确定", "取消"))
{
// 清除UIConfig中的指定类型
_uiJsonDatas.Remove(_uiName);
_uiNames.Remove(_uiName);
SaveJson();
// 删除文件
File.Delete(uiScriptPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
_uiNames.Remove(_uiName);
}
}
GUI.color = defaultColor;
}
}
else
{
_uiName = "";
}
}
EditorGUILayout.EndScrollView();
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
}
private void SaveJson()
{
List<UIConfigJson> list = new List<UIConfigJson>();
foreach (var name in _uiNames.Keys)
{
if (_uiJsonDatas.TryGetValue(name, out var data))
{
list.Add(data);
}
}
_uiConfigObj.uiConfigJsons.Clear();
_uiConfigObj.uiConfigJsons = list;
EditorUtility.SetDirty(_uiConfigObj);
AssetDatabase.SaveAssets();
}
private void TryGetPath(ref string path, string pathName, string endsWith)
{
path = PlayerPrefs.GetString(pathName);
if (!File.Exists(path))
{
string[] ids = AssetDatabase.FindAssets(pathName);
if (ids != null)
{
foreach (var id in ids)
{
var str = AssetDatabase.GUIDToAssetPath(id);
if (str.EndsWith(endsWith))
{
path = str;
}
}
}
}
}
private string GetUIScript(string name, bool tryFind = false)
{
if (_uiNames.TryGetValue(name, out string path))
{
return path;
}
if (!tryFind)
{
return string.Empty;
}
// if (GetUIJson(name) == null) return string.Empty;
string[] ids = AssetDatabase.FindAssets(name);
if (ids != null)
{
foreach (var id in ids)
{
var str = AssetDatabase.GUIDToAssetPath(id);
if (str.EndsWith(".cs"))
{
return str;
}
}
}
return string.Empty;
}
private UIConfigJson GetUIJson(string name)
{
if (_uiJsonDatas.Count == 0)
{
try
{
foreach (var item in _uiConfigObj.uiConfigJsons)
{
_uiJsonDatas.AddOrUpdate(item.uiType, item);
}
}
catch (Exception e)
{
Debug.LogError(e);
}
}
if (_uiJsonDatas.TryGetValue(name, out var jsonData))
{
return jsonData;
}
return null;
}
private void DomainPathField()
{
var path = $"Assets/Domain/{_domainNames[_domainIndex]}/AddressableRes/Config/UIConfig.asset";
if (_uiConfigObj == null)
{
_uiConfigObj = (UIConfig)AssetDatabase.LoadAssetAtPath(path, typeof(UIConfig));
}
if (_uiConfigObj == null)
{
Debug.LogError($"在{path}中未找到UIConfig");
return;
}
}
private void PathField(string name, ref string path, string pathName, string endsWith)
{
var obj = EditorGUILayout.ObjectField(name, AssetDatabase.LoadAssetAtPath(path, typeof(TextAsset)),
typeof(TextAsset), true);
if (obj != null)
{
var newPath = AssetDatabase.GetAssetPath(obj);
if (newPath.EndsWith(endsWith) && !newPath.Equals(path))
{
path = newPath;
PlayerPrefs.SetString(pathName, path);
}
}
}
}
#endif
static class ReflectionHelper
{
public static IEnumerable<T> CreateAllInstancesOf<T>()
{
return typeof(ReflectionHelper).Assembly.GetTypes() //获取当前类库下所有类型
.Where(t => typeof(T).IsAssignableFrom(t)) //获取间接或直接继承t的所有类型
.Where(t => !t.IsAbstract && t.IsClass) //获取非抽象类 排除接口继承
.Select(t => (T)Activator.CreateInstance(t)); //创造实例,并返回结果(项目需求,可删除)
}
// 新增方法专门用于查找UIView类型的所有实现类
public static IEnumerable<Type> GetAllUIViewTypes(string domainName)
{
// 查找所有程序集中的UIView类型实现
var uiviewType = typeof(UIView);
List<Type> result = new List<Type>();
// 尝试获取指定名称的程序集
var targetAssembly = AppDomain.CurrentDomain.GetAssemblies()
.FirstOrDefault(assembly => assembly.GetName().Name == $"HotUpdate_{domainName}");
if (targetAssembly == null)
{
Debug.LogError($"未找到名为HotUpdate_{domainName}的程序集");
return null;
}
try
{
result.AddRange(targetAssembly.GetTypes()
.Where(t => uiviewType.IsAssignableFrom(t))
.Where(t => !t.IsAbstract && t.IsClass));
}
catch (Exception)
{
// 忽略无法访问的程序集
}
// 遍历所有已加载的程序集
// foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
// {
// try
// {
// result.AddRange(assembly.GetTypes()
// .Where(t => uiviewType.IsAssignableFrom(t))
// .Where(t => !t.IsAbstract && t.IsClass));
// }
// catch (Exception)
// {
// // 忽略无法访问的程序集
// }
// }
return result;
}
}

View File

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

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using TMPro;
namespace Stary.Evo
{
public class UIXXXView : UIView
{
//UIControlData
public override void OnInit(UIControlData uIControlData, UIViewController controller)
{
base.OnInit(uIControlData, controller);
}
public override void OnOpen(object userData)
{
base.OnOpen(userData);
}
public override void OnAddListener()
{
base.OnAddListener();
}
public override void OnRemoveListener()
{
base.OnRemoveListener();
}
public override void OnClose()
{
base.OnClose();
}
}
}

View File

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

View File

@@ -1,7 +1,11 @@
{
"name": "com.uifarme.editor",
"rootNamespace": "",
"references": [],
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:6a5d7223300a2ef48aa366288a446472",
"GUID:044184040b21c434b8aee6f2a3424c06"
],
"includePlatforms": [
"Editor"
],

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 52d66146caaa4114ba0f4258e240277d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 6884082665aabe549ae4c6d9a142298d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 51b888818cbd7184b81f6f9643135c0e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: da055a807e845d14bb514ded002fc676
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 51132773839ee5b45b08ac9ad19a8b38
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 606cac99b2a6e27418aa01e7eaae56a0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 8495279a91ea6114eba1ca274b91af74
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 303410e7f835f984595c60510bf4b9a2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 90a94cbc0cd73e446807e4ef2d405b1d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: a056d76ac19f13841ad836bae9f6c3c2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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: 1
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: 3
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: 3
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
- serializedVersion: 3
buildTarget: Android
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: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,96 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Loading_ani
serializedVersion: 7
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- serializedVersion: 2
curve:
- time: 0
value: {fileID: 21300000, guid: 6884082665aabe549ae4c6d9a142298d, type: 3}
- time: 0.083333336
value: {fileID: 21300000, guid: 51b888818cbd7184b81f6f9643135c0e, type: 3}
- time: 0.16666667
value: {fileID: 21300000, guid: da055a807e845d14bb514ded002fc676, type: 3}
- time: 0.25
value: {fileID: 21300000, guid: 51132773839ee5b45b08ac9ad19a8b38, type: 3}
- time: 0.33333334
value: {fileID: 21300000, guid: 606cac99b2a6e27418aa01e7eaae56a0, type: 3}
- time: 0.41666666
value: {fileID: 21300000, guid: 8495279a91ea6114eba1ca274b91af74, type: 3}
- time: 0.5
value: {fileID: 21300000, guid: 303410e7f835f984595c60510bf4b9a2, type: 3}
- time: 0.5833333
value: {fileID: 21300000, guid: 90a94cbc0cd73e446807e4ef2d405b1d, type: 3}
- time: 0.6666667
value: {fileID: 21300000, guid: a056d76ac19f13841ad836bae9f6c3c2, type: 3}
attribute: m_Sprite
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 2
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 2015549526
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 1
isIntCurve: 0
isSerializeReferenceCurve: 0
pptrCurveMapping:
- {fileID: 21300000, guid: 6884082665aabe549ae4c6d9a142298d, type: 3}
- {fileID: 21300000, guid: 51b888818cbd7184b81f6f9643135c0e, type: 3}
- {fileID: 21300000, guid: da055a807e845d14bb514ded002fc676, type: 3}
- {fileID: 21300000, guid: 51132773839ee5b45b08ac9ad19a8b38, type: 3}
- {fileID: 21300000, guid: 606cac99b2a6e27418aa01e7eaae56a0, type: 3}
- {fileID: 21300000, guid: 8495279a91ea6114eba1ca274b91af74, type: 3}
- {fileID: 21300000, guid: 303410e7f835f984595c60510bf4b9a2, type: 3}
- {fileID: 21300000, guid: 90a94cbc0cd73e446807e4ef2d405b1d, type: 3}
- {fileID: 21300000, guid: a056d76ac19f13841ad836bae9f6c3c2, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.75
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8488f417302cba24fa328f9796d39402
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: anim
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 4470429071992645539}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &4177064496324344577
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Loading_ani
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 8488f417302cba24fa328f9796d39402, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &4470429071992645539
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 4177064496324344577}
m_Position: {x: 200, y: 0, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 4177064496324344577}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b32973ea88fca53489cd40f95b13c25f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9c06dd7c57ad1314eae1902d6cdb444f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f6e218215da269c45b6b578b4eb0da12
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,268 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace Stary.Evo
{
public enum AnchorPresets
{
TopLeft,
TopCenter,
TopRight,
MiddleLeft,
MiddleCenter,
MiddleRight,
BottomLeft,
BottonCenter,
BottomRight,
BottomStretch,
VertStretchLeft,
VertStretchRight,
VertStretchCenter,
HorStretchTop,
HorStretchMiddle,
HorStretchBottom,
StretchAll
}
public enum PivotPresets
{
TopLeft,
TopCenter,
TopRight,
MiddleLeft,
MiddleCenter,
MiddleRight,
BottomLeft,
BottomCenter,
BottomRight,
}
public static class UIExtension
{
public static void SetAnchor(this RectTransform source, AnchorPresets allign, int offsetX = 0, int offsetY = 0)
{
source.anchoredPosition = new Vector3(offsetX, offsetY, 0);
switch (allign)
{
case (AnchorPresets.TopLeft):
{
source.anchorMin = new Vector2(0, 1);
source.anchorMax = new Vector2(0, 1);
break;
}
case (AnchorPresets.TopCenter):
{
source.anchorMin = new Vector2(0.5f, 1);
source.anchorMax = new Vector2(0.5f, 1);
break;
}
case (AnchorPresets.TopRight):
{
source.anchorMin = new Vector2(1, 1);
source.anchorMax = new Vector2(1, 1);
break;
}
case (AnchorPresets.MiddleLeft):
{
source.anchorMin = new Vector2(0, 0.5f);
source.anchorMax = new Vector2(0, 0.5f);
break;
}
case (AnchorPresets.MiddleCenter):
{
source.anchorMin = new Vector2(0.5f, 0.5f);
source.anchorMax = new Vector2(0.5f, 0.5f);
break;
}
case (AnchorPresets.MiddleRight):
{
source.anchorMin = new Vector2(1, 0.5f);
source.anchorMax = new Vector2(1, 0.5f);
break;
}
case (AnchorPresets.BottomLeft):
{
source.anchorMin = new Vector2(0, 0);
source.anchorMax = new Vector2(0, 0);
break;
}
case (AnchorPresets.BottonCenter):
{
source.anchorMin = new Vector2(0.5f, 0);
source.anchorMax = new Vector2(0.5f, 0);
break;
}
case (AnchorPresets.BottomRight):
{
source.anchorMin = new Vector2(1, 0);
source.anchorMax = new Vector2(1, 0);
break;
}
case (AnchorPresets.HorStretchTop):
{
source.anchorMin = new Vector2(0, 1);
source.anchorMax = new Vector2(1, 1);
break;
}
case (AnchorPresets.HorStretchMiddle):
{
source.anchorMin = new Vector2(0, 0.5f);
source.anchorMax = new Vector2(1, 0.5f);
break;
}
case (AnchorPresets.HorStretchBottom):
{
source.anchorMin = new Vector2(0, 0);
source.anchorMax = new Vector2(1, 0);
break;
}
case (AnchorPresets.VertStretchLeft):
{
source.anchorMin = new Vector2(0, 0);
source.anchorMax = new Vector2(0, 1);
break;
}
case (AnchorPresets.VertStretchCenter):
{
source.anchorMin = new Vector2(0.5f, 0);
source.anchorMax = new Vector2(0.5f, 1);
break;
}
case (AnchorPresets.VertStretchRight):
{
source.anchorMin = new Vector2(1, 0);
source.anchorMax = new Vector2(1, 1);
break;
}
case (AnchorPresets.StretchAll):
{
source.anchorMin = new Vector2(0, 0);
source.anchorMax = new Vector2(1, 1);
source.sizeDelta = Vector2.zero;
break;
}
}
}
public static void SetPivot(this RectTransform source, PivotPresets preset)
{
switch (preset)
{
case (PivotPresets.TopLeft):
{
source.pivot = new Vector2(0, 1);
break;
}
case (PivotPresets.TopCenter):
{
source.pivot = new Vector2(0.5f, 1);
break;
}
case (PivotPresets.TopRight):
{
source.pivot = new Vector2(1, 1);
break;
}
case (PivotPresets.MiddleLeft):
{
source.pivot = new Vector2(0, 0.5f);
break;
}
case (PivotPresets.MiddleCenter):
{
source.pivot = new Vector2(0.5f, 0.5f);
break;
}
case (PivotPresets.MiddleRight):
{
source.pivot = new Vector2(1, 0.5f);
break;
}
case (PivotPresets.BottomLeft):
{
source.pivot = new Vector2(0, 0);
break;
}
case (PivotPresets.BottomCenter):
{
source.pivot = new Vector2(0.5f, 0);
break;
}
case (PivotPresets.BottomRight):
{
source.pivot = new Vector2(1, 0);
break;
}
}
}
public static CanvasGroup CreateBlackMask(Transform parent, float alpha = 0, string name = null)
{
GameObject maskGo = new GameObject("Black Mask");
RectTransform rectTransform = maskGo.AddComponent<RectTransform>();
rectTransform.SetParentEx(parent);
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
Image image = maskGo.AddComponent<Image>();
image.color = Color.black;
image.raycastTarget = false;
CanvasGroup canvasGroup = maskGo.AddComponent<CanvasGroup>();
canvasGroup.alpha = alpha;
if(name != null)
canvasGroup.name = name;
return canvasGroup;
}
public static Canvas CreateLayerCanvas(UILayer layer, bool is3D, Transform parent, Camera camera, float width, float height)
{
GameObject canvasGo = new GameObject(layer.ToString());
RectTransform rectTransform = canvasGo.AddComponent<RectTransform>();
rectTransform.SetParentEx(parent);
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
canvasGo.layer = is3D ? Layer.Default : Layer.UI;
Canvas canvas = canvasGo.AddComponent<Canvas>();
canvas.renderMode = is3D ? RenderMode.WorldSpace : RenderMode.ScreenSpaceCamera;
canvas.overrideSorting = true;
canvas.sortingOrder = (int)layer;
canvas.worldCamera = camera;
canvas.pixelPerfect = false;
CanvasScaler canvasScaler = canvasGo.AddComponent<CanvasScaler>();
canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
canvasScaler.referenceResolution = new Vector2(height,width);
canvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.Expand;
canvasGo.AddComponent<GraphicRaycaster>();
return canvas;
}
/// <summary>
/// 为方便统一处理点击音效等
/// </summary>
public static void AddClick(this Button button, UnityAction callback)
{
button.onClick.AddListener(callback);
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ab9e1d815209d5e469824bfa1bbc399c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More