UGUI导出工具
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -9,3 +9,6 @@
|
||||
/UnityGame/FairyGUI-Editor.csproj
|
||||
/UnityGame/UnityGame.sln
|
||||
/FairyGUIEditor/FairyGUI-Editor/
|
||||
UnityGame/Assembly-CSharp-Editor.csproj
|
||||
UnityGame/UnityGame.sln.DotSettings.user
|
||||
笔记.txt
|
||||
|
||||
@@ -18,7 +18,7 @@ MonoBehaviour:
|
||||
m_GUID: e54335de04e226844af6d4f43cee569c
|
||||
m_SerializeEntries:
|
||||
- m_GUID: df19a62afc91680458a47c27783266c1
|
||||
m_Address: Assets/AssetBundle/UI/Prefab/Main/MainView.prefab
|
||||
m_Address: UI/MainView
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
|
||||
@@ -1,5 +1,84 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1589286140665025168
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6123608764366358932}
|
||||
- component: {fileID: 8346965509829223120}
|
||||
- component: {fileID: 4240085648116956041}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6123608764366358932
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1589286140665025168}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4281662691709856397}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8346965509829223120
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1589286140665025168}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4240085648116956041
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1589286140665025168}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 20
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 2
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u5F00\u59CB"
|
||||
--- !u!1 &1824431982015067521
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -9,6 +88,8 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5853555582722751093}
|
||||
- component: {fileID: 3088543518438784306}
|
||||
- component: {fileID: 871140533514879651}
|
||||
m_Layer: 5
|
||||
m_Name: MainView
|
||||
m_TagString: Untagged
|
||||
@@ -27,11 +108,160 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 4281662691709856397}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_SizeDelta: {x: 1280, y: 720}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3088543518438784306
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824431982015067521}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &871140533514879651
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1824431982015067521}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d7f07a01cdb5c7c4aa72a3a420035842, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
entries:
|
||||
- key: StarBtn
|
||||
prefab: {fileID: 1860811135573344146}
|
||||
selectedComponentName: Button
|
||||
- key: StarBtnText
|
||||
prefab: {fileID: 1589286140665025168}
|
||||
selectedComponentName: Text
|
||||
--- !u!1 &1860811135573344146
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4281662691709856397}
|
||||
- component: {fileID: 7339185292449556773}
|
||||
- component: {fileID: 7969887340133370323}
|
||||
- component: {fileID: 8491173157682403425}
|
||||
m_Layer: 5
|
||||
m_Name: m_StarButton
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4281662691709856397
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1860811135573344146}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6123608764366358932}
|
||||
m_Father: {fileID: 5853555582722751093}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: -270}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7339185292449556773
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1860811135573344146}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7969887340133370323
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1860811135573344146}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &8491173157682403425
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1860811135573344146}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 7969887340133370323}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
|
||||
3
UnityGame/Assets/Editor.meta
Normal file
3
UnityGame/Assets/Editor.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3f618dd7a914cb58ff35683fc220416
|
||||
timeCreated: 1752637101
|
||||
3
UnityGame/Assets/Editor/GameUI.meta
Normal file
3
UnityGame/Assets/Editor/GameUI.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3ddfe80d5274d25869bbd0ad6bae9f9
|
||||
timeCreated: 1752637115
|
||||
102
UnityGame/Assets/Editor/GameUI/UIExportToolEditor.cs
Normal file
102
UnityGame/Assets/Editor/GameUI/UIExportToolEditor.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
[CustomEditor(typeof(UIExportTool))]
|
||||
public class UIExportToolEditor : Editor
|
||||
{
|
||||
private ReorderableList reorderableList;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
reorderableList = new ReorderableList(
|
||||
serializedObject,
|
||||
serializedObject.FindProperty("entries"),
|
||||
true, true, true, true);
|
||||
|
||||
reorderableList.drawHeaderCallback = (Rect rect) =>
|
||||
{
|
||||
EditorGUI.LabelField(rect, "UI Prefab Entries");
|
||||
};
|
||||
|
||||
reorderableList.elementHeightCallback = (int index) =>
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + 6f;
|
||||
};
|
||||
|
||||
reorderableList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
|
||||
{
|
||||
SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(index);
|
||||
// drawElementCallback 中的内容
|
||||
SerializedProperty keyProp = element.FindPropertyRelative("key");
|
||||
SerializedProperty prefabProp = element.FindPropertyRelative("prefab");
|
||||
SerializedProperty selectedNameProp = element.FindPropertyRelative("selectedComponentName");
|
||||
|
||||
GameObject prefab = prefabProp.objectReferenceValue as GameObject;
|
||||
|
||||
// 查找组件类型
|
||||
List<string> uguiComponentNames = new List<string>();
|
||||
if (prefab != null)
|
||||
{
|
||||
uguiComponentNames = prefab.GetComponents<Component>()
|
||||
.Where(c => c != null && IsUGUIComponent(c))
|
||||
.Select(c => c.GetType().Name)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
float lineHeight = EditorGUIUtility.singleLineHeight;
|
||||
float padding = 4f;
|
||||
float thirdWidth = (rect.width - 2 * padding) / 3f;
|
||||
|
||||
Rect keyRect = new Rect(rect.x, rect.y + 2, thirdWidth, lineHeight);
|
||||
Rect prefabRect = new Rect(rect.x + thirdWidth + padding, rect.y + 2, thirdWidth, lineHeight);
|
||||
Rect popupRect = new Rect(rect.x + 2 * (thirdWidth + padding), rect.y + 2, thirdWidth, lineHeight);
|
||||
|
||||
// key 字段
|
||||
EditorGUI.PropertyField(keyRect, keyProp, GUIContent.none);
|
||||
|
||||
// prefab 字段
|
||||
EditorGUI.PropertyField(prefabRect, prefabProp, GUIContent.none);
|
||||
|
||||
// 下拉框
|
||||
if (uguiComponentNames.Count > 0)
|
||||
{
|
||||
int selectedIndex = Mathf.Max(0, uguiComponentNames.IndexOf(selectedNameProp.stringValue));
|
||||
selectedIndex = EditorGUI.Popup(popupRect, selectedIndex, uguiComponentNames.ToArray());
|
||||
selectedNameProp.stringValue = uguiComponentNames[selectedIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(popupRect, "无UGUI组件");
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
reorderableList.DoLayoutList();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否是常见UGUI组件(你可以自行扩展)
|
||||
/// </summary>
|
||||
private bool IsUGUIComponent(Component component)
|
||||
{
|
||||
return component is Graphic // 基类,包含 Image、Text、RawImage
|
||||
|| component is Button
|
||||
|| component is Toggle
|
||||
|| component is Slider
|
||||
|| component is ScrollRect
|
||||
|| component is Dropdown
|
||||
|| component is InputField;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7580782f3f2c4729bb6f9c136708540c
|
||||
timeCreated: 1752637136
|
||||
@@ -177,7 +177,7 @@ MonoBehaviour:
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Bits: 32
|
||||
--- !u!114 &225313991
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -190,12 +190,12 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ReferenceResolution: {x: 1280, y: 720}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_MatchWidthOrHeight: 0.5
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
@@ -213,13 +213,13 @@ Canvas:
|
||||
m_RenderMode: 1
|
||||
m_Camera: {fileID: 291576393}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_PixelPerfect: 1
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_VertexColorAlwaysGammaSpace: 1
|
||||
m_AdditionalShaderChannelsFlag: -1
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
@@ -234,7 +234,6 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 291576391}
|
||||
- component: {fileID: 291576393}
|
||||
- component: {fileID: 291576392}
|
||||
m_Layer: 0
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
@@ -257,14 +256,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1765569912}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!81 &291576392
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 291576390}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &291576393
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -274,7 +265,7 @@ Camera:
|
||||
m_GameObject: {fileID: 291576390}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_ClearFlags: 3
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
@@ -296,15 +287,15 @@ Camera:
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
near clip plane: -500
|
||||
far clip plane: 500
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Bits: 32
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
|
||||
8
UnityGame/Assets/Scripts/GameLogic/Export/UGUI.meta
Normal file
8
UnityGame/Assets/Scripts/GameLogic/Export/UGUI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48f786d98d3d1d24296e6825756cf55a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace CreatGame
|
||||
{
|
||||
public class GameLogic
|
||||
public class GameLogic : Singleton<GameLogic>
|
||||
{
|
||||
|
||||
public void Start()
|
||||
{
|
||||
AssetBundle.AssetBundleManager.Instance.Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
namespace CreatGame.AssetBundle
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.AddressableAssets.ResourceLocators;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.ResourceManagement.ResourceLocations;
|
||||
|
||||
namespace CreatGame.AssetBundle
|
||||
{
|
||||
public class AssetBundleManager : Singleton<AssetBundleManager>
|
||||
{
|
||||
@@ -7,7 +14,47 @@
|
||||
/// </summary>
|
||||
public AssetBundleManager()
|
||||
{
|
||||
Addressables.InitializeAsync();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Addressables.InitializeAsync().Completed += OnInitializeCompleted;
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化信息回调
|
||||
/// </summary>
|
||||
private void OnInitializeCompleted(AsyncOperationHandle<IResourceLocator> operationHandle)
|
||||
{
|
||||
if (operationHandle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
Debug.Log("Addressables initialization succeeded");
|
||||
#region MyRegion
|
||||
// IResourceLocator locator = operationHandle.Result;
|
||||
// foreach (object locatorKey in locator.Keys)
|
||||
// {
|
||||
// locator.Locate(locatorKey,typeof(UnityEngine.Object),out IList<IResourceLocation> locations);
|
||||
// if (locations == null)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// foreach (var location in locations)
|
||||
// {
|
||||
// string key = location.PrimaryKey;
|
||||
// Addressables.LoadAssetAsync<UnityEngine.Object>(key).Completed += (handle) =>
|
||||
// {
|
||||
// if (handle.Status == AsyncOperationStatus.Succeeded)
|
||||
// {
|
||||
// Debug.Log("Addressables load asset succeeded");
|
||||
// var asset = handle.Result;
|
||||
// GameObject.Instantiate(asset);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CreatGame.UI
|
||||
{
|
||||
public class UIManager : Singleton<UIManager>
|
||||
{
|
||||
private Dictionary<UILayer,GameObject> m_UILayers;
|
||||
private Dictionary<UILayer, Queue<UIViewBase>> m_Windows;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public UIManager()
|
||||
{
|
||||
m_UILayers = new Dictionary<UILayer, GameObject>();
|
||||
m_Windows = new Dictionary<UILayer, Queue<UIViewBase>>();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="layer"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public UIViewBase OpenView<T>(UILayer layer) where T : UIViewBase , new()
|
||||
{
|
||||
var view = new T();
|
||||
|
||||
view.PreLoad();
|
||||
view.InitView();
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,30 @@
|
||||
namespace CreatGame.UI
|
||||
{
|
||||
public class UIViewBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 预制件的路径
|
||||
/// </summary>
|
||||
public virtual string PrefabPath { get; set; }
|
||||
/// <summary>
|
||||
/// 加载窗口的时候需要预先加载的东西
|
||||
/// </summary>
|
||||
public virtual void PreLoad()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化界面
|
||||
/// </summary>
|
||||
public virtual void InitView()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 关闭窗口的时候的调用
|
||||
/// </summary>
|
||||
public virtual void CloseView()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ public class GameStar : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
CreatGame.GameLogic.Instance.Start();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
3
UnityGame/Assets/Scripts/GameTools/UI.meta
Normal file
3
UnityGame/Assets/Scripts/GameTools/UI.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07fbcc20f70d4d90bce50c964419e32d
|
||||
timeCreated: 1752636609
|
||||
16
UnityGame/Assets/Scripts/GameTools/UI/UIExportTool.cs
Normal file
16
UnityGame/Assets/Scripts/GameTools/UI/UIExportTool.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIExportTool : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class UIEntry
|
||||
{
|
||||
public string key;
|
||||
public GameObject prefab;
|
||||
public string selectedComponentName; // 存储选择的组件类型名
|
||||
}
|
||||
|
||||
public List<UIEntry> entries = new List<UIEntry>();
|
||||
}
|
||||
11
UnityGame/Assets/Scripts/GameTools/UI/UIExportTool.cs.meta
Normal file
11
UnityGame/Assets/Scripts/GameTools/UI/UIExportTool.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7f07a01cdb5c7c4aa72a3a420035842
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1142
UnityGame/UserSettings/Layouts/default-2022.dwlt
Normal file
1142
UnityGame/UserSettings/Layouts/default-2022.dwlt
Normal file
File diff suppressed because it is too large
Load Diff
13
UnityGame/UserSettings/Search.index
Normal file
13
UnityGame/UserSettings/Search.index
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Assets",
|
||||
"roots": ["Assets"],
|
||||
"includes": [],
|
||||
"excludes": ["Assets/Temp/", "Assets/External/"],
|
||||
"options": {
|
||||
"types": true,
|
||||
"properties": true,
|
||||
"extended": false,
|
||||
"dependencies": false
|
||||
},
|
||||
"baseScore": 999
|
||||
}
|
||||
@@ -1 +1,76 @@
|
||||
{}
|
||||
trackSelection = true
|
||||
refreshSearchWindowsInPlayMode = false
|
||||
pickerAdvancedUI = false
|
||||
fetchPreview = true
|
||||
defaultFlags = 0
|
||||
keepOpen = true
|
||||
queryFolder = "Assets"
|
||||
onBoardingDoNotAskAgain = true
|
||||
showPackageIndexes = false
|
||||
showStatusBar = false
|
||||
scopes = {
|
||||
}
|
||||
providers = {
|
||||
asset = {
|
||||
active = true
|
||||
priority = 25
|
||||
defaultAction = null
|
||||
}
|
||||
scene = {
|
||||
active = true
|
||||
priority = 50
|
||||
defaultAction = null
|
||||
}
|
||||
adb = {
|
||||
active = false
|
||||
priority = 2500
|
||||
defaultAction = null
|
||||
}
|
||||
find = {
|
||||
active = true
|
||||
priority = 25
|
||||
defaultAction = null
|
||||
}
|
||||
packages = {
|
||||
active = false
|
||||
priority = 90
|
||||
defaultAction = null
|
||||
}
|
||||
store = {
|
||||
active = false
|
||||
priority = 100
|
||||
defaultAction = null
|
||||
}
|
||||
performance = {
|
||||
active = false
|
||||
priority = 100
|
||||
defaultAction = null
|
||||
}
|
||||
profilermarkers = {
|
||||
active = false
|
||||
priority = 100
|
||||
defaultAction = null
|
||||
}
|
||||
log = {
|
||||
active = false
|
||||
priority = 210
|
||||
defaultAction = null
|
||||
}
|
||||
}
|
||||
objectSelectors = {
|
||||
}
|
||||
recentSearches = [
|
||||
]
|
||||
searchItemFavorites = [
|
||||
]
|
||||
savedSearchesSortOrder = 0
|
||||
showSavedSearchPanel = false
|
||||
hideTabs = false
|
||||
expandedQueries = [
|
||||
]
|
||||
queryBuilder = true
|
||||
ignoredProperties = "id;name;classname;imagecontentshash"
|
||||
helperWidgetCurrentArea = "all"
|
||||
disabledIndexers = ""
|
||||
minIndexVariations = 2
|
||||
findProviderIndexHelper = true
|
||||
Reference in New Issue
Block a user