diff --git a/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleBuilderSetting.asset b/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleBuilderSetting.asset index 0e5d053..fe4808f 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleBuilderSetting.asset +++ b/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleBuilderSetting.asset @@ -15,8 +15,8 @@ MonoBehaviour: BuildPipeline: 0 BuildMode: 0 BuildPackage: DefaultPackage - CompressOption: 2 - OutputNameStyle: 1 - CopyBuildinFileOption: 1 - CopyBuildinFileTags: - EncyptionClassName: FileStreamEncryption + CompressOption: 0 + FileNameStyle: 1 + BuildinFileCopyOption: 1 + BuildinFileCopyParams: + EncyptionClassName: EncryptionNone diff --git a/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorConfig.xml b/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorConfig.xml index dbac721..41f8d2c 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorConfig.xml +++ b/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorConfig.xml @@ -1,24 +1,26 @@  - - - - + + + + - + - + - + - + + + diff --git a/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorSetting.asset b/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorSetting.asset index 43f4a45..b108e26 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorSetting.asset +++ b/Assets/YooAsset/Samples~/Space Shooter/AssetSetting/AssetBundleCollectorSetting.asset @@ -12,13 +12,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 185f6993d5150494d98da50e26cb1c25, type: 3} m_Name: AssetBundleCollectorSetting m_EditorClassIdentifier: - ShowPackageView: 0 - EnableAddressable: 1 - UniqueBundleName: 0 + ShowPackageView: 1 ShowEditorAlias: 0 + UniqueBundleName: 1 Packages: - PackageName: DefaultPackage PackageDesc: + EnableAddressable: 1 + LocationToLower: 0 + IncludeAssetGUID: 0 + IgnoreDefaultType: 1 Groups: - GroupName: battle GroupDesc: "\u6218\u6597" @@ -104,8 +107,15 @@ MonoBehaviour: FilterRuleName: CollectAll AssetTags: UserData: + - PackageName: RawPackage + PackageDesc: + EnableAddressable: 1 + LocationToLower: 0 + IncludeAssetGUID: 0 + IgnoreDefaultType: 0 + Groups: - GroupName: config - GroupDesc: "\u914D\u7F6E\u8868" + GroupDesc: "\u914D\u8868" AssetTags: ActiveRuleName: EnableGroup Collectors: diff --git a/Assets/YooAsset/Samples~/Space Shooter/Boot.unity b/Assets/YooAsset/Samples~/Space Shooter/Boot.unity index e33a519..d39fb7a 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/Boot.unity +++ b/Assets/YooAsset/Samples~/Space Shooter/Boot.unity @@ -43,7 +43,7 @@ RenderSettings: --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 11 + serializedVersion: 12 m_GIWorkflowMode: 1 m_GISettings: serializedVersion: 2 @@ -98,7 +98,7 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_UseShadowmask: 1 + m_LightingSettings: {fileID: 223974226} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -118,9 +118,72 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!850595691 &223974226 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 3 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 --- !u!1 &1096367106 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config.meta b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config.meta deleted file mode 100644 index 2df7e53..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1894d23646ddbf8479e579cc03261dde -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config/about.txt b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config/about.txt deleted file mode 100644 index 338f656..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config/about.txt +++ /dev/null @@ -1 +0,0 @@ -Powered by YooAsset @tuyoogame \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config/about.txt.meta b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config/about.txt.meta deleted file mode 100644 index 2863db9..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Config/about.txt.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 66ce1e032fc66694bb3fce32961d78d5 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battle.unity b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battle.unity index f7f063b..84e6dea 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battle.unity +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battle.unity @@ -81,6 +81,8 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} @@ -463,6 +465,7 @@ MeshRenderer: m_LightProbeUsage: 0 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 4294967295 m_RendererPriority: 0 m_Materials: @@ -487,6 +490,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!23 &34 MeshRenderer: m_ObjectHideFlags: 0 @@ -502,6 +506,7 @@ MeshRenderer: m_LightProbeUsage: 0 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 4294967295 m_RendererPriority: 0 m_Materials: @@ -526,6 +531,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &35 MeshFilter: m_ObjectHideFlags: 0 @@ -644,6 +650,7 @@ Light: m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!108 &43 @@ -705,6 +712,7 @@ Light: m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!108 &44 @@ -766,12 +774,13 @@ Light: m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!157 &46 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 11 + serializedVersion: 12 m_GIWorkflowMode: 1 m_GISettings: serializedVersion: 2 @@ -826,7 +835,8 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_UseShadowmask: 0 + m_LightingSettings: {fileID: 4890085278179872738, guid: 269b07723b31d484e85034b9691f5d05, + type: 2} --- !u!198 &47 ParticleSystem: m_ObjectHideFlags: 0 @@ -834,7 +844,7 @@ ParticleSystem: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2} - serializedVersion: 6 + serializedVersion: 7 lengthInSec: 100 simulationSpeed: 1 stopAction: 0 @@ -3271,6 +3281,62 @@ ParticleSystem: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 + LifetimeByEmitterSpeedModule: + enabled: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: -0.8 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0.2 + inSlope: -0.8 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Range: {x: 0, y: 1} ForceModule: enabled: 0 x: @@ -4701,19 +4767,20 @@ ParticleSystem: range: {x: 0, y: 1} CollisionModule: enabled: 0 - serializedVersion: 3 + serializedVersion: 4 type: 0 collisionMode: 0 colliderForce: 0 multiplyColliderForceByParticleSize: 0 multiplyColliderForceByParticleSpeed: 0 multiplyColliderForceByCollisionAngle: 1 - plane0: {fileID: 0} - plane1: {fileID: 0} - plane2: {fileID: 0} - plane3: {fileID: 0} - plane4: {fileID: 0} - plane5: {fileID: 0} + m_Planes: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} m_Dampen: serializedVersion: 2 minMaxState: 0 @@ -4887,17 +4954,20 @@ ParticleSystem: interiorCollisions: 0 TriggerModule: enabled: 0 - collisionShape0: {fileID: 0} - collisionShape1: {fileID: 0} - collisionShape2: {fileID: 0} - collisionShape3: {fileID: 0} - collisionShape4: {fileID: 0} - collisionShape5: {fileID: 0} + serializedVersion: 2 inside: 1 outside: 0 enter: 0 exit: 0 + colliderQueryMode: 0 radiusScale: 1 + primitives: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} SubModule: serializedVersion: 2 enabled: 0 @@ -5843,7 +5913,7 @@ ParticleSystem: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4} - serializedVersion: 6 + serializedVersion: 7 lengthInSec: 100 simulationSpeed: 1 stopAction: 0 @@ -8280,6 +8350,62 @@ ParticleSystem: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 + LifetimeByEmitterSpeedModule: + enabled: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: -0.8 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0.2 + inSlope: -0.8 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Range: {x: 0, y: 1} ForceModule: enabled: 0 x: @@ -9710,19 +9836,20 @@ ParticleSystem: range: {x: 0, y: 1} CollisionModule: enabled: 0 - serializedVersion: 3 + serializedVersion: 4 type: 0 collisionMode: 0 colliderForce: 0 multiplyColliderForceByParticleSize: 0 multiplyColliderForceByParticleSpeed: 0 multiplyColliderForceByCollisionAngle: 1 - plane0: {fileID: 0} - plane1: {fileID: 0} - plane2: {fileID: 0} - plane3: {fileID: 0} - plane4: {fileID: 0} - plane5: {fileID: 0} + m_Planes: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} m_Dampen: serializedVersion: 2 minMaxState: 0 @@ -9896,17 +10023,20 @@ ParticleSystem: interiorCollisions: 0 TriggerModule: enabled: 0 - collisionShape0: {fileID: 0} - collisionShape1: {fileID: 0} - collisionShape2: {fileID: 0} - collisionShape3: {fileID: 0} - collisionShape4: {fileID: 0} - collisionShape5: {fileID: 0} + serializedVersion: 2 inside: 1 outside: 0 enter: 0 exit: 0 + colliderQueryMode: 0 radiusScale: 1 + primitives: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} SubModule: serializedVersion: 2 enabled: 0 @@ -10861,6 +10991,7 @@ ParticleSystemRenderer: m_LightProbeUsage: 0 m_ReflectionProbeUsage: 0 m_RayTracingMode: 0 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 4294967295 m_RendererPriority: 0 m_Materials: @@ -10903,6 +11034,8 @@ ParticleSystemRenderer: m_EnableGPUInstancing: 0 m_ApplyActiveColorSpace: 0 m_AllowRoll: 1 + m_FreeformStretching: 0 + m_RotateWithStretchDirection: 1 m_VertexStreams: 0001030405 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} @@ -10925,6 +11058,7 @@ ParticleSystemRenderer: m_LightProbeUsage: 0 m_ReflectionProbeUsage: 0 m_RayTracingMode: 0 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 4294967295 m_RendererPriority: 0 m_Materials: @@ -10967,6 +11101,8 @@ ParticleSystemRenderer: m_EnableGPUInstancing: 0 m_ApplyActiveColorSpace: 0 m_AllowRoll: 1 + m_FreeformStretching: 0 + m_RotateWithStretchDirection: 1 m_VertexStreams: 0001030405 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} @@ -10987,6 +11123,50 @@ MonoBehaviour: m_EditorClassIdentifier: ScrollSpeed: -0.25 TileSizeZ: 30 +--- !u!1 &1167420185 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1167420186} + - component: {fileID: 1167420187} + m_Layer: 0 + m_Name: scene_battle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1167420186 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1167420185} + 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_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1167420187 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1167420185} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 54061fd8bcab2344e87b0faf0464c179, type: 3} + m_Name: + m_EditorClassIdentifier: + CanvasDesktop: {fileID: 3071470527417989667} --- !u!1 &1691764578 GameObject: m_ObjectHideFlags: 0 @@ -11031,6 +11211,142 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!223 &1457738501089579944 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1457738501089579947} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &1457738501089579945 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1457738501089579947} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &1457738501089579946 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1457738501089579947} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!1 &1457738501089579947 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1457738501089579951} + - component: {fileID: 1457738501089579944} + - component: {fileID: 1457738501089579945} + - component: {fileID: 1457738501089579946} + m_Layer: 5 + m_Name: UICanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1457738501089579951 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1457738501089579947} + 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_Children: + - {fileID: 4471021202677412472} + - {fileID: 3071470527417989666} + m_Father: {fileID: 0} + m_RootOrder: 7 + 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!224 &3071470527417989666 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3071470527417989667} + 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_Children: [] + m_Father: {fileID: 1457738501089579951} + m_RootOrder: 1 + 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 &3071470527417989667 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3071470527417989666} + m_Layer: 5 + m_Name: Desktop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &3992189574601221031 GameObject: m_ObjectHideFlags: 0 @@ -11114,3 +11430,69 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!114 &4471021202677412422 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4471021202677412423} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!1 &4471021202677412423 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4471021202677412472} + - component: {fileID: 4471021202677412473} + - component: {fileID: 4471021202677412422} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4471021202677412472 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4471021202677412423} + 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_Children: [] + m_Father: {fileID: 1457738501089579951} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4471021202677412473 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4471021202677412423} + 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: 10 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battleSettings.lighting b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battleSettings.lighting new file mode 100644 index 0000000..625df0a --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battleSettings.lighting @@ -0,0 +1,63 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!850595691 &4890085278179872738 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: scene_battleSettings + serializedVersion: 3 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 0 + m_BakeBackend: 0 + m_LightmapMaxSize: 1024 + m_BakeResolution: 50 + m_Padding: 2 + m_TextureCompression: 0 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 1 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 1 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battleSettings.lighting.meta b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battleSettings.lighting.meta new file mode 100644 index 0000000..dd9555d --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_battleSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 269b07723b31d484e85034b9691f5d05 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4890085278179872738 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_home.unity b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_home.unity index 6995887..9d8ec1b 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_home.unity +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_home.unity @@ -43,7 +43,7 @@ RenderSettings: --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 11 + serializedVersion: 12 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 @@ -98,7 +98,8 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_UseShadowmask: 1 + m_LightingSettings: {fileID: 4890085278179872738, guid: ce19ad4aed57dde42b11449845f36731, + type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -118,9 +119,257 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &287634992 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 287634993} + m_Layer: 5 + m_Name: Desktop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &287634993 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 287634992} + 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_Children: [] + m_Father: {fileID: 690216957} + m_RootOrder: 1 + 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 &477624801 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 477624802} + - component: {fileID: 477624803} + m_Layer: 0 + m_Name: scene_home + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &477624802 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 477624801} + 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_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &477624803 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 477624801} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 41730f8e5f2b6e64abc4a03035c61ea5, type: 3} + m_Name: + m_EditorClassIdentifier: + CanvasDesktop: {fileID: 287634992} +--- !u!1 &690216953 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 690216957} + - component: {fileID: 690216956} + - component: {fileID: 690216955} + - component: {fileID: 690216954} + m_Layer: 5 + m_Name: UICanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &690216954 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 690216953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &690216955 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 690216953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &690216956 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 690216953} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &690216957 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 690216953} + 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_Children: + - {fileID: 1645250797} + - {fileID: 287634993} + m_Father: {fileID: 0} + m_RootOrder: 3 + 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!1 &1645250796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1645250797} + - component: {fileID: 1645250799} + - component: {fileID: 1645250798} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1645250797 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1645250796} + 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_Children: [] + m_Father: {fileID: 690216957} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1645250798 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1645250796} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1645250799 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1645250796} + 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: 10 --- !u!4 &3517166543428106988 Transform: m_ObjectHideFlags: 0 @@ -233,6 +482,7 @@ MeshRenderer: m_LightProbeUsage: 0 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 4294967295 m_RendererPriority: 0 m_Materials: @@ -257,6 +507,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!23 &6334945670468298450 MeshRenderer: m_ObjectHideFlags: 0 @@ -272,6 +523,7 @@ MeshRenderer: m_LightProbeUsage: 0 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 4294967295 m_RendererPriority: 0 m_Materials: @@ -296,6 +548,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &6334945670468298451 MeshFilter: m_ObjectHideFlags: 0 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_homeSettings.lighting b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_homeSettings.lighting new file mode 100644 index 0000000..5178476 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_homeSettings.lighting @@ -0,0 +1,63 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!850595691 &4890085278179872738 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: scene_homeSettings + serializedVersion: 3 + m_GIWorkflowMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_homeSettings.lighting.meta b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_homeSettings.lighting.meta new file mode 100644 index 0000000..dfbaa09 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/Scene/scene_homeSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce19ad4aed57dde42b11449845f36731 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4890085278179872738 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIAbout.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIAbout.prefab deleted file mode 100644 index bd2ce45..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIAbout.prefab +++ /dev/null @@ -1,350 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &4099142336341904240 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7126978470340264304} - - component: {fileID: 3359586880618602463} - - component: {fileID: 8175961594734719007} - m_Layer: 5 - m_Name: info - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7126978470340264304 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4099142336341904240} - 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_Children: [] - m_Father: {fileID: 3997691783514560453} - m_RootOrder: 0 - 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 &3359586880618602463 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4099142336341904240} - m_CullTransparentMesh: 0 ---- !u!114 &8175961594734719007 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4099142336341904240} - 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: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_FontData: - m_Font: {fileID: 12800000, guid: 8297a2bf97dbbba468bd2518d003a876, type: 3} - m_FontSize: 22 - 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: ---- !u!1 &4142826567245113227 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4142826567245113224} - - component: {fileID: 4142826567245113225} - - component: {fileID: 446002385128238495} - m_Layer: 5 - m_Name: UIAbout - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &4142826567245113224 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4142826567245113227} - 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_Children: - - {fileID: 5343213182511549108} - - {fileID: 3997691783514560453} - m_Father: {fileID: 0} - m_RootOrder: 0 - 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!223 &4142826567245113225 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4142826567245113227} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 2 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 1 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_AdditionalShaderChannelsFlag: 0 - m_SortingLayerID: 0 - m_SortingOrder: 0 - m_TargetDisplay: 0 ---- !u!114 &446002385128238495 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4142826567245113227} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 ---- !u!1 &6154978740135451069 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5343213182511549108} - - component: {fileID: 8369344421515876960} - - component: {fileID: 7080476478489546113} - - component: {fileID: 8806219243094360206} - m_Layer: 5 - m_Name: mask - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &5343213182511549108 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6154978740135451069} - 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_Children: [] - m_Father: {fileID: 4142826567245113224} - m_RootOrder: 0 - 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 &8369344421515876960 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6154978740135451069} - m_CullTransparentMesh: 0 ---- !u!114 &7080476478489546113 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6154978740135451069} - 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: 0, g: 0, b: 0, a: 1} - m_RaycastTarget: 1 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10907, 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 &8806219243094360206 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6154978740135451069} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 0 - 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: 7080476478489546113} - m_OnClick: - m_PersistentCalls: - m_Calls: [] ---- !u!1 &8989319042809547364 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3997691783514560453} - - component: {fileID: 7677845000641202694} - - component: {fileID: 4438684259955260312} - m_Layer: 5 - m_Name: bg - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &3997691783514560453 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8989319042809547364} - 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_Children: - - {fileID: 7126978470340264304} - m_Father: {fileID: 4142826567245113224} - m_RootOrder: 1 - 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: 520, y: 286.62195} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7677845000641202694 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8989319042809547364} - m_CullTransparentMesh: 0 ---- !u!114 &4438684259955260312 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8989319042809547364} - 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_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 06edc4e02f9c48647adfed0a778cb8aa, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIAbout.prefab.meta b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIAbout.prefab.meta deleted file mode 100644 index a51b8f0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIAbout.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 2e0f217747ebd544c82e9ddd1b47525e -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab index 0006ea7..17f9fc1 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab @@ -61,6 +61,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.6509434, g: 0.19037023, b: 0.19037023, a: 0.23529412} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -77,7 +78,7 @@ MonoBehaviour: m_PixelsPerUnitMultiplier: 1 --- !u!95 &351064950 Animator: - serializedVersion: 3 + serializedVersion: 5 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -90,10 +91,12 @@ Animator: m_UpdateMode: 0 m_ApplyRootMotion: 0 m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 m_WarningMessage: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 --- !u!1 &3460976928793779057 GameObject: m_ObjectHideFlags: 0 @@ -154,6 +157,7 @@ MonoBehaviour: 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: @@ -187,7 +191,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &444825205667056620 RectTransform: m_ObjectHideFlags: 0 @@ -273,6 +277,7 @@ MonoBehaviour: 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: @@ -301,6 +306,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -341,6 +347,7 @@ GameObject: - component: {fileID: 4142826567245113224} - component: {fileID: 4142826567245113225} - component: {fileID: 446002385128238495} + - component: {fileID: 3593489457066976788} m_Layer: 5 m_Name: UIBattle m_TagString: Untagged @@ -408,6 +415,18 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 +--- !u!114 &3593489457066976788 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4142826567245113227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9776c197a7f86e94c9484946495616bb, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &5051316305113654670 GameObject: m_ObjectHideFlags: 0 @@ -468,6 +487,7 @@ MonoBehaviour: 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: @@ -546,6 +566,7 @@ MonoBehaviour: 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: @@ -624,6 +645,7 @@ MonoBehaviour: 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: @@ -703,6 +725,7 @@ MonoBehaviour: 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: @@ -731,6 +754,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -821,6 +845,7 @@ MonoBehaviour: 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: @@ -897,6 +922,7 @@ MonoBehaviour: 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: @@ -925,6 +951,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -1052,6 +1079,7 @@ MonoBehaviour: 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: @@ -1080,6 +1108,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UICanvas.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UICanvas.prefab deleted file mode 100644 index 06de56b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UICanvas.prefab +++ /dev/null @@ -1,203 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &1457738500883128975 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1457738500883128971} - - component: {fileID: 1457738500883128972} - - component: {fileID: 1457738500883128973} - - component: {fileID: 1457738500883128974} - m_Layer: 5 - m_Name: UICanvas - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1457738500883128971 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1457738500883128975} - 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_Children: - - {fileID: 4471021202605196124} - - {fileID: 3071470527211293446} - m_Father: {fileID: 0} - m_RootOrder: 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!223 &1457738500883128972 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1457738500883128975} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 0 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_AdditionalShaderChannelsFlag: 0 - m_SortingLayerID: 0 - m_SortingOrder: 0 - m_TargetDisplay: 0 ---- !u!114 &1457738500883128973 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1457738500883128975} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UiScaleMode: 0 - m_ReferencePixelsPerUnit: 100 - m_ScaleFactor: 1 - m_ReferenceResolution: {x: 800, y: 600} - m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0 - m_PhysicalUnit: 3 - m_FallbackScreenDPI: 96 - m_DefaultSpriteDPI: 96 - m_DynamicPixelsPerUnit: 1 ---- !u!114 &1457738500883128974 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1457738500883128975} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 ---- !u!1 &3071470527211293447 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3071470527211293446} - m_Layer: 5 - m_Name: Desktop - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &3071470527211293446 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3071470527211293447} - 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_Children: [] - m_Father: {fileID: 1457738500883128971} - m_RootOrder: 1 - 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 &4471021202605196131 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4471021202605196124} - - component: {fileID: 4471021202605196125} - - component: {fileID: 4471021202605196130} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4471021202605196124 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4471021202605196131} - 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_Children: [] - m_Father: {fileID: 1457738500883128971} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &4471021202605196125 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4471021202605196131} - 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: 10 ---- !u!114 &4471021202605196130 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4471021202605196131} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UICanvas.prefab.meta b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UICanvas.prefab.meta deleted file mode 100644 index 0f388e5..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UICanvas.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 1700631a871f2da418ca3815faed9394 -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab index 2353a96..c752f53 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab @@ -1,5 +1,121 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &2316646212898457076 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8803807611477594100} + - component: {fileID: 3916675095974121819} + - component: {fileID: 7616621098420649627} + m_Layer: 5 + m_Name: info + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8803807611477594100 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2316646212898457076} + 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_Children: [] + m_Father: {fileID: 3440699775385573697} + m_RootOrder: 0 + 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 &3916675095974121819 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2316646212898457076} + m_CullTransparentMesh: 0 +--- !u!114 &7616621098420649627 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2316646212898457076} + 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: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8297a2bf97dbbba468bd2518d003a876, type: 3} + m_FontSize: 22 + 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: Powered by YooAsset @tuyoogame +--- !u!1 &2430593153801103631 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2430593153801103628} + m_Layer: 5 + m_Name: AboutView + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2430593153801103628 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2430593153801103631} + 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_Children: + - {fileID: 5972790550119875632} + - {fileID: 3440699775385573697} + m_Father: {fileID: 4142826567245113224} + m_RootOrder: 3 + 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 &2894094678118443804 GameObject: m_ObjectHideFlags: 0 @@ -60,6 +176,7 @@ MonoBehaviour: 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: @@ -140,6 +257,7 @@ MonoBehaviour: 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: @@ -168,6 +286,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -208,6 +327,7 @@ GameObject: - component: {fileID: 4142826567245113224} - component: {fileID: 4142826567245113225} - component: {fileID: 446002385128238495} + - component: {fileID: 761597478329303380} m_Layer: 5 m_Name: UIHome m_TagString: Untagged @@ -229,6 +349,7 @@ RectTransform: - {fileID: 3112899034949946423} - {fileID: 2165109262903650435} - {fileID: 3005946438868630613} + - {fileID: 2430593153801103628} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -275,6 +396,18 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 +--- !u!114 &761597478329303380 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4142826567245113227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4792d7c57be85c845bc50d7215160853, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &4691699994207377690 GameObject: m_ObjectHideFlags: 0 @@ -337,6 +470,7 @@ MonoBehaviour: 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: @@ -365,6 +499,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -454,6 +589,7 @@ MonoBehaviour: 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: @@ -472,6 +608,202 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Start Game +--- !u!1 &5597857539391182649 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5972790550119875632} + - component: {fileID: 7845436718200411364} + - component: {fileID: 8829186808691376901} + - component: {fileID: 7129353201566141962} + m_Layer: 5 + m_Name: mask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5972790550119875632 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5597857539391182649} + 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_Children: [] + m_Father: {fileID: 2430593153801103628} + m_RootOrder: 0 + 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 &7845436718200411364 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5597857539391182649} + m_CullTransparentMesh: 0 +--- !u!114 &8829186808691376901 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5597857539391182649} + 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: 0, g: 0, b: 0, a: 0.93333334} + 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: 10907, 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 &7129353201566141962 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5597857539391182649} + 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: 0 + 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: 8829186808691376901} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &7207183558982288608 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3440699775385573697} + - component: {fileID: 8234930948123640962} + - component: {fileID: 2692073516022215964} + m_Layer: 5 + m_Name: bg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3440699775385573697 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7207183558982288608} + 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_Children: + - {fileID: 8803807611477594100} + m_Father: {fileID: 2430593153801103628} + m_RootOrder: 1 + 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: 512, y: 256} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8234930948123640962 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7207183558982288608} + m_CullTransparentMesh: 0 +--- !u!114 &2692073516022215964 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7207183558982288608} + 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: 21300000, guid: 06edc4e02f9c48647adfed0a778cb8aa, type: 3} + m_Type: 0 + 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!1 &7948794194953386984 GameObject: m_ObjectHideFlags: 0 @@ -532,6 +864,7 @@ MonoBehaviour: 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: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab index 9b6e1fd..6cc56ca 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab @@ -60,6 +60,7 @@ MonoBehaviour: 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: @@ -134,6 +135,7 @@ MonoBehaviour: 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: @@ -163,6 +165,7 @@ GameObject: - component: {fileID: 4142826567245113224} - component: {fileID: 4142826567245113225} - component: {fileID: 446002385128238495} + - component: {fileID: 6653013303473587574} m_Layer: 5 m_Name: UILoading m_TagString: Untagged @@ -229,3 +232,15 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 +--- !u!114 &6653013303473587574 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4142826567245113227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2bfcc4f450a0b94bb7748fb4788630e, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs index 43d5106..787cd75 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs @@ -3,6 +3,9 @@ using System.IO; using System.Text; using YooAsset; +/// +/// ļƫƼܷʽ +/// public class FileOffsetEncryption : IEncryptionServices { public EncryptResult Encrypt(EncryptFileInfo fileInfo) @@ -15,24 +18,26 @@ public class FileOffsetEncryption : IEncryptionServices Buffer.BlockCopy(fileData, 0, encryptedData, offset, fileData.Length); EncryptResult result = new EncryptResult(); - result.LoadMethod = EBundleLoadMethod.LoadFromFileOffset; + result.Encrypted = true; result.EncryptedData = encryptedData; return result; } else { EncryptResult result = new EncryptResult(); - result.LoadMethod = EBundleLoadMethod.Normal; + result.Encrypted = false; return result; } } } +/// +/// ļܷʽ +/// public class FileStreamEncryption : IEncryptionServices { public EncryptResult Encrypt(EncryptFileInfo fileInfo) { - // LoadFromStream if (fileInfo.BundleName.Contains("_gameres_audio")) { var fileData = File.ReadAllBytes(fileInfo.FilePath); @@ -42,15 +47,14 @@ public class FileStreamEncryption : IEncryptionServices } EncryptResult result = new EncryptResult(); - result.LoadMethod = EBundleLoadMethod.LoadFromStream; + result.Encrypted = true; result.EncryptedData = fileData; return result; } - - // Normal + else { EncryptResult result = new EncryptResult(); - result.LoadMethod = EBundleLoadMethod.Normal; + result.Encrypted = false; return result; } } diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs index 7e28b20..ea2dd60 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs @@ -2,8 +2,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UniFramework.Window; -using UniFramework.Pooling; using UniFramework.Event; using UniFramework.Utility; using YooAsset; @@ -24,16 +22,14 @@ public class BattleRoom { None, Ready, - Spawn, + SpawnEnemy, WaitSpawn, WaitWave, GameOver, } - private EventGroup _eventGroup = new EventGroup(); - private Spawner _entitySpawner; + private readonly EventGroup _eventGroup = new EventGroup(); private GameObject _roomRoot; - private AssetOperationHandle _musicHandle; // 关卡参数 private const int EnemyCount = 10; @@ -49,29 +45,46 @@ public class BattleRoom private int _totalScore = 0; private int _waveSpawnCount = 0; - private UniTimer _startWaitTimer = UniTimer.CreateOnceTimer(1f); - private UniTimer _spawnWaitTimer = UniTimer.CreateOnceTimer(0.75f); - private UniTimer _waveWaitTimer = UniTimer.CreateOnceTimer(4f); + private readonly UniTimer _startWaitTimer = UniTimer.CreateOnceTimer(1f); + private readonly UniTimer _spawnWaitTimer = UniTimer.CreateOnceTimer(0.75f); + private readonly UniTimer _waveWaitTimer = UniTimer.CreateOnceTimer(4f); + private readonly List _handles = new List(1000); + /// + /// 初始化房间 + /// + public void IntRoom() + { + // 创建房间根对象 + _roomRoot = new GameObject("BattleRoom"); + + // 监听游戏事件 + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + + _steps = ESteps.Ready; + } + /// /// 销毁房间 /// public void DestroyRoom() { - if (_musicHandle != null) - _musicHandle.Release(); - if (_eventGroup != null) _eventGroup.RemoveAllListener(); - if (_entitySpawner != null) - _entitySpawner.DestroyAll(true); - if (_roomRoot != null) GameObject.Destroy(_roomRoot); - UniWindow.CloseWindow(); + foreach(var handle in _handles) + { + handle.Release(); + } + _handles.Clear(); } /// @@ -86,30 +99,30 @@ public class BattleRoom { if (_startWaitTimer.Update(Time.deltaTime)) { - _steps = ESteps.Spawn; + // 生成实体 + var handle = YooAssets.LoadAssetAsync("player_ship"); + handle.Completed += (AssetHandle handle) => + { + handle.InstantiateSync(_roomRoot.transform); + }; + _handles.Add(handle); + _steps = ESteps.SpawnEnemy; } } - if (_steps == ESteps.Spawn) + if (_steps == ESteps.SpawnEnemy) { var enemyLocation = _entityLocations[Random.Range(0, 4)]; Vector3 spawnPosition = new Vector3(Random.Range(-_spawnValues.x, _spawnValues.x), _spawnValues.y, _spawnValues.z); Quaternion spawnRotation = Quaternion.identity; - if (enemyLocation == "enemy_ship") + // 生成实体 + var handle = YooAssets.LoadAssetAsync(enemyLocation); + handle.Completed += (AssetHandle handle) => { - // 生成敌人实体 - var handle = _entitySpawner.SpawnSync(enemyLocation, _roomRoot.transform, spawnPosition, spawnRotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); - } - else - { - // 生成小行星实体 - var handle = _entitySpawner.SpawnSync(enemyLocation, _roomRoot.transform, spawnPosition, spawnRotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); - } + handle.InstantiateSync(spawnPosition, spawnRotation, _roomRoot.transform); + }; + _handles.Add(handle); _waveSpawnCount++; if (_waveSpawnCount >= EnemyCount) @@ -127,7 +140,7 @@ public class BattleRoom if (_spawnWaitTimer.Update(Time.deltaTime)) { _spawnWaitTimer.Reset(); - _steps = ESteps.Spawn; + _steps = ESteps.SpawnEnemy; } } @@ -137,62 +150,11 @@ public class BattleRoom { _waveWaitTimer.Reset(); _waveSpawnCount = 0; - _steps = ESteps.Spawn; + _steps = ESteps.SpawnEnemy; } } } - /// - /// 加载房间 - /// - public IEnumerator LoadRoom() - { - // 创建房间根对象 - _roomRoot = new GameObject("BattleRoom"); - - // 加载背景音乐 - _musicHandle = YooAssets.LoadAssetAsync("music_background"); - yield return _musicHandle; - - // 播放背景音乐 - var audioSource = _roomRoot.AddComponent(); - audioSource.loop = true; - audioSource.clip = _musicHandle.AssetObject as AudioClip; - audioSource.Play(); - - // 创建游戏对象发生器 - _entitySpawner = UniPooling.CreateSpawner("DefaultPackage"); - - // 创建游戏对象池 - yield return _entitySpawner.CreateGameObjectPoolAsync("player_ship"); - yield return _entitySpawner.CreateGameObjectPoolAsync("player_bullet"); - yield return _entitySpawner.CreateGameObjectPoolAsync("enemy_ship"); - yield return _entitySpawner.CreateGameObjectPoolAsync("enemy_bullet"); - yield return _entitySpawner.CreateGameObjectPoolAsync("asteroid01"); - yield return _entitySpawner.CreateGameObjectPoolAsync("asteroid02"); - yield return _entitySpawner.CreateGameObjectPoolAsync("asteroid03"); - yield return _entitySpawner.CreateGameObjectPoolAsync("explosion_asteroid"); - yield return _entitySpawner.CreateGameObjectPoolAsync("explosion_enemy"); - yield return _entitySpawner.CreateGameObjectPoolAsync("explosion_player"); - - // 创建玩家实体对象 - var handle = _entitySpawner.SpawnSync("player_ship", _roomRoot.transform); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); - - // 显示战斗界面 - yield return UniWindow.OpenWindowAsync("UIBattle"); - - // 监听游戏事件 - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - - _steps = ESteps.Ready; - } - /// /// 接收事件 /// @@ -204,9 +166,12 @@ public class BattleRoom var msg = message as BattleEventDefine.PlayerDead; // 创建爆炸效果 - var handle = _entitySpawner.SpawnSync("explosion_player", _roomRoot.transform, msg.Position, msg.Rotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); + var handle = YooAssets.LoadAssetAsync("explosion_player"); + handle.Completed += (AssetHandle handle) => + { + handle.InstantiateSync(msg.Position, msg.Rotation, _roomRoot.transform); + }; + _handles.Add(handle); _steps = ESteps.GameOver; BattleEventDefine.GameOver.SendEventMessage(); @@ -216,9 +181,12 @@ public class BattleRoom var msg = message as BattleEventDefine.EnemyDead; // 创建爆炸效果 - var handle = _entitySpawner.SpawnSync("explosion_enemy", _roomRoot.transform, msg.Position, msg.Rotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); + var handle = YooAssets.LoadAssetAsync("explosion_enemy"); + handle.Completed += (AssetHandle handle) => + { + handle.InstantiateSync(msg.Position, msg.Rotation, _roomRoot.transform); + }; + _handles.Add(handle); _totalScore += EnemyScore; BattleEventDefine.ScoreChange.SendEventMessage(_totalScore); @@ -228,9 +196,12 @@ public class BattleRoom var msg = message as BattleEventDefine.AsteroidExplosion; // 创建爆炸效果 - var handle = _entitySpawner.SpawnSync("explosion_asteroid", _roomRoot.transform, msg.Position, msg.Rotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); + var handle = YooAssets.LoadAssetAsync("explosion_asteroid"); + handle.Completed += (AssetHandle handle) => + { + handle.InstantiateSync(msg.Position, msg.Rotation, _roomRoot.transform); + }; + _handles.Add(handle); _totalScore += AsteroidScore; BattleEventDefine.ScoreChange.SendEventMessage(_totalScore); @@ -240,18 +211,24 @@ public class BattleRoom var msg = message as BattleEventDefine.PlayerFireBullet; // 创建子弹实体 - var handle = _entitySpawner.SpawnSync("player_bullet", _roomRoot.transform, msg.Position, msg.Rotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); + var handle = YooAssets.LoadAssetAsync("player_bullet"); + handle.Completed += (AssetHandle handle) => + { + handle.InstantiateSync(msg.Position, msg.Rotation, _roomRoot.transform); + }; + _handles.Add(handle); } else if (message is BattleEventDefine.EnemyFireBullet) { var msg = message as BattleEventDefine.EnemyFireBullet; // 创建子弹实体 - var handle = _entitySpawner.SpawnSync("enemy_bullet", _roomRoot.transform, msg.Position, msg.Rotation); - var entity = handle.GameObj.GetComponent(); - entity.InitEntity(handle); + var handle = YooAssets.LoadAssetAsync("enemy_bullet"); + handle.Completed += (AssetHandle handle) => + { + handle.InstantiateSync(msg.Position, msg.Rotation, _roomRoot.transform); + }; + _handles.Add(handle); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity.meta deleted file mode 100644 index 056c09c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2673676235c2ebf4790768011d015d1d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityAsteroid.cs similarity index 78% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityAsteroid.cs index 289c30f..8adca5c 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityAsteroid.cs @@ -1,27 +1,19 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UniFramework.Pooling; public class EntityAsteroid : MonoBehaviour { public float MoveSpeed = -5f; public float Tumble = 5f; - private SpawnHandle _handle; private Rigidbody _rigidbody; - public void InitEntity(SpawnHandle handle) - { - _handle = handle; - - _rigidbody.velocity = this.transform.forward * MoveSpeed; - _rigidbody.angularVelocity = Random.insideUnitSphere * Tumble; - } - void Awake() { _rigidbody = this.transform.GetComponent(); + _rigidbody.velocity = this.transform.forward * MoveSpeed; + _rigidbody.angularVelocity = Random.insideUnitSphere * Tumble; } void OnTriggerEnter(Collider other) { @@ -29,8 +21,7 @@ public class EntityAsteroid : MonoBehaviour if (name.StartsWith("player")) { BattleEventDefine.AsteroidExplosion.SendEventMessage(this.transform.position, this.transform.rotation); - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } void OnTriggerExit(Collider other) @@ -38,8 +29,7 @@ public class EntityAsteroid : MonoBehaviour var name = other.gameObject.name; if (name.StartsWith("Boundary")) { - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityAsteroid.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityAsteroid.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityBullet.cs similarity index 76% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityBullet.cs index d94babe..88de3ef 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityBullet.cs @@ -1,25 +1,18 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UniFramework.Pooling; public class EntityBullet : MonoBehaviour { public float MoveSpeed = 20f; public float DelayDestroyTime = 5f; - private SpawnHandle _handle; private Rigidbody _rigidbody; - public void InitEntity(SpawnHandle handle) - { - _handle = handle; - _rigidbody.velocity = this.transform.forward * MoveSpeed; - } - void Awake() { _rigidbody = this.transform.GetComponent(); + _rigidbody.velocity = this.transform.forward * MoveSpeed; } void OnTriggerEnter(Collider other) { @@ -32,8 +25,7 @@ public class EntityBullet : MonoBehaviour { if (name.StartsWith("enemy") == false) { - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } @@ -41,8 +33,7 @@ public class EntityBullet : MonoBehaviour { if (name.StartsWith("player") == false) { - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } } @@ -51,8 +42,7 @@ public class EntityBullet : MonoBehaviour var name = other.gameObject.name; if (name.StartsWith("Boundary")) { - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityBullet.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityBullet.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEffect.cs similarity index 60% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEffect.cs index ef8da64..b62ea96 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEffect.cs @@ -1,23 +1,16 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UniFramework.Pooling; - public class EntityEffect : MonoBehaviour { public float DelayDestroyTime = 1f; - private SpawnHandle _handle; - - public void InitEntity(SpawnHandle handle) + private void Awake() { - _handle = handle; - Invoke(nameof(DelayDestroy), DelayDestroyTime); } private void DelayDestroy() { - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEffect.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEffect.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEnemy.cs similarity index 92% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEnemy.cs index c617f5f..316b16e 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEnemy.cs @@ -1,7 +1,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UniFramework.Pooling; using Random = UnityEngine.Random; public class EntityEnemy : MonoBehaviour @@ -17,7 +16,6 @@ public class EntityEnemy : MonoBehaviour public Vector2 ManeuverTime = new Vector2(1, 2); public Vector2 ManeuverWait = new Vector2(1, 2); - private SpawnHandle _handle; private Transform _shotSpawn; private Rigidbody _rigidbody; private AudioSource _audioSource; @@ -26,22 +24,18 @@ public class EntityEnemy : MonoBehaviour private float _targetManeuver; - public void InitEntity(SpawnHandle handle) - { - _handle = handle; - - _rigidbody.velocity = this.transform.forward * -5f; - _lastFireTime = Time.time; - _currentSpeed = _rigidbody.velocity.z; - _targetManeuver = 0f; - StartCoroutine(Evade()); - } - void Awake() { _rigidbody = this.gameObject.GetComponent(); _audioSource = this.gameObject.GetComponent(); _shotSpawn = this.transform.Find("shot_spawn"); + + _rigidbody.velocity = this.transform.forward * -5f; + _lastFireTime = Time.time; + _currentSpeed = _rigidbody.velocity.z; + _targetManeuver = 0f; + + StartCoroutine(Evade()); } void Update() { @@ -72,8 +66,7 @@ public class EntityEnemy : MonoBehaviour if (name.StartsWith("player")) { BattleEventDefine.EnemyDead.SendEventMessage(this.transform.position, this.transform.rotation); - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } void OnTriggerExit(Collider other) @@ -81,8 +74,7 @@ public class EntityEnemy : MonoBehaviour var name = other.gameObject.name; if (name.StartsWith("Boundary")) { - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEnemy.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityEnemy.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityPlayer.cs similarity index 90% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityPlayer.cs index 209f5cd..a4060b4 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityPlayer.cs @@ -1,7 +1,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UniFramework.Pooling; public class EntityPlayer : MonoBehaviour { @@ -9,17 +8,11 @@ public class EntityPlayer : MonoBehaviour public float MoveSpeed = 10f; public float FireRate = 0.25f; - private SpawnHandle _handle; private float _nextFireTime = 0f; private Transform _shotSpawn; private Rigidbody _rigidbody; private AudioSource _audioSource; - public void InitEntity(SpawnHandle handle) - { - _handle = handle; - } - void Awake() { _rigidbody = this.gameObject.GetComponent(); @@ -58,8 +51,7 @@ public class EntityPlayer : MonoBehaviour if (name.StartsWith("enemy") || name.StartsWith("asteroid")) { BattleEventDefine.PlayerDead.SendEventMessage(this.transform.position, this.transform.rotation); - _handle.Restore(); - _handle = null; + GameObject.Destroy(this.gameObject); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityPlayer.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/EntityPlayer.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvApplicationQuit.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/ApplicationQuit.cs similarity index 78% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvApplicationQuit.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/ApplicationQuit.cs index f318513..598ff17 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvApplicationQuit.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/ApplicationQuit.cs @@ -2,7 +2,7 @@ using UnityEngine; using YooAsset; -public class BhvApplicationQuit : MonoBehaviour +public class ApplicationQuit : MonoBehaviour { private void Awake() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvApplicationQuit.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/ApplicationQuit.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvApplicationQuit.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/ApplicationQuit.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvBackgroundScroller.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BackgroundScroller.cs similarity index 87% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvBackgroundScroller.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BackgroundScroller.cs index 941fcca..1b87509 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvBackgroundScroller.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BackgroundScroller.cs @@ -1,7 +1,7 @@ using System; using UnityEngine; -public class BhvBackgroundScroller : MonoBehaviour +public class BackgroundScroller : MonoBehaviour { public float ScrollSpeed; public float TileSizeZ; diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvBackgroundScroller.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BackgroundScroller.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BhvBackgroundScroller.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/BackgroundScroller.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs index acb1a1d..dab790c 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs @@ -1,6 +1,8 @@ -using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; using UniFramework.Event; -using UniFramework.Singleton; using YooAsset; public class Boot : MonoBehaviour @@ -15,23 +17,33 @@ public class Boot : MonoBehaviour Debug.Log($"资源系统运行模式:{PlayMode}"); Application.targetFrameRate = 60; Application.runInBackground = true; + DontDestroyOnLoad(this.gameObject); } - void Start() + IEnumerator Start() { + // 游戏管理器 + GameManager.Instance.Behaviour = this; + // 初始化事件系统 UniEvent.Initalize(); - // 初始化单例系统 - UniSingleton.Initialize(); - // 初始化资源系统 YooAssets.Initialize(); - YooAssets.SetOperationSystemMaxTimeSlice(30); - // 创建补丁管理器 - UniSingleton.CreateSingleton(); + // 加载更新页面 + var go = Resources.Load("PatchWindow"); + GameObject.Instantiate(go); // 开始补丁更新流程 - PatchManager.Instance.Run(PlayMode); + PatchOperation operation = new PatchOperation("DefaultPackage", DefaultBuildPipeline.BuiltinBuildPipelineName, PlayMode); + YooAssets.StartOperation(operation); + yield return operation; + + // 设置默认的资源包 + var gamePackage = YooAssets.GetPackage("DefaultPackage"); + YooAssets.SetDefaultPackage(gamePackage); + + // 切换到主页面场景 + SceneEventDefine.ChangeToHomeScene.SendEventMessage(); } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode.meta deleted file mode 100644 index 73bda8f..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: beab7f759234b61469afb94f517f959b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs deleted file mode 100644 index 6408d26..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UniFramework.Pooling; -using UniFramework.Window; -using UniFramework.Machine; -using UniFramework.Singleton; -using YooAsset; - -internal class FsmInitGame : IStateNode -{ - private StateMachine _machine; - - void IStateNode.OnCreate(StateMachine machine) - { - _machine = machine; - } - void IStateNode.OnEnter() - { - UniSingleton.StartCoroutine(Prepare()); - } - void IStateNode.OnUpdate() - { - } - void IStateNode.OnExit() - { - } - - private IEnumerator Prepare() - { - var handle = YooAssets.LoadAssetAsync("UICanvas"); - yield return handle; - var canvas = handle.InstantiateSync(); - var desktop = canvas.transform.Find("Desktop").gameObject; - GameObject.DontDestroyOnLoad(canvas); - - // 初始化窗口系统 - UniWindow.Initalize(desktop); - - // 初始化对象池系统 - UniPooling.Initalize(); - - _machine.ChangeState(); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs deleted file mode 100644 index df1486e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UniFramework.Window; -using UniFramework.Event; -using UniFramework.Machine; -using UniFramework.Singleton; -using YooAsset; - -internal class FsmSceneBattle : IStateNode -{ - private BattleRoom _battleRoom; - - void IStateNode.OnCreate(StateMachine machine) - { - } - void IStateNode.OnEnter() - { - UniSingleton.StartCoroutine(Prepare()); - } - void IStateNode.OnUpdate() - { - if(_battleRoom != null) - _battleRoom.UpdateRoom(); - } - void IStateNode.OnExit() - { - if(_battleRoom != null) - { - _battleRoom.DestroyRoom(); - _battleRoom = null; - } - } - - private IEnumerator Prepare() - { - yield return YooAssets.LoadSceneAsync("scene_battle"); - - _battleRoom = new BattleRoom(); - yield return _battleRoom.LoadRoom(); - - // 释放资源 - var package = YooAssets.GetPackage("DefaultPackage"); - package.UnloadUnusedAssets(); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs deleted file mode 100644 index df6e8d9..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UniFramework.Machine; -using UniFramework.Window; -using UniFramework.Singleton; -using YooAsset; - -internal class FsmSceneHome : IStateNode -{ - private StateMachine _machine; - - void IStateNode.OnCreate(StateMachine machine) - { - _machine = machine; - } - void IStateNode.OnEnter() - { - UniSingleton.StartCoroutine(Prepare()); - } - void IStateNode.OnUpdate() - { - } - void IStateNode.OnExit() - { - UniWindow.CloseWindow(); - } - - private IEnumerator Prepare() - { - yield return YooAssets.LoadSceneAsync("scene_home"); - yield return UniWindow.OpenWindowAsync("UIHome"); - - // 释放资源 - var package = YooAssets.GetPackage("DefaultPackage"); - package.UnloadUnusedAssets(); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs index 13e81ae..c4494bb 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs @@ -2,63 +2,56 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Event; -using UniFramework.Machine; -using UniFramework.Singleton; +using YooAsset; -public class GameManager : SingletonInstance, ISingleton +public class GameManager { - private bool _isRun = false; - private EventGroup _eventGroup = new EventGroup(); - private StateMachine _machine; - - void ISingleton.OnCreate(object createParam) + private static GameManager _instance; + public static GameManager Instance { - } - void ISingleton.OnDestroy() - { - _eventGroup.RemoveAllListener(); - } - void ISingleton.OnUpdate() - { - if (_machine != null) - _machine.Update(); - } - - public void Run() - { - if (_isRun == false) + get { - _isRun = true; - - // 注册监听事件 - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - - Debug.Log("开启游戏流程..."); - _machine = new StateMachine(this); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.Run(); - } - else - { - Debug.LogWarning("补丁更新已经正在进行中!"); + if (_instance == null) + _instance = new GameManager(); + return _instance; } } + private readonly EventGroup _eventGroup = new EventGroup(); + + /// + /// 协程启动器 + /// + public MonoBehaviour Behaviour; + + + private GameManager() + { + // 注册监听事件 + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + } + + /// + /// 开启一个协程 + /// + public void StartCoroutine(IEnumerator enumerator) + { + Behaviour.StartCoroutine(enumerator); + } + /// /// 接收事件 /// private void OnHandleEventMessage(IEventMessage message) { - if(message is SceneEventDefine.ChangeToHomeScene) + if (message is SceneEventDefine.ChangeToHomeScene) { - _machine.ChangeState(); + YooAssets.LoadSceneAsync("scene_home"); } - else if(message is SceneEventDefine.ChangeToBattleScene) + else if (message is SceneEventDefine.ChangeToBattleScene) { - _machine.ChangeState(); + YooAssets.LoadSceneAsync("scene_battle"); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneBattle.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneBattle.cs new file mode 100644 index 0000000..6689293 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneBattle.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UniFramework.Event; +using UniFramework.Machine; +using YooAsset; + +internal class SceneBattle : MonoBehaviour +{ + public GameObject CanvasDesktop; + + private AssetHandle _windowHandle; + private AssetHandle _musicHandle; + private BattleRoom _battleRoom; + + private IEnumerator Start() + { + // 加载战斗页面 + _windowHandle = YooAssets.LoadAssetAsync("UIBattle"); + yield return _windowHandle; + _windowHandle.InstantiateSync(CanvasDesktop.transform); + + // 加载背景音乐 + var package = YooAssets.GetPackage("DefaultPackage"); + _musicHandle = package.LoadAssetAsync("music_background"); + yield return _musicHandle; + + // 播放背景音乐 + var audioSource = this.gameObject.AddComponent(); + audioSource.loop = true; + audioSource.clip = _musicHandle.AssetObject as AudioClip; + audioSource.Play(); + + _battleRoom = new BattleRoom(); + _battleRoom.IntRoom(); + } + private void OnDestroy() + { + if (_windowHandle != null) + { + _windowHandle.Release(); + _windowHandle = null; + } + + if (_musicHandle != null) + { + _musicHandle.Release(); + _musicHandle = null; + } + + if (_battleRoom != null) + { + _battleRoom.DestroyRoom(); + _battleRoom = null; + } + + // 切换场景的时候释放资源 + var package = YooAssets.GetPackage("DefaultPackage"); + package.UnloadUnusedAssets(); + } + private void Update() + { + if (_battleRoom != null) + _battleRoom.UpdateRoom(); + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneBattle.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneBattle.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneHome.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneHome.cs new file mode 100644 index 0000000..5112c99 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneHome.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using YooAsset; + +public class SceneHome : MonoBehaviour +{ + public GameObject CanvasDesktop; + + private AssetHandle _windowHandle; + + private IEnumerator Start() + { + // 加载登录页面 + _windowHandle = YooAssets.LoadAssetAsync("UIHome"); + yield return _windowHandle; + _windowHandle.InstantiateSync(CanvasDesktop.transform); + } + private void OnDestroy() + { + if (_windowHandle != null) + { + _windowHandle.Release(); + _windowHandle = null; + } + + // 切换场景的时候释放资源 + var package = YooAssets.GetPackage("DefaultPackage"); + package.UnloadUnusedAssets(); + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneHome.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/SceneHome.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FileStream.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FileStream.cs deleted file mode 100644 index 51839f7..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FileStream.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using UnityEngine; - -public class BundleStream : FileStream -{ - public const byte KEY = 64; - - public BundleStream(string path, FileMode mode, FileAccess access, FileShare share) : base(path, mode, access, share) - { - } - public BundleStream(string path, FileMode mode) : base(path, mode) - { - } - - public override int Read(byte[] array, int offset, int count) - { - var index = base.Read(array, offset, count); - for (int i = 0; i < array.Length; i++) - { - array[i] ^= KEY; - } - return index; - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FileStream.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FileStream.cs.meta deleted file mode 100644 index a7df7a0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FileStream.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7da6bc93686626a4cb248691891073ac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearCache.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearPackageCache.cs similarity index 73% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearCache.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearPackageCache.cs index efe8263..9f6fdf5 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearCache.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearPackageCache.cs @@ -2,11 +2,12 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; +using YooAsset; /// /// 清理未使用的缓存文件 /// -internal class FsmClearCache : IStateNode +internal class FsmClearPackageCache : IStateNode { private StateMachine _machine; @@ -17,7 +18,8 @@ internal class FsmClearCache : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("清理未使用的缓存文件!"); - var package = YooAsset.YooAssets.GetPackage("DefaultPackage"); + var packageName = (string)_machine.GetBlackboardValue("PackageName"); + var package = YooAssets.GetPackage(packageName); var operation = package.ClearUnusedCacheFilesAsync(); operation.Completed += Operation_Completed; } @@ -30,6 +32,6 @@ internal class FsmClearCache : IStateNode private void Operation_Completed(YooAsset.AsyncOperationBase obj) { - _machine.ChangeState(); + _machine.ChangeState(); } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearCache.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearPackageCache.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearCache.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmClearPackageCache.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreatePackageDownloader.cs similarity index 69% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreatePackageDownloader.cs index fd8b0a6..53cb1eb 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreatePackageDownloader.cs @@ -2,13 +2,12 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Singleton; using YooAsset; /// /// 创建文件下载器 /// -public class FsmCreateDownloader : IStateNode +public class FsmCreatePackageDownloader : IStateNode { private StateMachine _machine; @@ -19,7 +18,7 @@ public class FsmCreateDownloader : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("创建补丁下载器!"); - UniSingleton.StartCoroutine(CreateDownloader()); + GameManager.Instance.StartCoroutine(CreateDownloader()); } void IStateNode.OnUpdate() { @@ -32,21 +31,20 @@ public class FsmCreateDownloader : IStateNode { yield return new WaitForSecondsRealtime(0.5f); + var packageName = (string)_machine.GetBlackboardValue("PackageName"); + var package = YooAssets.GetPackage(packageName); int downloadingMaxNum = 10; int failedTryAgain = 3; - var downloader = YooAssets.CreateResourceDownloader(downloadingMaxNum, failedTryAgain); - PatchManager.Instance.Downloader = downloader; + var downloader = package.CreateResourceDownloader(downloadingMaxNum, failedTryAgain); + _machine.SetBlackboardValue("Downloader", downloader); if (downloader.TotalDownloadCount == 0) { Debug.Log("Not found any download files !"); - _machine.ChangeState(); + _machine.ChangeState(); } else { - //A total of 10 files were found that need to be downloaded - Debug.Log($"Found total {downloader.TotalDownloadCount} files that need download !"); - // 发现新更新文件后,挂起流程系统 // 注意:开发者需要在下载前检测磁盘空间不足 int totalDownloadCount = downloader.TotalDownloadCount; diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreatePackageDownloader.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreatePackageDownloader.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageFiles.cs similarity index 77% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageFiles.cs index cf149c4..18a112d 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageFiles.cs @@ -1,13 +1,12 @@ using System.Collections; using UnityEngine; using UniFramework.Machine; -using UniFramework.Singleton; using YooAsset; /// /// 下载更新文件 /// -public class FsmDownloadFiles : IStateNode +public class FsmDownloadPackageFiles : IStateNode { private StateMachine _machine; @@ -18,7 +17,7 @@ public class FsmDownloadFiles : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("开始下载补丁文件!"); - UniSingleton.StartCoroutine(BeginDownload()); + GameManager.Instance.StartCoroutine(BeginDownload()); } void IStateNode.OnUpdate() { @@ -29,9 +28,7 @@ public class FsmDownloadFiles : IStateNode private IEnumerator BeginDownload() { - var downloader = PatchManager.Instance.Downloader; - - // 注册下载回调 + var downloader = (ResourceDownloaderOperation)_machine.GetBlackboardValue("Downloader"); downloader.OnDownloadErrorCallback = PatchEventDefine.WebFileDownloadFailed.SendEventMessage; downloader.OnDownloadProgressCallback = PatchEventDefine.DownloadProgressUpdate.SendEventMessage; downloader.BeginDownload(); @@ -41,6 +38,6 @@ public class FsmDownloadFiles : IStateNode if (downloader.Status != EOperationStatus.Succeed) yield break; - _machine.ChangeState(); + _machine.ChangeState(); } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageFiles.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageFiles.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadOver.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageOver.cs similarity index 78% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadOver.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageOver.cs index 8a886f2..8609399 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadOver.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageOver.cs @@ -6,7 +6,7 @@ using UniFramework.Machine; /// /// 下载完毕 /// -internal class FsmDownloadOver : IStateNode +internal class FsmDownloadPackageOver : IStateNode { private StateMachine _machine; @@ -16,7 +16,7 @@ internal class FsmDownloadOver : IStateNode } void IStateNode.OnEnter() { - _machine.ChangeState(); + _machine.ChangeState(); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadOver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageOver.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadOver.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadPackageOver.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitializePackage.cs similarity index 55% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitializePackage.cs index f25b2bc..2c9846e 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitializePackage.cs @@ -4,13 +4,12 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Singleton; using YooAsset; /// /// 初始化资源包 /// -internal class FsmInitialize : IStateNode +internal class FsmInitializePackage : IStateNode { private StateMachine _machine; @@ -21,7 +20,7 @@ internal class FsmInitialize : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("初始化资源包!"); - UniSingleton.StartCoroutine(InitPackage()); + GameManager.Instance.StartCoroutine(InitPackage()); } void IStateNode.OnUpdate() { @@ -32,25 +31,21 @@ internal class FsmInitialize : IStateNode private IEnumerator InitPackage() { - yield return new WaitForSeconds(1f); + var playMode = (EPlayMode)_machine.GetBlackboardValue("PlayMode"); + var packageName = (string)_machine.GetBlackboardValue("PackageName"); + var buildPipeline = (string)_machine.GetBlackboardValue("BuildPipeline"); - var playMode = PatchManager.Instance.PlayMode; - - // 创建默认的资源包 - string packageName = "DefaultPackage"; + // 创建资源包裹类 var package = YooAssets.TryGetPackage(packageName); if (package == null) - { package = YooAssets.CreatePackage(packageName); - YooAssets.SetDefaultPackage(package); - } // 编辑器下的模拟模式 InitializationOperation initializationOperation = null; if (playMode == EPlayMode.EditorSimulateMode) { var createParameters = new EditorSimulateModeParameters(); - createParameters.SimulateManifestFilePath = EditorSimulateModeHelper.SimulateBuild(packageName); + createParameters.SimulateManifestFilePath = EditorSimulateModeHelper.SimulateBuild(buildPipeline, packageName); initializationOperation = package.InitializeAsync(createParameters); } @@ -58,7 +53,7 @@ internal class FsmInitialize : IStateNode if (playMode == EPlayMode.OfflinePlayMode) { var createParameters = new OfflinePlayModeParameters(); - createParameters.DecryptionServices = new GameDecryptionServices(); + createParameters.DecryptionServices = new FileStreamDecryption(); initializationOperation = package.InitializeAsync(createParameters); } @@ -68,9 +63,8 @@ internal class FsmInitialize : IStateNode string defaultHostServer = GetHostServerURL(); string fallbackHostServer = GetHostServerURL(); var createParameters = new HostPlayModeParameters(); - createParameters.DecryptionServices = new GameDecryptionServices(); + createParameters.DecryptionServices = new FileStreamDecryption(); createParameters.BuildinQueryServices = new GameQueryServices(); - createParameters.DeliveryQueryServices = new DefaultDeliveryQueryServices(); createParameters.RemoteServices = new RemoteServices(defaultHostServer, fallbackHostServer); initializationOperation = package.InitializeAsync(createParameters); } @@ -81,22 +75,24 @@ internal class FsmInitialize : IStateNode string defaultHostServer = GetHostServerURL(); string fallbackHostServer = GetHostServerURL(); var createParameters = new WebPlayModeParameters(); - createParameters.DecryptionServices = new GameDecryptionServices(); + createParameters.DecryptionServices = new FileStreamDecryption(); createParameters.BuildinQueryServices = new GameQueryServices(); createParameters.RemoteServices = new RemoteServices(defaultHostServer, fallbackHostServer); initializationOperation = package.InitializeAsync(createParameters); } yield return initializationOperation; - if (initializationOperation.Status == EOperationStatus.Succeed) - { - _machine.ChangeState(); - } - else + + // 如果初始化失败弹出提示界面 + if (initializationOperation.Status != EOperationStatus.Succeed) { Debug.LogWarning($"{initializationOperation.Error}"); PatchEventDefine.InitializeFailed.SendEventMessage(); } + else + { + _machine.ChangeState(); + } } /// @@ -129,7 +125,6 @@ internal class FsmInitialize : IStateNode #endif } - /// /// 远端资源地址查询服务类 /// @@ -154,44 +149,91 @@ internal class FsmInitialize : IStateNode } /// - /// 资源文件解密服务类 + /// 资源文件流加载解密类 /// - private class GameDecryptionServices : IDecryptionServices + private class FileStreamDecryption : IDecryptionServices { - public ulong LoadFromFileOffset(DecryptFileInfo fileInfo) + /// + /// 同步方式获取解密的资源包对象 + /// 注意:加载流对象在资源包对象释放的时候会自动释放 + /// + AssetBundle IDecryptionServices.LoadAssetBundle(DecryptFileInfo fileInfo, out Stream managedStream) { - return 32; + BundleStream bundleStream = new BundleStream(fileInfo.FileLoadPath, FileMode.Open, FileAccess.Read, FileShare.Read); + managedStream = bundleStream; + return AssetBundle.LoadFromStream(bundleStream, fileInfo.ConentCRC, GetManagedReadBufferSize()); } - public byte[] LoadFromMemory(DecryptFileInfo fileInfo) + /// + /// 异步方式获取解密的资源包对象 + /// 注意:加载流对象在资源包对象释放的时候会自动释放 + /// + AssetBundleCreateRequest IDecryptionServices.LoadAssetBundleAsync(DecryptFileInfo fileInfo, out Stream managedStream) { - throw new NotImplementedException(); + BundleStream bundleStream = new BundleStream(fileInfo.FileLoadPath, FileMode.Open, FileAccess.Read, FileShare.Read); + managedStream = bundleStream; + return AssetBundle.LoadFromStreamAsync(bundleStream, fileInfo.ConentCRC, GetManagedReadBufferSize()); } - public Stream LoadFromStream(DecryptFileInfo fileInfo) - { - BundleStream bundleStream = new BundleStream(fileInfo.FilePath, FileMode.Open, FileAccess.Read, FileShare.Read); - return bundleStream; - } - - public uint GetManagedReadBufferSize() + private static uint GetManagedReadBufferSize() { return 1024; } } /// - /// 默认的分发资源查询服务类 + /// 资源文件偏移加载解密类 /// - private class DefaultDeliveryQueryServices : IDeliveryQueryServices + private class FileOffsetDecryption : IDecryptionServices { - public DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName) + /// + /// 同步方式获取解密的资源包对象 + /// 注意:加载流对象在资源包对象释放的时候会自动释放 + /// + AssetBundle IDecryptionServices.LoadAssetBundle(DecryptFileInfo fileInfo, out Stream managedStream) { - throw new NotImplementedException(); + managedStream = null; + return AssetBundle.LoadFromFile(fileInfo.FileLoadPath, fileInfo.ConentCRC, GetFileOffset()); } - public bool QueryDeliveryFiles(string packageName, string fileName) + + /// + /// 异步方式获取解密的资源包对象 + /// 注意:加载流对象在资源包对象释放的时候会自动释放 + /// + AssetBundleCreateRequest IDecryptionServices.LoadAssetBundleAsync(DecryptFileInfo fileInfo, out Stream managedStream) { - return false; + managedStream = null; + return AssetBundle.LoadFromFileAsync(fileInfo.FileLoadPath, fileInfo.ConentCRC, GetFileOffset()); + } + + private static ulong GetFileOffset() + { + return 32; } } +} + +/// +/// 资源文件解密流 +/// +public class BundleStream : FileStream +{ + public const byte KEY = 64; + + public BundleStream(string path, FileMode mode, FileAccess access, FileShare share) : base(path, mode, access, share) + { + } + public BundleStream(string path, FileMode mode) : base(path, mode) + { + } + + public override int Read(byte[] array, int offset, int count) + { + var index = base.Read(array, offset, count); + for (int i = 0; i < array.Length; i++) + { + array[i] ^= KEY; + } + return index; + } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitializePackage.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitializePackage.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs deleted file mode 100644 index 377b14c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UniFramework.Machine; -using UniFramework.Singleton; - -/// -/// 流程准备工作 -/// -internal class FsmPatchPrepare : IStateNode -{ - private StateMachine _machine; - - void IStateNode.OnCreate(StateMachine machine) - { - _machine = machine; - } - void IStateNode.OnEnter() - { - // 加载更新面板 - var go = Resources.Load("PatchWindow"); - GameObject.Instantiate(go); - - _machine.ChangeState(); - } - void IStateNode.OnUpdate() - { - } - void IStateNode.OnExit() - { - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs.meta deleted file mode 100644 index 7d9235a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8998f67b4187d404eb26190f5cd5ac86 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs.meta deleted file mode 100644 index 1b38785..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b4b6ef49759dcf14d80c5aa2d360f597 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageManifest.cs similarity index 58% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageManifest.cs index 1797f83..399e0df 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageManifest.cs @@ -2,13 +2,12 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Singleton; using YooAsset; /// /// 更新资源清单 /// -public class FsmUpdateManifest : IStateNode +public class FsmUpdatePackageManifest : IStateNode { private StateMachine _machine; @@ -19,7 +18,7 @@ public class FsmUpdateManifest : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("更新资源清单!"); - UniSingleton.StartCoroutine(UpdateManifest()); + GameManager.Instance.StartCoroutine(UpdateManifest()); } void IStateNode.OnUpdate() { @@ -32,19 +31,22 @@ public class FsmUpdateManifest : IStateNode { yield return new WaitForSecondsRealtime(0.5f); + var packageName = (string)_machine.GetBlackboardValue("PackageName"); + var packageVersion = (string)_machine.GetBlackboardValue("PackageVersion"); + var package = YooAssets.GetPackage(packageName); bool savePackageVersion = true; - var package = YooAssets.GetPackage("DefaultPackage"); - var operation = package.UpdatePackageManifestAsync(PatchManager.Instance.PackageVersion, savePackageVersion); + var operation = package.UpdatePackageManifestAsync(packageVersion, savePackageVersion); yield return operation; - if(operation.Status == EOperationStatus.Succeed) - { - _machine.ChangeState(); - } - else + if (operation.Status != EOperationStatus.Succeed) { Debug.LogWarning(operation.Error); PatchEventDefine.PatchManifestUpdateFailed.SendEventMessage(); + yield break; + } + else + { + _machine.ChangeState(); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageManifest.cs.meta similarity index 83% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageManifest.cs.meta index 97c7022..4f56796 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs.meta +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageManifest.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 35d459ebb0d7dc947b7b62d1f64a412f +guid: 13faaa12de67f5e4db31cd8a44563089 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageVersion.cs similarity index 61% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageVersion.cs index 66eb2e5..31ef6cb 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageVersion.cs @@ -2,13 +2,12 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Singleton; using YooAsset; /// /// 更新资源版本号 /// -internal class FsmUpdateVersion : IStateNode +internal class FsmUpdatePackageVersion : IStateNode { private StateMachine _machine; @@ -19,7 +18,7 @@ internal class FsmUpdateVersion : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("获取最新的资源版本 !"); - UniSingleton.StartCoroutine(GetStaticVersion()); + GameManager.Instance.StartCoroutine(UpdatePackageVersion()); } void IStateNode.OnUpdate() { @@ -28,24 +27,24 @@ internal class FsmUpdateVersion : IStateNode { } - private IEnumerator GetStaticVersion() + private IEnumerator UpdatePackageVersion() { yield return new WaitForSecondsRealtime(0.5f); - var package = YooAssets.GetPackage("DefaultPackage"); + var packageName = (string)_machine.GetBlackboardValue("PackageName"); + var package = YooAssets.GetPackage(packageName); var operation = package.UpdatePackageVersionAsync(); yield return operation; - if (operation.Status == EOperationStatus.Succeed) - { - PatchManager.Instance.PackageVersion = operation.PackageVersion; - Debug.Log($"远端最新版本为: {operation.PackageVersion}"); - _machine.ChangeState(); - } - else + if (operation.Status != EOperationStatus.Succeed) { Debug.LogWarning(operation.Error); PatchEventDefine.PackageVersionUpdateFailed.SendEventMessage(); } + else + { + _machine.SetBlackboardValue("PackageVersion", operation.PackageVersion); + _machine.ChangeState(); + } } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageVersion.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdatePackageVersion.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdaterDone.cs similarity index 53% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdaterDone.cs index df85677..3fe1e12 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdaterDone.cs @@ -2,25 +2,17 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Singleton; /// /// 流程更新完毕 /// -internal class FsmPatchDone : IStateNode +internal class FsmUpdaterDone : IStateNode { void IStateNode.OnCreate(StateMachine machine) { } void IStateNode.OnEnter() { - PatchEventDefine.PatchStatesChange.SendEventMessage("开始游戏!"); - - // 创建游戏管理器 - UniSingleton.CreateSingleton(); - - // 开启游戏流程 - GameManager.Instance.Run(); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdaterDone.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdaterDone.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs deleted file mode 100644 index 4e0f425..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UniFramework.Machine; -using UniFramework.Event; -using UniFramework.Singleton; -using YooAsset; - -public class PatchManager : SingletonInstance, ISingleton -{ - /// - /// 运行模式 - /// - public EPlayMode PlayMode { private set; get; } - - /// - /// 包裹的版本信息 - /// - public string PackageVersion { set; get; } - - /// - /// 下载器 - /// - public ResourceDownloaderOperation Downloader { set; get; } - - - private bool _isRun = false; - private EventGroup _eventGroup = new EventGroup(); - private StateMachine _machine; - - void ISingleton.OnCreate(object createParam) - { - } - void ISingleton.OnDestroy() - { - _eventGroup.RemoveAllListener(); - } - void ISingleton.OnUpdate() - { - if (_machine != null) - _machine.Update(); - } - - /// - /// 开启流程 - /// - public void Run(EPlayMode playMode) - { - if (_isRun == false) - { - _isRun = true; - PlayMode = playMode; - - // 注册监听事件 - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - _eventGroup.AddListener(OnHandleEventMessage); - - Debug.Log("开启补丁更新流程..."); - _machine = new StateMachine(this); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.AddNode(); - _machine.Run(); - } - else - { - Debug.LogWarning("补丁更新已经正在进行中!"); - } - } - - /// - /// 接收事件 - /// - private void OnHandleEventMessage(IEventMessage message) - { - if (message is UserEventDefine.UserTryInitialize) - { - _machine.ChangeState(); - } - else if (message is UserEventDefine.UserBeginDownloadWebFiles) - { - _machine.ChangeState(); - } - else if (message is UserEventDefine.UserTryUpdatePackageVersion) - { - _machine.ChangeState(); - } - else if (message is UserEventDefine.UserTryUpdatePatchManifest) - { - _machine.ChangeState(); - } - else if (message is UserEventDefine.UserTryDownloadWebFiles) - { - _machine.ChangeState(); - } - else - { - throw new System.NotImplementedException($"{message.GetType()}"); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchOperation.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchOperation.cs new file mode 100644 index 0000000..cb55a02 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchOperation.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UniFramework.Machine; +using UniFramework.Event; +using YooAsset; + +public class PatchOperation : GameAsyncOperation +{ + private enum ESteps + { + None, + Update, + Done, + } + + private readonly EventGroup _eventGroup = new EventGroup(); + private readonly StateMachine _machine; + private ESteps _steps = ESteps.None; + + public PatchOperation(string packageName, string buildPipeline, EPlayMode playMode) + { + // 注册监听事件 + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + _eventGroup.AddListener(OnHandleEventMessage); + + // 创建状态机 + _machine = new StateMachine(this); + _machine.AddNode(); + _machine.AddNode(); + _machine.AddNode(); + _machine.AddNode(); + _machine.AddNode(); + _machine.AddNode(); + _machine.AddNode(); + _machine.AddNode(); + + _machine.SetBlackboardValue("PackageName", packageName); + _machine.SetBlackboardValue("PlayMode", playMode); + _machine.SetBlackboardValue("BuildPipeline", buildPipeline); + } + protected override void OnStart() + { + _steps = ESteps.Update; + _machine.Run(); + } + protected override void OnUpdate() + { + if (_steps == ESteps.None || _steps == ESteps.Done) + return; + + if(_steps == ESteps.Update) + { + _machine.Update(); + if(_machine.CurrentNode == typeof(FsmUpdaterDone).FullName) + { + _eventGroup.RemoveAllListener(); + Status = EOperationStatus.Succeed; + _steps = ESteps.Done; + } + } + } + + /// + /// 接收事件 + /// + private void OnHandleEventMessage(IEventMessage message) + { + if (message is UserEventDefine.UserTryInitialize) + { + _machine.ChangeState(); + } + else if (message is UserEventDefine.UserBeginDownloadWebFiles) + { + _machine.ChangeState(); + } + else if (message is UserEventDefine.UserTryUpdatePackageVersion) + { + _machine.ChangeState(); + } + else if (message is UserEventDefine.UserTryUpdatePatchManifest) + { + _machine.ChangeState(); + } + else if (message is UserEventDefine.UserTryDownloadWebFiles) + { + _machine.ChangeState(); + } + else + { + throw new System.NotImplementedException($"{message.GetType()}"); + } + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchOperation.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchOperation.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UIAboutWindow.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UIAboutWindow.cs deleted file mode 100644 index 1dea2c2..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UIAboutWindow.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using UniFramework.Window; -using YooAsset; - -[WindowAttribute(100, false)] -public class UIAboutWindow : UIWindow -{ - private Text _info; - private RawFileOperationHandle _handle; - - public override void OnCreate() - { - var maskBtn = this.transform.Find("mask").GetComponent public class GameQueryServices : IBuildinQueryServices { - public bool QueryStreamingAssets(string packageName, string fileName) + public bool Query(string packageName, string fileName) { // 注意:fileName包含文件格式 return StreamingAssetsHelper.FileExists(packageName, fileName); diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation.meta deleted file mode 100644 index bc5ba08..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 22c4a6746deb208479f4b7a040eed7f3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/README.md deleted file mode 100644 index 4597745..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# UniFramework.Animation - -一个轻量级的高效率的动画系统。 - -支持新的动画文件格式,不再依赖Animator文件来驱动动画,使用方式非常类似于老的Animation系统。 diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/README.md.meta deleted file mode 100644 index c47688a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6a7da62cb3785ef45b2dda8fa0b3c8e5 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime.meta deleted file mode 100644 index 1832fb4..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8664294e17a47c14c8d12545da2349a1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimClip.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimClip.cs deleted file mode 100644 index 4d8ac73..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimClip.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Playables; -using UnityEngine.Animations; - -namespace UniFramework.Animation -{ - internal sealed class AnimClip : AnimNode - { - public readonly string Name; - private readonly AnimationClip _clip; - public AnimationClipPlayable _clipPlayable; - - /// - /// 动画层级 - /// - public int Layer = 0; - - /// - /// 动画长度 - /// - public float ClipLength - { - get - { - if (_clip == null) - return 0f; - if (Speed == 0f) - return Mathf.Infinity; - return _clip.length / Speed; - } - } - - /// - /// 归一化时间轴 - /// - public float NormalizedTime - { - set - { - if (_clip == null) - return; - Time = _clip.length * value; - } - - get - { - if (_clip == null) - return 1f; - return Time / _clip.length; - } - } - - /// - /// 动画模式 - /// - public WrapMode WrapMode - { - set - { - if (_clip != null) - _clip.wrapMode = value; - } - get - { - if (_clip == null) - return WrapMode.Default; - return _clip.wrapMode; - } - } - - /// - /// 动画状态 - /// - public AnimState State { private set; get; } - - public AnimClip(PlayableGraph graph, AnimationClip clip, string name, int layer) : base(graph) - { - _clip = clip; - Name = name; - Layer = layer; - - _clipPlayable = AnimationClipPlayable.Create(graph, clip); - _clipPlayable.SetApplyFootIK(false); - _clipPlayable.SetApplyPlayableIK(false); - SetSourcePlayable(_clipPlayable); - - if (clip.wrapMode == WrapMode.Once) - { - _clipPlayable.SetDuration(clip.length); - } - - State = new AnimState(this); - } - public override void PlayNode() - { - if (_clip.wrapMode == WrapMode.Once || _clip.wrapMode == WrapMode.ClampForever) - { - Time = 0; - } - - base.PlayNode(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimClip.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimClip.cs.meta deleted file mode 100644 index 71a052f..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimClip.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 606e5729d04cc8742a38f58e595c02f9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimMixer.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimMixer.cs deleted file mode 100644 index 0af25bc..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimMixer.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Playables; -using UnityEngine.Animations; - -namespace UniFramework.Animation -{ - internal sealed class AnimMixer : AnimNode - { - private const float HIDE_DURATION = 0.25f; - private readonly List _animClips = new List(10); - private AnimationMixerPlayable _mixer; - private bool _isQuiting = false; - - /// - /// 动画层级 - /// - public int Layer { private set; get; } - - - public AnimMixer(PlayableGraph graph, int layer) : base(graph) - { - Layer = layer; - - _mixer = AnimationMixerPlayable.Create(graph); - SetSourcePlayable(_mixer); - } - public override void Update(float deltaTime) - { - base.Update(deltaTime); - - for (int i = 0; i < _animClips.Count; i++) - { - var animClip = _animClips[i]; - if (animClip != null) - animClip.Update(deltaTime); - } - - bool isAllDone = true; - for (int i = 0; i < _animClips.Count; i++) - { - var animClip = _animClips[i]; - if (animClip != null) - { - if (animClip.IsDone == false) - isAllDone = false; - } - } - - // 当子节点都已经完成的时候断开连接 - if (isAllDone && _isQuiting == false) - { - _isQuiting = true; - StartWeightFade(0, HIDE_DURATION); - } - if (_isQuiting) - { - if (Mathf.Approximately(Weight, 0f)) - DisconnectMixer(); - } - } - - /// - /// 播放指定动画 - /// - public void Play(AnimClip newAnimClip, float fadeDuration) - { - // 重新激活混合器 - _isQuiting = false; - StartWeightFade(1f, 0); - - if (IsContains(newAnimClip) == false) - { - // 优先插入到一个空位 - int index = _animClips.FindIndex(s => s == null); - if (index == -1) - { - // Increase input count - int inputCount = _mixer.GetInputCount(); - _mixer.SetInputCount(inputCount + 1); - - newAnimClip.Connect(_mixer, inputCount); - _animClips.Add(newAnimClip); - } - else - { - newAnimClip.Connect(_mixer, index); - _animClips[index] = newAnimClip; - } - } - - for (int i = 0; i < _animClips.Count; i++) - { - var animClip = _animClips[i]; - if (animClip == null) - continue; - - if (animClip == newAnimClip) - { - animClip.StartWeightFade(1f, fadeDuration); - animClip.PlayNode(); - } - else - { - animClip.StartWeightFade(0f, fadeDuration); - animClip.PauseNode(); - } - } - } - - /// - /// 停止指定动画,恢复为初始状态 - /// - public void Stop(string name) - { - AnimClip animClip = FindClip(name); - if (animClip == null) - return; - - animClip.PauseNode(); - animClip.ResetNode(); - } - - /// - /// 暂停所有动画 - /// - public void PauseAll() - { - for (int i = 0; i < _animClips.Count; i++) - { - var animClip = _animClips[i]; - if (animClip == null) - continue; - animClip.PauseNode(); - } - } - - /// - /// 是否包含该动画 - /// - public bool IsContains(AnimClip clip) - { - foreach (var animClip in _animClips) - { - if (animClip == clip) - return true; - } - return false; - } - - /// - /// 移除一个动画 - /// - public void RemoveClip(string name) - { - var animClip = FindClip(name); - if (animClip == null) - return; - - _animClips[animClip.InputPort] = null; - animClip.Destroy(); - } - - /// - /// 获取指定的动画 - /// - /// 如果没有返回NULL - private AnimClip FindClip(string name) - { - foreach (var animClip in _animClips) - { - if (animClip != null && animClip.Name == name) - return animClip; - } - - UniLogger.Warning($"${nameof(AnimClip)} doesn't exist : {name}"); - return null; - } - - private void DisconnectMixer() - { - for (int i = 0; i < _animClips.Count; i++) - { - var animClip = _animClips[i]; - if (animClip == null) - continue; - - animClip.Disconnect(); - _animClips[i] = null; - } - - Disconnect(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimMixer.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimMixer.cs.meta deleted file mode 100644 index 7842188..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimMixer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b33204afd07c00c4f8b425276778b8bf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimNode.cs deleted file mode 100644 index 7dc96c3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimNode.cs +++ /dev/null @@ -1,221 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Playables; -using UnityEngine.Animations; - -namespace UniFramework.Animation -{ - internal abstract class AnimNode - { - private readonly PlayableGraph _graph; - private Playable _source; - private Playable _parent; - - private float _fadeSpeed = 0f; - private float _fadeWeight = 0f; - private bool _isFading = false; - - - /// - /// 是否已经连接 - /// - public bool IsConnect { get; private set; } = false; - - /// - /// 输入端口 - /// - public int InputPort { private set; get; } - - /// - /// 是否已经完成 - /// If the duration of the playable is set, when the time of the playable reaches its duration during playback this flag will be set to true. - /// - public bool IsDone - { - get - { - return _source.IsDone(); - } - } - - /// - /// 是否有效 - /// if the Playable is properly constructed by the PlayableGraph and has not been destroyed, false otherwise. - /// - public bool IsValid - { - get - { - return _source.IsValid(); - } - } - - /// - /// 是否正在播放中 - /// - public bool IsPlaying - { - get - { - return _source.GetPlayState() == PlayState.Playing; - } - } - - /// - /// 时间轴 - /// - public float Time - { - set - { - _source.SetTime(value); - } - get - { - return (float)_source.GetTime(); - } - } - - /// - /// 播放速度 - /// - public float Speed - { - set - { - _source.SetSpeed(value); - } - get - { - return (float)_source.GetSpeed(); - } - } - - /// - /// 权重值 - /// - public float Weight - { - set - { - _parent.SetInputWeight(InputPort, value); - } - get - { - return _parent.GetInputWeight(InputPort); - } - } - - - public AnimNode(PlayableGraph graph) - { - _graph = graph; - } - public virtual void Update(float deltaTime) - { - if (_isFading) - { - Weight = Mathf.MoveTowards(Weight, _fadeWeight, _fadeSpeed * deltaTime); - if (Mathf.Approximately(Weight, _fadeWeight)) - { - _isFading = false; - } - } - } - public virtual void Destroy() - { - if (IsValid) - { - _graph.DestroySubgraph(_source); - } - } - public virtual void PlayNode() - { - // NOTE : When playing, the local time of this Playable will be updated during the evaluation of the PlayableGraph. - _source.Play(); - - // NOTE : Changes a flag indicating that a playable has completed its operation. - // Playable that reach the end of their duration are automatically marked as done. - _source.SetDone(false); - } - public virtual void PauseNode() - { - // NOTE : When paused, the local time of this Playable will not be updated during the evaluation of the PlayableGraph. - _source.Pause(); - - // NOTE : Changes a flag indicating that a playable has completed its operation. - // Playable that reach the end of their duration are automatically marked as done. - _source.SetDone(true); - } - public virtual void ResetNode() - { - _fadeSpeed = 0; - _fadeWeight = 0; - _isFading = false; - - Time = 0; - Speed = 1; - Weight = 0; - } - - /// - /// 连接到父节点 - /// - /// 父节点对象 - /// 父节点上的输入端口 - public void Connect(Playable parent, int parentInputPort) - { - if (IsConnect) - throw new System.Exception("AnimNode is connected."); - - _parent = parent; - InputPort = parentInputPort; - - // 重置节点 - ResetNode(); - - // 连接 - _graph.Connect(_source, 0, parent, parentInputPort); - IsConnect = true; - } - - /// - /// 同父节点断开连接 - /// - public void Disconnect() - { - if (IsConnect == false) - throw new System.Exception("AnimNode is disconnected."); - - // 断开 - _graph.Disconnect(_parent, InputPort); - IsConnect = false; - } - - /// - /// 开始权重值过渡 - /// - /// 目标权重值 - /// 过渡时间 - public void StartWeightFade(float destWeight, float fadeDuration) - { - if (fadeDuration <= 0) - { - Weight = destWeight; - _isFading = false; - return; - } - - //注意:保持统一的渐变速度 - _fadeSpeed = 1f / fadeDuration; - _fadeWeight = destWeight; - _isFading = true; - } - - protected void SetSourcePlayable(Playable playable) - { - _source = playable; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimNode.cs.meta deleted file mode 100644 index 1f91ab9..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b6928afd60ab2ed489e492e00d9ddaba -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimPlayable.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimPlayable.cs deleted file mode 100644 index 274f65a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimPlayable.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Playables; -using UnityEngine.Animations; - -namespace UniFramework.Animation -{ - internal class AnimPlayable - { - private readonly List _animClips = new List(10); - private readonly List _animMixers = new List(10); - - private PlayableGraph _graph; - private AnimationPlayableOutput _output; - private AnimationLayerMixerPlayable _mixerRoot; - - public void Create(Animator animator) - { - string name = animator.gameObject.name; - _graph = PlayableGraph.Create(name); - _graph.SetTimeUpdateMode(DirectorUpdateMode.Manual); - - _mixerRoot = AnimationLayerMixerPlayable.Create(_graph); - _output = AnimationPlayableOutput.Create(_graph, name, animator); - _output.SetSourcePlayable(_mixerRoot); - } - public void Update(float deltaTime) - { - _graph.Evaluate(deltaTime); - - // 更新所有层级 - for (int i = 0; i < _animMixers.Count; i++) - { - var mixer = _animMixers[i]; - if(mixer.IsConnect) - mixer.Update(deltaTime); - } - } - public void Destroy() - { - _graph.Destroy(); - } - - /// - /// Play the graph - /// - public void PlayGraph() - { - _graph.Play(); - } - - /// - /// Stop the graph - /// - public void StopGraph() - { - _graph.Stop(); - } - - /// - /// 获取动画的状态 - /// - /// 动画名称 - /// 如果动画不存在返回空 - public AnimState GetAnimState(string name) - { - for (int i = 0; i < _animClips.Count; i++) - { - if (_animClips[i].Name == name) - return _animClips[i].State; - } - return null; - } - - /// - /// 检测动画是否正在播放 - /// - /// 动画名称 - public bool IsPlaying(string name) - { - AnimClip animClip = GetAnimClip(name); - if (animClip == null) - return false; - - return animClip.IsConnect && animClip.IsPlaying; - } - - /// - /// 播放一个动画 - /// - /// 动画名称 - /// 融合时间 - public void Play(string name, float fadeLength) - { - var animClip = GetAnimClip(name); - if (animClip == null) - { - UniLogger.Warning($"Not found animation {name}"); - return; - } - - int layer = animClip.Layer; - var animMixer = GetAnimMixer(layer); - if (animMixer == null) - animMixer = CreateAnimMixer(layer); - - if(animMixer.IsConnect == false) - animMixer.Connect(_mixerRoot, animMixer.Layer); - - animMixer.Play(animClip, fadeLength); - } - - /// - /// 停止一个动画 - /// - /// 动画名称 - public void Stop(string name) - { - var animClip = GetAnimClip(name); - if (animClip == null) - { - UniLogger.Warning($"Not found animation {name}"); - return; - } - - if (animClip.IsConnect == false) - return; - - var animMixer = GetAnimMixer(animClip.Layer); - if (animMixer == null) - throw new System.Exception("Should never get here."); - - animMixer.Stop(animClip.Name); - } - - /// - /// 添加一个动画片段 - /// - /// 动画名称 - /// 动画片段 - /// 动画层级 - public bool AddAnimation(string name, AnimationClip clip, int layer = 0) - { - if (string.IsNullOrEmpty(name)) - throw new System.ArgumentException("Name is null or empty."); - if (clip == null) - throw new System.ArgumentNullException(); - if (layer < 0) - throw new System.Exception("Layer must be greater than zero."); - - if (IsContains(name)) - { - UniLogger.Warning($"Animation already exists : {name}"); - return false; - } - - AnimClip animClip = new AnimClip(_graph, clip, name, layer); - _animClips.Add(animClip); - return true; - } - - /// - /// 移除一个动画片段 - /// - /// 动画名称 - public bool RemoveAnimation(string name) - { - if (IsContains(name) == false) - { - UniLogger.Warning($"Not found Animation : {name}"); - return false; - } - - AnimClip animClip = GetAnimClip(name); - AnimMixer animMixer = GetAnimMixer(animClip.Layer); - if(animMixer != null) - animMixer.RemoveClip(animClip.Name); - - animClip.Destroy(); - _animClips.Remove(animClip); - return true; - } - - /// - /// 是否包含一个动画状态 - /// - /// 动画名称 - public bool IsContains(string name) - { - for (int i = 0; i < _animClips.Count; i++) - { - if (_animClips[i].Name == name) - return true; - } - return false; - } - - private AnimClip GetAnimClip(string name) - { - for (int i = 0; i < _animClips.Count; i++) - { - if (_animClips[i].Name == name) - return _animClips[i]; - } - return null; - } - private AnimMixer GetAnimMixer(int layer) - { - for (int i = 0; i < _animMixers.Count; i++) - { - if (_animMixers[i].Layer == layer) - return _animMixers[i]; - } - return null; - } - private AnimMixer CreateAnimMixer(int layer) - { - // Increase input count - int inputCount = _mixerRoot.GetInputCount(); - if(layer == 0 && inputCount == 0) - { - _mixerRoot.SetInputCount(1); - } - else - { - if (layer > inputCount - 1) - { - _mixerRoot.SetInputCount(layer + 1); - } - } - - var animMixer = new AnimMixer(_graph, layer); - _animMixers.Add(animMixer); - return animMixer; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimPlayable.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimPlayable.cs.meta deleted file mode 100644 index 36714b0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimPlayable.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 772b8a9edd8466646bab12d6f5ba1084 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimState.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimState.cs deleted file mode 100644 index c0ae266..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimState.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System.Collections; -using UnityEngine; -using UnityEngine.Playables; -using UnityEngine.Animations; - -namespace UniFramework.Animation -{ - public class AnimState - { - private readonly AnimClip _animClip; - - private AnimState() - { - } - internal AnimState(AnimClip animClip) - { - _animClip = animClip; - } - - - /// - /// The name of animation. - /// - public string Name - { - get - { - return _animClip.Name; - } - } - - /// - /// The length of the animation clip in seconds. - /// - public float Length - { - get - { - return _animClip.ClipLength; - } - } - - /// - /// The layer of animation. - /// - public int Layer - { - get - { - return _animClip.Layer; - } - } - - /// - /// Wrapping mode of the animation. - /// - public WrapMode WrapMode - { - get - { - return _animClip.WrapMode; - } - } - - - /// - /// The weight of animation. - /// - public float Weight - { - get - { - return _animClip.Weight; - } - set - { - _animClip.Weight = value; - } - } - - /// - /// The current time of the animation. - /// - public float Time - { - get - { - return _animClip.Time; - } - set - { - _animClip.Time = value; - } - } - - /// - /// The normalized time of the animation. - /// - public float NormalizedTime - { - get - { - return _animClip.NormalizedTime; - } - set - { - _animClip.NormalizedTime = value; - } - } - - /// - /// The playback speed of the animation. 1 is normal playback speed. - /// - public float Speed - { - get - { - return _animClip.Speed; - } - set - { - _animClip.Speed = value; - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimState.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimState.cs.meta deleted file mode 100644 index 3b2e4c8..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/AnimState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5660d9e37e5c2a44f818506c9fe76624 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniAnimation.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniAnimation.cs deleted file mode 100644 index 15471d4..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniAnimation.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace UniFramework.Animation -{ - [RequireComponent(typeof(Animator))] - public class UniAnimation : MonoBehaviour - { - [Serializable] - public class AnimationWrapper - { - public int Layer; - public WrapMode Mode; - public AnimationClip Clip; - } - - private AnimPlayable _animPlayable; - private Animator _animator; - - [SerializeField] - private AnimationWrapper[] _animations; - - [SerializeField] - private bool _playAutomatically = true; - - [SerializeField] - private bool _animatePhysics = false; - - /// - /// 自动播放动画 - /// - public bool PlayAutomatically - { - get - { - return _playAutomatically; - } - set - { - _playAutomatically = value; - } - } - - /// - /// 物理更新模式 - /// - public bool AnimatePhysics - { - get - { - return _animatePhysics; - } - set - { - _animatePhysics = value; - _animator.updateMode = _animatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal; - } - } - - - public void Awake() - { - _animator = GetComponent(); - _animator.updateMode = _animatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal; - - _animPlayable = new AnimPlayable(); - _animPlayable.Create(_animator); - - // 添加列表动作 - for (int i = 0; i < _animations.Length; i++) - { - var wrapper = _animations[i]; - if (wrapper == null || wrapper.Clip == null) - continue; - - wrapper.Clip.wrapMode = wrapper.Mode; - _animPlayable.AddAnimation(wrapper.Clip.name, wrapper.Clip, wrapper.Layer); - } - } - public void OnEnable() - { - _animPlayable.PlayGraph(); - - if (PlayAutomatically) - { - var wrapper = GetDefaultWrapper(); - if (wrapper != null) - { - Play(wrapper.Clip.name, 0f); - } - } - - _animPlayable.Update(float.MaxValue); - } - public void OnDisable() - { - _animPlayable.StopGraph(); - } - public void OnDestroy() - { - _animPlayable.Destroy(); - } - public void Update() - { - _animPlayable.Update(Time.deltaTime); - } - - /// - /// 添加一个动画 - /// - /// 动画片段 - /// 动画层级 - public bool AddAnimation(AnimationClip clip, int layer = 0) - { - return _animPlayable.AddAnimation(clip.name, clip, layer); - } - - /// - /// 移除动画 - /// - /// 动画名称 - public bool RemoveAnimation(string name) - { - return _animPlayable.RemoveAnimation(name); - } - - /// - /// 获取动画状态 - /// - public AnimState GetState(string name) - { - return _animPlayable.GetAnimState(name); - } - - /// - /// 动画是否在播放中 - /// - public bool IsPlaying(string name) - { - return _animPlayable.IsPlaying(name); - } - - /// - /// 是否包含动画片段 - /// - public bool IsContains(string name) - { - return _animPlayable.IsContains(name); - } - - /// - /// 播放动画 - /// - public void Play(string name, float fadeLength = 0.25f) - { - _animPlayable.Play(name, fadeLength); - } - - /// - /// 停止动画 - /// - public void Stop(string name) - { - _animPlayable.Stop(name); - } - - private AnimationWrapper GetDefaultWrapper() - { - for (int i = 0; i < _animations.Length; i++) - { - var wrapper = _animations[i]; - if (wrapper == null || wrapper.Clip == null) - continue; - - return wrapper; - } - return null; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniAnimation.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniAnimation.cs.meta deleted file mode 100644 index 18eabca..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniAnimation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ef52174816df6104587b15c5b250201a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniFramework.Animation.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniFramework.Animation.asmdef deleted file mode 100644 index 9ad70f0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniFramework.Animation.asmdef +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "UniFramework.Animation", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniFramework.Animation.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniFramework.Animation.asmdef.meta deleted file mode 100644 index 0d81060..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniFramework.Animation.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ccbd3ee89c7c8614bb89388a769680c1 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniLogger.cs deleted file mode 100644 index 4bd5ee6..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniLogger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Diagnostics; - -namespace UniFramework.Animation -{ - internal static class UniLogger - { - [Conditional("DEBUG")] - public static void Log(string info) - { - UnityEngine.Debug.Log(info); - } - public static void Warning(string info) - { - UnityEngine.Debug.LogWarning(info); - } - public static void Error(string info) - { - UnityEngine.Debug.LogError(info); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniLogger.cs.meta deleted file mode 100644 index 7785b38..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniAnimation/Runtime/UniLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5c11371eb114ef24daad9fc81ac6e0cd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniMachine/Runtime/StateMachine.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniMachine/Runtime/StateMachine.cs index 89c3242..6099df5 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniMachine/Runtime/StateMachine.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniMachine/Runtime/StateMachine.cs @@ -6,6 +6,7 @@ namespace UniFramework.Machine { public class StateMachine { + private readonly Dictionary _blackboard = new Dictionary(100); private readonly Dictionary _nodes = new Dictionary(100); private IStateNode _curNode; private IStateNode _preNode; @@ -133,6 +134,35 @@ namespace UniFramework.Machine _curNode.OnEnter(); } + /// + /// 设置黑板数据 + /// + /// + /// + public void SetBlackboardValue(string key, System.Object value) + { + if (_blackboard.ContainsKey(key) == false) + _blackboard.Add(key, value); + else + _blackboard[key] = value; + } + + /// + /// 获取黑板数据 + /// + public System.Object GetBlackboardValue(string key) + { + if (_blackboard.TryGetValue(key, out System.Object value)) + { + return value; + } + else + { + UniLogger.Warning($"Not found blackboard value : {key}"); + return null; + } + } + private IStateNode TryGetNode(string nodeName) { _nodes.TryGetValue(nodeName, out IStateNode result); diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork.meta deleted file mode 100644 index eb88ee2..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 99ad37bbd721c834d8157bb257d4b8bb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/README.md deleted file mode 100644 index 9517f36..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# UniFramework.Network - -一个高效的基于IOCP模型的网络系统。 - -```c# -using System.Net; -using System.Net.Sockets; -using System.Text; -using UnityEngine; -using UniFramework.Network; - -// 登录请求消息 -class LoginRequestMessage -{ - public string Name; - public string Password; -} - -// 登录反馈消息 -class LoginResponseMessage -{ - public string Result; -} - -// TCP客户端 -UniFramework.Network.TcpClient _client = null; - -// 创建TCP客户端 -void CreateClient() -{ - // 初始化网络系统 - UniNetwork.Initalize(); - - // 创建TCP客户端 - int packageMaxSize = short.MaxValue; - var encoder = new DefaultNetPackageEncoder(); - var decoder = new DefaultNetPackageDecoder(); - _client = UniNetwork.CreateTcpClient(packageMaxSize, encoder, decoder); - - // 连接服务器 - var remote = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000); - _client.ConnectAsync(remote, OnConnectServer); -} - -// 关闭TCP客户端 -void CloseClient() -{ - if(_client != null) - { - _client.Dispose(); - _client = null; - } -} - -void OnConnectServer(SocketError error) -{ - Debug.Log($"Server connect result : {error}"); - if (error == SocketError.Success) - Debug.Log("服务器连接成功!"); - else - Debug.Log("服务器连接失败!"); -} - -void Update() -{ - // 每帧去获取解析的网络包 - DefaultNetPackage networkPackage = client.PickPackage() as DefaultNetPackage; - if(networkPackage != null) - { - string json = Encoding.UTF8.GetString(networkPackage.BodyBytes); - LoginResponseMessage message = JsonUtility.FromJson(json); - Debug.Log(message.Result); - } -} - -// 发送登录请求消息 -void SendLoginMessage() -{ - LoginRequestMessage message = new LoginRequestMessage(); - message.Name = "hevinci"; - message.Password = "1234567"; - - DefaultNetPackage networkPackage = new DefaultNetPackage(); - networkPackage.MsgID = 10001; - networkPackage.BodyBytes = Encoding.UTF8.GetBytes(JsonUtility.ToJson(message)); - _client.SendPackage(networkPackage); -} -``` - diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/README.md.meta deleted file mode 100644 index ec85d20..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9325e3d425f106a41977ea6e672fecdb -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime.meta deleted file mode 100644 index cf9ffd7..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: efa01143ee531b6478df4aca44367f8a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package.meta deleted file mode 100644 index c5de313..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3cb02cc27ea1caf479c14cebf66a5dab -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackage.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackage.cs deleted file mode 100644 index f0c0713..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackage.cs +++ /dev/null @@ -1,16 +0,0 @@ - -namespace UniFramework.Network -{ - public class DefaultNetPackage : INetPackage - { - /// - /// 消息ID - /// - public int MsgID { set; get; } - - /// - /// 包体数据 - /// - public byte[] BodyBytes { set; get; } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackage.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackage.cs.meta deleted file mode 100644 index e6bde14..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 77bfd5d9f7d9c79478b19cf99a103c47 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageDecoder.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageDecoder.cs deleted file mode 100644 index 58fbf86..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageDecoder.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace UniFramework.Network -{ - /// - /// 网络包解码器 - /// - public class DefaultNetPackageDecoder : INetPackageDecoder - { - private HandleErrorDelegate _handleErrorCallback; - private const int PackageHeaderLengthFiledSize = 4; //int类型 - private const int PackageHeaderIDFiledSize = 4; //int类型 - - /// - /// 获取包头的尺寸 - /// - public int GetPackageHeaderSize() - { - return PackageHeaderLengthFiledSize + PackageHeaderIDFiledSize; - } - - /// - /// 注册异常错误回调方法 - /// - /// - public void RigistHandleErrorCallback(HandleErrorDelegate callback) - { - _handleErrorCallback = callback; - } - - /// - /// 网络消息解码 - /// - /// 包体的最大尺寸 - /// 解码需要的字节缓冲区 - /// 接收的包裹列表 - public void Decode(int packageBodyMaxSize, RingBuffer ringBuffer, List outputPackages) - { - // 循环解包 - while (true) - { - // 如果数据不够判断消息长度 - if (ringBuffer.ReadableBytes < PackageHeaderLengthFiledSize) - break; - - ringBuffer.MarkReaderIndex(); - - // 读取Package长度 - int packageSize = ringBuffer.ReadInt(); - - // 如果剩余可读数据小于Package长度 - if (ringBuffer.ReadableBytes < packageSize) - { - ringBuffer.ResetReaderIndex(); - break; //需要退出读够数据再解包 - } - - DefaultNetPackage package = new DefaultNetPackage(); - - // 读取包头 - { - // 读取消息ID - package.MsgID = ringBuffer.ReadInt(); - } - - // 检测包体长度 - int bodySize = packageSize - PackageHeaderIDFiledSize; - if (bodySize > packageBodyMaxSize) - { - _handleErrorCallback(true, $"The decode package {package.MsgID} body size is larger than {packageBodyMaxSize} !"); - break; - } - - // 读取包体 - { - package.BodyBytes = ringBuffer.ReadBytes(bodySize); - outputPackages.Add(package); - } - } - - // 注意:将剩余数据移至起始 - ringBuffer.DiscardReadBytes(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageDecoder.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageDecoder.cs.meta deleted file mode 100644 index 029bf18..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageDecoder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6b9693105d824c8409392d251d920346 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageEncoder.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageEncoder.cs deleted file mode 100644 index 58b099a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageEncoder.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace UniFramework.Network -{ - /// - /// 网络包编码器 - /// - public class DefaultNetPackageEncoder : INetPackageEncoder - { - private HandleErrorDelegate _handleErrorCallback; - private const int PackageHeaderLengthFiledSize = 4; //int类型 - private const int PackageHeaderIDFiledSize = 4; //int类型 - - /// - /// 获取包头的尺寸 - /// - public int GetPackageHeaderSize() - { - return PackageHeaderLengthFiledSize + PackageHeaderIDFiledSize; - } - - /// - /// 注册异常错误回调方法 - /// - /// - public void RigistHandleErrorCallback(HandleErrorDelegate callback) - { - _handleErrorCallback = callback; - } - - /// - /// 编码 - /// - /// 包体的最大尺寸 - /// 编码填充的字节缓冲区 - /// 发送的包裹 - public void Encode(int packageBodyMaxSize, RingBuffer ringBuffer, INetPackage encodePackage) - { - if (encodePackage == null) - { - _handleErrorCallback(false, "The encode package object is null"); - return; - } - - DefaultNetPackage package = (DefaultNetPackage)encodePackage; - if (package == null) - { - _handleErrorCallback(false, $"The encode package object is invalid : {encodePackage.GetType()}"); - return; - } - - // 检测逻辑是否合法 - if (package.BodyBytes == null) - { - _handleErrorCallback(false, $"The encode package BodyBytes field is null : {encodePackage.GetType()}"); - return; - } - - // 获取包体数据 - byte[] bodyData = package.BodyBytes; - - // 检测包体长度 - if (bodyData.Length > packageBodyMaxSize) - { - _handleErrorCallback(false, $"The encode package {package.MsgID} body size is larger than {packageBodyMaxSize}"); - return; - } - - // 写入长度 - int packetLength = PackageHeaderIDFiledSize + bodyData.Length; - ringBuffer.WriteInt(packetLength); - - // 写入包头 - { - // 写入消息ID - ringBuffer.WriteInt(package.MsgID); - } - - // 写入包体 - ringBuffer.WriteBytes(bodyData, 0, bodyData.Length); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageEncoder.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageEncoder.cs.meta deleted file mode 100644 index 172f28d..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/DefaultNetPackageEncoder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a91c21858dd0d2645b67361f76d9e747 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackage.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackage.cs deleted file mode 100644 index f0eeb4c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackage.cs +++ /dev/null @@ -1,9 +0,0 @@ - -namespace UniFramework.Network -{ - public delegate void HandleErrorDelegate(bool isDispose, string error); - - public interface INetPackage - { - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackage.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackage.cs.meta deleted file mode 100644 index 6af8e91..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 00149ae4ecfb570418760bc2d359e7ca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageDecoder.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageDecoder.cs deleted file mode 100644 index 6234d62..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageDecoder.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace UniFramework.Network -{ - /// - /// 网络包解码器 - /// - public interface INetPackageDecoder - { - /// - /// 获取包头的尺寸 - /// - int GetPackageHeaderSize(); - - /// - /// 注册异常错误回调方法 - /// - /// - void RigistHandleErrorCallback(HandleErrorDelegate callback); - - /// - /// 网络消息解码 - /// - /// 包体的最大尺寸 - /// 解码需要的字节缓冲区 - /// 接收的包裹列表 - void Decode(int packageBodyMaxSize, RingBuffer ringBuffer, List outputPackages); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageDecoder.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageDecoder.cs.meta deleted file mode 100644 index 8fc989c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageDecoder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8c549df6ac813a74b9fd787e3991a254 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageEncoder.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageEncoder.cs deleted file mode 100644 index d56a48c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageEncoder.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace UniFramework.Network -{ - /// - /// 网络包编码器 - /// - public interface INetPackageEncoder - { - /// - /// 获取包头的尺寸 - /// - int GetPackageHeaderSize(); - - /// - /// 注册异常错误回调方法 - /// - /// - void RigistHandleErrorCallback(HandleErrorDelegate callback); - - /// - /// 编码 - /// - /// 包体的最大尺寸 - /// 编码填充的字节缓冲区 - /// 发送的包裹 - void Encode(int packageBodyMaxSize, RingBuffer ringBuffer, INetPackage encodePackage); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageEncoder.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageEncoder.cs.meta deleted file mode 100644 index 799ad4f..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/Package/INetPackageEncoder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0c4bce3e31495bc4483ab697d895fd62 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/RingBuffer.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/RingBuffer.cs deleted file mode 100644 index b91fa37..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/RingBuffer.cs +++ /dev/null @@ -1,537 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using UnityEngine; - -namespace UniFramework.Network -{ - /// - /// 环形缓冲区 - /// - public class RingBuffer - { - private readonly byte[] _buffer; - private int _readerIndex = 0; - private int _writerIndex = 0; - private int _markedReaderIndex = 0; - private int _markedWriterIndex = 0; - - - /// - /// 字节缓冲区 - /// - public RingBuffer(int capacity) - { - _buffer = new byte[capacity]; - } - - /// - /// 字节缓冲区 - /// - public RingBuffer(byte[] data) - { - _buffer = data; - _writerIndex = data.Length; - } - - /// - /// 获取数据 - /// - public byte[] GetBuffer() - { - return _buffer; - } - - /// - /// 缓冲区容量 - /// - public int Capacity - { - get { return _buffer.Length; } - } - - /// - /// 清空缓冲区 - /// - public void Clear() - { - _readerIndex = 0; - _writerIndex = 0; - _markedReaderIndex = 0; - _markedWriterIndex = 0; - } - - /// - /// 删除已读部分,重新初始化数组 - /// - public void DiscardReadBytes() - { - if (_readerIndex == 0) - return; - - if (_readerIndex == _writerIndex) - { - _readerIndex = 0; - _writerIndex = 0; - } - else - { - for (int i = 0, j = _readerIndex, length = _writerIndex - _readerIndex; i < length; i++, j++) - { - _buffer[i] = _buffer[j]; - } - _writerIndex -= _readerIndex; - _readerIndex = 0; - } - } - - #region 读取相关 - /// - /// 读取的下标位置 - /// - public int ReaderIndex - { - get { return _readerIndex; } - } - - /// - /// 当前可读数据量 - /// - public int ReadableBytes - { - get { return _writerIndex - _readerIndex; } - } - - /// - /// 查询是否可以读取 - /// - /// 读取数据量 - public bool IsReadable(int size = 1) - { - return _writerIndex - _readerIndex >= size; - } - - /// - /// 标记读取的下标位置,便于某些时候回退到该位置 - /// - public void MarkReaderIndex() - { - _markedReaderIndex = _readerIndex; - } - - /// - /// 回退到标记的读取下标位置 - /// - public void ResetReaderIndex() - { - _readerIndex = _markedReaderIndex; - } - #endregion - - #region 写入相关 - /// - /// 写入的下标位置 - /// - public int WriterIndex - { - get { return _writerIndex; } - } - - /// - /// 当前可写入数据量 - /// - public int WriteableBytes - { - get { return Capacity - _writerIndex; } - } - - /// - /// 查询是否可以写入 - /// - /// 写入数据量 - public bool IsWriteable(int size = 1) - { - return Capacity - _writerIndex >= size; - } - - /// - /// 标记写入的下标位置,便于某些时候回退到该位置。 - /// - public void MarkWriterIndex() - { - _markedWriterIndex = _writerIndex; - } - - /// - /// 回退到标记的写入下标位置 - /// - public void ResetWriterIndex() - { - _writerIndex = _markedWriterIndex; - } - #endregion - - #region 读取操作 - [Conditional("DEBUG")] - private void CheckReaderIndex(int length) - { - if (_readerIndex + length > _writerIndex) - { - throw new IndexOutOfRangeException(); - } - } - - public byte[] ReadBytes(int count) - { - CheckReaderIndex(count); - var data = new byte[count]; - Buffer.BlockCopy(_buffer, _readerIndex, data, 0, count); - _readerIndex += count; - return data; - } - public bool ReadBool() - { - CheckReaderIndex(1); - return _buffer[_readerIndex++] == 1; - } - public byte ReadByte() - { - CheckReaderIndex(1); - return _buffer[_readerIndex++]; - } - public sbyte ReadSbyte() - { - return (sbyte)ReadByte(); - } - public short ReadShort() - { - CheckReaderIndex(2); - short result = BitConverter.ToInt16(_buffer, _readerIndex); - _readerIndex += 2; - return result; - } - public ushort ReadUShort() - { - CheckReaderIndex(2); - ushort result = BitConverter.ToUInt16(_buffer, _readerIndex); - _readerIndex += 2; - return result; - } - public int ReadInt() - { - CheckReaderIndex(4); - int result = BitConverter.ToInt32(_buffer, _readerIndex); - _readerIndex += 4; - return result; - } - public uint ReadUInt() - { - CheckReaderIndex(4); - uint result = BitConverter.ToUInt32(_buffer, _readerIndex); - _readerIndex += 4; - return result; - } - public long ReadLong() - { - CheckReaderIndex(8); - long result = BitConverter.ToInt64(_buffer, _readerIndex); - _readerIndex += 8; - return result; - } - public ulong ReadULong() - { - CheckReaderIndex(8); - ulong result = BitConverter.ToUInt64(_buffer, _readerIndex); - _readerIndex += 8; - return result; - } - public float ReadFloat() - { - CheckReaderIndex(4); - float result = BitConverter.ToSingle(_buffer, _readerIndex); - _readerIndex += 4; - return result; - } - public double ReadDouble() - { - CheckReaderIndex(8); - double result = BitConverter.ToDouble(_buffer, _readerIndex); - _readerIndex += 8; - return result; - } - public string ReadUTF() - { - ushort count = ReadUShort(); - CheckReaderIndex(count); - string result = Encoding.UTF8.GetString(_buffer, _readerIndex, count - 1); // 注意:读取的时候忽略字符串末尾写入结束符 - _readerIndex += count; - return result; - } - - public List ReadListInt() - { - List result = new List(); - int count = ReadInt(); - for (int i = 0; i < count; i++) - { - result.Add(ReadInt()); - } - return result; - } - public List ReadListLong() - { - List result = new List(); - int count = ReadInt(); - for (int i = 0; i < count; i++) - { - result.Add(ReadLong()); - } - return result; - } - public List ReadListFloat() - { - List result = new List(); - int count = ReadInt(); - for (int i = 0; i < count; i++) - { - result.Add(ReadFloat()); - } - return result; - } - public List ReadListDouble() - { - List result = new List(); - int count = ReadInt(); - for (int i = 0; i < count; i++) - { - result.Add(ReadDouble()); - } - return result; - } - public List ReadListUTF() - { - List result = new List(); - int count = ReadInt(); - for (int i = 0; i < count; i++) - { - result.Add(ReadUTF()); - } - return result; - } - - public Vector2 ReadVector2() - { - float x = ReadFloat(); - float y = ReadFloat(); - return new Vector2(x, y); - } - public Vector3 ReadVector3() - { - float x = ReadFloat(); - float y = ReadFloat(); - float z = ReadFloat(); - return new Vector3(x, y, z); - } - public Vector4 ReadVector4() - { - float x = ReadFloat(); - float y = ReadFloat(); - float z = ReadFloat(); - float w = ReadFloat(); - return new Vector4(x, y, z, w); - } - #endregion - - #region 写入操作 - [Conditional("DEBUG")] - private void CheckWriterIndex(int length) - { - if (_writerIndex + length > Capacity) - { - throw new IndexOutOfRangeException(); - } - } - - public void WriteBytes(byte[] data) - { - WriteBytes(data, 0, data.Length); - } - public void WriteBytes(byte[] data, int offset, int count) - { - CheckWriterIndex(count); - Buffer.BlockCopy(data, offset, _buffer, _writerIndex, count); - _writerIndex += count; - } - public void WriteBool(bool value) - { - WriteByte((byte)(value ? 1 : 0)); - } - public void WriteByte(byte value) - { - CheckWriterIndex(1); - _buffer[_writerIndex++] = value; - } - public void WriteSbyte(sbyte value) - { - // 注意:从sbyte强转到byte不会有数据变化或丢失 - WriteByte((byte)value); - } - public void WriteShort(short value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteUShort(ushort value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteInt(int value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteUInt(uint value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteLong(long value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteULong(ulong value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteFloat(float value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteDouble(double value) - { - byte[] bytes = BitConverter.GetBytes(value); - WriteBytes(bytes); - } - public void WriteUTF(string value) - { - byte[] bytes = Encoding.UTF8.GetBytes(value); - int num = bytes.Length + 1; // 注意:字符串末尾写入结束符 - if (num > ushort.MaxValue) - throw new FormatException($"String length cannot be greater than {ushort.MaxValue} !"); - - WriteUShort(Convert.ToUInt16(num)); - WriteBytes(bytes); - WriteByte((byte)'\0'); - } - - public void WriteListInt(List values) - { - int count = 0; - if (values != null) - count = values.Count; - - WriteInt(count); - for (int i = 0; i < count; i++) - { - WriteInt(values[i]); - } - } - public void WriteListLong(List values) - { - int count = 0; - if (values != null) - count = values.Count; - - WriteInt(count); - for (int i = 0; i < count; i++) - { - WriteLong(values[i]); - } - } - public void WriteListFloat(List values) - { - int count = 0; - if (values != null) - count = values.Count; - - WriteInt(count); - for (int i = 0; i < count; i++) - { - WriteFloat(values[i]); - } - } - public void WriteListDouble(List values) - { - int count = 0; - if (values != null) - count = values.Count; - - WriteInt(count); - for (int i = 0; i < count; i++) - { - WriteDouble(values[i]); - } - } - public void WriteListUTF(List values) - { - int count = 0; - if (values != null) - count = values.Count; - - WriteInt(count); - for (int i = 0; i < count; i++) - { - WriteUTF(values[i]); - } - } - - public void WriteVector2(Vector2 value) - { - WriteFloat(value.x); - WriteFloat(value.y); - } - public void WriteVector3(Vector3 value) - { - WriteFloat(value.x); - WriteFloat(value.y); - WriteFloat(value.z); - } - public void WriteVector4(Vector4 value) - { - WriteFloat(value.x); - WriteFloat(value.y); - WriteFloat(value.z); - WriteFloat(value.w); - } - #endregion - - /// - /// 大小端转换 - /// - public static void ReverseOrder(byte[] data) - { - ReverseOrder(data, 0, data.Length); - } - public static void ReverseOrder(byte[] data, int offset, int length) - { - if (length <= 1) - return; - - int end = offset + length - 1; - int max = offset + length / 2; - byte temp; - for (int index = offset; index < max; index++, end--) - { - temp = data[end]; - data[end] = data[index]; - data[index] = temp; - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/RingBuffer.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/RingBuffer.cs.meta deleted file mode 100644 index af52d37..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/RingBuffer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dcd2ef8207d26994497ffeb6e8f30d13 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP.meta deleted file mode 100644 index 0372837..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f491992d09ff2c1498b496c4746ff01a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpChannel.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpChannel.cs deleted file mode 100644 index 97df90b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpChannel.cs +++ /dev/null @@ -1,301 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; - -namespace UniFramework.Network -{ - internal class TcpChannel : IDisposable - { - private readonly SocketAsyncEventArgs _receiveArgs = new SocketAsyncEventArgs(); - private readonly SocketAsyncEventArgs _sendArgs = new SocketAsyncEventArgs(); - - private readonly Queue _sendQueue = new Queue(10000); - private readonly Queue _receiveQueue = new Queue(10000); - private readonly List _decodeTempList = new List(100); - - private byte[] _receiveBuffer; - private RingBuffer _encodeBuffer; - private RingBuffer _decodeBuffer; - private int _packageBodyMaxSize; - private INetPackageEncoder _packageEncoder; - private INetPackageDecoder _packageDecoder; - private bool _isSending = false; - private bool _isReceiving = false; - - /// - /// 通信Socket - /// - private Socket _socket; - - /// - /// 同步上下文 - /// - private ThreadSyncContext _context; - - /// - /// 初始化频道 - /// - internal void InitChannel(ThreadSyncContext context, Socket socket, int packageBodyMaxSize, INetPackageEncoder encoder, INetPackageDecoder decoder) - { - if (packageBodyMaxSize <= 0) - throw new System.ArgumentException($"PackageMaxSize is invalid : {packageBodyMaxSize}"); - - _context = context; - _socket = socket; - _socket.NoDelay = true; - - // 创建编码解码器 - _packageBodyMaxSize = packageBodyMaxSize; - _packageEncoder = encoder; - _packageEncoder.RigistHandleErrorCallback(HandleError); - _packageDecoder = decoder; - _packageDecoder.RigistHandleErrorCallback(HandleError); - - // 创建字节缓冲类 - // 注意:字节缓冲区长度,推荐4倍最大包体长度 - int encoderPackageMaxSize = packageBodyMaxSize + _packageEncoder.GetPackageHeaderSize(); - int decoderPakcageMaxSize = packageBodyMaxSize + _packageDecoder.GetPackageHeaderSize(); - _encodeBuffer = new RingBuffer(encoderPackageMaxSize * 4); - _decodeBuffer = new RingBuffer(decoderPakcageMaxSize * 4); - _receiveBuffer = new byte[decoderPakcageMaxSize]; - - // 创建IOCP接收类 - _receiveArgs.Completed += new EventHandler(IO_Completed); - _receiveArgs.SetBuffer(_receiveBuffer, 0, _receiveBuffer.Length); - - // 创建IOCP发送类 - _sendArgs.Completed += new EventHandler(IO_Completed); - _sendArgs.SetBuffer(_encodeBuffer.GetBuffer(), 0, _encodeBuffer.Capacity); - } - - /// - /// 检测Socket是否已连接 - /// - public bool IsConnected() - { - if (_socket == null) - return false; - return _socket.Connected; - } - - /// - /// Dispose - /// - public void Dispose() - { - try - { - if (_socket != null) - _socket.Shutdown(SocketShutdown.Both); - - _receiveArgs.Dispose(); - _sendArgs.Dispose(); - - _sendQueue.Clear(); - _receiveQueue.Clear(); - _decodeTempList.Clear(); - - _encodeBuffer.Clear(); - _decodeBuffer.Clear(); - - _isSending = false; - _isReceiving = false; - } - catch (Exception) - { - // throws if client process has already closed, so it is not necessary to catch. - } - finally - { - if (_socket != null) - { - _socket.Close(); - _socket = null; - } - } - } - - /// - /// 主线程内更新 - /// - public void Update() - { - if (_socket == null || _socket.Connected == false) - return; - - // 接收数据 - UpdateReceiving(); - - // 发送数据 - UpdateSending(); - } - private void UpdateReceiving() - { - if (_isReceiving == false) - { - _isReceiving = true; - - // 请求操作 - bool willRaiseEvent = _socket.ReceiveAsync(_receiveArgs); - if (!willRaiseEvent) - { - ProcessReceive(_receiveArgs); - } - } - } - private void UpdateSending() - { - if (_isSending == false && _sendQueue.Count > 0) - { - _isSending = true; - - // 清空缓存 - _encodeBuffer.Clear(); - - // 合并数据一起发送 - while (_sendQueue.Count > 0) - { - // 如果不够写入一个最大的消息包 - int encoderPackageMaxSize = _packageBodyMaxSize + _packageEncoder.GetPackageHeaderSize(); - if (_encodeBuffer.WriteableBytes < encoderPackageMaxSize) - break; - - // 数据压码 - INetPackage package = _sendQueue.Dequeue(); - _packageEncoder.Encode(_packageBodyMaxSize, _encodeBuffer, package); - } - - // 请求操作 - _sendArgs.SetBuffer(0, _encodeBuffer.ReadableBytes); - bool willRaiseEvent = _socket.SendAsync(_sendArgs); - if (!willRaiseEvent) - { - ProcessSend(_sendArgs); - } - } - } - - /// - /// 发送网络包 - /// - public void SendPackage(INetPackage package) - { - lock (_sendQueue) - { - _sendQueue.Enqueue(package); - } - } - - /// - /// 获取网络包 - /// - public INetPackage PickPackage() - { - INetPackage package = null; - lock (_receiveQueue) - { - if (_receiveQueue.Count > 0) - package = _receiveQueue.Dequeue(); - } - return package; - } - - - /// - /// This method is called whenever a receive or send operation is completed on a socket - /// - private void IO_Completed(object sender, SocketAsyncEventArgs e) - { - // determine which type of operation just completed and call the associated handler - switch (e.LastOperation) - { - case SocketAsyncOperation.Receive: - _context.Post(ProcessReceive, e); - break; - case SocketAsyncOperation.Send: - _context.Post(ProcessSend, e); - break; - default: - throw new ArgumentException("The last operation completed on the socket was not a receive or send"); - } - } - - /// - /// 数据接收完成时 - /// - private void ProcessReceive(object obj) - { - if (_socket == null) - return; - - SocketAsyncEventArgs e = obj as SocketAsyncEventArgs; - - // check if the remote host closed the connection - if (e.BytesTransferred > 0 && e.SocketError == SocketError.Success) - { - // 如果数据写穿 - if (_decodeBuffer.IsWriteable(e.BytesTransferred) == false) - { - HandleError(true, "The channel fatal error"); - return; - } - - // 拷贝数据 - _decodeBuffer.WriteBytes(e.Buffer, 0, e.BytesTransferred); - - // 数据解码 - _decodeTempList.Clear(); - _packageDecoder.Decode(_packageBodyMaxSize, _decodeBuffer, _decodeTempList); - lock (_receiveQueue) - { - for (int i = 0; i < _decodeTempList.Count; i++) - { - _receiveQueue.Enqueue(_decodeTempList[i]); - } - } - - // 为接收下一段数据,投递接收请求 - e.SetBuffer(0, _receiveBuffer.Length); - bool willRaiseEvent = _socket.ReceiveAsync(e); - if (!willRaiseEvent) - { - ProcessReceive(e); - } - } - else - { - HandleError(true, $"ProcessReceive error : {e.SocketError}"); - } - } - - /// - /// 数据发送完成时 - /// - private void ProcessSend(object obj) - { - if (_socket == null) - return; - - SocketAsyncEventArgs e = obj as SocketAsyncEventArgs; - if (e.SocketError == SocketError.Success) - { - _isSending = false; - } - else - { - HandleError(true, $"ProcessSend error : {e.SocketError}"); - } - } - - /// - /// 捕获异常错误 - /// - private void HandleError(bool isDispose, string error) - { - UniLogger.Error(error); - if (isDispose) Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpChannel.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpChannel.cs.meta deleted file mode 100644 index 245c6e4..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpChannel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 841a2723c2b01744fb4bcd170411249f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpClient.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpClient.cs deleted file mode 100644 index 50397d6..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpClient.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; - -namespace UniFramework.Network -{ - public class TcpClient : IDisposable - { - private class UserToken - { - public System.Action Callback; - } - - private TcpChannel _channel; - private readonly int _packageBodyMaxSize; - private readonly INetPackageEncoder _encoder; - private readonly INetPackageDecoder _decoder; - private readonly ThreadSyncContext _syncContext; - - private TcpClient() - { - } - internal TcpClient(int packageBodyMaxSize, INetPackageEncoder encoder, INetPackageDecoder decoder) - { - _packageBodyMaxSize = packageBodyMaxSize; - _encoder = encoder; - _decoder = decoder; - _syncContext = new ThreadSyncContext(); - } - - /// - /// 更新网络 - /// - internal void Update() - { - _syncContext.Update(); - - if (_channel != null) - _channel.Update(); - } - - /// - /// 销毁网络 - /// - internal void Destroy() - { - Dispose(); - } - - /// - /// Dispose - /// - public void Dispose() - { - if (_channel != null) - { - _channel.Dispose(); - _channel = null; - } - } - - /// - /// 发送网络包 - /// - public void SendPackage(INetPackage package) - { - if (_channel != null) - _channel.SendPackage(package); - } - - /// - /// 获取网络包 - /// - public INetPackage PickPackage() - { - if (_channel == null) - return null; - - return _channel.PickPackage(); - } - - /// - /// 检测Socket是否已连接 - /// - public bool IsConnected() - { - if (_channel == null) - return false; - - return _channel.IsConnected(); - } - - - /// - /// 异步连接 - /// - /// IP终端 - /// 连接回调 - public void ConnectAsync(IPEndPoint remote, System.Action callback) - { - UserToken token = new UserToken() - { - Callback = callback, - }; - - SocketAsyncEventArgs args = new SocketAsyncEventArgs(); - args.RemoteEndPoint = remote; - args.Completed += new EventHandler(AcceptEventArg_Completed); - args.UserToken = token; - - Socket clientSock = new Socket(remote.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - bool willRaiseEvent = clientSock.ConnectAsync(args); - if (!willRaiseEvent) - { - ProcessConnected(args); - } - } - - /// - /// 处理连接请求 - /// - private void ProcessConnected(object obj) - { - SocketAsyncEventArgs e = obj as SocketAsyncEventArgs; - UserToken token = (UserToken)e.UserToken; - if (e.SocketError == SocketError.Success) - { - if (_channel != null) - throw new Exception("TcpClient channel is created."); - - // 创建频道 - _channel = new TcpChannel(); - _channel.InitChannel(_syncContext, e.ConnectSocket, _packageBodyMaxSize, _encoder, _decoder); - } - else - { - UniLogger.Error($"Network connecte error : {e.SocketError}"); - } - - // 回调函数 - if (token.Callback != null) - token.Callback.Invoke(e.SocketError); - } - - private void AcceptEventArg_Completed(object sender, SocketAsyncEventArgs e) - { - switch (e.LastOperation) - { - case SocketAsyncOperation.Connect: - _syncContext.Post(ProcessConnected, e); - break; - default: - throw new ArgumentException("The last operation completed on the socket was not a connect"); - } - } - } -} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpClient.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpClient.cs.meta deleted file mode 100644 index 5d0d895..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/TCP/TcpClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 23ae68566c8488c4099ef4652dd317c2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/ThreadSyncContext.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/ThreadSyncContext.cs deleted file mode 100644 index 0cc141b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/ThreadSyncContext.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Concurrent; -using System.Threading; - -namespace UniFramework.Network -{ - /// - /// 同步其它线程里的回调到主线程里 - /// 注意:Unity3D中需要设置Scripting Runtime Version为.NET4.6 - /// - internal sealed class ThreadSyncContext : SynchronizationContext - { - private readonly ConcurrentQueue _safeQueue = new ConcurrentQueue(); - - /// - /// 更新同步队列 - /// - public void Update() - { - while (true) - { - if (_safeQueue.TryDequeue(out Action action) == false) - return; - action.Invoke(); - } - } - - /// - /// 向同步队列里投递一个回调方法 - /// - public override void Post(SendOrPostCallback callback, object state) - { - Action action = new Action(() => { callback(state); }); - _safeQueue.Enqueue(action); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/ThreadSyncContext.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/ThreadSyncContext.cs.meta deleted file mode 100644 index 2ff67ea..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/ThreadSyncContext.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8dc088445ce08dc4e81bfe04a381b449 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniFramework.Network.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniFramework.Network.asmdef deleted file mode 100644 index 994608f..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniFramework.Network.asmdef +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "UniFramework.Network", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniFramework.Network.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniFramework.Network.asmdef.meta deleted file mode 100644 index e1ddb21..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniFramework.Network.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 456617c24a0e6ba4dbc9a80e49a9a021 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniLogger.cs deleted file mode 100644 index 2e5a1e3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniLogger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Diagnostics; - -namespace UniFramework.Network -{ - internal static class UniLogger - { - [Conditional("DEBUG")] - public static void Log(string info) - { - UnityEngine.Debug.Log(info); - } - public static void Warning(string info) - { - UnityEngine.Debug.LogWarning(info); - } - public static void Error(string info) - { - UnityEngine.Debug.LogError(info); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniLogger.cs.meta deleted file mode 100644 index 1d82d2b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 96bf934b4c0166c489b7b967a7c23b32 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetwork.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetwork.cs deleted file mode 100644 index 4da83ff..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetwork.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UniFramework.Network -{ - public static class UniNetwork - { - private static bool _isInitialize = false; - private static GameObject _driver = null; - private readonly static List _tcpClients = new List(); - - /// - /// 初始化网络系统 - /// - public static void Initalize() - { - if (_isInitialize) - throw new Exception($"{nameof(UniNetwork)} is initialized !"); - - if (_isInitialize == false) - { - // 创建驱动器 - _isInitialize = true; - _driver = new GameObject($"[{nameof(UniNetwork)}]"); - _driver.AddComponent(); - UnityEngine.Object.DontDestroyOnLoad(_driver); - UniLogger.Log($"{nameof(UniNetwork)} initalize !"); - } - } - - /// - /// 销毁网络系统 - /// - public static void Destroy() - { - if (_isInitialize) - { - foreach (var client in _tcpClients) - { - client.Destroy(); - } - _tcpClients.Clear(); - - _isInitialize = false; - if (_driver != null) - GameObject.Destroy(_driver); - UniLogger.Log($"{nameof(UniNetwork)} destroy all !"); - } - } - - /// - /// 更新网络系统 - /// - internal static void Update() - { - if (_isInitialize) - { - foreach (var client in _tcpClients) - { - client.Update(); - } - } - } - - /// - /// 创建TCP客户端 - /// - /// 网络包体最大长度 - public static TcpClient CreateTcpClient(int packageBodyMaxSize, INetPackageEncoder encoder, INetPackageDecoder decoder) - { - if (_isInitialize == false) - throw new Exception($"{nameof(UniNetwork)} not initialized !"); - - var client = new TcpClient(packageBodyMaxSize, encoder, decoder); - _tcpClients.Add(client); - return client; - } - - /// - /// 销毁TCP客户端 - /// - public static void DestroyTcpClient(TcpClient client) - { - if (client == null) - return; - - client.Dispose(); - _tcpClients.Remove(client); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetwork.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetwork.cs.meta deleted file mode 100644 index 868f2ed..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetwork.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6dce5e59401e1344bbd9aabf981383b5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetworkDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetworkDriver.cs deleted file mode 100644 index 687952a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetworkDriver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Network -{ - internal class UniNetworkDriver : MonoBehaviour - { - void Update() - { - UniNetwork.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetworkDriver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetworkDriver.cs.meta deleted file mode 100644 index a94f2c1..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniNetwork/Runtime/UniNetworkDriver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2490b5980d0936344a4c3574bcced111 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling.meta deleted file mode 100644 index 2f95771..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2348da7d2a69de841a7ad5508df0bf90 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/README.md deleted file mode 100644 index 7df48b0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# UniFramework.Pooling - -一个功能强大的游戏对象池系统。 - -该系统依赖于YooAsset资源系统,支持各类异步编程,支持同步接口和异步接口。 - -```c# -using UnityEngine; -using YooAsset; -using UniFramework.Pooling; - -IEnumerator Start() -{ - // 初始化游戏对象池系统 - UniPooling.Initalize(); - - // 创建孵化器 - var spawner = UniPooling.CreateSpawner("DefaultPackage"); - - // 创建Cube预制体的对象池 - var operation = spawner.CreateGameObjectPoolAsync("Cube.prefab"); - yield return operation; - - // 孵化Cube游戏对象 - SpawnHandle handle = spawner.SpawnAsync("Cube.prefab"); - yield return handle; - Debug.Log(handle.GameObj.name); - - // 回收游戏对象 - handle.Restore(); - - // 丢弃游戏对象 - handle.Discard(); -} -``` - diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/README.md.meta deleted file mode 100644 index c6d8284..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 7976cbcaa4dcfcc4b932fb01d6c0499a -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime.meta deleted file mode 100644 index 47022f2..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5904699460a22064182a5cf9129fc09e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/CreatePoolOperation.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/CreatePoolOperation.cs deleted file mode 100644 index b7da560..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/CreatePoolOperation.cs +++ /dev/null @@ -1,70 +0,0 @@ -using YooAsset; - -namespace UniFramework.Pooling -{ - public class CreatePoolOperation : GameAsyncOperation - { - private enum ESteps - { - None, - Waiting, - Done, - } - - private readonly AssetOperationHandle _handle; - private ESteps _steps = ESteps.None; - - internal CreatePoolOperation(AssetOperationHandle handle) - { - _handle = handle; - } - protected override void OnStart() - { - _steps = ESteps.Waiting; - } - protected override void OnUpdate() - { - if (_steps == ESteps.None || _steps == ESteps.Done) - return; - - if (_steps == ESteps.Waiting) - { - if (_handle.IsValid == false) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = $"{nameof(AssetOperationHandle)} is invalid."; - return; - } - - if (_handle.IsDone == false) - return; - - if (_handle.AssetObject == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = $"{nameof(AssetOperationHandle.AssetObject)} is null."; - return; - } - - _steps = ESteps.Done; - Status = EOperationStatus.Succeed; - } - } - - /// - /// 等待异步实例化结束 - /// - public void WaitForAsyncComplete() - { - if (_handle != null) - { - if (_steps == ESteps.Done) - return; - _handle.WaitForAsyncComplete(); - OnUpdate(); - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/CreatePoolOperation.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/CreatePoolOperation.cs.meta deleted file mode 100644 index b9dabf7..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/CreatePoolOperation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a5687620a17f42e4085a0e2243be7561 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs deleted file mode 100644 index 6745e29..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using YooAsset; - -namespace UniFramework.Pooling -{ - internal class GameObjectPool - { - private readonly GameObject _root; - private readonly Queue _cacheOperations; - private readonly bool _dontDestroy; - private readonly int _initCapacity; - private readonly int _maxCapacity; - private readonly float _destroyTime; - private float _lastRestoreRealTime = -1f; - - /// - /// 资源句柄 - /// - public AssetOperationHandle AssetHandle { private set; get; } - - /// - /// 资源定位地址 - /// - public string Location { private set; get; } - - /// - /// 内部缓存总数 - /// - public int CacheCount - { - get { return _cacheOperations.Count; } - } - - /// - /// 外部使用总数 - /// - public int SpawnCount { private set; get; } = 0; - - /// - /// 是否常驻不销毁 - /// - public bool DontDestroy - { - get { return _dontDestroy; } - } - - - public GameObjectPool(GameObject poolingRoot, string location, bool dontDestroy, int initCapacity, int maxCapacity, float destroyTime) - { - _root = new GameObject(location); - _root.transform.parent = poolingRoot.transform; - Location = location; - - _dontDestroy = dontDestroy; - _initCapacity = initCapacity; - _maxCapacity = maxCapacity; - _destroyTime = destroyTime; - - // 创建缓存池 - _cacheOperations = new Queue(initCapacity); - } - - /// - /// 创建对象池 - /// - public void CreatePool(ResourcePackage package) - { - // 加载游戏对象 - AssetHandle = package.LoadAssetAsync(Location); - - // 创建初始对象 - for (int i = 0; i < _initCapacity; i++) - { - var operation = AssetHandle.InstantiateAsync(_root.transform); - operation.Completed += Operation_Completed; - _cacheOperations.Enqueue(operation); - } - } - private void Operation_Completed(AsyncOperationBase obj) - { - if (obj.Status == EOperationStatus.Succeed) - { - var op = obj as InstantiateOperation; - if (op.Result != null) - op.Result.SetActive(false); - } - } - - /// - /// 销毁游戏对象池 - /// - public void DestroyPool() - { - // 卸载资源对象 - AssetHandle.Release(); - AssetHandle = null; - - // 销毁游戏对象 - GameObject.Destroy(_root); - _cacheOperations.Clear(); - - SpawnCount = 0; - } - - /// - /// 查询静默时间内是否可以销毁 - /// - public bool CanAutoDestroy() - { - if (_dontDestroy) - return false; - if (_destroyTime < 0) - return false; - - if (_lastRestoreRealTime > 0 && SpawnCount <= 0) - return (Time.realtimeSinceStartup - _lastRestoreRealTime) > _destroyTime; - else - return false; - } - - /// - /// 游戏对象池是否已经销毁 - /// - public bool IsDestroyed() - { - return AssetHandle == null; - } - - /// - /// 回收 - /// - public void Restore(InstantiateOperation operation) - { - if (IsDestroyed()) - { - DestroyInstantiateOperation(operation); - return; - } - - SpawnCount--; - if (SpawnCount <= 0) - _lastRestoreRealTime = Time.realtimeSinceStartup; - - // 如果外部逻辑销毁了游戏对象 - if (operation.Status == EOperationStatus.Succeed) - { - if (operation.Result == null) - return; - } - - // 如果缓存池还未满员 - if (_cacheOperations.Count < _maxCapacity) - { - SetRestoreGameObject(operation.Result); - _cacheOperations.Enqueue(operation); - } - else - { - DestroyInstantiateOperation(operation); - } - } - - /// - /// 丢弃 - /// - public void Discard(InstantiateOperation operation) - { - if (IsDestroyed()) - { - DestroyInstantiateOperation(operation); - return; - } - - SpawnCount--; - if (SpawnCount <= 0) - _lastRestoreRealTime = Time.realtimeSinceStartup; - - DestroyInstantiateOperation(operation); - } - - /// - /// 获取一个游戏对象 - /// - public SpawnHandle Spawn(Transform parent, Vector3 position, Quaternion rotation, bool forceClone, params System.Object[] userDatas) - { - InstantiateOperation operation; - if (forceClone == false && _cacheOperations.Count > 0) - operation = _cacheOperations.Dequeue(); - else - operation = AssetHandle.InstantiateAsync(); - - SpawnCount++; - SpawnHandle handle = new SpawnHandle(this, operation, parent, position, rotation, userDatas); - YooAssets.StartOperation(handle); - return handle; - } - - private void DestroyInstantiateOperation(InstantiateOperation operation) - { - // 取消异步操作 - operation.Cancel(); - - // 销毁游戏对象 - if (operation.Result != null) - { - GameObject.Destroy(operation.Result); - } - } - private void SetRestoreGameObject(GameObject gameObj) - { - if (gameObj != null) - { - gameObj.SetActive(false); - gameObj.transform.SetParent(_root.transform); - gameObj.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs.meta deleted file mode 100644 index 9b639eb..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1dd976626eb4ca645b4ec80921f4e8fd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/SpawnHandle.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/SpawnHandle.cs deleted file mode 100644 index ff84ecc..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/SpawnHandle.cs +++ /dev/null @@ -1,148 +0,0 @@ -using UnityEngine; -using YooAsset; - -namespace UniFramework.Pooling -{ - public sealed class SpawnHandle : GameAsyncOperation - { - private enum ESteps - { - None, - Waiting, - Done, - } - - private readonly GameObjectPool _pool; - private InstantiateOperation _operation; - private readonly Transform _parent; - private readonly Vector3 _position; - private readonly Quaternion _rotation; - private ESteps _steps = ESteps.None; - - /// - /// 实例化的游戏对象 - /// - public GameObject GameObj - { - get - { - if (_operation == null) - { - UniLogger.Warning("The spawn handle is invalid !"); - return null; - } - - return _operation.Result; - } - } - - /// - /// 用户自定义数据集 - /// - public System.Object[] UserDatas { private set; get; } - - private SpawnHandle() - { - } - internal SpawnHandle(GameObjectPool pool, InstantiateOperation operation, Transform parent, Vector3 position, Quaternion rotation, params System.Object[] userDatas) - { - _pool = pool; - _operation = operation; - _parent = parent; - _position = position; - _rotation = rotation; - UserDatas = userDatas; - } - protected override void OnStart() - { - _steps = ESteps.Waiting; - } - protected override void OnUpdate() - { - if (_steps == ESteps.None || _steps == ESteps.Done) - return; - - if (_steps == ESteps.Waiting) - { - if (_operation.IsDone == false) - return; - - if (_operation.Status != EOperationStatus.Succeed) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = _operation.Error; - return; - } - - if (_operation.Result == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = $"Clone game object is null."; - return; - } - - // 设置参数 - _operation.Result.transform.SetParent(_parent); - _operation.Result.transform.SetPositionAndRotation(_position, _rotation); - _operation.Result.SetActive(true); - - _steps = ESteps.Done; - Status = EOperationStatus.Succeed; - } - } - - /// - /// 回收 - /// - public void Restore() - { - if (_operation != null) - { - ClearCompletedCallback(); - CancelHandle(); - _pool.Restore(_operation); - _operation = null; - } - } - - /// - /// 丢弃 - /// - public void Discard() - { - if (_operation != null) - { - ClearCompletedCallback(); - CancelHandle(); - _pool.Discard(_operation); - _operation = null; - } - } - - /// - /// 等待异步实例化结束 - /// - public void WaitForAsyncComplete() - { - if (_operation != null) - { - if (_steps == ESteps.Done) - return; - _operation.WaitForAsyncComplete(); - OnUpdate(); - } - } - - private void CancelHandle() - { - if (IsDone == false) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = $"User cancelled !"; - } - } - } -} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/SpawnHandle.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/SpawnHandle.cs.meta deleted file mode 100644 index 5c010ed..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/SpawnHandle.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6350d2984a149b349b9cec658d21b12a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs deleted file mode 100644 index c46901f..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using YooAsset; - -namespace UniFramework.Pooling -{ - public class Spawner - { - private readonly List _gameObjectPools = new List(100); - private readonly List _removeList = new List(100); - private readonly GameObject _spawnerRoot; - private readonly ResourcePackage _package; - - public string PackageName - { - get - { - return _package.PackageName; - } - } - - - private Spawner() - { - } - internal Spawner(GameObject poolingRoot, ResourcePackage package) - { - _spawnerRoot = new GameObject($"{package.PackageName}"); - _spawnerRoot.transform.SetParent(poolingRoot.transform); - _package = package; - } - - /// - /// 更新游戏对象池系统 - /// - internal void Update() - { - _removeList.Clear(); - foreach (var pool in _gameObjectPools) - { - if (pool.CanAutoDestroy()) - _removeList.Add(pool); - } - - foreach (var pool in _removeList) - { - _gameObjectPools.Remove(pool); - pool.DestroyPool(); - } - } - - /// - /// 销毁游戏对象池系统 - /// - internal void Destroy() - { - DestroyAll(true); - } - - /// - /// 销毁所有对象池及其资源 - /// - /// 销毁所有对象池,包括常驻对象池 - public void DestroyAll(bool includeAll) - { - if (includeAll) - { - foreach (var pool in _gameObjectPools) - { - pool.DestroyPool(); - } - _gameObjectPools.Clear(); - } - else - { - List removeList = new List(); - foreach (var pool in _gameObjectPools) - { - if (pool.DontDestroy == false) - removeList.Add(pool); - } - foreach (var pool in removeList) - { - _gameObjectPools.Remove(pool); - pool.DestroyPool(); - } - } - } - - - /// - /// 异步创建指定资源的游戏对象池 - /// - /// 资源定位地址 - /// 资源常驻不销毁 - /// 对象池的初始容量 - /// 对象池的最大容量 - /// 静默销毁时间(注意:小于零代表不主动销毁) - public CreatePoolOperation CreateGameObjectPoolAsync(string location, bool dontDestroy = false, int initCapacity = 0, int maxCapacity = int.MaxValue, float destroyTime = -1f) - { - return CreateGameObjectPoolInternal(location, dontDestroy, initCapacity, maxCapacity, destroyTime); - } - - /// - /// 同步创建指定资源的游戏对象池 - /// - /// 资源定位地址 - /// 资源常驻不销毁 - /// 对象池的初始容量 - /// 对象池的最大容量 - /// 静默销毁时间(注意:小于零代表不主动销毁) - public CreatePoolOperation CreateGameObjectPoolSync(string location, bool dontDestroy = false, int initCapacity = 0, int maxCapacity = int.MaxValue, float destroyTime = -1f) - { - var operation = CreateGameObjectPoolInternal(location, dontDestroy, initCapacity, maxCapacity, destroyTime); - operation.WaitForAsyncComplete(); - return operation; - } - - /// - /// 创建指定资源的游戏对象池 - /// - private CreatePoolOperation CreateGameObjectPoolInternal(string location, bool dontDestroy = false, int initCapacity = 0, int maxCapacity = int.MaxValue, float destroyTime = -1f) - { - if (maxCapacity < initCapacity) - throw new Exception("The max capacity value must be greater the init capacity value."); - - GameObjectPool pool = TryGetGameObjectPool(location); - if (pool != null) - { - UniLogger.Warning($"GameObject pool is already existed : {location}"); - var operation = new CreatePoolOperation(pool.AssetHandle); - YooAssets.StartOperation(operation); - return operation; - } - else - { - pool = new GameObjectPool(_spawnerRoot, location, dontDestroy, initCapacity, maxCapacity, destroyTime); - pool.CreatePool(_package); - _gameObjectPools.Add(pool); - - var operation = new CreatePoolOperation(pool.AssetHandle); - YooAssets.StartOperation(operation); - return operation; - } - } - - - /// - /// 异步实例化一个游戏对象 - /// - /// 资源定位地址 - /// 强制克隆游戏对象,忽略缓存池里的对象 - /// 用户自定义数据 - public SpawnHandle SpawnAsync(string location, bool forceClone = false, params System.Object[] userDatas) - { - return SpawnInternal(location, null, Vector3.zero, Quaternion.identity, forceClone, userDatas); - } - - /// - /// 异步实例化一个游戏对象 - /// - /// 资源定位地址 - /// 父物体 - /// 强制克隆游戏对象,忽略缓存池里的对象 - /// 用户自定义数据 - public SpawnHandle SpawnAsync(string location, Transform parent, bool forceClone = false, params System.Object[] userDatas) - { - return SpawnInternal(location, parent, Vector3.zero, Quaternion.identity, forceClone, userDatas); - } - - /// - /// 异步实例化一个游戏对象 - /// - /// 资源定位地址 - /// 父物体 - /// 世界坐标 - /// 世界角度 - /// 强制克隆游戏对象,忽略缓存池里的对象 - /// 用户自定义数据 - public SpawnHandle SpawnAsync(string location, Transform parent, Vector3 position, Quaternion rotation, bool forceClone = false, params System.Object[] userDatas) - { - return SpawnInternal(location, parent, position, rotation, forceClone, userDatas); - } - - /// - /// 同步实例化一个游戏对象 - /// - /// 资源定位地址 - /// 强制克隆游戏对象,忽略缓存池里的对象 - /// 用户自定义数据 - public SpawnHandle SpawnSync(string location, bool forceClone = false, params System.Object[] userDatas) - { - SpawnHandle handle = SpawnInternal(location, null, Vector3.zero, Quaternion.identity, forceClone, userDatas); - handle.WaitForAsyncComplete(); - return handle; - } - - /// - /// 同步实例化一个游戏对象 - /// - /// 资源定位地址 - /// 父物体 - /// 强制克隆游戏对象,忽略缓存池里的对象 - /// 用户自定义数据 - public SpawnHandle SpawnSync(string location, Transform parent, bool forceClone = false, params System.Object[] userDatas) - { - SpawnHandle handle = SpawnInternal(location, parent, Vector3.zero, Quaternion.identity, forceClone, userDatas); - handle.WaitForAsyncComplete(); - return handle; - } - - /// - /// 同步实例化一个游戏对象 - /// - /// 资源定位地址 - /// 父物体 - /// 世界坐标 - /// 世界角度 - /// 强制克隆游戏对象,忽略缓存池里的对象 - /// 用户自定义数据 - public SpawnHandle SpawnSync(string location, Transform parent, Vector3 position, Quaternion rotation, bool forceClone = false, params System.Object[] userDatas) - { - SpawnHandle handle = SpawnInternal(location, parent, position, rotation, forceClone, userDatas); - handle.WaitForAsyncComplete(); - return handle; - } - - /// - /// 实例化一个游戏对象 - /// - private SpawnHandle SpawnInternal(string location, Transform parent, Vector3 position, Quaternion rotation, bool forceClone, params System.Object[] userDatas) - { - var pool = TryGetGameObjectPool(location); - if (pool != null) - { - return pool.Spawn(parent, position, rotation, forceClone, userDatas); - } - - // 如果不存在创建游戏对象池 - pool = new GameObjectPool(_spawnerRoot, location, false, 0, int.MaxValue, -1f); - pool.CreatePool(_package); - _gameObjectPools.Add(pool); - return pool.Spawn(parent, position, rotation, forceClone, userDatas); - } - - - private GameObjectPool TryGetGameObjectPool(string location) - { - foreach (var pool in _gameObjectPools) - { - if (pool.Location == location) - return pool; - } - return null; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs.meta deleted file mode 100644 index 9ab36a8..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6c0b7912d44674d47a5b7240670dcc87 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniFramework.Pooling.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniFramework.Pooling.asmdef deleted file mode 100644 index 67d8d9e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniFramework.Pooling.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "UniFramework.Pooling", - "rootNamespace": "", - "references": [ - "GUID:e34a5702dd353724aa315fb8011f08c3" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": true, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniFramework.Pooling.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniFramework.Pooling.asmdef.meta deleted file mode 100644 index 1f4c377..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniFramework.Pooling.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b0a84d582f6a6fa4185f67ce934d99c2 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniLogger.cs deleted file mode 100644 index 726222f..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniLogger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Diagnostics; - -namespace UniFramework.Pooling -{ - internal static class UniLogger - { - [Conditional("DEBUG")] - public static void Log(string info) - { - UnityEngine.Debug.Log(info); - } - public static void Warning(string info) - { - UnityEngine.Debug.LogWarning(info); - } - public static void Error(string info) - { - UnityEngine.Debug.LogError(info); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniLogger.cs.meta deleted file mode 100644 index 9f693e9..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 50142a5596fb6c1439dced35faef4d4c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs deleted file mode 100644 index 85d5054..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using YooAsset; - -namespace UniFramework.Pooling -{ - /// - /// 游戏对象池系统 - /// - public static class UniPooling - { - private static bool _isInitialize = false; - private static GameObject _driver = null; - private static readonly List _spawners = new List(); - - - /// - /// 初始化游戏对象池系统 - /// - public static void Initalize() - { - if (_isInitialize) - throw new Exception($"{nameof(UniPooling)} is initialized !"); - - if (_isInitialize == false) - { - // 创建驱动器 - _isInitialize = true; - _driver = new UnityEngine.GameObject($"[{nameof(UniPooling)}]"); - _driver.AddComponent(); - UnityEngine.Object.DontDestroyOnLoad(_driver); - UniLogger.Log($"{nameof(UniPooling)} initalize !"); - } - } - - /// - /// 销毁游戏对象池系统 - /// - public static void Destroy() - { - if (_isInitialize) - { - foreach (var spawner in _spawners) - { - spawner.Destroy(); - } - _spawners.Clear(); - - _isInitialize = false; - if (_driver != null) - GameObject.Destroy(_driver); - UniLogger.Log($"{nameof(UniPooling)} destroy all !"); - } - } - - /// - /// 更新游戏对象池系统 - /// - internal static void Update() - { - if (_isInitialize) - { - foreach (var spawner in _spawners) - { - spawner.Update(); - } - } - } - - /// - /// 创建游戏对象生成器 - /// - /// 资源包名称 - public static Spawner CreateSpawner(string packageName) - { - // 获取资源包 - var assetPackage = YooAssets.GetPackage(packageName); - if (assetPackage == null) - throw new Exception($"Not found asset package : {packageName}"); - - // 检测资源包初始化状态 - if (assetPackage.InitializeStatus == EOperationStatus.None) - throw new Exception($"Asset package {packageName} not initialize !"); - if (assetPackage.InitializeStatus == EOperationStatus.Failed) - throw new Exception($"Asset package {packageName} initialize failed !"); - - if (HasSpawner(packageName)) - return GetSpawner(packageName); - - Spawner spawner = new Spawner(_driver, assetPackage); - _spawners.Add(spawner); - return spawner; - } - - /// - /// 获取游戏对象生成器 - /// - /// 资源包名称 - public static Spawner GetSpawner(string packageName) - { - foreach (var spawner in _spawners) - { - if (spawner.PackageName == packageName) - return spawner; - } - - UniLogger.Warning($"Not found spawner : {packageName}"); - return null; - } - - /// - /// 检测游戏对象生成器是否存在 - /// - /// 资源包名称 - public static bool HasSpawner(string packageName) - { - foreach (var spawner in _spawners) - { - if (spawner.PackageName == packageName) - return true; - } - return false; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs.meta deleted file mode 100644 index adf5909..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04fd1800aa2e61644893fa7893d93db8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPoolingDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPoolingDriver.cs deleted file mode 100644 index b928a02..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPoolingDriver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Pooling -{ - internal class UniPoolingDriver : MonoBehaviour - { - void Update() - { - UniPooling.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPoolingDriver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPoolingDriver.cs.meta deleted file mode 100644 index 0c9ab7d..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPoolingDriver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f4112e0723ed46c45927cc3498d62e5a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton.meta deleted file mode 100644 index dd63952..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 645ad92cafefcc144b8a9811864e1d73 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md deleted file mode 100644 index ad8db66..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# UniFramework.Singleton - -一个轻量级的单例系统。 diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md.meta deleted file mode 100644 index 433a8ea..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 496f400bdfe0c6c46809be47d2a45b37 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime.meta deleted file mode 100644 index 9209c6b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: aef3e45fdde94b245841e6e62655912f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs deleted file mode 100644 index c61c8b7..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs +++ /dev/null @@ -1,21 +0,0 @@ - -namespace UniFramework.Singleton -{ - public interface ISingleton - { - /// - /// 创建单例 - /// - void OnCreate(System.Object createParam); - - /// - /// 更新单例 - /// - void OnUpdate(); - - /// - /// 销毁单例 - /// - void OnDestroy(); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs.meta deleted file mode 100644 index 74cdaad..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f4757101f8553d49ad6da27c94c50c5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs deleted file mode 100644 index 31f4426..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs +++ /dev/null @@ -1,28 +0,0 @@ - -namespace UniFramework.Singleton -{ - public abstract class SingletonInstance where T : class, ISingleton - { - private static T _instance; - public static T Instance - { - get - { - if (_instance == null) - UniLogger.Error($"{typeof(T)} is not create. Use {nameof(UniSingleton)}.{nameof(UniSingleton.CreateSingleton)} create."); - return _instance; - } - } - - protected SingletonInstance() - { - if (_instance != null) - throw new System.Exception($"{typeof(T)} instance already created."); - _instance = this as T; - } - protected void DestroyInstance() - { - _instance = null; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs.meta deleted file mode 100644 index a413c9c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9b334be14d2a937409f5e47373f819c4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniFramework.Singleton.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniFramework.Singleton.asmdef deleted file mode 100644 index 874b7db..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniFramework.Singleton.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "UniFramework.Singleton", - "rootNamespace": "", - "references": [ - "GUID:e34a5702dd353724aa315fb8011f08c3" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": true, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniFramework.Singleton.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniFramework.Singleton.asmdef.meta deleted file mode 100644 index 8bafe69..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniFramework.Singleton.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b35e33884f6755d43b7e0511e88956d0 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs deleted file mode 100644 index 191554c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Diagnostics; - -namespace UniFramework.Singleton -{ - internal static class UniLogger - { - [Conditional("DEBUG")] - public static void Log(string info) - { - UnityEngine.Debug.Log(info); - } - public static void Warning(string info) - { - UnityEngine.Debug.LogWarning(info); - } - public static void Error(string info) - { - UnityEngine.Debug.LogError(info); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs.meta deleted file mode 100644 index d9d02ac..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b2a99934c26e0304cb6292b0c40ae684 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs deleted file mode 100644 index 1b9db48..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs +++ /dev/null @@ -1,226 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace UniFramework.Singleton -{ - public static class UniSingleton - { - private class Wrapper - { - public int Priority { private set; get; } - public ISingleton Singleton { private set; get; } - - public Wrapper(ISingleton module, int priority) - { - Singleton = module; - Priority = priority; - } - } - - private static bool _isInitialize = false; - private static GameObject _driver = null; - private static readonly List _wrappers = new List(100); - private static MonoBehaviour _behaviour; - private static bool _isDirty = false; - - /// - /// 初始化单例系统 - /// - public static void Initialize() - { - if (_isInitialize) - throw new Exception($"{nameof(UniSingleton)} is initialized !"); - - if (_isInitialize == false) - { - // 创建驱动器 - _isInitialize = true; - _driver = new UnityEngine.GameObject($"[{nameof(UniSingleton)}]"); - _behaviour = _driver.AddComponent(); - UnityEngine.Object.DontDestroyOnLoad(_driver); - UniLogger.Log($"{nameof(UniSingleton)} initalize !"); - } - } - - /// - /// 销毁单例系统 - /// - public static void Destroy() - { - if (_isInitialize) - { - DestroyAll(); - - _isInitialize = false; - if (_driver != null) - GameObject.Destroy(_driver); - UniLogger.Log($"{nameof(UniSingleton)} destroy all !"); - } - } - - /// - /// 更新单例系统 - /// - internal static void Update() - { - // 如果需要重新排序 - if (_isDirty) - { - _isDirty = false; - _wrappers.Sort((left, right) => - { - if (left.Priority > right.Priority) - return -1; - else if (left.Priority == right.Priority) - return 0; - else - return 1; - }); - } - - // 轮询所有模块 - for (int i = 0; i < _wrappers.Count; i++) - { - _wrappers[i].Singleton.OnUpdate(); - } - } - - /// - /// 获取单例 - /// - public static T GetSingleton() where T : class, ISingleton - { - System.Type type = typeof(T); - for (int i = 0; i < _wrappers.Count; i++) - { - if (_wrappers[i].Singleton.GetType() == type) - return _wrappers[i].Singleton as T; - } - - UniLogger.Error($"Not found manager : {type}"); - return null; - } - - /// - /// 查询单例是否存在 - /// - public static bool Contains() where T : class, ISingleton - { - System.Type type = typeof(T); - for (int i = 0; i < _wrappers.Count; i++) - { - if (_wrappers[i].Singleton.GetType() == type) - return true; - } - return false; - } - - /// - /// 创建单例 - /// - /// 运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行 - public static T CreateSingleton(int priority = 0) where T : class, ISingleton - { - return CreateSingleton(null, priority); - } - - /// - /// 创建单例 - /// - /// 附加参数 - /// 运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行 - public static T CreateSingleton(System.Object createParam, int priority = 0) where T : class, ISingleton - { - if (priority < 0) - throw new Exception("The priority can not be negative"); - - if (Contains()) - throw new Exception($"Module is already existed : {typeof(T)}"); - - // 如果没有设置优先级 - if (priority == 0) - { - int minPriority = GetMinPriority(); - priority = --minPriority; - } - - T module = Activator.CreateInstance(); - Wrapper wrapper = new Wrapper(module, priority); - wrapper.Singleton.OnCreate(createParam); - _wrappers.Add(wrapper); - _isDirty = true; - return module; - } - - /// - /// 销毁单例 - /// - public static bool DestroySingleton() where T : class, ISingleton - { - var type = typeof(T); - for (int i = 0; i < _wrappers.Count; i++) - { - if (_wrappers[i].Singleton.GetType() == type) - { - _wrappers[i].Singleton.OnDestroy(); - _wrappers.RemoveAt(i); - return true; - } - } - return false; - } - - /// - /// 开启一个协程 - /// - public static Coroutine StartCoroutine(IEnumerator coroutine) - { - return _behaviour.StartCoroutine(coroutine); - } - public static Coroutine StartCoroutine(string methodName) - { - return _behaviour.StartCoroutine(methodName); - } - - /// - /// 停止一个协程 - /// - public static void StopCoroutine(Coroutine coroutine) - { - _behaviour.StopCoroutine(coroutine); - } - public static void StopCoroutine(string methodName) - { - _behaviour.StopCoroutine(methodName); - } - - /// - /// 停止所有协程 - /// - public static void StopAllCoroutines() - { - _behaviour.StopAllCoroutines(); - } - - private static int GetMinPriority() - { - int minPriority = 0; - for (int i = 0; i < _wrappers.Count; i++) - { - if (_wrappers[i].Priority < minPriority) - minPriority = _wrappers[i].Priority; - } - return minPriority; //小于等于零 - } - private static void DestroyAll() - { - for (int i = 0; i < _wrappers.Count; i++) - { - _wrappers[i].Singleton.OnDestroy(); - } - _wrappers.Clear(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs.meta deleted file mode 100644 index 0ef990c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b799b83d73a9cb543b2504ccb1cf796a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs deleted file mode 100644 index a252e18..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Singleton -{ - internal class UniSingletonDriver : MonoBehaviour - { - void Update() - { - UniSingleton.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs.meta deleted file mode 100644 index e28ceda..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f0b2648cd533049449e1e81d215afbd7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween.meta deleted file mode 100644 index 953684c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 13f396e17446c5545bd76be7fda54f4d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/README.md deleted file mode 100644 index 0b2bc49..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# UniFramework.Tween - -一个轻量级的补间动画系统。(扩展方便,使用灵活,功能强大) - -初始化补间动画系统 - -```c# -using UnityEngine; -using UniFramework.Tween; - -void Start() -{ - // 初始化补间动画系统 - UniTween.Initalize(); -} -``` - -传统编程 - -```c# -void Start() -{ - // 原地停留1秒,然后向上移动,停留1秒,然后同时缩小并回归原位。 - var tween = UniTween.AllocateSequence - ( - UniTween.AllocateDelay(1f), - this.transform.TweenMove(0.5f, new Vector3(0, 256, 0)), - UniTween.AllocateDelay(1f), - UniTween.AllocateParallel - ( - this.transform.TweenScaleTo(0.5f, new Vector3(0.2f, 0.2f, 1f)), - this.transform.TweenMove(0.5f, new Vector3(0, 0, 0)) - ) - ); - this.gameObject.PlayTween(tween); -} -``` - -链式编程 - -```c# -void Start() -{ - // 原地停留1秒,然后向上移动,停留1秒,然后同时缩小并回归原位。 - ITweenChain tween = UniTween.AllocateSequence(); - tween.Delay(1f). - Append(this.transform.TweenMove(0.5f, new Vector3(0, 256, 0))). - Delay(1f). - SwitchToParallel(). - Append(this.transform.TweenScaleTo(0.5f, new Vector3(0.2f, 0.2f, 1f))). - Append(this.transform.TweenMove(0.5f, new Vector3(0, 0, 0))); - this.gameObject.PlayTween(tween); -} -``` - -默认的公共补间方法一共有30种,还可以使用AnimationCurve补充效果 - -```c# -public AnimationCurve EaseCurve; - -public void PlayAnim() -{ - var tween = this.transform.TweenScaleTo(1f, Vector3.zero).SetEase(EaseCurve); - UniTween.Play(tween); -} -``` - -扩展支持任意对象 - -```c# -// 扩展支持Image对象 -public static class UnityEngine_UI_Image_Tween_Extension -{ - public static ColorTween TweenColor(this Image obj, float duration, Color from, Color to) - { - ColorTween node = ColorTween.Allocate(duration, from, to); - node.SetOnUpdate((result) => { obj.color = result; }); - return node; - } - public static ColorTween TweenColorTo(this Image obj, float duration, Color to) - { - return TweenColor(obj, duration, obj.color, to); - } - public static ColorTween TweenColorFrom(this Image obj, float duration, Color from) - { - return TweenColor(obj, duration, from, obj.color); - } -} -``` - diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/README.md.meta deleted file mode 100644 index 1e8f028..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ac85f5ddcea96cd46931986ac50d5204 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime.meta deleted file mode 100644 index 3bb6307..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f3cdaa08c50e0dd4c940fb957314cf2d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenLoop.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenLoop.cs deleted file mode 100644 index 5569aea..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenLoop.cs +++ /dev/null @@ -1,24 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 补间循环类型 - /// - public enum ETweenLoop - { - /// - /// 只执行一次 - /// - None, - - /// - /// 从头执行 - /// - Restart, - - /// - /// 反复执行 - /// - PingPong, - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenLoop.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenLoop.cs.meta deleted file mode 100644 index 22a8cd7..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenLoop.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1391131ea350c9640a05910d947a38b8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenStatus.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenStatus.cs deleted file mode 100644 index 2bafdf6..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenStatus.cs +++ /dev/null @@ -1,29 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 补间动画状态 - /// - public enum ETweenStatus - { - /// - /// 空闲状态 - /// - Idle, - - /// - /// 运行中 - /// - Runing, - - /// - /// 已经完成 - /// - Completed, - - /// - /// 已被终止 - /// - Abort, - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenStatus.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenStatus.cs.meta deleted file mode 100644 index ef4c580..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ETweenStatus.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 315dd5291803c6b40a9ab70933c4d50b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenChain.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenChain.cs deleted file mode 100644 index 09de75b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenChain.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace UniFramework.Tween -{ - public interface ITweenChain - { - ITweenChain Append(ITweenNode node); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenChain.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenChain.cs.meta deleted file mode 100644 index fe790ee..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenChain.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1a69c912d23f3f446aa6dee33054bcc1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenNode.cs deleted file mode 100644 index 82e50fc..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenNode.cs +++ /dev/null @@ -1,15 +0,0 @@ - -namespace UniFramework.Tween -{ - public interface ITweenNode - { - /// - /// 节点状态 - /// - ETweenStatus Status { get; } - - void OnUpdate(float deltaTime); - void OnDispose(); - void Abort(); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenNode.cs.meta deleted file mode 100644 index 61a9ba8..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/ITweenNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d96ae9e29e307e44087fc62fdc6fc259 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain.meta deleted file mode 100644 index 024641d..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 466dbe54c22685f48b0bc73113a7edd1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain/TweenChainExtension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain/TweenChainExtension.cs deleted file mode 100644 index 0f380e9..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain/TweenChainExtension.cs +++ /dev/null @@ -1,126 +0,0 @@ - -namespace UniFramework.Tween -{ - public static partial class TweenChainExtension - { - /// - /// 执行节点 - /// - public static ITweenChain Execute(this ITweenChain chain, System.Action execute) - { - return chain.Append(UniTween.AllocateExecute(execute)); - } - - /// - /// 条件等待节点 - /// - public static ITweenChain Until(this ITweenChain chain, System.Func condition) - { - return chain.Append(UniTween.AllocateUntil(condition)); - } - - - /// - /// 并行执行的复合节点 - /// - public static ITweenChain AppendParallel(this ITweenChain chain, params ITweenNode[] nodes) - { - var node = UniTween.AllocateParallel(nodes); - chain.Append(node); - return chain; - } - - /// - /// 顺序执行的复合节点 - /// - public static ITweenChain AppendSequence(this ITweenChain chain, params ITweenNode[] nodes) - { - var node = UniTween.AllocateSequence(nodes); - chain.Append(node); - return chain; - } - - /// - /// 随机执行的复合节点 - /// - public static ITweenChain AppendSelector(this ITweenChain chain, params ITweenNode[] nodes) - { - var node = UniTween.AllocateSelector(nodes); - chain.Append(node); - return chain; - } - - - /// - /// 并行执行的复合节点 - /// - public static ITweenChain SwitchToParallel(this ITweenChain chain, params ITweenNode[] nodes) - { - var node = UniTween.AllocateParallel(nodes); - chain.Append(node); - return node; - } - - /// - /// 顺序执行的复合节点 - /// - public static ITweenChain SwitchToSequence(this ITweenChain chain, params ITweenNode[] nodes) - { - var node = UniTween.AllocateSequence(nodes); - chain.Append(node); - return node; - } - - /// - /// 随机执行的复合节点 - /// - public static ITweenChain SwitchToSelector(this ITweenChain chain, params ITweenNode[] nodes) - { - var node = UniTween.AllocateSelector(nodes); - chain.Append(node); - return node; - } - - - /// - /// 延迟计时节点 - /// - public static ITweenChain Delay(this ITweenChain chain, float delay, System.Action trigger = null) - { - return chain.Append(UniTween.AllocateDelay(delay, trigger)); - } - - /// - /// 重复计时节点 - /// 注意:该节点为无限时长 - /// - public static ITweenChain Repeat(this ITweenChain chain, float delay, float interval, System.Action trigger = null) - { - return chain.Append(UniTween.AllocateRepeat(delay, interval, trigger)); - } - - /// - /// 重复计时节点 - /// - public static ITweenChain Repeat(this ITweenChain chain, float delay, float interval, float duration, System.Action trigger = null) - { - return chain.Append(UniTween.AllocateRepeat(delay, interval, duration, trigger)); - } - - /// - /// 重复计时节点 - /// - public static ITweenChain Repeat(this ITweenChain chain, float delay, float interval, long maxRepeatCount, System.Action trigger = null) - { - return chain.Append(UniTween.AllocateRepeat(delay, interval, maxRepeatCount, trigger)); - } - - /// - /// 持续计时节点 - /// - public static ITweenChain Duration(this ITweenChain chain, float delay, float duration, System.Action trigger = null) - { - return chain.Append(UniTween.AllocateDuration(delay, duration, trigger)); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain/TweenChainExtension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain/TweenChainExtension.cs.meta deleted file mode 100644 index 0614d2b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenChain/TweenChainExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7f62323a6b951174b9a207f7e8d3971b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenEase.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenEase.cs deleted file mode 100644 index 29dd736..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenEase.cs +++ /dev/null @@ -1,228 +0,0 @@ -//-------------------------------------------------- -// Author : David Ochmann -// Website:https://easings.net/ -//-------------------------------------------------- -using System; - -namespace UniFramework.Tween -{ - /// - /// 公共补间方法 - /// - public static class TweenEase - { - public static class Linear - { - public static float Default(float t, float b, float c, float d) - { - return c * t / d + b; - } - public static float EaseIn(float t, float b, float c, float d) - { - return c * t / d + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return c * t / d + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - return c * t / d + b; - } - } - public static class Sine - { - public static float EaseIn(float t, float b, float c, float d) - { - return -c * (float)Math.Cos(t / d * ((float)Math.PI / 2)) + c + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return c * (float)Math.Sin(t / d * ((float)Math.PI / 2)) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - return -c / 2f * ((float)Math.Cos((float)Math.PI * t / d) - 1) + b; - } - } - public static class Quad - { - public static float EaseIn(float t, float b, float c, float d) - { - return c * (t /= d) * t + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return -c * (t /= d) * (t - 2) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - if ((t /= d / 2) < 1) return c / 2 * t * t + b; - return -c / 2 * ((--t) * (t - 2) - 1) + b; - } - } - public static class Cubic - { - public static float EaseIn(float t, float b, float c, float d) - { - return c * (t /= d) * t * t + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return c * ((t = t / d - 1) * t * t + 1) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; - return c / 2 * ((t -= 2) * t * t + 2) + b; - } - } - public static class Quart - { - public static float EaseIn(float t, float b, float c, float d) - { - return c * (t /= d) * t * t * t + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return -c * ((t = t / d - 1) * t * t * t - 1) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; - return -c / 2 * ((t -= 2) * t * t * t - 2) + b; - } - } - public static class Quint - { - public static float EaseIn(float t, float b, float c, float d) - { - return c * (t /= d) * t * t * t * t + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return c * ((t = t / d - 1) * t * t * t * t + 1) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; - return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; - } - } - public static class Expo - { - public static float EaseIn(float t, float b, float c, float d) - { - return (t == 0) ? b : c * (float)Math.Pow(2, 10 * (t / d - 1)) + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return (t == d) ? b + c : c * (-(float)Math.Pow(2, -10 * t / d) + 1) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - if (t == 0) return b; - if (t == d) return b + c; - if ((t /= d / 2) < 1) return c / 2 * (float)Math.Pow(2, 10 * (t - 1)) + b; - return c / 2 * (-(float)Math.Pow(2, -10 * --t) + 2) + b; - } - } - public static class Circ - { - public static float EaseIn(float t, float b, float c, float d) - { - return -c * ((float)Math.Sqrt(1 - (t /= d) * t) - 1) + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - return c * (float)Math.Sqrt(1 - (t = t / d - 1) * t) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - if ((t /= d / 2) < 1) return -c / 2 * ((float)Math.Sqrt(1 - t * t) - 1) + b; - return c / 2 * ((float)Math.Sqrt(1 - (t -= 2) * t) + 1) + b; - } - } - public static class Back - { - public static float EaseIn(float t, float b, float c, float d) - { - float s = 1.70158f; - return c * (t /= d) * t * ((s + 1) * t - s) + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - float s = 1.70158f; - return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; - } - public static float EaseInOut(float t, float b, float c, float d) - { - float s = 1.70158f; - if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525f)) + 1) * t - s)) + b; - return c / 2 * ((t -= 2) * t * (((s *= (1.525f)) + 1) * t + s) + 2) + b; - } - } - public static class Elastic - { - public static float EaseIn(float t, float b, float c, float d) - { - if (t == 0) return b; if ((t /= d) == 1) return b + c; float p = d * .3f; - - float a = c; - float s = p / 4; - - return -(a * (float)Math.Pow(2, 10 * (t -= 1)) * (float)Math.Sin((t * d - s) * (2 * (float)Math.PI) / p)) + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - if (t == 0) return b; if ((t /= d) == 1) return b + c; float p = d * .3f; - - float a = c; - float s = p / 4; - - return (a * (float)Math.Pow(2, -10 * t) * (float)Math.Sin((t * d - s) * (2 * (float)Math.PI) / p) + c + b); - } - public static float EaseInOut(float t, float b, float c, float d) - { - if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; float p = d * (.3f * 1.5f); - - float a = c; - float s = p / 4; - - if (t < 1) return -.5f * (a * (float)Math.Pow(2, 10 * (t -= 1)) * (float)Math.Sin((t * d - s) * (2 * (float)Math.PI) / p)) + b; - return a * (float)Math.Pow(2, -10 * (t -= 1)) * (float)Math.Sin((t * d - s) * (2 * (float)Math.PI) / p) * .5f + c + b; - } - } - public static class Bounce - { - public static float EaseIn(float t, float b, float c, float d) - { - return c - Bounce.EaseOut(d - t, 0, c, d) + b; - } - public static float EaseOut(float t, float b, float c, float d) - { - if ((t /= d) < (1 / 2.75f)) - { - return c * (7.5625f * t * t) + b; - } - else if (t < (2 / 2.75f)) - { - return c * (7.5625f * (t -= (1.5f / 2.75f)) * t + .75f) + b; - } - else if (t < (2.5f / 2.75f)) - { - return c * (7.5625f * (t -= (2.25f / 2.75f)) * t + .9375f) + b; - } - else - { - return c * (7.5625f * (t -= (2.625f / 2.75f)) * t + .984375f) + b; - } - } - public static float EaseInOut(float t, float b, float c, float d) - { - if (t < d / 2) return Bounce.EaseIn(t * 2, 0, c, d) * .5f + b; - else return Bounce.EaseOut(t * 2 - d, 0, c, d) * .5f + c * .5f + b; - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenEase.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenEase.cs.meta deleted file mode 100644 index fa0abdf..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenEase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f73be75c1e900a64bab71022ae49d368 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension.meta deleted file mode 100644 index 54cad7e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 688bba5b21bb5fa40ac50ba0292aae82 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_CanvasGroup_Tween_Extension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_CanvasGroup_Tween_Extension.cs deleted file mode 100644 index 40b2357..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_CanvasGroup_Tween_Extension.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UniFramework.Tween; - -namespace UnityEngine -{ - public static class UnityEngine_CanvasGroup_Tween_Extension - { - public static FloatTween TweenAlpha(this CanvasGroup obj, float duration, float from, float to) - { - FloatTween node = FloatTween.Allocate(duration, from, to); - node.SetOnUpdate((result) => { obj.alpha = result; }); - return node; - } - public static FloatTween TweenAlphaTo(this CanvasGroup obj, float duration, float to) - { - return TweenAlpha(obj, duration, obj.alpha, to); - } - public static FloatTween TweenAlphaFrom(this CanvasGroup obj, float duration, float from) - { - return TweenAlpha(obj, duration, from, obj.alpha); - } - } -} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_CanvasGroup_Tween_Extension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_CanvasGroup_Tween_Extension.cs.meta deleted file mode 100644 index 09ed09d..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_CanvasGroup_Tween_Extension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8852afd144dfb644d9828c95d09536fd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_GameObject_Tween_Extension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_GameObject_Tween_Extension.cs deleted file mode 100644 index 9487ef2..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_GameObject_Tween_Extension.cs +++ /dev/null @@ -1,31 +0,0 @@ -using UniFramework.Tween; - -namespace UnityEngine -{ - public static class UnityEngine_GameObject_Tween_Extension - { - /// - /// 播放补间动画 - /// - public static TweenHandle PlayTween(this GameObject go, ITweenNode tweenRoot) - { - return UniTween.Play(tweenRoot, go); - } - - /// - /// 播放补间动画 - /// - public static TweenHandle PlayTween(this GameObject go, ITweenChain tweenRoot) - { - return UniTween.Play(tweenRoot, go); - } - - /// - /// 播放补间动画 - /// - public static TweenHandle PlayTween(this GameObject go, ChainNode tweenRoot) - { - return UniTween.Play(tweenRoot, go); - } - } -} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_GameObject_Tween_Extension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_GameObject_Tween_Extension.cs.meta deleted file mode 100644 index 5bf4645..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_GameObject_Tween_Extension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 257bf3445be76d349a37454396799650 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_RectTransform_Tween_Extension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_RectTransform_Tween_Extension.cs deleted file mode 100644 index 3efe150..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_RectTransform_Tween_Extension.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UniFramework.Tween; - -namespace UnityEngine -{ - public static class UnityEngine_RectTransform_Tween_Extension - { - public static Vector2Tween TweenAnchoredPosition(this RectTransform obj, float duration, Vector2 from, Vector2 to) - { - Vector2Tween node = Vector2Tween.Allocate(duration, from, to); - node.SetOnUpdate( - (result) => - { - obj.anchoredPosition = result; - }); - return node; - } - public static Vector2Tween TweenAnchoredPositionTo(this RectTransform obj, float duration, Vector2 to) - { - return TweenAnchoredPosition(obj, duration, obj.anchoredPosition, to); - } - public static Vector2Tween TweenAnchoredPositionFrom(this RectTransform obj, float duration, Vector2 from) - { - return TweenAnchoredPosition(obj, duration, from, obj.anchoredPosition); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_RectTransform_Tween_Extension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_RectTransform_Tween_Extension.cs.meta deleted file mode 100644 index 0f30928..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_RectTransform_Tween_Extension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6c8bdaa0ab683904f9b5c002995e43e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_Transform_Tween_Extension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_Transform_Tween_Extension.cs deleted file mode 100644 index 7cd48c3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_Transform_Tween_Extension.cs +++ /dev/null @@ -1,137 +0,0 @@ -using UniFramework.Tween; - -namespace UnityEngine -{ - public static class UnityEngine_Transform_Tween_Extension - { - public static Vector3Tween TweenScale(this Transform obj, float duration, Vector3 from, Vector3 to) - { - Vector3Tween node = Vector3Tween.Allocate(duration, from, to); - node.SetOnUpdate((result) => { obj.localScale = result; }); - return node; - } - public static Vector3Tween TweenScaleTo(this Transform obj, float duration, Vector3 to) - { - return TweenScale(obj, duration, obj.localScale, to); - } - public static Vector3Tween TweenScaleFrom(this Transform obj, float duration, Vector3 from) - { - return TweenScale(obj, duration, from, obj.localScale); - } - - public static Vector3Tween ShakePosition(this Transform obj, float duration, Vector3 magnitude, bool relativeWorld = false) - { - Vector3 position = relativeWorld ? obj.position : obj.localPosition; - Vector3Tween node = Vector3Tween.Allocate(duration, position, position); - node.SetOnUpdate( - (result) => - { - if (relativeWorld) - obj.position = result; - else - obj.localPosition = result; - }); - node.SetLerp( - (from, to, progress) => - { - return TweenMath.Shake(magnitude, from, progress); - }); - node.SetLoop(ETweenLoop.PingPong, 1); - return node; - } - public static Vector3Tween TweenMove(this Transform obj, float duration, Vector3 dest, bool relativeWorld = false) - { - Vector3Tween node = Vector3Tween.Allocate(duration, dest, dest); - node.SetOnUpdate( - (result) => - { - if (relativeWorld) - obj.position = result; - else - obj.localPosition = result; - }); - node.SetOnBegin( - () => - { - if (relativeWorld) - node.SetValueFrom(obj.position); - else - node.SetValueFrom(obj.localPosition); - } - ); - return node; - } - public static Vector3Tween TweenPosition(this Transform obj, float duration, Vector3 from, Vector3 to, bool relativeWorld = false) - { - Vector3Tween node = Vector3Tween.Allocate(duration, from, to); - node.SetOnUpdate( - (result) => - { - if (relativeWorld) - obj.position = result; - else - obj.localPosition = result; - }); - return node; - } - public static Vector3Tween TweenPositionTo(this Transform obj, float duration, Vector3 to, bool relativeWorld = false) - { - Vector3 from = relativeWorld ? obj.position : obj.localPosition; - return TweenPosition(obj, duration, from, to, relativeWorld); - } - public static Vector3Tween TweenPositionFrom(this Transform obj, float duration, Vector3 from, bool relativeWorld = false) - { - Vector3 to = relativeWorld ? obj.position : obj.localPosition; - return TweenPosition(obj, duration, from, to, relativeWorld); - } - - public static Vector3Tween TweenAngles(this Transform obj, float duration, Vector3 from, Vector3 to, bool relativeWorld = false) - { - Vector3Tween node = Vector3Tween.Allocate(duration, from, to); - node.SetOnUpdate( - (result) => - { - if (relativeWorld) - obj.eulerAngles = result; - else - obj.localEulerAngles = result; - }); - node.SetLerp(TweenMath.AngleLerp); - return node; - } - public static Vector3Tween TweenAnglesTo(this Transform obj, float duration, Vector3 to, bool relativeWorld = false) - { - Vector3 from = relativeWorld ? obj.eulerAngles : obj.localEulerAngles; - return TweenAngles(obj, duration, from, to, relativeWorld); - } - public static Vector3Tween TweenAnglesFrom(this Transform obj, float duration, Vector3 from, bool relativeWorld = false) - { - Vector3 to = relativeWorld ? obj.eulerAngles : obj.localEulerAngles; - return TweenAngles(obj, duration, from, to, relativeWorld); - } - - public static QuaternionTween TweenRotation(this Transform obj, float duration, Quaternion from, Quaternion to, bool relativeWorld = false) - { - QuaternionTween node = QuaternionTween.Allocate(duration, from, to); - node.SetOnUpdate( - (result) => - { - if (relativeWorld) - obj.rotation = result; - else - obj.localRotation = result; - }); - return node; - } - public static QuaternionTween TweenRotationTo(this Transform obj, float duration, Quaternion to, bool relativeWorld = false) - { - Quaternion from = relativeWorld ? obj.rotation : obj.localRotation; - return TweenRotation(obj, duration, from, to, relativeWorld); - } - public static QuaternionTween TweenRotationFrom(this Transform obj, float duration, Quaternion from, bool relativeWorld = false) - { - Quaternion to = relativeWorld ? obj.rotation : obj.localRotation; - return TweenRotation(obj, duration, from, to, relativeWorld); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_Transform_Tween_Extension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_Transform_Tween_Extension.cs.meta deleted file mode 100644 index a081e54..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_Transform_Tween_Extension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3848269d8b1e18e4fab08c34a729fc36 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Image_Tween_Extension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Image_Tween_Extension.cs deleted file mode 100644 index 9e76390..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Image_Tween_Extension.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UniFramework.Tween; - -namespace UnityEngine.UI -{ - public static class UnityEngine_UI_Image_Tween_Extension - { - public static ColorTween TweenColor(this Image obj, float duration, Color from, Color to) - { - ColorTween node = ColorTween.Allocate(duration, from, to); - node.SetOnUpdate((result) => { obj.color = result; }); - return node; - } - public static ColorTween TweenColorTo(this Image obj, float duration, Color to) - { - return TweenColor(obj, duration, obj.color, to); - } - public static ColorTween TweenColorFrom(this Image obj, float duration, Color from) - { - return TweenColor(obj, duration, from, obj.color); - } - } -} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Image_Tween_Extension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Image_Tween_Extension.cs.meta deleted file mode 100644 index 53468a5..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Image_Tween_Extension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dc5c855c625d63e429c5975f4c87ae20 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Text_Tween_Extension.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Text_Tween_Extension.cs deleted file mode 100644 index 6af1889..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Text_Tween_Extension.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UniFramework.Tween; - -namespace UnityEngine.UI -{ - public static class UnityEngine_UI_Text_Tween_Extension - { - public static ColorTween TweenColor(this Text obj, float duration, Color from, Color to) - { - ColorTween node = ColorTween.Allocate(duration, from, to); - node.SetOnUpdate((result) => { obj.color = result; }); - return node; - } - public static ColorTween TweenColorTo(this Text obj, float duration, Color to) - { - return TweenColor(obj, duration, obj.color, to); - } - public static ColorTween TweenColorFrom(this Text obj, float duration, Color from) - { - return TweenColor(obj, duration, from, obj.color); - } - } -} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Text_Tween_Extension.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Text_Tween_Extension.cs.meta deleted file mode 100644 index 687fe05..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenExtension/UnityEngine_UI_Text_Tween_Extension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 65a5efc0be7931241ba1ad7ea25398d5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenHandle.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenHandle.cs deleted file mode 100644 index 0da22dd..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenHandle.cs +++ /dev/null @@ -1,90 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 补间动画句柄 - /// - public class TweenHandle - { - private readonly ITweenNode _tweenRoot; - private readonly UnityEngine.Object _unityObject; - private readonly bool _safeMode; - private bool _hasException = false; - internal int InstanceID { private set; get; } - - private TweenHandle() - { - } - internal TweenHandle(ITweenNode tweenRoot, UnityEngine.Object unityObject) - { - _tweenRoot = tweenRoot; - _unityObject = unityObject; - - if (unityObject == null) - { - InstanceID = 0; - _safeMode = false; - } - else - { - InstanceID = unityObject.GetInstanceID(); - _safeMode = true; - } - } - internal void Update(float deltaTime) - { - try - { - _tweenRoot.OnUpdate(deltaTime); - } - catch (System.Exception e) - { - _hasException = true; - UniLogger.Warning($"TweenNode has exception : {e}"); - } - } - internal void Dispose() - { - try - { - _tweenRoot.OnDispose(); - } - catch(System.Exception e) - { - UniLogger.Warning($"TweenNode has exception : {e}"); - } - } - internal bool IsCanRemove() - { - // 检测游戏对象是否销毁 - if (_safeMode) - { - if (_unityObject == null) - { - _tweenRoot.Abort(); - return true; - } - } - - // 检测运行过程是否发生异常 - if (_hasException) - { - _tweenRoot.Abort(); - return true; - } - - if (_tweenRoot.Status == ETweenStatus.Abort || _tweenRoot.Status == ETweenStatus.Completed) - return true; - else - return false; - } - - /// - /// 终止补间动画 - /// - public void Abort() - { - _tweenRoot.Abort(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenHandle.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenHandle.cs.meta deleted file mode 100644 index 6dadae0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenHandle.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 20d19c757b8deb54790d4fb99e8a5315 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenMath.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenMath.cs deleted file mode 100644 index dbc9235..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenMath.cs +++ /dev/null @@ -1,65 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Tween -{ - public static class TweenMath - { - /// - /// 角度插值 - /// - public static Vector3 AngleLerp(Vector3 from, Vector3 to, float progress) - { - float x = Mathf.LerpAngle(from.x, to.x, progress); - float y = Mathf.LerpAngle(from.y, to.y, progress); - float z = Mathf.LerpAngle(from.z, to.z, progress); - Vector3 result = new Vector3(x, y, z); - return result; - } - - /// - /// 二阶贝塞尔曲线 - /// - public static Vector3 QuadBezier(Vector3 p1, Vector3 c, Vector3 p2, float progress) - { - float t = progress; - float d = 1f - t; - return d * d * p1 + 2f * d * t * c + t * t * p2; - } - - /// - /// 三阶贝塞尔曲线 - /// - public static Vector3 CubicBezier(Vector3 p1, Vector3 c1, Vector3 c2, Vector3 p2, float progress) - { - float t = progress; - float d = 1f - t; - return d * d * d * p1 + 3f * d * d * t * c1 + 3f * d * t * t * c2 + t * t * t * p2; - } - - /// - /// 样条曲线 - /// - public static Vector3 CatmullRoom(Vector3 c1, Vector3 p1, Vector3 p2, Vector3 c2, float progress) - { - float t = progress; - return .5f * - ( - (-c1 + 3f * p1 - 3f * p2 + c2) * (t * t * t) - + (2f * c1 - 5f * p1 + 4f * p2 - c2) * (t * t) - + (-c1 + p2) * t - + 2f * p1 - ); - } - - /// - /// 震动采样 - /// - public static Vector3 Shake(Vector3 magnitude, Vector3 position, float progress) - { - float x = Random.Range(-magnitude.x, magnitude.x) * progress; - float y = Random.Range(-magnitude.y, magnitude.y) * progress; - float z = Random.Range(-magnitude.z, magnitude.z) * progress; - return position + new Vector3(x, y, z); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenMath.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenMath.cs.meta deleted file mode 100644 index 466105e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenMath.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0a8b3a494b08ef3408b6f52b5abe7db2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode.meta deleted file mode 100644 index 7594f67..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f1ce3e0893e80104fbc320d03a5bf5bc -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ChainNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ChainNode.cs deleted file mode 100644 index 404aeb3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ChainNode.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System.Collections.Generic; - -namespace UniFramework.Tween -{ - /// - /// 复合节点基类 - /// - public abstract class ChainNode : ITweenNode, ITweenChain - { - protected List _nodes = new List(); - - private System.Action _onBegin = null; - private System.Action _onComplete = null; - private System.Action _onDispose = null; - - /// - /// 节点状态 - /// - public ETweenStatus Status { private set; get; } = ETweenStatus.Idle; - - - /// - /// 添加节点 - /// - public void AddNode(ITweenNode node) - { - if (_nodes.Contains(node) == false) - _nodes.Add(node); - } - - /// - /// 添加节点 - /// - /// - public void AddNode(params ITweenNode[] nodes) - { - foreach (var node in nodes) - { - AddNode(node); - } - } - - public ITweenChain SetOnBegin(System.Action onBegin) - { - _onBegin = onBegin; - return this; - } - public ITweenChain SetOnComplete(System.Action onComplete) - { - _onComplete = onComplete; - return this; - } - public ITweenChain SetDispose(System.Action onDispose) - { - _onDispose = onDispose; - return this; - } - - void ITweenNode.OnUpdate(float deltaTime) - { - if (Status == ETweenStatus.Idle) - { - Status = ETweenStatus.Runing; - _onBegin?.Invoke(); - } - - if (Status == ETweenStatus.Runing) - { - bool isComplete = UpdateChainNodes(deltaTime); - if (isComplete) - { - Status = ETweenStatus.Completed; - _onComplete?.Invoke(); - } - } - } - void ITweenNode.OnDispose() - { - foreach (var node in _nodes) - { - node.OnDispose(); - } - _nodes.Clear(); - _onDispose?.Invoke(); - } - void ITweenNode.Abort() - { - foreach (var node in _nodes) - { - node.Abort(); - } - Status = ETweenStatus.Abort; - } - - ITweenChain ITweenChain.Append(ITweenNode node) - { - AddNode(node); - return this; - } - - protected abstract bool UpdateChainNodes(float deltaTime); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ChainNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ChainNode.cs.meta deleted file mode 100644 index 99f8511..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ChainNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a7a4c117e42263644943d618569e16fd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ExecuteNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ExecuteNode.cs deleted file mode 100644 index 94facfa..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ExecuteNode.cs +++ /dev/null @@ -1,47 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 执行节点 - /// - public sealed class ExecuteNode : ITweenNode - { - private System.Action _execute = null; - - /// - /// 节点状态 - /// - public ETweenStatus Status { private set; get; } = ETweenStatus.Idle; - - - /// - /// 设置执行方法 - /// - public ExecuteNode SetExecute(System.Action execute) - { - _execute = execute; - return this; - } - - void ITweenNode.OnUpdate(float deltaTime) - { - if (Status == ETweenStatus.Idle) - { - Status = ETweenStatus.Runing; - } - - if (Status == ETweenStatus.Runing) - { - _execute?.Invoke(); - Status = ETweenStatus.Completed; - } - } - void ITweenNode.OnDispose() - { - } - void ITweenNode.Abort() - { - Status = ETweenStatus.Abort; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ExecuteNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ExecuteNode.cs.meta deleted file mode 100644 index 174da4c..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ExecuteNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c0e71daf2e3846f438e94207f355c106 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ParallelNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ParallelNode.cs deleted file mode 100644 index 86a5435..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ParallelNode.cs +++ /dev/null @@ -1,25 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 并行执行的复合节点 - /// 说明:节点列表并行执行,所有子节点同时执行,所有节点都结束时复合节点结束。 - /// - public sealed class ParallelNode : ChainNode - { - protected override bool UpdateChainNodes(float deltaTime) - { - bool isComplete = true; - for (int index = 0; index < _nodes.Count; index++) - { - var node = _nodes[index]; - node.OnUpdate(deltaTime); - if (node.Status == ETweenStatus.Idle || node.Status == ETweenStatus.Runing) - { - isComplete = false; - } - } - return isComplete; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ParallelNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ParallelNode.cs.meta deleted file mode 100644 index a35d1e1..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ParallelNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 53828e1dbd1e0ef4fa95b13237dbd166 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SelectorNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SelectorNode.cs deleted file mode 100644 index a94234a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SelectorNode.cs +++ /dev/null @@ -1,36 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 随机执行的复合节点 - /// 说明:节点列表随机执行,在随机节点结束后复合节点结束。 - /// - public sealed class SelectorNode : ChainNode - { - private ITweenNode _selectNode = null; - - protected override bool UpdateChainNodes(float deltaTime) - { - if (_selectNode == null) - { - if (_nodes.Count > 0) - { - int index = UnityEngine.Random.Range(0, _nodes.Count); - _selectNode = _nodes[index]; - } - } - - if (_selectNode != null) - { - _selectNode.OnUpdate(deltaTime); - if (_selectNode.Status == ETweenStatus.Idle || _selectNode.Status == ETweenStatus.Runing) - return false; - else - return true; - } - - // 如果没有执行节点直接返回完成 - return true; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SelectorNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SelectorNode.cs.meta deleted file mode 100644 index e548dcc..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SelectorNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 35ae6d86b02c78d4baa5c5b45112304e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SequenceNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SequenceNode.cs deleted file mode 100644 index f6969e8..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SequenceNode.cs +++ /dev/null @@ -1,26 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 顺序执行的复合节点 - /// 说明:节点列表依次执行,每个子节点结束之后便执行下一个节点,所有节点都结束时复合节点结束。 - /// - public sealed class SequenceNode : ChainNode - { - protected override bool UpdateChainNodes(float deltaTime) - { - bool isComplete = true; - for (int index = 0; index < _nodes.Count; index++) - { - var node = _nodes[index]; - node.OnUpdate(deltaTime); - if (node.Status == ETweenStatus.Idle || node.Status == ETweenStatus.Runing) - { - isComplete = false; - break; - } - } - return isComplete; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SequenceNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SequenceNode.cs.meta deleted file mode 100644 index 54eb437..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/SequenceNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: de086a12be6a3f04ea3e6edac31cd23c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/TimerNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/TimerNode.cs deleted file mode 100644 index 3901c38..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/TimerNode.cs +++ /dev/null @@ -1,57 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 计时器节点 - /// - public sealed class TimerNode : ITweenNode - { - private readonly UniTimer _timer; - private System.Action _trigger; - - /// - /// 节点状态 - /// - public ETweenStatus Status { private set; get; } = ETweenStatus.Idle; - - - public TimerNode(UniTimer timer) - { - _timer = timer; - } - - /// - /// 设置触发方法 - /// - public TimerNode SetTrigger(System.Action trigger) - { - _trigger = trigger; - return this; - } - - void ITweenNode.OnUpdate(float deltaTime) - { - if (Status == ETweenStatus.Idle) - { - Status = ETweenStatus.Runing; - } - - if (Status == ETweenStatus.Runing) - { - if (_timer.Update(deltaTime)) - _trigger?.Invoke(); - - bool result = _timer.IsOver; - if (result) - Status = ETweenStatus.Completed; - } - } - void ITweenNode.OnDispose() - { - } - void ITweenNode.Abort() - { - Status = ETweenStatus.Abort; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/TimerNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/TimerNode.cs.meta deleted file mode 100644 index 1aa5584..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/TimerNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 57190cc55d5fba24ca7f6e22dcbf38fb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/UntilNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/UntilNode.cs deleted file mode 100644 index ffc2824..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/UntilNode.cs +++ /dev/null @@ -1,55 +0,0 @@ - -namespace UniFramework.Tween -{ - /// - /// 条件等待节点 - /// - public sealed class UntilNode : ITweenNode - { - private System.Func _condition = null; - - /// - /// 节点状态 - /// - public ETweenStatus Status { private set; get; } = ETweenStatus.Idle; - - /// - /// 设置条件方法 - /// - public UntilNode SetCondition(System.Func condition) - { - _condition = condition; - return this; - } - - void ITweenNode.OnUpdate(float deltaTime) - { - if (Status == ETweenStatus.Idle) - { - Status = ETweenStatus.Runing; - } - - if (Status == ETweenStatus.Runing) - { - if (_condition == null) - { - UniLogger.Warning($"The {nameof(UntilNode)} condition is null. Set completed !"); - Status = ETweenStatus.Completed; - } - else - { - bool result = _condition.Invoke(); - if (result) - Status = ETweenStatus.Completed; - } - } - } - void ITweenNode.OnDispose() - { - } - void ITweenNode.Abort() - { - Status = ETweenStatus.Abort; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/UntilNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/UntilNode.cs.meta deleted file mode 100644 index fe0da14..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/UntilNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 010500ebd041e5b4d89e581f33e4b0d8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ValueNode.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ValueNode.cs deleted file mode 100644 index ff0ac66..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ValueNode.cs +++ /dev/null @@ -1,363 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Tween -{ - public abstract class ValueNode : ITweenNode where ValueType : struct - { - /// - /// 补间委托 - /// - /// 运行时长 - /// 起始数值 - /// 变化差值 - /// 总时长 - public delegate float TweenEaseDelegate(float t, float b, float c, float d); - - /// - /// 插值委托 - /// - /// 起始数值 - /// 目标数值 - /// 进度值 - public delegate ValueType TweenLerpDelegate(ValueType from, ValueType to, float progress); - - - private readonly float _duration; - private ValueType _valueFrom; - private ValueType _valueTo; - - private ETweenLoop _tweenLoop = ETweenLoop.None; - private int _loopCount = -1; - private long _loopCounter = 0; - private float _timeReverse = 1f; - private float _runningTime = 0; - - private System.Action _onUpdate = null; - private System.Action _onBegin = null; - private System.Action _onComplete = null; - private System.Action _onDispose = null; - protected TweenEaseDelegate _easeFun = null; - protected TweenLerpDelegate _lerpFun = null; - - /// - /// 补间结果 - /// - public ValueType Result { get; private set; } - - /// - /// 节点状态 - /// - public ETweenStatus Status { private set; get; } = ETweenStatus.Idle; - - - public ValueNode(float duration, ValueType from, ValueType to) - { - _duration = duration; - _valueFrom = from; - _valueTo = to; - _easeFun = TweenEase.Linear.Default; - } - void ITweenNode.OnDispose() - { - _onDispose?.Invoke(); - } - void ITweenNode.OnUpdate(float deltaTime) - { - if(Status == ETweenStatus.Idle) - { - Status = ETweenStatus.Runing; - _onBegin?.Invoke(); - } - - if(Status == ETweenStatus.Runing) - { - _runningTime += (deltaTime * _timeReverse); - if (_duration > 0 && _runningTime > 0 && _runningTime < _duration) - { - float progress = _easeFun.Invoke(_runningTime, 0, 1, _duration); - Result = GetResultValue(_valueFrom, _valueTo, progress); - _onUpdate?.Invoke(Result); - } - else - { - if (_tweenLoop == ETweenLoop.None) - { - Result = _valueTo; - _onUpdate?.Invoke(Result); - - Status = ETweenStatus.Completed; - _onComplete?.Invoke(); - } - else if (_tweenLoop == ETweenLoop.Restart) - { - _runningTime = 0; - Result = _valueTo; - _onUpdate?.Invoke(Result); - - _loopCounter++; - if (_loopCount > 0 && _loopCounter >= _loopCount) - { - Status = ETweenStatus.Completed; - _onComplete?.Invoke(); - } - } - else if (_tweenLoop == ETweenLoop.PingPong) - { - _timeReverse *= -1; - if (_timeReverse > 0) - { - _runningTime = 0; - Result = _valueFrom; - _onUpdate?.Invoke(Result); - - // 注意:完整PingPong算一次 - _loopCounter++; - if (_loopCount > 0 && _loopCounter >= _loopCount) - { - Status = ETweenStatus.Completed; - _onComplete?.Invoke(); - } - } - else - { - _runningTime = _duration; - Result = _valueTo; - _onUpdate?.Invoke(Result); - } - } - else - { - throw new System.NotImplementedException(); - } - } - } - } - void ITweenNode.Abort() - { - Status = ETweenStatus.Abort; - } - - public ValueNode SetRunningTime(float runingTime) - { - _runningTime = runingTime; - return this; - } - public ValueNode SetValueFrom(ValueType value) - { - _valueFrom = value; - return this; - } - public ValueNode SetValueTo(ValueType value) - { - _valueTo = value; - return this; - } - public ValueNode SetLoop(ETweenLoop tweenLoop, int loopCount = -1) - { - _tweenLoop = tweenLoop; - _loopCount = loopCount; - return this; - } - public ValueNode SetEase(AnimationCurve easeCurve) - { - if (easeCurve == null) - { - UniLogger.Error($"{nameof(AnimationCurve)} param is null."); - return this; - } - - // 获取动画总时长 - float length = 0f; - for (int i = 0; i < easeCurve.keys.Length; i++) - { - var key = easeCurve.keys[i]; - if (key.time > length) - length = key.time; - } - - _easeFun = delegate (float t, float b, float c, float d) - { - float time = length * (t / d); - return easeCurve.Evaluate(time) * c + b; - }; - - return this; - } - public ValueNode SetEase(TweenEaseDelegate easeFun) - { - if (easeFun == null) - { - UniLogger.Error($"{nameof(TweenEaseDelegate)} param is null."); - return this; - } - - _easeFun = easeFun; - return this; - } - public ValueNode SetLerp(TweenLerpDelegate lerpFun) - { - if (lerpFun == null) - { - UniLogger.Error($"{nameof(TweenLerpDelegate)} param is null."); - return this; - } - - _lerpFun = lerpFun; - return this; - } - public ValueNode SetOnUpdate(System.Action onUpdate) - { - _onUpdate = onUpdate; - return this; - } - public ValueNode SetOnBegin(System.Action onBegin) - { - _onBegin = onBegin; - return this; - } - public ValueNode SetOnComplete(System.Action onComplete) - { - _onComplete = onComplete; - return this; - } - public ValueNode SetOnDispose(System.Action onDispose) - { - _onDispose = onDispose; - return this; - } - - protected abstract ValueType GetResultValue(ValueType from, ValueType to, float progress); - } - - /// - /// Float Tween - /// - public sealed class FloatTween : ValueNode - { - public static FloatTween Allocate(float duration, float from, float to) - { - return new FloatTween(duration, from, to); - } - - public FloatTween(float duration, float from, float to) : base(duration, from, to) - { - } - protected override float GetResultValue(float from, float to, float progress) - { - if (_lerpFun != null) - return _lerpFun.Invoke(from, to, progress); - else - return Mathf.LerpUnclamped(from, to, progress); - } - } - - /// - /// Vector2 Tween - /// - public sealed class Vector2Tween : ValueNode - { - public static Vector2Tween Allocate(float duration, Vector2 from, Vector2 to) - { - return new Vector2Tween(duration, from, to); - } - - public Vector2Tween(float duration, Vector2 from, Vector2 to) : base(duration, from, to) - { - } - protected override Vector2 GetResultValue(Vector2 from, Vector2 to, float progress) - { - if (_lerpFun != null) - return _lerpFun.Invoke(from, to, progress); - else - return Vector2.LerpUnclamped(from, to, progress); - } - } - - /// - /// Vector3 Tween - /// - public sealed class Vector3Tween : ValueNode - { - public static Vector3Tween Allocate(float duration, Vector3 from, Vector3 to) - { - return new Vector3Tween(duration, from, to); - } - - public Vector3Tween(float duration, Vector3 from, Vector3 to) : base(duration, from, to) - { - } - protected override Vector3 GetResultValue(Vector3 from, Vector3 to, float progress) - { - if (_lerpFun != null) - return _lerpFun.Invoke(from, to, progress); - else - return Vector3.LerpUnclamped(from, to, progress); - } - } - - /// - /// Vector4 Tween - /// - public sealed class Vector4Tween : ValueNode - { - public static Vector4Tween Allocate(float duration, Vector4 from, Vector4 to) - { - return new Vector4Tween(duration, from, to); - } - - public Vector4Tween(float duration, Vector4 from, Vector4 to) : base(duration, from, to) - { - } - protected override Vector4 GetResultValue(Vector4 from, Vector4 to, float progress) - { - if (_lerpFun != null) - return _lerpFun.Invoke(from, to, progress); - else - return Vector4.LerpUnclamped(from, to, progress); - } - } - - /// - /// Color Tween - /// - public sealed class ColorTween : ValueNode - { - public static ColorTween Allocate(float duration, Color from, Color to) - { - return new ColorTween(duration, from, to); - } - - public ColorTween(float duration, Color from, Color to) : base(duration, from, to) - { - } - protected override Color GetResultValue(Color from, Color to, float progress) - { - if (_lerpFun != null) - return _lerpFun.Invoke(from, to, progress); - else - return Color.LerpUnclamped(from, to, progress); - } - } - - /// - /// Quaternion Tween - /// - public sealed class QuaternionTween : ValueNode - { - public static QuaternionTween Allocate(float duration, Quaternion from, Quaternion to) - { - return new QuaternionTween(duration, from, to); - } - - public QuaternionTween(float duration, Quaternion from, Quaternion to) : base(duration, from, to) - { - } - protected override Quaternion GetResultValue(Quaternion from, Quaternion to, float progress) - { - if (_lerpFun != null) - return _lerpFun.Invoke(from, to, progress); - else - return Quaternion.LerpUnclamped(from, to, progress); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ValueNode.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ValueNode.cs.meta deleted file mode 100644 index e5d5b17..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/TweenNode/ValueNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b6764a4a4b1300a4886350df53844828 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniFramework.Tween.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniFramework.Tween.asmdef deleted file mode 100644 index 025e4ae..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniFramework.Tween.asmdef +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "UniFramework.Tween", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniFramework.Tween.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniFramework.Tween.asmdef.meta deleted file mode 100644 index 80db938..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniFramework.Tween.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 44de5b8c35e72e2488d54682724e6105 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniLogger.cs deleted file mode 100644 index bad20e3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniLogger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Diagnostics; - -namespace UniFramework.Tween -{ - internal static class UniLogger - { - [Conditional("DEBUG")] - public static void Log(string info) - { - UnityEngine.Debug.Log(info); - } - public static void Warning(string info) - { - UnityEngine.Debug.LogWarning(info); - } - public static void Error(string info) - { - UnityEngine.Debug.LogError(info); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniLogger.cs.meta deleted file mode 100644 index b066e9e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dbad3cd04905bab4fb6391f5184bcfa0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTimer.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTimer.cs deleted file mode 100644 index 763cef1..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTimer.cs +++ /dev/null @@ -1,199 +0,0 @@ - -namespace UniFramework.Tween -{ - public sealed class UniTimer - { - /// - /// 延迟后,触发一次 - /// - public static UniTimer CreateOnceTimer(float delay) - { - return new UniTimer(delay, -1, -1, 1); - } - - /// - /// 延迟后,永久性的间隔触发 - /// - /// 延迟时间 - /// 间隔时间 - public static UniTimer CreatePepeatTimer(float delay, float interval) - { - return new UniTimer(delay, interval, -1, -1); - } - - /// - /// 延迟后,在一段时间内间隔触发 - /// - /// 延迟时间 - /// 间隔时间 - /// 触发周期 - public static UniTimer CreatePepeatTimer(float delay, float interval, float duration) - { - return new UniTimer(delay, interval, duration, -1); - } - - /// - /// 延迟后,间隔触发一定次数 - /// - /// 延迟时间 - /// 间隔时间 - /// 最大触发次数 - public static UniTimer CreatePepeatTimer(float delay, float interval, long maxTriggerCount) - { - return new UniTimer(delay, interval, -1, maxTriggerCount); - } - - /// - /// 延迟后,在一段时间内触发 - /// - /// 延迟时间 - /// 触发周期 - public static UniTimer CreateDurationTimer(float delay, float duration) - { - return new UniTimer(delay, -1, duration, -1); - } - - /// - /// 延迟后,永久触发 - /// - public static UniTimer CreateForeverTimer(float delay) - { - return new UniTimer(delay, -1, -1, -1); - } - - - private readonly float _intervalTime; - private readonly float _durationTime; - private readonly long _maxTriggerCount; - - // 需要重置的变量 - private float _delayTimer = 0; - private float _durationTimer = 0; - private float _intervalTimer = 0; - private long _triggerCount = 0; - - /// - /// 延迟时间 - /// - public float DelayTime { private set; get; } - - /// - /// 是否已经结束 - /// - public bool IsOver { private set; get; } - - /// - /// 是否已经暂停 - /// - public bool IsPause { private set; get; } - - /// - /// 延迟剩余时间 - /// - public float Remaining - { - get - { - if (IsOver) - return 0f; - else - return System.Math.Max(0f, DelayTime - _delayTimer); - } - } - - /// - /// 计时器 - /// - /// 延迟时间 - /// 间隔时间 - /// 运行时间 - /// 最大触发次数 - public UniTimer(float delay, float interval, float duration, long maxTriggerCount) - { - DelayTime = delay; - _intervalTime = interval; - _durationTime = duration; - _maxTriggerCount = maxTriggerCount; - } - - /// - /// 暂停计时器 - /// - public void Pause() - { - IsPause = true; - } - - /// - /// 恢复计时器 - /// - public void Resume() - { - IsPause = false; - } - - /// - /// 结束计时器 - /// - public void Kill() - { - IsOver = true; - } - - /// - /// 重置计时器 - /// - public void Reset() - { - _delayTimer = 0; - _durationTimer = 0; - _intervalTimer = 0; - _triggerCount = 0; - IsOver = false; - IsPause = false; - } - - /// - /// 更新计时器 - /// - public bool Update(float deltaTime) - { - if (IsOver || IsPause) - return false; - - _delayTimer += deltaTime; - if (_delayTimer < DelayTime) - return false; - - if(_intervalTime > 0) - _intervalTimer += deltaTime; - if (_durationTime > 0) - _durationTimer += deltaTime; - - // 检测间隔执行 - if (_intervalTime > 0) - { - if (_intervalTimer < _intervalTime) - return false; - _intervalTimer = 0; - } - - // 检测结束条件 - if (_durationTime > 0) - { - if (_durationTimer >= _durationTime) - Kill(); - } - - // 检测结束条件 - if (_maxTriggerCount > 0) - { - _triggerCount++; - if (_triggerCount >= _maxTriggerCount) - Kill(); - } - - return true; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTimer.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTimer.cs.meta deleted file mode 100644 index 73e498b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTimer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 60ae01c18fb54794c92589be693490e4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTween.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTween.cs deleted file mode 100644 index 78e280a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTween.cs +++ /dev/null @@ -1,344 +0,0 @@ -using System; -using System.Diagnostics; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace UniFramework.Tween -{ - /// - /// 补间动画系统 - /// - public static class UniTween - { - private static bool _isInitialize = false; - private static GameObject _driver = null; - private static readonly List _tweens = new List(1000); - private static readonly List _newer = new List(1000); - private static readonly List _remover = new List(1000); - - /// - /// 是否忽略时间戳缩放 - /// - public static bool IgnoreTimeScale { set; get; } = false; - - /// - /// 所有补间动画的播放速度 - /// - public static float PlaySpeed { set; get; } = 1f; - - - /// - /// 初始化补间动画系统 - /// - public static void Initalize() - { - if (_isInitialize) - throw new Exception($"{nameof(UniTween)} is initialized !"); - - if(_isInitialize == false) - { - // 创建驱动器 - _isInitialize = true; - _driver = new GameObject($"[{nameof(UniTween)}]"); - _driver.AddComponent(); - UnityEngine.Object.DontDestroyOnLoad(_driver); - UniLogger.Log($"{nameof(UniTween)} initalize !"); - } - } - - /// - /// 销毁补间动画系统 - /// - public static void Destroy() - { - if (_isInitialize) - { - foreach (var tween in _tweens) - { - tween.Dispose(); - } - foreach (var tween in _newer) - { - tween.Dispose(); - } - foreach (var tween in _remover) - { - tween.Dispose(); - } - - _tweens.Clear(); - _newer.Clear(); - _remover.Clear(); - - _isInitialize = false; - if (_driver != null) - GameObject.Destroy(_driver); - UniLogger.Log($"{nameof(UniTween)} destroy all !"); - } - } - - /// - /// 更新补间动画系统 - /// - internal static void Update() - { - if (_isInitialize) - { - // 添加新的补间动画 - if (_newer.Count > 0) - { - _tweens.AddRange(_newer); - _newer.Clear(); - } - - // 更新所有补间动画 - float deltaTime = IgnoreTimeScale ? UnityEngine.Time.unscaledDeltaTime : UnityEngine.Time.deltaTime; - deltaTime *= PlaySpeed; - for (int i = 0; i < _tweens.Count; i++) - { - var handle = _tweens[i]; - if (handle.IsCanRemove()) - _remover.Add(handle); - else - handle.Update(deltaTime); - } - - // 移除完成的补间动画 - for (int i = 0; i < _remover.Count; i++) - { - var handle = _remover[i]; - handle.Dispose(); - _tweens.Remove(handle); - } - _remover.Clear(); - } - } - - - /// - /// 播放一个补间动画 - /// - /// 补间根节点 - /// 游戏对象 - public static TweenHandle Play(ITweenNode tweenRoot, UnityEngine.Object unityObject = null) - { - DebugCheckInitialize(); - - if (tweenRoot == null) - throw new System.ArgumentNullException(); - - TweenHandle handle = new TweenHandle(tweenRoot, unityObject); - _newer.Add(handle); - return handle; - } - - /// - /// 播放一个补间动画 - /// - /// 补间链节点 - /// 游戏对象 - public static TweenHandle Play(ITweenChain tweenChain, UnityEngine.Object unityObject = null) - { - ITweenNode tweenRoot = tweenChain as ITweenNode; - if (tweenRoot == null) - throw new System.InvalidCastException(); - - return Play(tweenRoot, unityObject); - } - - /// - /// 播放一个补间动画 - /// - /// 补间链节点 - /// 游戏对象 - public static TweenHandle Play(ChainNode chainNode, UnityEngine.Object unityObject = null) - { - ITweenNode tweenRoot = chainNode as ITweenNode; - if (tweenRoot == null) - throw new System.InvalidCastException(); - - return Play(tweenRoot, unityObject); - } - - /// - /// 中途关闭补间动画 - /// - /// 关闭的补间动画句柄 - public static void Abort(TweenHandle tweenHandle) - { - DebugCheckInitialize(); - - if (tweenHandle != null) - tweenHandle.Abort(); - } - - /// - /// 中途关闭补间动画 - /// - /// 关闭该游戏对象下的所有补间动画 - public static void Abort(UnityEngine.Object unityObject) - { - DebugCheckInitialize(); - - int instanceID = unityObject.GetInstanceID(); - for (int i = 0; i < _tweens.Count; i++) - { - var handle = _tweens[i]; - if (handle.InstanceID == instanceID) - { - handle.Abort(); - } - } - for (int i = 0; i < _newer.Count; i++) - { - var handle = _newer[i]; - if (handle.InstanceID == instanceID) - { - handle.Abort(); - } - } - } - - - #region Tween Allocate - /// - /// 执行节点 - /// - /// 执行方法 - public static ExecuteNode AllocateExecute(System.Action execute) - { - ExecuteNode node = new ExecuteNode(); - node.SetExecute(execute); - return node; - } - - /// - /// 条件等待节点 - /// - /// 条件方法 - public static UntilNode AllocateUntil(System.Func condition) - { - UntilNode node = new UntilNode(); - node.SetCondition(condition); - return node; - } - - - /// - /// 并行执行的复合节点 - /// - /// 成员节点列表 - public static ParallelNode AllocateParallel(params ITweenNode[] nodes) - { - ParallelNode node = new ParallelNode(); - node.AddNode(nodes); - return node; - } - - /// - /// 顺序执行的复合节点 - /// - /// 成员节点列表 - public static SequenceNode AllocateSequence(params ITweenNode[] nodes) - { - SequenceNode node = new SequenceNode(); - node.AddNode(nodes); - return node; - } - - /// - /// 随机执行的复合节点 - /// - /// 成员节点列表 - public static SelectorNode AllocateSelector(params ITweenNode[] nodes) - { - SelectorNode node = new SelectorNode(); - node.AddNode(nodes); - return node; - } - - - /// - /// 延迟计时节点 - /// - /// 延迟时间 - /// 触发事件 - public static TimerNode AllocateDelay(float delay, System.Action trigger = null) - { - UniTimer timer = UniTimer.CreateOnceTimer(delay); - TimerNode node = new TimerNode(timer); - node.SetTrigger(trigger); - return node; - } - - /// - /// 重复计时节点 - /// 注意:该节点为无限时长 - /// - /// 延迟时间 - /// 间隔时间 - /// 触发事件 - public static TimerNode AllocateRepeat(float delay, float interval, System.Action trigger = null) - { - UniTimer timer = UniTimer.CreatePepeatTimer(delay, interval); - TimerNode node = new TimerNode(timer); - node.SetTrigger(trigger); - return node; - } - - /// - /// 重复计时节点 - /// - /// 延迟时间 - /// 间隔时间 - /// 持续时间 - /// 触发事件 - public static TimerNode AllocateRepeat(float delay, float interval, float duration, System.Action trigger = null) - { - UniTimer timer = UniTimer.CreatePepeatTimer(delay, interval, duration); - TimerNode node = new TimerNode(timer); - node.SetTrigger(trigger); - return node; - } - - /// - /// 重复计时节点 - /// - /// 延迟时间 - /// 间隔时间 - /// 最大触发次数 - /// 触发事件 - public static TimerNode AllocateRepeat(float delay, float interval, long maxRepeatCount, System.Action trigger = null) - { - UniTimer timer = UniTimer.CreatePepeatTimer(delay, interval, maxRepeatCount); - TimerNode node = new TimerNode(timer); - node.SetTrigger(trigger); - return node; - } - - /// - /// 持续计时节点 - /// - /// 延迟时间 - /// 持续时间 - /// 触发事件 - public static TimerNode AllocateDuration(float delay, float duration, System.Action trigger = null) - { - UniTimer timer = UniTimer.CreateDurationTimer(delay, duration); - TimerNode node = new TimerNode(timer); - node.SetTrigger(trigger); - return node; - } - #endregion - - #region 调试方法 - [Conditional("DEBUG")] - private static void DebugCheckInitialize() - { - if (_isInitialize == false) - throw new Exception($"{nameof(UniTween)} not initialize !"); - } - #endregion - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTween.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTween.cs.meta deleted file mode 100644 index d39a552..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTween.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4942da830749fca4e9cb7bbdf1bda924 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTweenDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTweenDriver.cs deleted file mode 100644 index e49ecc2..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTweenDriver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Tween -{ - internal class UniTweenDriver : MonoBehaviour - { - void Update() - { - UniTween.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTweenDriver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTweenDriver.cs.meta deleted file mode 100644 index df391ff..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniTween/Runtime/UniTweenDriver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d2cbc1a9339629f47ae487886e5bae0b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow.meta deleted file mode 100644 index e091003..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 047e2424cfccd68479ce85171e28d9f5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/README.md deleted file mode 100644 index ca8126d..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# UniFramework.Window - -一个轻量级的基于堆栈的界面系统。 - diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/README.md.meta deleted file mode 100644 index 8a2e492..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 32e55b8a0d57de5428a1e06cc0cc87b3 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime.meta deleted file mode 100644 index 739f46b..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a933ee98d9388e74dba1a42e77f4f6d8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/OpenWindowOperation.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/OpenWindowOperation.cs deleted file mode 100644 index 19662b3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/OpenWindowOperation.cs +++ /dev/null @@ -1,70 +0,0 @@ -using YooAsset; - -namespace UniFramework.Window -{ - public class OpenWindowOperation : GameAsyncOperation - { - private enum ESteps - { - None, - Waiting, - Done, - } - - private readonly AssetOperationHandle _handle; - private ESteps _steps = ESteps.None; - - internal OpenWindowOperation(AssetOperationHandle handle) - { - _handle = handle; - } - protected override void OnStart() - { - _steps = ESteps.Waiting; - } - protected override void OnUpdate() - { - if (_steps == ESteps.None || _steps == ESteps.Done) - return; - - if (_steps == ESteps.Waiting) - { - if (_handle.IsValid == false) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = $"{nameof(AssetOperationHandle)} is invalid."; - return; - } - - if (_handle.IsDone == false) - return; - - if (_handle.AssetObject == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = $"{nameof(AssetOperationHandle.AssetObject)} is null."; - return; - } - - _steps = ESteps.Done; - Status = EOperationStatus.Succeed; - } - } - - /// - /// 等待异步实例化结束 - /// - public void WaitForAsyncComplete() - { - if (_handle != null) - { - if (_steps == ESteps.Done) - return; - _handle.WaitForAsyncComplete(); - OnUpdate(); - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/OpenWindowOperation.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/OpenWindowOperation.cs.meta deleted file mode 100644 index eddedcb..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/OpenWindowOperation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4607e0d0ccaff3940854224460f93bbd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UIWindow.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UIWindow.cs deleted file mode 100644 index 2bc83e3..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UIWindow.cs +++ /dev/null @@ -1,325 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.UI; -using YooAsset; - -namespace UniFramework.Window -{ - public abstract class UIWindow - { - public const int WINDOW_HIDE_LAYER = 2; // Ignore Raycast - public const int WINDOW_SHOW_LAYER = 5; // UI - - internal AssetOperationHandle Handle { private set; get;} - private System.Action _prepareCallback; - private System.Object[] _userDatas; - - private bool _isCreate = false; - private GameObject _panel; - private Canvas _canvas; - private Canvas[] _childCanvas; - private GraphicRaycaster _raycaster; - private GraphicRaycaster[] _childRaycaster; - - /// - /// 面板的Transfrom组件 - /// - public Transform transform - { - get - { - return _panel.transform; - } - } - - /// - /// 面板的游戏对象 - /// - public GameObject gameObject - { - get - { - return _panel; - } - } - - /// - /// 窗口名称 - /// - public string WindowName { private set; get; } - - /// - /// 窗口层级 - /// - public int WindowLayer { private set; get; } - - /// - /// 是否为全屏窗口 - /// - public bool FullScreen { private set; get; } - - /// - /// 自定义数据 - /// - public System.Object UserData - { - get - { - if (_userDatas != null && _userDatas.Length >= 1) - return _userDatas[0]; - else - return null; - } - } - - /// - /// 自定义数据集 - /// - public System.Object[] UserDatas - { - get { return _userDatas; } - } - - /// - /// 窗口深度值 - /// - public int Depth - { - get - { - if (_canvas != null) - return _canvas.sortingOrder; - else - return 0; - } - - set - { - if (_canvas != null) - { - if (_canvas.sortingOrder == value) - return; - - // 设置父类 - _canvas.sortingOrder = value; - - // 设置子类 - int depth = value; - for (int i = 0; i < _childCanvas.Length; i++) - { - var canvas = _childCanvas[i]; - if (canvas != _canvas) - { - depth += 5; //注意递增值 - canvas.sortingOrder = depth; - } - } - - // 虚函数 - if (_isCreate) - OnSortDepth(value); - } - } - } - - /// - /// - /// 窗口可见性 - /// - public bool Visible - { - get - { - if (_canvas != null) - return _canvas.gameObject.layer == WINDOW_SHOW_LAYER; - else - return false; - } - - set - { - if (_canvas != null) - { - int setLayer = value ? WINDOW_SHOW_LAYER : WINDOW_HIDE_LAYER; - if (_canvas.gameObject.layer == setLayer) - return; - - // 显示设置 - _canvas.gameObject.layer = setLayer; - for (int i = 0; i < _childCanvas.Length; i++) - { - _childCanvas[i].gameObject.layer = setLayer; - } - - // 交互设置 - Interactable = value; - - // 虚函数 - if (_isCreate) - OnSetVisible(value); - } - } - } - - /// - /// 窗口交互性 - /// - private bool Interactable - { - get - { - if (_raycaster != null) - return _raycaster.enabled; - else - return false; - } - - set - { - if (_raycaster != null) - { - _raycaster.enabled = value; - for (int i = 0; i < _childRaycaster.Length; i++) - { - _childRaycaster[i].enabled = value; - } - } - } - } - - /// - /// 是否加载完毕 - /// - internal bool IsLoadDone { get { return Handle.IsDone; } } - - /// - /// 是否准备完毕 - /// - internal bool IsPrepare { private set; get; } - - - public void Init(string name, int layer, bool fullScreen) - { - WindowName = name; - WindowLayer = layer; - FullScreen = fullScreen; - } - - /// - /// 窗口创建 - /// - public abstract void OnCreate(); - - /// - /// 窗口刷新 - /// - public abstract void OnRefresh(); - - /// - /// 窗口更新 - /// - public abstract void OnUpdate(); - - /// - /// 窗口销毁 - /// - public abstract void OnDestroy(); - - /// - /// 当触发窗口的层级排序 - /// - protected virtual void OnSortDepth(int depth) { } - - /// - /// 当因为全屏遮挡触发窗口的显隐 - /// - protected virtual void OnSetVisible(bool visible) { } - - internal void TryInvoke(System.Action prepareCallback, System.Object[] userDatas) - { - _userDatas = userDatas; - if (IsPrepare) - prepareCallback?.Invoke(this); - else - _prepareCallback = prepareCallback; - } - internal void InternalLoad(string location, System.Action prepareCallback, System.Object[] userDatas) - { - if (Handle != null) - return; - - _prepareCallback = prepareCallback; - _userDatas = userDatas; - Handle = YooAssets.LoadAssetAsync(location); - Handle.Completed += Handle_Completed; - } - internal void InternalCreate() - { - if (_isCreate == false) - { - _isCreate = true; - OnCreate(); - } - } - internal void InternalRefresh() - { - OnRefresh(); - } - internal void InternalUpdate() - { - if(IsPrepare) - { - OnUpdate(); - } - } - internal void InternalDestroy() - { - _isCreate = false; - - // 注销回调函数 - _prepareCallback = null; - - // 卸载面板资源 - if (Handle != null) - { - Handle.Release(); - Handle = null; - } - - // 销毁面板对象 - if (_panel != null) - { - OnDestroy(); - GameObject.Destroy(_panel); - _panel = null; - } - } - - private void Handle_Completed(AssetOperationHandle handle) - { - if (handle.AssetObject == null) - return; - - // 实例化对象 - _panel = handle.InstantiateSync(UniWindow.Desktop.transform); - _panel.transform.localPosition = Vector3.zero; - - // 获取组件 - _canvas = _panel.GetComponent(); - if (_canvas == null) - throw new Exception($"Not found {nameof(Canvas)} in panel {WindowName}"); - _canvas.overrideSorting = true; - _canvas.sortingOrder = 0; - _canvas.sortingLayerName = "Default"; - - // 获取组件 - _raycaster = _panel.GetComponent(); - _childCanvas = _panel.GetComponentsInChildren(true); - _childRaycaster = _panel.GetComponentsInChildren(true); - - // 通知UI管理器 - IsPrepare = true; - _prepareCallback?.Invoke(this); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UIWindow.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UIWindow.cs.meta deleted file mode 100644 index 0d8e32e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UIWindow.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7e1414cd524a4d24aa5653dba76dd850 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniFramework.Window.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniFramework.Window.asmdef deleted file mode 100644 index a4792e1..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniFramework.Window.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "UniFramework.Window", - "rootNamespace": "", - "references": [ - "GUID:e34a5702dd353724aa315fb8011f08c3" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": true, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniFramework.Window.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniFramework.Window.asmdef.meta deleted file mode 100644 index c591fd2..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniFramework.Window.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: e62322788ba70c5428b168602000a586 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniLogger.cs deleted file mode 100644 index 29ff4b5..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniLogger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Diagnostics; - -namespace UniFramework.Window -{ - internal static class UniLogger - { - [Conditional("DEBUG")] - public static void Log(string info) - { - UnityEngine.Debug.Log(info); - } - public static void Warning(string info) - { - UnityEngine.Debug.LogWarning(info); - } - public static void Error(string info) - { - UnityEngine.Debug.LogError(info); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniLogger.cs.meta deleted file mode 100644 index 462a7fd..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 53b3b144d6b239e4a8a00b13b18494c0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindow.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindow.cs deleted file mode 100644 index 4284e2e..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindow.cs +++ /dev/null @@ -1,414 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using YooAsset; - -namespace UniFramework.Window -{ - public static class UniWindow - { - public struct WindowInfo - { - public string WindowName; - public int WindowLayer; - public bool IsLoadDone; - } - - private static bool _isInitialize = false; - private static GameObject _driver = null; - private static readonly List _stack = new List(100); - internal static GameObject Desktop { private set; get; } - - - /// - /// 初始化界面系统 - /// - public static void Initalize(GameObject desktop) - { - if (_isInitialize) - throw new Exception($"{nameof(UniWindow)} is initialized !"); - if (desktop == null) - throw new ArgumentNullException(); - - if (_isInitialize == false) - { - // 创建驱动器 - _isInitialize = true; - _driver = new UnityEngine.GameObject($"[{nameof(UniWindow)}]"); - _driver.AddComponent(); - UnityEngine.Object.DontDestroyOnLoad(_driver); - UniLogger.Log($"{nameof(UniWindow)} initalize !"); - - Desktop = desktop; - } - } - - /// - /// 销毁界面系统 - /// - public static void Destroy() - { - if (_isInitialize) - { - CloseAll(); - - _isInitialize = false; - if (_driver != null) - GameObject.Destroy(_driver); - UniLogger.Log($"{nameof(UniWindow)} destroy all !"); - } - } - - /// - /// 更新界面系统 - /// - internal static void Update() - { - if (_isInitialize) - { - int count = _stack.Count; - for (int i = 0; i < _stack.Count; i++) - { - if (_stack.Count != count) - break; - var window = _stack[i]; - window.InternalUpdate(); - } - } - } - - /// - /// 设置屏幕安全区域(异形屏支持) - /// - /// 安全区域 - public static void ApplyScreenSafeRect(Rect safeRect) - { - CanvasScaler scaler = Desktop.GetComponentInParent(); - if (scaler == null) - { - UniLogger.Error($"Not found {nameof(CanvasScaler)} !"); - return; - } - - // Convert safe area rectangle from absolute pixels to UGUI coordinates - float rateX = scaler.referenceResolution.x / Screen.width; - float rateY = scaler.referenceResolution.y / Screen.height; - float posX = (int)(safeRect.position.x * rateX); - float posY = (int)(safeRect.position.y * rateY); - float width = (int)(safeRect.size.x * rateX); - float height = (int)(safeRect.size.y * rateY); - - float offsetMaxX = scaler.referenceResolution.x - width - posX; - float offsetMaxY = scaler.referenceResolution.y - height - posY; - - // 注意:安全区坐标系的原点为左下角 - var rectTrans = Desktop.transform as RectTransform; - rectTrans.offsetMin = new Vector2(posX, posY); //锚框状态下的屏幕左下角偏移向量 - rectTrans.offsetMax = new Vector2(-offsetMaxX, -offsetMaxY); //锚框状态下的屏幕右上角偏移向量 - } - - /// - /// 模拟IPhoneX异形屏 - /// - public static void SimulateIPhoneXNotchScreen() - { - Rect rect; - if (Screen.height > Screen.width) - { - // 竖屏Portrait - float deviceWidth = 1125; - float deviceHeight = 2436; - rect = new Rect(0f / deviceWidth, 102f / deviceHeight, 1125f / deviceWidth, 2202f / deviceHeight); - } - else - { - // 横屏Landscape - float deviceWidth = 2436; - float deviceHeight = 1125; - rect = new Rect(132f / deviceWidth, 63f / deviceHeight, 2172f / deviceWidth, 1062f / deviceHeight); - } - - Rect safeArea = new Rect(Screen.width * rect.x, Screen.height * rect.y, Screen.width * rect.width, Screen.height * rect.height); - ApplyScreenSafeRect(safeArea); - } - - - /// - /// 获取窗口堆栈信息 - /// - public static void GetWindowInfos(List output) - { - if (output == null) - output = new List(); - else - output.Clear(); - - for (int i = 0; i < _stack.Count; i++) - { - var window = _stack[i]; - WindowInfo info = new WindowInfo(); - info.WindowName = window.WindowName; - info.WindowLayer = window.WindowLayer; - info.IsLoadDone = window.IsLoadDone; - output.Add(info); - } - } - - /// - /// 获取所有层级下顶部的窗口名称 - /// - public static string GetTopWindow() - { - if (_stack.Count == 0) - return string.Empty; - - UIWindow topWindow = _stack[_stack.Count - 1]; - return topWindow.WindowName; - } - - /// - /// 获取指定层级下顶部的窗口名称 - /// - public static string GetTopWindow(int layer) - { - UIWindow lastOne = null; - for (int i = 0; i < _stack.Count; i++) - { - if (_stack[i].WindowLayer == layer) - lastOne = _stack[i]; - } - - if (lastOne == null) - return string.Empty; - - return lastOne.WindowName; - } - - /// - /// 是否有任意窗口正在加载 - /// - public static bool IsAnyLoading() - { - for (int i = 0; i < _stack.Count; i++) - { - var window = _stack[i]; - if (window.IsLoadDone == false) - return true; - } - return false; - } - - /// - /// 查询窗口是否存在 - /// - public static bool HasWindow() - { - return HasWindow(typeof(T)); - } - public static bool HasWindow(Type type) - { - return IsContains(type.FullName); - } - - - /// - /// 异步打开窗口 - /// - /// 资源定位地址 - /// 用户自定义数据 - public static OpenWindowOperation OpenWindowAsync(string location, params System.Object[] userDatas) where T : UIWindow - { - return OpenWindowAsync(typeof(T), location, userDatas); - } - public static OpenWindowOperation OpenWindowAsync(Type type, string location, params System.Object[] userDatas) - { - string windowName = type.FullName; - - // 如果窗口已经存在 - if (IsContains(windowName)) - { - UIWindow window = GetWindow(windowName); - Pop(window); //弹出窗口 - Push(window); //重新压入 - window.TryInvoke(OnWindowPrepare, userDatas); - var operation = new OpenWindowOperation(window.Handle); - YooAssets.StartOperation(operation); - return operation; - } - else - { - UIWindow window = CreateInstance(type); - Push(window); //首次压入 - window.InternalLoad(location, OnWindowPrepare, userDatas); - var operation = new OpenWindowOperation(window.Handle); - YooAssets.StartOperation(operation); - return operation; - } - } - - /// - /// 同步打开窗口 - /// - /// 窗口类 - /// 资源定位地址 - /// 用户自定义数据 - public static OpenWindowOperation OpenWindowSync(string location, params System.Object[] userDatas) where T : UIWindow - { - var operation = OpenWindowAsync(typeof(T), location, userDatas); - operation.WaitForAsyncComplete(); - return operation; - } - public static OpenWindowOperation OpenWindowSync(Type type, string location, params System.Object[] userDatas) - { - var operation = OpenWindowAsync(type, location, userDatas); - operation.WaitForAsyncComplete(); - return operation; - } - - /// - /// 关闭窗口 - /// - public static void CloseWindow() where T : UIWindow - { - CloseWindow(typeof(T)); - } - public static void CloseWindow(Type type) - { - string windowName = type.FullName; - UIWindow window = GetWindow(windowName); - if (window == null) - return; - - window.InternalDestroy(); - Pop(window); - OnSortWindowDepth(window.WindowLayer); - OnSetWindowVisible(); - } - - /// - /// 关闭所有窗口 - /// - public static void CloseAll() - { - for (int i = 0; i < _stack.Count; i++) - { - UIWindow window = _stack[i]; - window.InternalDestroy(); - } - _stack.Clear(); - } - - - private static void OnWindowPrepare(UIWindow window) - { - OnSortWindowDepth(window.WindowLayer); - window.InternalCreate(); - window.InternalRefresh(); - OnSetWindowVisible(); - } - private static void OnSortWindowDepth(int layer) - { - int depth = layer; - for (int i = 0; i < _stack.Count; i++) - { - if (_stack[i].WindowLayer == layer) - { - _stack[i].Depth = depth; - depth += 100; //注意:每次递增100深度 - } - } - } - private static void OnSetWindowVisible() - { - bool isHideNext = false; - for (int i = _stack.Count - 1; i >= 0; i--) - { - UIWindow window = _stack[i]; - if (isHideNext == false) - { - window.Visible = true; - if (window.IsPrepare && window.FullScreen) - isHideNext = true; - } - else - { - window.Visible = false; - } - } - } - - private static UIWindow CreateInstance(Type type) - { - UIWindow window = Activator.CreateInstance(type) as UIWindow; - WindowAttribute attribute = Attribute.GetCustomAttribute(type, typeof(WindowAttribute)) as WindowAttribute; - - if (window == null) - throw new Exception($"Window {type.FullName} create instance failed."); - if (attribute == null) - throw new Exception($"Window {type.FullName} not found {nameof(WindowAttribute)} attribute."); - - window.Init(type.FullName, attribute.WindowLayer, attribute.FullScreen); - return window; - } - private static UIWindow GetWindow(string name) - { - for (int i = 0; i < _stack.Count; i++) - { - UIWindow window = _stack[i]; - if (window.WindowName == name) - return window; - } - return null; - } - private static bool IsContains(string name) - { - for (int i = 0; i < _stack.Count; i++) - { - UIWindow window = _stack[i]; - if (window.WindowName == name) - return true; - } - return false; - } - private static void Push(UIWindow window) - { - // 如果已经存在 - if (IsContains(window.WindowName)) - throw new System.Exception($"Window {window.WindowName} is exist."); - - // 获取插入到所属层级的位置 - int insertIndex = -1; - for (int i = 0; i < _stack.Count; i++) - { - if (window.WindowLayer == _stack[i].WindowLayer) - insertIndex = i + 1; - } - - // 如果没有所属层级,找到相邻层级 - if (insertIndex == -1) - { - for (int i = 0; i < _stack.Count; i++) - { - if (window.WindowLayer > _stack[i].WindowLayer) - insertIndex = i + 1; - } - } - - // 如果是空栈或没有找到插入位置 - if (insertIndex == -1) - { - insertIndex = 0; - } - - // 最后插入到堆栈 - _stack.Insert(insertIndex, window); - } - private static void Pop(UIWindow window) - { - // 从堆栈里移除 - _stack.Remove(window); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindow.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindow.cs.meta deleted file mode 100644 index 67fd69d..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindow.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9cd9bf5acfacf214dabf26d7db088067 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindowDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindowDriver.cs deleted file mode 100644 index 01858b6..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindowDriver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Window -{ - internal class UniWindowDriver : MonoBehaviour - { - void Update() - { - UniWindow.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindowDriver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindowDriver.cs.meta deleted file mode 100644 index fd0b9c9..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/UniWindowDriver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7468af77f37112d45819be1404c0258d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/WindowAttribute.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/WindowAttribute.cs deleted file mode 100644 index 94a08d0..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/WindowAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace UniFramework.Window -{ - [AttributeUsage(AttributeTargets.Class)] - public class WindowAttribute : Attribute - { - /// - /// 窗口层级 - /// - public int WindowLayer; - - /// - /// 全屏窗口标记 - /// - public bool FullScreen; - - public WindowAttribute(int windowLayer, bool fullScreen) - { - WindowLayer = windowLayer; - FullScreen = fullScreen; - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/WindowAttribute.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/WindowAttribute.cs.meta deleted file mode 100644 index 80e4dfb..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniWindow/Runtime/WindowAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 422a90e8b252ae840aca5adb13efb130 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: