新增界面

This commit is contained in:
shenjianxing 2025-04-27 11:41:11 +08:00
parent 33a5c245a4
commit cb23a56bb0
15 changed files with 3274 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8ae12c898f4042949bc5cc317c63d77d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: uiimageselectmap_prefab
assetBundleVariant:

View File

@ -0,0 +1,975 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &377343312
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 377343313}
m_Layer: 5
m_Name: CanvasPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &377343313
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 377343312}
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: 2114871786}
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!1 &801682693
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 801682694}
- component: {fileID: 801682696}
- component: {fileID: 801682695}
m_Layer: 5
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &801682694
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 801682693}
serializedVersion: 2
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: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &801682695
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 801682693}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 1
--- !u!114 &801682696
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 801682693}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!1 &995027251
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 995027252}
m_Layer: 5
m_Name: Bg
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &995027252
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 995027251}
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: 2114871786}
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!1 &1084276686
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1084276689}
- component: {fileID: 1084276687}
- component: {fileID: 1084276688}
m_Layer: 5
m_Name: UICamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!20 &1084276687
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1084276686}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 3
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: 99
m_CullingMask:
serializedVersion: 2
m_Bits: 32
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!124 &1084276688
Behaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1084276686}
m_Enabled: 1
--- !u!4 &1084276689
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1084276686}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -100}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1126280010
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1126280011}
m_Layer: 5
m_Name: Common
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1126280011
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1126280010}
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: 2114871786}
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!1 &1161286720
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1161286721}
- component: {fileID: 1161286724}
- component: {fileID: 1161286723}
- component: {fileID: 1161286722}
m_Layer: 5
m_Name: RightBottom
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1161286721
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
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: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1828.92, y: 0}
m_Pivot: {x: 1, y: -0.000000461936}
--- !u!222 &1161286722
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_CullTransparentMesh: 1
--- !u!114 &1161286723
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!114 &1161286724
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 10
m_Bottom: 10
m_ChildAlignment: 8
m_Spacing: 10
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 1
m_ReverseArrangement: 1
--- !u!1 &1320020531
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1320020532}
m_Layer: 5
m_Name: PopUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1320020532
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1320020531}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0000799, y: 1.0000799, z: 1.0000799}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
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!1 &1349401529
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1349401531}
- component: {fileID: 1349401530}
m_Layer: 0
m_Name: TestUIImageSelectMap
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1349401530
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1349401529}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b6b7a3e7dc894eaca1053ef166cdad33, type: 3}
m_Name:
m_EditorClassIdentifier:
PanelName: UIImageSelectMap
Level: 0
mOtherPanels: []
--- !u!4 &1349401531
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1349401529}
serializedVersion: 2
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: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1635592603
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1635592604}
- component: {fileID: 1635592605}
m_Layer: 5
m_Name: Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1635592604
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635592603}
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: 2114871786}
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_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1635592605
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635592603}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5dc84f25d84334e168bf64050b91e1fb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1661191870
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1661191871}
- component: {fileID: 1661191872}
m_Layer: 5
m_Name: Design
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1661191871
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661191870}
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: 8931408189093656909}
m_Father: {fileID: 2114871786}
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!114 &1661191872
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661191870}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6eba024ea32574239b57b098f1dc6282, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2114871781
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2114871786}
- component: {fileID: 2114871785}
- component: {fileID: 2114871784}
- component: {fileID: 2114871783}
- component: {fileID: 2114871782}
m_Layer: 5
m_Name: UIRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2114871782
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2db7fffd623c478eba3d2cb84034d2f, type: 3}
m_Name:
m_EditorClassIdentifier:
UICamera: {fileID: 1084276687}
Canvas: {fileID: 2114871785}
CanvasScaler: {fileID: 2114871784}
GraphicRaycaster: {fileID: 2114871783}
Bg: {fileID: 995027252}
Common: {fileID: 1126280011}
PopUI: {fileID: 1320020532}
RightBottom: {fileID: 1161286721}
CanvasPanel: {fileID: 377343313}
--- !u!114 &2114871783
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 0
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2114871784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.5
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &2114871785
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 1084276687}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 1
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 100
m_TargetDisplay: 0
--- !u!224 &2114871786
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 995027252}
- {fileID: 1126280011}
- {fileID: 1161286721}
- {fileID: 1320020532}
- {fileID: 377343313}
- {fileID: 1661191871}
- {fileID: 801682694}
- {fileID: 1084276689}
- {fileID: 1635592604}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
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_Pivot: {x: 0, y: 0}
--- !u!1001 &8931408189093656908
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1661191871}
m_Modifications:
- target: {fileID: 1318390635077869678, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1318390635077869678, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1318390635077869678, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2525946039026654729, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2525946039026654729, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5702230170007598446, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_HorizontalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 6336473892143704609, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.0009040238
objectReference: {fileID: 0}
- target: {fileID: 6608813160943937009, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6608813160943937009, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6690386520824484871, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.0009040238
objectReference: {fileID: 0}
- target: {fileID: 7471371802902961118, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7471371802902961118, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8048533352694695708, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8048533352694695708, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8636616114181872079, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_Name
value: UIImageSelectMap
objectReference: {fileID: 0}
- target: {fileID: 8684970269249796938, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8684970269249796938, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
--- !u!224 &8931408189093656909 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
m_PrefabInstance: {fileID: 8931408189093656908}
m_PrefabAsset: {fileID: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 2114871786}
- {fileID: 1349401531}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6aebd18275784904b8bee1a5e43e817a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -23,6 +23,19 @@ namespace XMLTool
public Dictionary<string, string> args = new Dictionary<string, string>();
}
public class ImageSelectMapAction : Action
{
public class Item
{
public string pic;
public string pos;
public string size;
}
public Dictionary<string, string> args = new Dictionary<string, string>();
public List<Item> items = new List<Item>();
}
public class DictionaryCondition : Condition
{

View File

@ -283,6 +283,11 @@ public class ActionHelper
var dictAction = (XMLTool.DictionaryAction)act;
return QFramework.ShowScoreAction.Allocate(dictAction.args);
}
case "ImageSelectMap":
{
var dictAction = (XMLTool.ImageSelectMapAction)act;
return QFramework.ImageSelectMapAction.Allocate(dictAction.args,dictAction.items);
}
default:
Debug.LogError($"没有找到此Action的类型{act.Type}");
break;

View File

@ -0,0 +1,115 @@
using QFramework.Example;
using System;
using System.Collections.Generic;
using UnityEngine;
using XMLTool;
namespace QFramework
{
internal class ImageSelectMapAction : IAction
{
public string txt;
public System.Action OnFinished { get; set; }
private ImageSelectMapAction()
{
}
private static readonly SimpleObjectPool<ImageSelectMapAction> mPool =
new SimpleObjectPool<ImageSelectMapAction>(() => new ImageSelectMapAction(), null, 10);
Dictionary<string, string> datas;
List<XMLTool.ImageSelectMapAction.Item> items;
public static ImageSelectMapAction Allocate(Dictionary<string, string> datas, List<XMLTool.ImageSelectMapAction.Item> items, System.Action OnFinished = null)
{
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.datas = datas;
retNode.items = items;
retNode.Reset();
retNode.OnFinished = OnFinished;
return retNode;
}
public ulong ActionID { get; set; }
public ActionStatus Status { get; set; }
public void OnStart()
{
UIImageSelectMapData data = new UIImageSelectMapData();
data.totalScore = 0;
if (datas.ContainsKey("totalScore"))
{
float.TryParse(datas["totalScore"], out data.totalScore);
}
data.rightScore = 0;
if (datas.ContainsKey("rightScore"))
{
float.TryParse(datas["rightScore"], out data.rightScore);
}
data.wrongScore = 0;
if (datas.ContainsKey("wrongScore"))
{
float.TryParse(datas["wrongScore"], out data.wrongScore);
}
data.scoreName = datas.ContainsKey("scoreName") ? datas["scoreName"] : "";
data.rightLabel = datas.ContainsKey("rightLabel") ? datas["rightLabel"] : "";
data.wrongLabel = datas.ContainsKey("wrongLabel") ? datas["wrongLabel"] : "";
data.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : "";
data.rightBg = datas.ContainsKey("rightBg") ? datas["rightBg"] : "";
foreach (var item in items)
{
data.items.Add(new UIImageSelectMapData.OptionItem()
{
pic = item.pic,
pos = Utility.GetVector2FromStrArray(item.pos),
size = Utility.GetVector2FromStrArray(item.size)
});
}
UIKit.OpenPanelAsync<UIImageSelectMap>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
{
this.Finish();
OnFinished?.Invoke();
});
}
public void OnExecute(float dt)
{
}
public void OnFinish()
{
}
public void Reset()
{
Status = ActionStatus.NotStart;
Paused = false;
}
public bool Paused { get; set; }
public void Deinit()
{
if (!Deinited)
{
OnFinished = null;
Deinited = true;
mPool.Recycle(this);
}
}
public bool Deinited { get; set; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 93d6ed89dd2e1974f8712dde5a2c6c31
timeCreated: 1647655796

View File

@ -0,0 +1,361 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class WaterfallScrollView : MonoBehaviour
{
[Header("组件引用")]
[SerializeField] private ScrollRect scrollRect;
[SerializeField] private RectTransform viewport;
[SerializeField] private RectTransform content;
[SerializeField] private RectTransform itemPrefab;
[SerializeField] private Image itemImageComponent; // 预制体中的Image组件引用
[Header("瀑布流设置")]
[SerializeField] private int columnCount = 3;
[SerializeField] private float spacingX = 10f;
[SerializeField] private float spacingY = 10f;
[SerializeField] private float paddingLeft = 10f;
[SerializeField] private float paddingRight = 10f;
[SerializeField] private float paddingTop = 10f;
[SerializeField] private float paddingBottom = 10f;
private List<float> columnHeights;
private List<RectTransform> activeItems = new List<RectTransform>();
private Dictionary<int, RectTransform> pooledItems = new Dictionary<int, RectTransform>();
private float itemWidth;
private float viewportHeight;
private float contentHeight;
private int totalItemCount = 0;
private int visibleStartIndex = 0;
private int visibleEndIndex = 0;
public List<Sprite> sprites = new List<Sprite>(); // 存储所有精灵
private List<float> itemHeights = new List<float>(); // 存储每项的计算高度
private void Start()
{
Initialize();
scrollRect.onValueChanged.AddListener(OnScroll);
// 初始检查sprites是否有内容
if (sprites.Count > 0)
{
SetContent(sprites);
}
else
{
ClearContent();
}
}
private void Initialize()
{
// 计算列宽和间距
float availableWidth = viewport.rect.width - paddingLeft - paddingRight - (columnCount - 1) * spacingX;
itemWidth = availableWidth / columnCount;
// 初始化列高度数组
columnHeights = new List<float>(new float[columnCount]);
// 记录视口高度用于计算可见项
viewportHeight = viewport.rect.height;
}
// 使用提供的精灵列表设置内容
public void SetContent(List<Sprite> sprites)
{
this.sprites = sprites ?? new List<Sprite>();
totalItemCount = this.sprites.Count;
// 如果没有精灵,清空内容
if (totalItemCount == 0)
{
ClearContent();
return;
}
// 计算每项的高度
CalculateItemHeights();
// 计算内容高度
contentHeight = CalculateContentHeight();
content.sizeDelta = new Vector2(content.sizeDelta.x, contentHeight);
// 更新可见项
UpdateVisibleItems();
}
// 清空所有内容
public void ClearContent()
{
// 回收所有活动项
foreach (var item in activeItems)
{
item.gameObject.SetActive(false);
}
activeItems.Clear();
// 重置内容大小
content.sizeDelta = new Vector2(content.sizeDelta.x, 0);
totalItemCount = 0;
itemHeights.Clear();
}
private void CalculateItemHeights()
{
itemHeights.Clear();
foreach (Sprite sprite in sprites)
{
if (sprite != null)
{
// 计算保持宽高比的高度
float aspectRatio = sprite.rect.width / sprite.rect.height;
float height = itemWidth / aspectRatio;
itemHeights.Add(height);
}
else
{
// 如果精灵为空,使用默认高度
itemHeights.Add(150f);
}
}
}
private float CalculateContentHeight()
{
// 重置列高度
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 模拟布局计算内容高度
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int shortestColumnIndex = GetShortestColumn();
columnHeights[shortestColumnIndex] += height + spacingY;
}
// 找出最高的列作为内容高度
float maxHeight = 0;
foreach (float height in columnHeights)
{
if (height > maxHeight)
{
maxHeight = height;
}
}
return maxHeight + paddingBottom - spacingY;
}
private int GetShortestColumn()
{
int shortestIndex = 0;
float minHeight = columnHeights[0];
for (int i = 1; i < columnCount; i++)
{
if (columnHeights[i] < minHeight)
{
minHeight = columnHeights[i];
shortestIndex = i;
}
}
return shortestIndex;
}
private void UpdateVisibleItems()
{
// 如果没有项目,不执行任何操作
if (totalItemCount == 0)
return;
// 计算当前可视区域的上下边界
float viewportTop = -content.anchoredPosition.y;
float viewportBottom = viewportTop + viewportHeight;
// 重置列高度用于布局计算
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 计算可见项的起始和结束索引
int newVisibleStartIndex = 0;
int newVisibleEndIndex = totalItemCount - 1;
float currentYPosition = 0;
// 找到第一个可见项的索引
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int columnIndex = GetShortestColumn();
float xPosition = paddingLeft + columnIndex * (itemWidth + spacingX);
float yPosition = -columnHeights[columnIndex]; // 注意UI坐标是向下为正
columnHeights[columnIndex] += height + spacingY;
float itemTop = yPosition;
float itemBottom = yPosition - height;
// 如果项在可视区域内或者与可视区域有交集
if (itemBottom <= viewportBottom && itemTop >= viewportTop - viewportHeight) // 多加载一个屏幕高度的内容
{
newVisibleStartIndex = i;
break;
}
}
// 重置列高度再次计算
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 找到最后一个可见项的索引
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int columnIndex = GetShortestColumn();
float xPosition = paddingLeft + columnIndex * (itemWidth + spacingX);
float yPosition = -columnHeights[columnIndex]; // 注意UI坐标是向下为正
columnHeights[columnIndex] += height + spacingY;
float itemTop = yPosition;
float itemBottom = yPosition - height;
// 如果项在可视区域内或者与可视区域有交集
if (itemBottom <= viewportBottom + viewportHeight && itemTop >= viewportTop) // 多加载一个屏幕高度的内容
{
newVisibleEndIndex = i;
}
else if (i > newVisibleStartIndex) // 已经找到起始索引后才开始判断结束
{
break;
}
}
// 如果可见项范围没有变化则不更新
if (newVisibleStartIndex == visibleStartIndex && newVisibleEndIndex == visibleEndIndex)
{
return;
}
visibleStartIndex = newVisibleStartIndex;
visibleEndIndex = newVisibleEndIndex;
// 回收不再可见的项
RecycleInvisibleItems();
// 重置列高度再次计算,这次用于实际布局
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 创建或更新可见项
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int columnIndex = GetShortestColumn();
float xPosition = paddingLeft + columnIndex * (itemWidth + spacingX);
float yPosition = -columnHeights[columnIndex]; // 注意UI坐标是向下为正
columnHeights[columnIndex] += height + spacingY;
// 只处理可见范围内的项
if (i >= visibleStartIndex && i <= visibleEndIndex)
{
CreateOrUpdateItem(i, xPosition, yPosition, itemWidth, height);
}
}
}
private void CreateOrUpdateItem(int index, float x, float y, float width, float height)
{
RectTransform item;
if (!pooledItems.TryGetValue(index, out item))
{
// 创建新项
item = Instantiate(itemPrefab, content);
item.name = "Item_" + index;
pooledItems[index] = item;
activeItems.Add(item);
}
else if (!activeItems.Contains(item))
{
// 从池中取出
item.gameObject.SetActive(true);
activeItems.Add(item);
}
// 设置位置和大小
item.anchorMin = new Vector2(0, 1);
item.anchorMax = new Vector2(0, 1);
item.pivot = new Vector2(0, 1);
item.anchoredPosition = new Vector2(x, y);
item.sizeDelta = new Vector2(width, height);
// 更新项内容
UpdateItemContent(item, index);
}
private void UpdateItemContent(RectTransform item, int index)
{
// 获取Image组件
Image image = item.GetComponentInChildren<Image>();
if (image == null && itemImageComponent != null)
{
// 如果没有找到Image组件使用预制体中的引用
image = Instantiate(itemImageComponent, item);
image.rectTransform.anchorMin = Vector2.zero;
image.rectTransform.anchorMax = Vector2.one;
image.rectTransform.sizeDelta = Vector2.zero;
}
if (image && index < sprites.Count && sprites[index] != null)
{
// 设置精灵
image.sprite = sprites[index];
image.SetNativeSize();
// 设置Image组件为保持宽高比
image.preserveAspect = true;
}
}
private void RecycleInvisibleItems()
{
// 找出需要回收的项
List<RectTransform> itemsToRecycle = new List<RectTransform>();
foreach (RectTransform item in activeItems)
{
string[] nameParts = item.name.Split('_');
if (nameParts.Length >= 2 && int.TryParse(nameParts[1], out int itemIndex))
{
if (itemIndex < visibleStartIndex || itemIndex > visibleEndIndex)
{
itemsToRecycle.Add(item);
}
}
}
// 回收项
foreach (RectTransform item in itemsToRecycle)
{
item.gameObject.SetActive(false);
activeItems.Remove(item);
}
}
private void OnScroll(Vector2 scrollPosition)
{
UpdateVisibleItems();
}
}

View File

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

View File

@ -0,0 +1,55 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using QFramework;
namespace QFramework.Example
{
// Generate Id:b499f0f9-a71b-40ff-a499-a5e4defad39f
public partial class UIImageSelectMap
{
public const string Name = "UIImageSelectMap";
[SerializeField]
public RectTransform LeftContent;
[SerializeField]
public UnityEngine.UI.Image LeftItem;
[SerializeField]
public UnityEngine.UI.Image RightItem;
[SerializeField]
public RectTransform RightContent;
private UIImageSelectMapData mPrivateData = null;
protected override void ClearUIComponents()
{
LeftContent = null;
LeftItem = null;
RightItem = null;
RightContent = null;
mData = null;
}
public UIImageSelectMapData Data
{
get
{
return mData;
}
}
UIImageSelectMapData mData
{
get
{
return mPrivateData ?? (mPrivateData = new UIImageSelectMapData());
}
set
{
mUIData = value;
mPrivateData = value;
}
}
}
}

View File

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

View File

@ -0,0 +1,90 @@
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using System.Collections.Generic;
namespace QFramework.Example
{
public class UIImageSelectMapData : UIPanelData
{
public class OptionItem
{
public string pic;
public Vector2 pos;
public Vector2 size;
}
public string scoreName;
public float totalScore;
public float rightScore;
public float wrongScore;
public string rightLabel;
public string wrongLabel;
public string finishedEvent;
public string rightBg;
public List<OptionItem> items = new List<OptionItem>();
}
public partial class UIImageSelectMap : UIPanel
{
ResLoader loader;
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
// please add init code here
loader = ResLoader.Allocate();
}
protected override void OnOpen(IUIData uiData = null)
{
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
LeftContent.RemoveAllChildren();
RightContent.RemoveAllChildren();
foreach (var item in mData.items)
{
var leftObj = GameObject.Instantiate(LeftItem, LeftContent);
var path = Global.imagePath + item.pic;
loader.Add2Load(path.ToNetImageResName(), (success, res) =>
{
if (success)
{
leftObj.GetComponent<Image>().sprite = Utility.GetSprite(res.Asset as Texture2D);
}
});
var rightObj = GameObject.Instantiate(RightItem, RightContent);
rightObj.transform.localPosition = item.pos;
rightObj.rectTransform.sizeDelta = item.size;
}
var rightBgPath = Global.imagePath + mData.rightBg;
loader.Add2Load(rightBgPath.ToNetImageResName(), (success, res) =>
{
if (success)
{
RightContent.GetComponent<Image>().sprite = Utility.GetSprite(res.Asset as Texture2D);
RightContent.GetComponent<Image>().SetNativeSize();
}
});
loader.LoadAsync();
}
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
}
}
}

View File

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

View File

@ -1670,6 +1670,61 @@ namespace XMLTool
newAction = act;
}
break;
case "ImageSelectMap":
{
var act = new ImageSelectMapAction();
XAttribute scoreName = action.Attribute("scoreName");
if (scoreName != null)
{
act.args.Add("scoreName", scoreName.Value);
}
XAttribute totalScore = action.Attribute("totalScore");
if (totalScore != null)
{
act.args.Add("totalScore", totalScore.Value);
}
XAttribute rightScore = action.Attribute("rightScore");
if (rightScore != null)
{
act.args.Add("rightScore", rightScore.Value);
}
XAttribute wrongScore = action.Attribute("wrongScore");
if (wrongScore != null)
{
act.args.Add("wrongScore", wrongScore.Value);
}
XAttribute rightLabel = action.Attribute("rightLabel");
if (rightLabel != null)
{
act.args.Add("rightLabel", rightLabel.Value);
}
XAttribute wrongLabel = action.Attribute("wrongLabel");
if (wrongLabel != null)
{
act.args.Add("wrongLabel", wrongLabel.Value);
}
XAttribute finishedEvent = action.Attribute("finishedEvent");
if (finishedEvent != null)
{
act.args.Add("finishedEvent", finishedEvent.Value);
}
XAttribute rightBg = action.Attribute("rightBg");
if (rightBg != null)
{
act.args.Add("rightBg", rightBg.Value);
}
foreach (var itemData in action.Elements("Item"))
{
act.items.Add(new ImageSelectMapAction.Item()
{
pic = itemData.Attribute("pic")?.Value,
size = itemData.Attribute("rightSize")?.Value,
pos = itemData.Attribute("rightPos")?.Value
});
}
newAction = act;
}
break;
default:
newAction = new Action();
break;