屏幕问题

This commit is contained in:
2026-01-28 16:20:19 +08:00
parent 7464cd8b6c
commit 7d7e2fcdf0
20 changed files with 771 additions and 479 deletions
@@ -112,6 +112,11 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: ea4cf9d585ac1034ca7b6e108a07a2a3
m_Address: "BlockPuzzle/\u6309\u94AE\u7F29\u7565\u56FE"
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 77169ce22e430f64fb36c771815a4a7b, type: 2}
m_SchemaSet:
+33 -1
View File
@@ -1,4 +1,4 @@
using UnityEditor;
using UnityEditor;
using UnityEngine;
namespace AibisDream.SystemEditor
@@ -22,6 +22,38 @@ namespace AibisDream.SystemEditor
return TransIdx2SortingLayer(newIdx);
}
/// <summary>
/// 使用 SerializedProperty 绘制 SortingLayer 下拉菜单(基于ID
/// </summary>
/// <param name="label">显示的标签</param>
/// <param name="property">存储排序层ID的 SerializedPropertyint 类型)</param>
public static void SortingLayerField(GUIContent label, SerializedProperty property)
{
if (property == null || property.propertyType != SerializedPropertyType.Integer)
{
EditorGUILayout.HelpBox("Property must be an integer type for sorting layer ID.", MessageType.Error);
return;
}
EditorGUI.BeginChangeCheck();
// 获取所有排序层名称
string[] sortingLayerNames = GetSortingLayerNames();
// 将当前ID转为索引
int currentId = property.intValue;
int currentIndex = TransSortingLayer2Idx(currentId);
// 显示下拉菜单
int newIndex = EditorGUILayout.Popup(label, currentIndex, sortingLayerNames);
// 如果选择了新的排序层,更新属性值为新的ID
if (EditorGUI.EndChangeCheck() || newIndex != currentIndex)
{
int newId = TransIdx2SortingLayer(newIndex);
property.intValue = newId;
}
}
private static string[] GetSortingLayerNames()
{
// 获取所有 Sorting Layer 名称
@@ -0,0 +1,46 @@
using UnityEditor;
using UnityEngine;
namespace AibisDream.SystemEditor
{
[CustomEditor(typeof(ShapeDragger))]
public class ShapeDraggerEditor : Editor
{
private SerializedProperty isDraggableProperty;
private SerializedProperty dragLayerNameProperty;
private SerializedProperty dragLayerOrderProperty;
private SerializedProperty idleLayerNameProperty;
private SerializedProperty idleLayerOrderProperty;
private void OnEnable()
{
isDraggableProperty = serializedObject.FindProperty("isDraggable");
dragLayerNameProperty = serializedObject.FindProperty("dragLayerId");
dragLayerOrderProperty = serializedObject.FindProperty("dragLayerOrder");
idleLayerNameProperty = serializedObject.FindProperty("idleLayerId");
idleLayerOrderProperty = serializedObject.FindProperty("idleLayerOrder");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.LabelField("拖拽设置", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(isDraggableProperty, new GUIContent("是否可拖拽"));
EditorGUILayout.Space();
EditorGUILayout.LabelField("排序层设置", EditorStyles.boldLabel);
// 使用 EditorKit 的公共函数绘制 SortingLayer
EditorKit.SortingLayerField(new GUIContent("拖拽时 Layer"), dragLayerNameProperty);
// 使用 SerializedProperty 绘制 SortingOrder
EditorGUILayout.PropertyField(dragLayerOrderProperty, new GUIContent("拖拽时 Order"));
EditorKit.SortingLayerField(new GUIContent("闲置时 Layer"), idleLayerNameProperty);
EditorGUILayout.PropertyField(idleLayerOrderProperty, new GUIContent("闲置时 Order"));
serializedObject.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e95fcb0cf28247f4d97e3718719574cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+13 -3
View File
@@ -59,6 +59,15 @@ MonoBehaviour:
extraLimits: 0
rootLimit: {x: 0, y: 0}
rotationAngleLimit: 0
blockShapeInfo:
shapeName:
paramValue:
power: 0
noise: 0
heat: 0
shapeDescription:
states: []
buttonImagePath:
--- !u!212 &5623161269037470069
SpriteRenderer:
m_ObjectHideFlags: 0
@@ -224,7 +233,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
isDraggable: 1
snapColor: {r: 0, g: 1, b: 0, a: 0.7}
invalidColor: {r: 1, g: 0, b: 0, a: 0.7}
normalColor: {r: 1, g: 1, b: 1, a: 1}
dragScale: 1.1
dragLayerId: 0
dragLayerOrder: 25
idleLayerId: 0
idleLayerOrder: 11
@@ -87,6 +87,7 @@ GameObject:
- component: {fileID: 7632880227653304092}
- component: {fileID: 3846346392859234953}
- component: {fileID: 6851318043950123479}
- component: {fileID: 7456639161979422264}
m_Layer: 0
m_Name: ShapeCreateButton
m_TagString: Untagged
@@ -113,7 +114,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 120}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7632880227653304092
CanvasRenderer:
@@ -197,6 +198,21 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &7456639161979422264
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4143230107302099057}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fae2a3bab01b11147a06ea3a105dcc2f, type: 3}
m_Name:
m_EditorClassIdentifier:
_image: {fileID: 116155875420541764}
_text: {fileID: 5620790754753047260}
_button: {fileID: 6851318043950123479}
--- !u!1 &4517236050654204292
GameObject:
m_ObjectHideFlags: 0
@@ -0,0 +1,342 @@
fileFormatVersion: 2
guid: ea4cf9d585ac1034ca7b6e108a07a2a3
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: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
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: WebGL
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
- serializedVersion: 3
buildTarget: Server
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: iPhone
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:
- serializedVersion: 2
name: "\u65E7\u5F0F\u91CD\u578B\u5F15\u64CE"
rect:
serializedVersion: 2
x: 47
y: 669
width: 400
height: 300
alignment: 9
pivot: {x: 0.125, y: 0.16666667}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 23498d6479d70c6428fe034f3a062d8e
internalID: 485554460
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u52A8\u5E73\u8861\u98DE\u8F6E\u7EC4"
rect:
serializedVersion: 2
x: 498
y: 668
width: 302
height: 301
alignment: 9
pivot: {x: 0.16556291, y: 0.16611296}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 391ff6a6d3f2de649b128e61e4e01f09
internalID: 629878897
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u6563\u70ED\u7CFB\u7EDF"
rect:
serializedVersion: 2
x: 851
y: 667
width: 302
height: 302
alignment: 9
pivot: {x: 0.16556291, y: 0.16556291}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 4a089884d7b7da8438fc360355e748c9
internalID: 1653300043
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u6392\u6C14\u5171\u9E23\u8154"
rect:
serializedVersion: 2
x: 47
y: 350
width: 201
height: 202
alignment: 9
pivot: {x: 0.24875621, y: 0.24752475}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: d8ed7d34e459d294c8ffffefeb90aac8
internalID: 68348533
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u8F85\u52A9\u6DA1\u8F6E"
rect:
serializedVersion: 2
x: 273
y: 351
width: 201
height: 202
alignment: 9
pivot: {x: 0.24875621, y: 0.24752475}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 11c0be94b053e1b4ebe819e42911b7d8
internalID: -515767054
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u65B0\u5F15\u64CE"
rect:
serializedVersion: 2
x: 602
y: 85
width: 400
height: 500
alignment: 9
pivot: {x: 0.125, y: 0.1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 0e3b99fc41175d441a0c281118b72797
internalID: 658359936
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u60EF\u6027\u7A33\u538B\u5668"
rect:
serializedVersion: 2
x: 32
y: 20
width: 202
height: 300
alignment: 9
pivot: {x: 0.24752475, y: 0.16666667}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 21aeeacff623a264e978afad35af19c3
internalID: 1109020032
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: "\u8FDB\u6C14\u7CFB\u7EDF"
rect:
serializedVersion: 2
x: 273
y: 20
width: 201
height: 302
alignment: 9
pivot: {x: 0.24875621, y: 0.16556291}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 7eedb2616e8107247978541a6de3489b
internalID: -780296576
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable:
"\u52A8\u5E73\u8861\u98DE\u8F6E\u7EC4": 629878897
"\u60EF\u6027\u7A33\u538B\u5668": 1109020032
"\u6392\u6C14\u5171\u9E23\u8154": 68348533
"\u6563\u70ED\u7CFB\u7EDF": 1653300043
"\u65B0\u5F15\u64CE": 658359936
"\u65E7\u5F0F\u91CD\u578B\u5F15\u64CE": 485554460
"\u8F85\u52A9\u6DA1\u8F6E": -515767054
"\u8FDB\u6C14\u7CFB\u7EDF": -780296576
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
+89 -375
View File
@@ -141,7 +141,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &96399202
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -203,7 +203,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10
m_SortingOrder: 30
m_TargetDisplay: 0
--- !u!224 &96399205
RectTransform:
@@ -458,9 +458,9 @@ RectTransform:
- {fileID: 2016105020}
m_Father: {fileID: 710940761}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 95.3075, y: -50}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &293111317
@@ -751,7 +751,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 6
m_SortingOrder: 21
m_Sprite: {fileID: -366098708, guid: 02cf82119edd5d44cbcc1d11318e499b, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@@ -776,7 +776,7 @@ GameObject:
- component: {fileID: 535456366}
- component: {fileID: 535456365}
m_Layer: 0
m_Name: "\u91CD\u7F6E"
m_Name: "\u5F39\u51FA"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -797,9 +797,9 @@ RectTransform:
- {fileID: 1419638732}
m_Father: {fileID: 710940761}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 285.92252, y: -50}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &535456365
@@ -1317,6 +1317,7 @@ MonoBehaviour:
_deviceButtonRoot: {fileID: 1211326591}
_deviceItemPrefab: {fileID: 4143230107302099057, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
lockButton: {fileID: 293111317}
popUpButton: {fileID: 535456365}
--- !u!1 &605981712
GameObject:
m_ObjectHideFlags: 0
@@ -1353,7 +1354,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -152, y: 152.7}
m_SizeDelta: {x: 89.6, y: 24.01}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &605981714
MonoBehaviour:
@@ -1538,7 +1539,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 7
m_SortingOrder: 22
m_Sprite: {fileID: -366098708, guid: 02cf82119edd5d44cbcc1d11318e499b, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@@ -1829,7 +1830,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMin.x
@@ -1837,7 +1838,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_SizeDelta.x
@@ -1877,11 +1878,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchoredPosition.x
value: 200
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchoredPosition.y
value: -125.158325
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -2092,18 +2093,17 @@ Transform:
m_GameObject: {fileID: 995348382}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 7, y: -2.73, z: 0}
m_LocalPosition: {x: 6.78, y: -2.65, z: 90}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1638996020}
- {fileID: 1842595236}
- {fileID: 1006207894}
- {fileID: 1501284897}
- {fileID: 1084840941}
- {fileID: 1456095183}
- {fileID: 1136123082}
m_Father: {fileID: 0}
m_Father: {fileID: 4973841588922437152}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &995348384
MonoBehaviour:
@@ -2555,7 +2555,7 @@ Transform:
m_GameObject: {fileID: 1136123081}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5, y: 0, z: 0}
m_LocalPosition: {x: -4.81, y: 0.25, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -2573,8 +2573,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a9831cebfabb09f4993b755f03fcc5eb, type: 3}
m_Name:
m_EditorClassIdentifier:
width: 4
height: 4
width: 5
height: 5
anchorPoint: 4
--- !u!1 &1211326590
GameObject:
@@ -2606,8 +2606,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1617150492}
m_Children: []
m_Father: {fileID: 599612779}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@@ -2749,7 +2748,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 7
m_SortingOrder: 23
m_Sprite: {fileID: -2118079210, guid: 02cf82119edd5d44cbcc1d11318e499b, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@@ -2787,7 +2786,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMin.x
@@ -2795,7 +2794,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_SizeDelta.x
@@ -2835,11 +2834,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchoredPosition.x
value: 200
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchoredPosition.y
value: -75.095
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -3204,7 +3203,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u91CD\u7F6E"
m_text: "\u5F39\u51FA"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: c7fc4cbba4b38a04c8985d4dbce12a73, type: 2}
m_sharedMaterial: {fileID: -5947736473428621296, guid: c7fc4cbba4b38a04c8985d4dbce12a73, type: 2}
@@ -3441,7 +3440,7 @@ Transform:
m_GameObject: {fileID: 1456095182}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.86, y: 0, z: 0}
m_LocalPosition: {x: -3.75, y: 0.25, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -3459,8 +3458,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a9831cebfabb09f4993b755f03fcc5eb, type: 3}
m_Name:
m_EditorClassIdentifier:
width: 1.5
height: 4
width: 2
height: 5
anchorPoint: 4
--- !u!1 &1467061558
GameObject:
@@ -3629,244 +3628,6 @@ MonoBehaviour:
logText: {fileID: 2011813025}
textFields: []
imageFields: []
--- !u!224 &1617150492 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
m_PrefabInstance: {fileID: 5349796245655118265}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1638996019
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1638996020}
- component: {fileID: 1638996025}
- component: {fileID: 1638996024}
- component: {fileID: 1638996023}
- component: {fileID: 1638996022}
- component: {fileID: 1638996021}
m_Layer: 0
m_Name: "\u6392\u6C14\u5171\u9E23\u8154 (1)"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1638996020
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638996019}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -7.885, y: 3.9849997, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 995348383}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1638996021
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638996019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62aeab6b39ab40949ab3e66462c5e295, type: 3}
m_Name:
m_EditorClassIdentifier:
isDraggable: 1
dragScale: 1.1
recycleSlot: {fileID: 995348384}
--- !u!114 &1638996022
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638996019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0c4fbab01ad40c2449c849cd2a8c620f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Delegates:
- eventID: 0
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 1
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 2
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 3
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 4
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 5
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 14
callback:
m_PersistentCalls:
m_Calls: []
- eventID: 13
callback:
m_PersistentCalls:
m_Calls: []
--- !u!60 &1638996023
PolygonCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638996019}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.25, y: 0.167}
oldSize: {x: 2.3906977, y: 3.4976745}
newSize: {x: 2, y: 3}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: -0.585, y: -0.585}
- {x: 1.7549999, y: -0.585}
- {x: 1.7549999, y: 0.585}
- {x: 0.585, y: 0.585}
- {x: 0.585, y: 1.7549999}
- {x: 1.7549999, y: 1.7549999}
- {x: 1.7549999, y: 2.925}
- {x: -0.585, y: 2.925}
m_UseDelaunayMesh: 0
--- !u!212 &1638996024
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638996019}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 5
m_Sprite: {fileID: -4903168459446787704, guid: 4a2b713e6648d764094de9d628609c75, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2, y: 3}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &1638996025
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638996019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4be33b2e5baf96447a7df0d10cb22064, type: 3}
m_Name:
m_EditorClassIdentifier:
_blockShapeData:
shapeId: 2
shapeName: "\u6392\u6C14\u5171\u9E23\u8154"
width: 2
height: 3
cellSize: 1.17
originalPatternStr: 1,1,1;1,0,1
spritePath: "BlockPuzzle/\u5F15\u64CE\u4ED3\u90E8\u4EF6[\u6392\u6C14\u5171\u9E23\u8154]"
extraLimits: 0
rootLimit: {x: 0, y: 0}
rotationAngleLimit: 0
blockShapeInfo:
shapeName:
paramValue:
power: 0
noise: 0
heat: 0
shapeDescription:
states: []
buttonImagePath:
--- !u!1 &1650896846
GameObject:
m_ObjectHideFlags: 0
@@ -4525,7 +4286,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMin.x
@@ -4533,7 +4294,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_SizeDelta.x
@@ -4573,11 +4334,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchoredPosition.x
value: 200
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_AnchoredPosition.y
value: -25.031666
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315691780937248007, guid: c858e6c79c195e544aed0e14e043fcf7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -4636,6 +4397,14 @@ PrefabInstance:
propertyPath: blockPuzzlePanel
value:
objectReference: {fileID: 2126631945}
- target: {fileID: 205405881972710832, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: shapeRecycleSlot
value:
objectReference: {fileID: 995348384}
- target: {fileID: 856747765937572932, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1133554645891563439, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@@ -4676,116 +4445,62 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1372856441920777658, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_SortingOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4005591901077341241, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5832289988495609530, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_Name
value: Block Puzzle Game
objectReference: {fileID: 0}
- target: {fileID: 5832289988495609530, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5967947099444148843, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6213904822448501237, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_SortingOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6668614951528669954, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7203917669022731298, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_LocalPosition.x
value: 1.04
objectReference: {fileID: 0}
- target: {fileID: 8155762674042709482, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_RemovedGameObjects:
- {fileID: 8674205148396041441, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
- {fileID: 2234235524907542922, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
- {fileID: 3136809114767034397, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
- {fileID: 3167217023155311119, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
- {fileID: 1997755591233928732, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
- {fileID: 5213224785570908867, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
- {fileID: 2824281136311423526, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 1133554645891563439, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
insertIndex: 2
addedObject: {fileID: 995348383}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
--- !u!1001 &5349796245655118265
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1211326591}
m_Modifications:
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_SizeDelta.x
value: 80
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_SizeDelta.y
value: 120
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_AnchoredPosition.x
value: 60
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_AnchoredPosition.y
value: -80
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 589261108523086158, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4143230107302099057, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
propertyPath: m_Name
value: Button
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9345b48dfa0bded4db0af9dd6eb482c4, type: 3}
--- !u!4 &4973841588922437152 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1133554645891563439, guid: 5b2e098922156b645a82b7bcdb436ac9, type: 3}
m_PrefabInstance: {fileID: 4973841588922437151}
m_PrefabAsset: {fileID: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@@ -4794,4 +4509,3 @@ SceneRoots:
- {fileID: 791020756}
- {fileID: 4973841588922437151}
- {fileID: 96399205}
- {fileID: 995348383}
@@ -2,12 +2,15 @@ using UnityEngine;
using AibisDream.UI;
using UnityEngine.UI;
using System;
using TMPro;
using UnityEngine.Events;
namespace AibisDream.FixSystem
{
public class BlockPuzzlePart : MonoBehaviour, IOperatorPanel
{
public UnityEvent OnSubmit => lockButton.onClick;
public UnityEvent OnPopUp => popUpButton.onClick;
private Animator _animator;
// ------------------------ 进度条 -------------------------
@@ -48,8 +51,6 @@ namespace AibisDream.FixSystem
public void OnDeviceRecycle(BlockShape blockShape)
{
// TODO: 播放回收动画
AddDeviceButton(blockShape.BlockShapeData.blockShapeInfo);
}
@@ -62,15 +63,13 @@ namespace AibisDream.FixSystem
private void AddDeviceButton(BlockShapeInfo blockShapeInfo)
{
var button = Instantiate(_deviceItemPrefab, _deviceButtonRoot);
var button = Instantiate(_deviceItemPrefab, _deviceButtonRoot).GetComponent<ShapeCreateButton>();
button.gameObject.name = blockShapeInfo.shapeName;
button.GetComponentInChildren<TMP_Text>().text = blockShapeInfo.shapeName;
button.GetComponentInChildren<Image>().sprite = blockShapeInfo.GetButtonImage();
button.GetComponent<Button>().onClick.AddListener(() => OnDeviceSelected?.Invoke(blockShapeInfo));
button.SetInfo(blockShapeInfo);
button.OnClicked.AddListener(() => OnDeviceSelected?.Invoke(blockShapeInfo));
}
private void RemoveDeviceButton(string shapeName)
public void RemoveDeviceButton(string shapeName)
{
var button = _deviceButtonRoot.Find(shapeName).gameObject;
Destroy(button);
@@ -80,15 +79,10 @@ namespace AibisDream.FixSystem
[Header("提交按钮")]
[SerializeField] private Button lockButton;
[SerializeField] private Button popUpButton;
public Button LockButton => lockButton;
// ------------------------- 模块出口 -------------------------
public void SetRecycleAvailable(bool isAvailable)
{
// TODO: 更新模块出口状态
}
public Button PopUpButton => popUpButton;
// ------------------------ 面板收放 -------------------------
public void Init()
@@ -79,9 +79,40 @@ namespace AibisDream.Kit
private readonly List<IActionQueueCallback> _actionQueueCallbacks = new();
/// <summary>
/// 确保存在可用的 <see cref="ActionKitMonoBehaviourEvents"/> 实例。
/// 由于 <see cref="Singleton{T}"/> 不会自动创建对象,当场景里没有该组件时,某些 Action 的 Deinit 回收入队会触发 NRE。
/// </summary>
private static ActionKitMonoBehaviourEvents EnsureInstance()
{
if (Instance != null) return Instance;
if (!Application.isPlaying) return null;
var go = new GameObject(nameof(ActionKitMonoBehaviourEvents));
DontDestroyOnLoad(go);
return go.AddComponent<ActionKitMonoBehaviourEvents>();
}
/// <summary>
/// 获取或创建全局事件载体(用于 StartGlobal、回收队列等)。
/// </summary>
public static ActionKitMonoBehaviourEvents GetOrCreate()
{
return EnsureInstance();
}
public static void AddCallback(IActionQueueCallback actionQueueCallback)
{
Instance._actionQueueCallbacks.Add(actionQueueCallback);
var inst = EnsureInstance();
// 在退出/非运行态等情况下无法创建实例时,直接执行回调避免 NRE(回收/清理类回调通常是幂等的)。
if (inst == null)
{
actionQueueCallback?.Call();
return;
}
inst._actionQueueCallbacks.Add(actionQueueCallback);
}
// Update is called once per frame
@@ -1,4 +1,4 @@
using System;
using System;
using UnityEngine;
namespace AibisDream.Kit
@@ -135,12 +135,12 @@ namespace AibisDream.Kit
public static IActionController StartGlobal(this IAction self, Action<IActionController> onFinish = null)
{
return self.Start(ActionKitMonoBehaviourEvents.Instance, onFinish);
return self.Start(ActionKitMonoBehaviourEvents.GetOrCreate(), onFinish);
}
public static IActionController StartGlobal(this IAction self, Action onFinish)
{
return self.Start(ActionKitMonoBehaviourEvents.Instance, onFinish);
return self.Start(ActionKitMonoBehaviourEvents.GetOrCreate(), onFinish);
}
@@ -1,6 +1,7 @@
using UnityEngine;
using AibisDream.FixSystem;
using System;
using UnityEngine.Events;
namespace AibisDream
{
@@ -11,8 +12,6 @@ namespace AibisDream
[SerializeField] private UniversalScreen blockPuzzleScreen;
[SerializeField] private BlockPuzzlePart blockPuzzlePart;
public event Action OnSubmit;
// ---------------------- 维修部分 ----------------------
public BlockPuzzlePart Panel => blockPuzzlePart;
@@ -34,6 +33,18 @@ namespace AibisDream
// TODO: 设备状态后面实现
}
public void ClearShapeInScreen()
{
blockPuzzleScreen.SetImage("设备缩略图", null);
blockPuzzleScreen.SetText("设备名称", "待选择");
blockPuzzleScreen.SetText("设备描述", null);
blockPuzzleScreen.SetText("PWR", "0");
blockPuzzleScreen.SetText("NOISE", "0");
blockPuzzleScreen.SetText("HEAT", "0");
}
// ---------------------- 对话功能 ----------------------
public void RunLine(LineSyncToken syncToken)
@@ -50,15 +61,11 @@ namespace AibisDream
private void OnEnable()
{
DialogUIManager.Instance.RegisterScreenView(DialogViewType.Log, this);
blockPuzzlePart.LockButton.onClick.AddListener(() => OnSubmit?.Invoke());
}
private void OnDisable()
{
DialogUIManager.Instance.UnRegisterScreenView(DialogViewType.Log);
blockPuzzlePart.LockButton.onClick.RemoveAllListeners();
}
}
}
@@ -4,6 +4,7 @@ using AibisDream.Kit;
using AibisDream.Utility;
using System.Linq;
using AibisDream.Framework;
using System;
namespace AibisDream
{
@@ -107,8 +108,8 @@ namespace AibisDream
{
// 由面板触发
blockPuzzlePanel.Panel.OnDeviceSelected += OnPanelShapeSelected;
blockPuzzlePanel.OnSubmit += SubmitGameResult;
// blockPuzzlePanel.
blockPuzzlePanel.Panel.OnSubmit.AddListener(SubmitGameResult);
blockPuzzlePanel.Panel.OnPopUp.AddListener(PopUpShape);
// 由网格触发
grid.OnShapePlaced += PreCheckGameState;
@@ -116,7 +117,7 @@ namespace AibisDream
// 由Shape触发
shapeFactory.OnDragStart += OnShapeDragStart;
shapeFactory.OnDragEnd += OnShapeDragEnd;
// shapeFactory.OnDragUpdate += OnShapeRecycled;
shapeFactory.OnDragUpdate += OnShapeDragUpdate;
}
private void OnPanelShapeSelected(BlockShapeInfo shapeData)
@@ -139,19 +140,60 @@ namespace AibisDream
// 更新选中图形
// 回收抽屉高亮,半开
blockPuzzlePanel.Panel.SetRecycleAvailable(true);
shapeRecycleSlot.PreRecycle();
shapeRecycleSlot.SetRecycleAvaliable(true);
}
public void OnShapeDragEnd(IBlockShape blockShape, bool isPlaced)
{
if (isPlaced)
{
// 关闭回收抽屉
blockPuzzlePanel.Panel.SetRecycleAvailable(false);
}
//
// TODO: 如果吸附到回收处,应该播放动画,并提示回收成功
}
public void OnShapeDragUpdate(IBlockShape blockShape)
{
// 更新回收槽状态
shapeRecycleSlot.UpdateSlotState(blockShape);
}
public void PopUpShape()
{
if (selectedShapeName == null)
{
return;
}
// 弹出形状
var blockShape = shapeFactory.CreateBlockShape(selectedShapeName);
shapeRecycleSlot.PopUpShape(blockShape);
blockShape.GetComponent<ShapeDragger>().CurrentState = DragState.Idle;
// 删除按钮
blockPuzzlePanel.Panel.RemoveDeviceButton(selectedShapeName);
selectedShapeName = null;
blockPuzzlePanel.ClearShapeInScreen();
}
// --------------------- 吸附校验 ---------------------
public bool TrySnapToRecycleSlot(BlockShape blockShape)
{
// 先判断是否吸附到回收槽
if (shapeRecycleSlot.CurrentState == PositionState.Open)
{
shapeRecycleSlot.RecycleShape(blockShape);
// TODO: 向面板添加回收的形状
blockPuzzlePanel.Panel.OnDeviceRecycle(blockShape);
// 延时后进行销毁
ActionKit.Delay(1.0f, () => {
shapeFactory.RecycleBlockShape(blockShape);
}).Start(this);
return true;
}
return false;
}
// ---------------- 编辑器状态逻辑 ----------------
/// <summary>
@@ -201,6 +243,10 @@ namespace AibisDream
public void CreateShapeInEditor(string shapeKey)
{
if (shapeFactory == null)
{
shapeFactory = new ShapeFactory(shapeRoot);
}
shapeFactory.CreateBlockShape(shapeKey);
}
}
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.Events;
namespace AibisDream
{
public class ShapeCreateButton : MonoBehaviour
{
[SerializeField] private Image _image;
[SerializeField] private TMP_Text _text;
[SerializeField] private Button _button;
public UnityEvent OnClicked => _button.onClick;
public void SetInfo(BlockShapeInfo blockShapeInfo)
{
_image.sprite = blockShapeInfo.GetButtonImage();
_text.text = blockShapeInfo.shapeName;
gameObject.name = blockShapeInfo.shapeName;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fae2a3bab01b11147a06ea3a105dcc2f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -7,25 +7,42 @@ namespace AibisDream
{
public class ShapeDragger : MonoBehaviour, IBlockShapeDragger, IInteraction
{
[Header("拖拽设置")]
#region
[SerializeField] private bool isDraggable = true;
[SerializeField] private float dragScale = 1.1f;
// [SerializeField] private float dragScale = 1.1f;
[SerializeField] private int dragLayerId;
[SerializeField] private int dragLayerOrder;
[SerializeField] private int idleLayerId;
[SerializeField] private int idleLayerOrder;
#endregion
// 拖拽状态
private DragState _currentState = DragState.Idle;
private DragState _currentState = DragState.Placed;
public DragState CurrentState
{
get => _currentState;
set
{
if (value == _currentState) return;
// 处理状态切换
HandleStateChange(value);
_currentState = value;
}
}
private SnapResult _snapResult;
// 组件引用
private BlockShape _blockShape;
private EventTriggerEx _eventTrigger;
public DragState CurrentState => _currentState;
private SpriteRenderer _spriteRenderer;
public bool IsDraggable { get => isDraggable; set => isDraggable = value; }
public IBlockPuzzleGrid TargetGrid => BlockPuzzleSystem.Instance.grid;
public IBlockShape BlockShape => _blockShape;
// 事件
public event Action<IBlockShape> OnDragStart;
public event Action<IBlockShape> OnDragUpdate;
@@ -35,6 +52,7 @@ namespace AibisDream
{
_blockShape = GetComponent<BlockShape>();
_eventTrigger = GetComponent<EventTriggerEx>();
_spriteRenderer = GetComponent<SpriteRenderer>();
RegisterEvent();
}
@@ -53,7 +71,7 @@ namespace AibisDream
private void Update()
{
if (_currentState == DragState.Dragging)
if (CurrentState == DragState.Dragging)
{
UpdateDrag();
}
@@ -67,7 +85,7 @@ namespace AibisDream
}
// 如果当前物体不在拖拽中则进入拖拽逻辑
if (_currentState == DragState.Idle || _currentState == DragState.Placed)
if (CurrentState == DragState.Idle || CurrentState == DragState.Placed)
{
StartDrag();
}
@@ -86,52 +104,36 @@ namespace AibisDream
TargetGrid?.TryRemoveShapeFromGrid(_blockShape);
TargetGrid?.ResetPreviewGrid();
_currentState = DragState.Dragging;
// 处理层级和缩放
HandleDragStart();
CurrentState = DragState.Dragging;
OnDragStart?.Invoke(_blockShape);
}
private void HandleDragStart()
{
// 调整缩放和层级
transform.localScale = dragScale * Vector3.one;
}
public void CancelDrag()
{
throw new NotImplementedException();
}
public void EndDrag()
{
TargetGrid?.ResetPreviewGrid();
OnDragEnd?.Invoke(_blockShape, CurrentState == DragState.Placed);
// 先吸附到回收槽
var recycled = BlockPuzzleSystem.Instance.TrySnapToRecycleSlot(_blockShape);
if (recycled)
{
CurrentState = DragState.Idle;
return;
}
// 如果吸附到了就靠过去
// 吸附到网格
TargetGrid?.ResetPreviewGrid();
if (_snapResult.canSnap)
{
_currentState = DragState.Placed;
CurrentState = DragState.Placed;
transform.localScale = Vector3.one;
TargetGrid.TrySnapToGrid(_blockShape, _snapResult.RootCell);
// 处理Cursor
_eventTrigger.OnPointerUp(null);
OnDragEnd?.Invoke(_blockShape, _currentState == DragState.Placed);
}
// TODO: 无法吸附直接不处理
// else
// {
// _currentState = DragState.Idle;
// // transform.position = _originalPosition;
// transform.localScale = Vector3.one;
// // BlockPuzzleSystem.Instance.shapeRack.RecycleBlockShape(_blockShape);
// }
// TODO: 都没吸附到,则恢复原位
TargetGrid.GridVisualizer.UpdateAllCellsVisual();
}
@@ -154,6 +156,24 @@ namespace AibisDream
OnDragUpdate?.Invoke(_blockShape);
}
private void HandleStateChange(DragState newState)
{
switch (newState)
{
case DragState.Idle:
_spriteRenderer.sortingOrder = dragLayerOrder;
_spriteRenderer.sortingLayerID = dragLayerId;
break;
case DragState.Dragging:
_spriteRenderer.sortingOrder = dragLayerOrder;
_spriteRenderer.sortingLayerID = dragLayerId;
break;
case DragState.Placed:
_spriteRenderer.sortingOrder = idleLayerOrder;
_spriteRenderer.sortingLayerID = idleLayerId;
break;
}
}
private Vector3 GetMouseWorldPosition()
{
@@ -35,11 +35,13 @@ namespace AibisDream
dragger.OnDragStart += OnShapeDragStart;
dragger.OnDragEnd += OnShapeDragEnd;
dragger.OnDragUpdate += OnShapeDragUpdate;
return blockShape;
}
private void OnShapeDragStart(IBlockShape blockShape)
{
blockShape.ShapeDragger.transform.SetParent(_shapeRoot);
OnDragStart?.Invoke(blockShape);
}
@@ -20,14 +20,14 @@ namespace AibisDream
public void OpenForRecycle()
{
// TODO: 回收槽完全弹出
// 回收槽完全弹出
mover.SetToOpen();
// TODO: 边缘发光提示
}
public void CloseForRecycle()
{
// TODO: 回收槽回到半关闭
// 回收槽回到半关闭
mover.SetToHalf();
// TODO: 边缘发光提示
}
@@ -36,8 +36,8 @@ namespace AibisDream
{
// 将 shape 放到回收槽
PutShapeInSlot(shape);
// TODO: 播放回收动画
// 播放回收动画
mover.SetToClose();
// TODO: 销毁Shape
}
@@ -48,6 +48,7 @@ namespace AibisDream
// 将 shape 添加到回收槽
PutShapeInSlot(shape);
// TODO: 播放弹出动画
mover.SetToOpen();
}
// ----------------------- 状态校验 -----------------------
@@ -72,42 +73,26 @@ namespace AibisDream
{
if (!openArea.Contains(shape.GetGlobalCenterPosition()))
{
// TODO: 回到半关闭状态
CloseForRecycle();
}
return;
}
// 半关闭状态下的判断
if (mover.GetCurrentState() == PositionState.Half)
{
Debug.Log("Half: " + halfArea.Contains(shape.GetGlobalCenterPosition()));
if (halfArea.Contains(shape.GetGlobalCenterPosition()))
{
// TODO: 回到开启状态
OpenForRecycle();
}
}
}
private void PutShapeInSlot(BlockShape shape)
{
shape.transform.SetParent(transform);
shape.transform.SetParent(mover.transform);
Vector3 centerPosition = shape.GetCenterPosition();
shape.transform.localPosition = -centerPosition;
}
private void SetMoverState(ShapeRecycleSlotState state)
{
}
}
public enum ShapeRecycleSlotState
{
Close,
Half,
Open
}
}
@@ -10,7 +10,6 @@ namespace AibisDream
{
Idle, // 空闲
Dragging, // 拖拽中
Snapping, // 吸附中
Placed // 已放置
}
@@ -70,11 +69,6 @@ namespace AibisDream
/// </summary>
void EndDrag();
/// <summary>
/// 取消拖拽(返回原位置)
/// </summary>
void CancelDrag();
/// <summary>
/// 检查是否可以放置到指定位置
/// </summary>