提交
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2286bdb9423d4da48ba3b1bd8765173f
|
guid: 692a8563bf4ba9749905419c982657c8
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 468a46d0ae32c3544b7d98094e6448a9, type: 3}
|
||||||
|
m_Name: AddressableAssetSettings
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_DefaultGroup: a45d0d25213104f44ad8fe07eb3548d1
|
||||||
|
m_currentHash:
|
||||||
|
serializedVersion: 2
|
||||||
|
Hash: 24f7d451677154961ad4235510acee73
|
||||||
|
m_OptimizeCatalogSize: 0
|
||||||
|
m_BuildRemoteCatalog: 0
|
||||||
|
m_BundleLocalCatalog: 0
|
||||||
|
m_CatalogRequestsTimeout: 0
|
||||||
|
m_DisableCatalogUpdateOnStart: 0
|
||||||
|
m_IgnoreUnsupportedFilesInBuild: 0
|
||||||
|
m_UniqueBundleIds: 0
|
||||||
|
m_NonRecursiveBuilding: 1
|
||||||
|
m_CCDEnabled: 0
|
||||||
|
m_maxConcurrentWebRequests: 3
|
||||||
|
m_ContiguousBundles: 1
|
||||||
|
m_StripUnityVersionFromBundleBuild: 0
|
||||||
|
m_DisableVisibleSubAssetRepresentations: 0
|
||||||
|
m_ShaderBundleNaming: 0
|
||||||
|
m_ShaderBundleCustomNaming:
|
||||||
|
m_MonoScriptBundleNaming: 0
|
||||||
|
m_CheckForContentUpdateRestrictionsOption: 0
|
||||||
|
m_MonoScriptBundleCustomNaming:
|
||||||
|
m_RemoteCatalogBuildPath:
|
||||||
|
m_Id:
|
||||||
|
m_RemoteCatalogLoadPath:
|
||||||
|
m_Id:
|
||||||
|
m_ContentStateBuildPathProfileVariableName:
|
||||||
|
m_CustomContentStateBuildPath:
|
||||||
|
m_ContentStateBuildPath:
|
||||||
|
m_BuildAddressablesWithPlayerBuild: 0
|
||||||
|
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
||||||
|
m_GroupAssets:
|
||||||
|
- {fileID: 11400000, guid: 902fafad9bba93345b7a8d95737094ff, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 0835c4975fed7d14795ec925b54bca80, type: 2}
|
||||||
|
m_BuildSettings:
|
||||||
|
m_CompileScriptsInVirtualMode: 0
|
||||||
|
m_CleanupStreamingAssetsAfterBuilds: 1
|
||||||
|
m_LogResourceManagerExceptions: 1
|
||||||
|
m_BundleBuildPath: Temp/com.unity.addressables/AssetBundles
|
||||||
|
m_ProfileSettings:
|
||||||
|
m_Profiles:
|
||||||
|
- m_InheritedParent:
|
||||||
|
m_Id: 70f0db63e1b2ccc49a35826b26d42ffa
|
||||||
|
m_ProfileName: Default
|
||||||
|
m_Values:
|
||||||
|
- m_Id: 693c6cc232ba75944b76340184d8d5da
|
||||||
|
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||||
|
- m_Id: 6c2c4720f61c8134b9b4b2c9776cd752
|
||||||
|
m_Value: http://[PrivateIpAddress]:[HostingServicePort]
|
||||||
|
- m_Id: 6e2463dd44eb1f54cb6bd7d1ed217d78
|
||||||
|
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||||
|
- m_Id: 79ac92be39ae3b548acfff4d617e9f3d
|
||||||
|
m_Value: ServerData/[BuildTarget]
|
||||||
|
- m_Id: c213fc96596f0424b92d9b5da98dc49d
|
||||||
|
m_Value: '[UnityEditor.EditorUserBuildSettings.activeBuildTarget]'
|
||||||
|
m_ProfileEntryNames:
|
||||||
|
- m_Id: 693c6cc232ba75944b76340184d8d5da
|
||||||
|
m_Name: Local.LoadPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 6c2c4720f61c8134b9b4b2c9776cd752
|
||||||
|
m_Name: Remote.LoadPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 6e2463dd44eb1f54cb6bd7d1ed217d78
|
||||||
|
m_Name: Local.BuildPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 79ac92be39ae3b548acfff4d617e9f3d
|
||||||
|
m_Name: Remote.BuildPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: c213fc96596f0424b92d9b5da98dc49d
|
||||||
|
m_Name: BuildTarget
|
||||||
|
m_InlineUsage: 0
|
||||||
|
m_ProfileVersion: 1
|
||||||
|
m_LabelTable:
|
||||||
|
m_LabelNames:
|
||||||
|
- default
|
||||||
|
- config
|
||||||
|
m_SchemaTemplates: []
|
||||||
|
m_GroupTemplateObjects:
|
||||||
|
- {fileID: 11400000, guid: e3717cb91779b3c42b0fa261a19e2089, type: 2}
|
||||||
|
m_InitializationObjects: []
|
||||||
|
m_CertificateHandlerType:
|
||||||
|
m_AssemblyName:
|
||||||
|
m_ClassName:
|
||||||
|
m_ActivePlayerDataBuilderIndex: 3
|
||||||
|
m_DataBuilders:
|
||||||
|
- {fileID: 11400000, guid: e3793cbe36022934c8e448ba864e7d23, type: 2}
|
||||||
|
- {fileID: 11400000, guid: c1b22d2e9c442004aa8ce9415342d39b, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 09b58a3e361fb894bb05487b13037296, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 451c87b652b66324b93ed04ca22c9f79, type: 2}
|
||||||
|
m_ActiveProfileId: 70f0db63e1b2ccc49a35826b26d42ffa
|
||||||
|
m_HostingServicesManager:
|
||||||
|
m_HostingServiceInfos: []
|
||||||
|
m_Settings: {fileID: 11400000}
|
||||||
|
m_NextInstanceId: 0
|
||||||
|
m_RegisteredServiceTypeRefs: []
|
||||||
|
m_PingTimeoutInMilliseconds: 5000
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e60983ba8459aa349988c3ecb65abf31
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 820198255c53d7944a20b1c68c5aa2c9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f800864c27698964ab1fae5a1384670e
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0da0bb3855501354a9bc91673adc7b14
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1a3c5d64ac83548c09dd1678b9f6f1cd, type: 3}
|
||||||
|
m_Name: Packed Assets
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_SchemaObjects:
|
||||||
|
- {fileID: 5467363252551928993}
|
||||||
|
- {fileID: 56619259277380849}
|
||||||
|
m_Description: Pack assets into asset bundles.
|
||||||
|
m_Settings: {fileID: 11400000, guid: e60983ba8459aa349988c3ecb65abf31, type: 2}
|
||||||
|
--- !u!114 &56619259277380849
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||||
|
m_Name: ContentUpdateGroupSchema
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Group: {fileID: 0}
|
||||||
|
m_StaticContent: 0
|
||||||
|
--- !u!114 &5467363252551928993
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||||
|
m_Name: BundledAssetGroupSchema
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Group: {fileID: 0}
|
||||||
|
m_InternalBundleIdMode: 1
|
||||||
|
m_Compression: 1
|
||||||
|
m_IncludeAddressInCatalog: 1
|
||||||
|
m_IncludeGUIDInCatalog: 1
|
||||||
|
m_IncludeLabelsInCatalog: 1
|
||||||
|
m_InternalIdNamingMode: 0
|
||||||
|
m_CacheClearBehavior: 0
|
||||||
|
m_IncludeInBuild: 1
|
||||||
|
m_BundledAssetProviderType:
|
||||||
|
m_AssemblyName:
|
||||||
|
m_ClassName:
|
||||||
|
m_ForceUniqueProvider: 0
|
||||||
|
m_UseAssetBundleCache: 1
|
||||||
|
m_UseAssetBundleCrc: 1
|
||||||
|
m_UseAssetBundleCrcForCachedBundles: 1
|
||||||
|
m_UseUWRForLocalBundles: 0
|
||||||
|
m_Timeout: 0
|
||||||
|
m_ChunkedTransfer: 0
|
||||||
|
m_RedirectLimit: -1
|
||||||
|
m_RetryCount: 0
|
||||||
|
m_BuildPath:
|
||||||
|
m_Id:
|
||||||
|
m_LoadPath:
|
||||||
|
m_Id:
|
||||||
|
m_BundleMode: 0
|
||||||
|
m_AssetBundleProviderType:
|
||||||
|
m_AssemblyName:
|
||||||
|
m_ClassName:
|
||||||
|
m_BundleNaming: 0
|
||||||
|
m_AssetLoadMode: 0
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e3717cb91779b3c42b0fa261a19e2089
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0177e9cd130f2644c94ff6f27591f32f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||||
|
m_Name: Built In Data
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_GroupName: Built In Data
|
||||||
|
m_Data:
|
||||||
|
m_SerializedData: []
|
||||||
|
m_GUID: cd4decefa4232884fa80ecdbff31c3a5
|
||||||
|
m_SerializeEntries: []
|
||||||
|
m_ReadOnly: 1
|
||||||
|
m_Settings: {fileID: 11400000, guid: e60983ba8459aa349988c3ecb65abf31, type: 2}
|
||||||
|
m_SchemaSet:
|
||||||
|
m_Schemas: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0835c4975fed7d14795ec925b54bca80
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||||
|
m_Name: Default Local Group
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_GroupName: Default Local Group
|
||||||
|
m_Data:
|
||||||
|
m_SerializedData: []
|
||||||
|
m_GUID: a45d0d25213104f44ad8fe07eb3548d1
|
||||||
|
m_SerializeEntries:
|
||||||
|
- m_GUID: 2286bdb9423d4da48ba3b1bd8765173f
|
||||||
|
m_Address: Assets/Configs
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels:
|
||||||
|
- config
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_Settings: {fileID: 11400000, guid: e60983ba8459aa349988c3ecb65abf31, type: 2}
|
||||||
|
m_SchemaSet:
|
||||||
|
m_Schemas:
|
||||||
|
- {fileID: 11400000, guid: a6c2bb9206a787d40a5ddd394de13ea2, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 38bec3dff28f2014194d6df27120ffe2, type: 2}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 902fafad9bba93345b7a8d95737094ff
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a65b9c2fafd9b444aa0ce2c532b4133d
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b1487f5d688e4f94f828f879d599dbdc, type: 3}
|
||||||
|
m_Name: Built In Data_PlayerDataGroupSchema
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Group: {fileID: 11400000, guid: 0835c4975fed7d14795ec925b54bca80, type: 2}
|
||||||
|
m_IncludeResourcesFolders: 1
|
||||||
|
m_IncludeBuildSettingsScenes: 1
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 20981212fe0549c4f8f7200e0ce3f519
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||||
|
m_Name: Default Local Group_BundledAssetGroupSchema
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Group: {fileID: 0}
|
||||||
|
m_InternalBundleIdMode: 1
|
||||||
|
m_Compression: 1
|
||||||
|
m_IncludeAddressInCatalog: 1
|
||||||
|
m_IncludeGUIDInCatalog: 1
|
||||||
|
m_IncludeLabelsInCatalog: 1
|
||||||
|
m_InternalIdNamingMode: 0
|
||||||
|
m_CacheClearBehavior: 0
|
||||||
|
m_IncludeInBuild: 1
|
||||||
|
m_BundledAssetProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||||
|
m_ForceUniqueProvider: 0
|
||||||
|
m_UseAssetBundleCache: 1
|
||||||
|
m_UseAssetBundleCrc: 1
|
||||||
|
m_UseAssetBundleCrcForCachedBundles: 1
|
||||||
|
m_UseUWRForLocalBundles: 0
|
||||||
|
m_Timeout: 0
|
||||||
|
m_ChunkedTransfer: 0
|
||||||
|
m_RedirectLimit: -1
|
||||||
|
m_RetryCount: 0
|
||||||
|
m_BuildPath:
|
||||||
|
m_Id: 6e2463dd44eb1f54cb6bd7d1ed217d78
|
||||||
|
m_LoadPath:
|
||||||
|
m_Id: 693c6cc232ba75944b76340184d8d5da
|
||||||
|
m_BundleMode: 0
|
||||||
|
m_AssetBundleProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||||
|
m_BundleNaming: 0
|
||||||
|
m_AssetLoadMode: 0
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a6c2bb9206a787d40a5ddd394de13ea2
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||||
|
m_Name: Default Local Group_ContentUpdateGroupSchema
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Group: {fileID: 0}
|
||||||
|
m_StaticContent: 0
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 38bec3dff28f2014194d6df27120ffe2
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 72553237eae78744ba2ff551ec768030
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 88d21199f5d473f4db36845f2318f180, type: 3}
|
||||||
|
m_Name: BuildScriptFastMode
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e3793cbe36022934c8e448ba864e7d23
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3e2e0ffa088c91d41a086d0b8cb16bdc, type: 3}
|
||||||
|
m_Name: BuildScriptPackedMode
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 451c87b652b66324b93ed04ca22c9f79
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ad8c280d42ee0ed41a27db23b43dd2bf, type: 3}
|
||||||
|
m_Name: BuildScriptPackedPlayMode
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 09b58a3e361fb894bb05487b13037296
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bb0e4994b34add1409fd8ccaf4a82de5, type: 3}
|
||||||
|
m_Name: BuildScriptVirtualMode
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c1b22d2e9c442004aa8ce9415342d39b
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3a189bb168d8d90478a09ea08c2f3d72, type: 3}
|
||||||
|
m_Name: DefaultObject
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_AddressableAssetSettingsGuid: e60983ba8459aa349988c3ecb65abf31
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f9b9b19ab849a34f8c66956df64c186
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7e3976da977cb49238499ea3b4c237ae, type: 3}
|
||||||
|
m_Name: ProfileDataSourceSettings
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
profileGroupTypes:
|
||||||
|
- m_GroupTypePrefix: Built-In
|
||||||
|
m_Variables:
|
||||||
|
- m_Suffix: BuildPath
|
||||||
|
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||||
|
- m_Suffix: LoadPath
|
||||||
|
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||||
|
- m_GroupTypePrefix: Editor Hosted
|
||||||
|
m_Variables:
|
||||||
|
- m_Suffix: BuildPath
|
||||||
|
m_Value: ServerData/[BuildTarget]
|
||||||
|
- m_Suffix: LoadPath
|
||||||
|
m_Value: http://[PrivateIpAddress]:[HostingServicePort]
|
||||||
|
environments: []
|
||||||
|
currentEnvironment:
|
||||||
|
id:
|
||||||
|
projectId:
|
||||||
|
projectGenesisId:
|
||||||
|
name:
|
||||||
|
isDefault: 0
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 59f7c3bb2d35146c88dfedf2004a8ae7
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fed1a435d3956452d953a0a0118be7b1
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 56a8814c396664b048814cc6d477d82d
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 410e26deedfc5864bb5bd6b9cad1f450
|
guid: 2286bdb9423d4da48ba3b1bd8765173f
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f8c67570025fefa448706dadc37c5988
|
guid: 7ba7c6a75110f483683dc4885aee0758
|
||||||
TextScriptImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
@@ -12,5 +12,5 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c836612725633cc4093d7ac06e7d9ef1, type: 3}
|
m_Script: {fileID: 11500000, guid: c836612725633cc4093d7ac06e7d9ef1, type: 3}
|
||||||
m_Name: GameConfig
|
m_Name: GameConfig
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
packageName: com.tronwingame.redhotroast
|
packageName: com.crazyballcatgame.frozenarena
|
||||||
hardwareAcceleration: 1
|
hardwareAcceleration: 1
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ MonoBehaviour:
|
|||||||
m_Name: NetworkConfig
|
m_Name: NetworkConfig
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
showNetworkLog: 1
|
showNetworkLog: 1
|
||||||
debugHost: api.jsoncompare.online
|
debugHost: sandbox-api.swhitegames.tech
|
||||||
releaseHost: frozenarena.top
|
releaseHost: frozenarena.top
|
||||||
connectionMode: 0
|
connectionMode: 0
|
||||||
|
|||||||
@@ -0,0 +1,188 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using SGModule.Common.Helper;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.PackageManager;
|
||||||
|
using UnityEditor.PackageManager.Requests;
|
||||||
|
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
|
||||||
|
#if USE_ADDRESSABLES
|
||||||
|
using UnityEditor.AddressableAssets;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace SGModule.Editor {
|
||||||
|
[InitializeOnLoad]
|
||||||
|
public static class AddressablesManager {
|
||||||
|
private const string AddressablesPackageName = "com.unity.addressables";
|
||||||
|
private const string AddressablesSymbol = "USE_ADDRESSABLES";
|
||||||
|
private static AddRequest _addRequest;
|
||||||
|
|
||||||
|
// 安装标记,避免重复弹窗
|
||||||
|
private static bool _isInstallingAddressables;
|
||||||
|
|
||||||
|
static AddressablesManager() {
|
||||||
|
EditorApplication.projectChanged += OnProjectChanged; // 监听项目变更
|
||||||
|
|
||||||
|
CheckAndSetupAddressables();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string DefaultConfigsPath => "Assets/Configs"; // 默认的 Addressables 配置路径
|
||||||
|
|
||||||
|
private static void CheckAndSetupAddressables() {
|
||||||
|
if (IsAddressablesInstalled()) {
|
||||||
|
Log.Info("ConfigLoader", "Addressables 已安装,正在初始化...");
|
||||||
|
|
||||||
|
AddScriptingDefineSymbol(AddressablesSymbol);
|
||||||
|
|
||||||
|
#if USE_ADDRESSABLES
|
||||||
|
EnsureAddressablesConfigured();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RemoveScriptingDefineSymbol(AddressablesSymbol);
|
||||||
|
if (!_isInstallingAddressables) {
|
||||||
|
PromptToInstallAddressables();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAddressablesInstalled() {
|
||||||
|
return PackageInfo.GetAllRegisteredPackages().Any(package => package.name == AddressablesPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PromptToInstallAddressables() {
|
||||||
|
var install = EditorUtility.DisplayDialog(
|
||||||
|
"Addressables 未安装",
|
||||||
|
"当前插件依赖 Addressables 功能,请安装以确保正常使用。\n\n是否立即安装 Addressables?",
|
||||||
|
"安装",
|
||||||
|
"取消");
|
||||||
|
|
||||||
|
if (install) {
|
||||||
|
InstallAddressables();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.Warning("ConfigLoader", "用户取消安装 Addressables,部分功能可能无法正常使用!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void InstallAddressables() {
|
||||||
|
if (_isInstallingAddressables) {
|
||||||
|
return; // 防止重复安装
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Info("ConfigLoader", "开始安装 Addressables...");
|
||||||
|
|
||||||
|
_isInstallingAddressables = true; // 标记正在安装,避免重复弹窗
|
||||||
|
_addRequest = Client.Add(AddressablesPackageName);
|
||||||
|
|
||||||
|
EditorApplication.update += MonitorAddRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void MonitorAddRequest() {
|
||||||
|
if (_addRequest == null || !_addRequest.IsCompleted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorApplication.update -= MonitorAddRequest;
|
||||||
|
|
||||||
|
if (_addRequest.Status == StatusCode.Success) {
|
||||||
|
Log.Info("ConfigLoader", "Addressables 安装成功!");
|
||||||
|
|
||||||
|
EditorUtility.DisplayDialog("安装完成", "Addressables 安装成功,请稍候等待 Unity 刷新。", "确定");
|
||||||
|
|
||||||
|
CheckAndSetupAddressables();
|
||||||
|
}
|
||||||
|
else if (_addRequest.Status >= StatusCode.Failure) {
|
||||||
|
Log.Error("ConfigLoader", $"安装 Addressables 失败:{_addRequest.Error.message}");
|
||||||
|
|
||||||
|
EditorUtility.DisplayDialog("安装失败", $"安装 Addressables 失败:{_addRequest.Error.message}", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
|
_isInstallingAddressables = false; // 重置标记
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddScriptingDefineSymbol(string symbol) {
|
||||||
|
var symbols = new List<string>(PlayerSettings
|
||||||
|
.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';'));
|
||||||
|
if (symbols.Contains(symbol)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
symbols.Add(symbol);
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup,
|
||||||
|
string.Join(";", symbols));
|
||||||
|
Log.Info("ConfigLoader", $"已添加脚本定义符号: {symbol}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RemoveScriptingDefineSymbol(string symbol) {
|
||||||
|
var symbols = new List<string>(PlayerSettings
|
||||||
|
.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';'));
|
||||||
|
if (symbols.Contains(symbol)) {
|
||||||
|
symbols.Remove(symbol);
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup,
|
||||||
|
string.Join(";", symbols));
|
||||||
|
|
||||||
|
Log.Info("ConfigLoader", $"已移除脚本定义符号: {symbol}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnProjectChanged() {
|
||||||
|
Log.Info("ConfigLoader", "检测到项目变更,重新检查 Addressables 状态...");
|
||||||
|
|
||||||
|
CheckAndSetupAddressables();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if USE_ADDRESSABLES
|
||||||
|
private static void EnsureAddressablesConfigured() {
|
||||||
|
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
||||||
|
|
||||||
|
if (settings == null) {
|
||||||
|
Log.Info("ConfigLoader", "正在初始化 Addressables 设置...");
|
||||||
|
|
||||||
|
settings = AddressableAssetSettingsDefaultObject.GetSettings(true); // 自动创建配置
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保默认的 Configs 文件夹存在并被添加到 Addressables
|
||||||
|
var needRefresh = false;
|
||||||
|
if (!Directory.Exists(DefaultConfigsPath)) {
|
||||||
|
Directory.CreateDirectory(DefaultConfigsPath);
|
||||||
|
Log.Info("ConfigLoader", $"已创建文件夹: {DefaultConfigsPath}");
|
||||||
|
|
||||||
|
needRefresh = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsFolderInAddressables(DefaultConfigsPath)) {
|
||||||
|
var guid = AssetDatabase.AssetPathToGUID(DefaultConfigsPath);
|
||||||
|
var group = settings.DefaultGroup;
|
||||||
|
settings.CreateOrMoveEntry(guid, group)?.SetLabel("config", true, true);
|
||||||
|
needRefresh = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needRefresh) {
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsFolderInAddressables(string folderPath) {
|
||||||
|
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
||||||
|
foreach (var group in settings.groups)
|
||||||
|
{
|
||||||
|
if (group)
|
||||||
|
{
|
||||||
|
foreach (var entry in group.entries)
|
||||||
|
{
|
||||||
|
if (AssetDatabase.GUIDToAssetPath(entry.guid) == folderPath)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 383ac67f695b4c6e94ba988c9303cd5b
|
||||||
|
timeCreated: 1733734050
|
||||||
@@ -3,10 +3,8 @@ using System.IO;
|
|||||||
using SGModule.Common.Helper;
|
using SGModule.Common.Helper;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SGModule.ConfigLoader
|
namespace SGModule.ConfigLoader {
|
||||||
{
|
public class ConfigFileManager {
|
||||||
public class ConfigFileManager
|
|
||||||
{
|
|
||||||
private const int MaxErrorCount = 6;
|
private const int MaxErrorCount = 6;
|
||||||
private const string ConfigFileNameKey = "ConfigFileName";
|
private const string ConfigFileNameKey = "ConfigFileName";
|
||||||
private const string FirstLaunchKey = "FirstLaunch";
|
private const string FirstLaunchKey = "FirstLaunch";
|
||||||
@@ -17,59 +15,44 @@ namespace SGModule.ConfigLoader
|
|||||||
private static bool IsFirstLaunch => !PlayerPrefs.HasKey(FirstLaunchKey);
|
private static bool IsFirstLaunch => !PlayerPrefs.HasKey(FirstLaunchKey);
|
||||||
private static string SavedConfigFileName => PlayerPrefs.GetString(ConfigFileNameKey);
|
private static string SavedConfigFileName => PlayerPrefs.GetString(ConfigFileNameKey);
|
||||||
|
|
||||||
private static void SetFirstLaunch()
|
private static void SetFirstLaunch() {
|
||||||
{
|
|
||||||
PlayerPrefs.SetInt(FirstLaunchKey, 1);
|
PlayerPrefs.SetInt(FirstLaunchKey, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetSavedConfigFileName(string name)
|
private static void SetSavedConfigFileName(string name) {
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(ConfigFileNameKey, name);
|
PlayerPrefs.SetString(ConfigFileNameKey, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IncrementErrorCount()
|
private void IncrementErrorCount() {
|
||||||
{
|
|
||||||
_initConfigErrorCount++;
|
_initConfigErrorCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否需要下载新配置,基于传入的期望配置文件名setting
|
// 检查是否需要下载新配置,基于传入的期望配置文件名setting
|
||||||
private static bool HasNewConfig(string expectedSetting)
|
private static bool HasNewConfig(string expectedSetting) {
|
||||||
{
|
if (string.IsNullOrEmpty(SavedConfigFileName)) {
|
||||||
if (string.IsNullOrEmpty(SavedConfigFileName))
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !SavedConfigFileName.Equals(expectedSetting);
|
return !SavedConfigFileName.Equals(expectedSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FirstLaunchCopyConfig(Action<bool> callback)
|
private void FirstLaunchCopyConfig(Action<bool> callback) {
|
||||||
{
|
|
||||||
SetFirstLaunch();
|
SetFirstLaunch();
|
||||||
Debug.Log("000000000000000000000000000000");
|
|
||||||
FileNetworkManager.Instance.CopyStreamingAssetsToPersistentDataPath(result =>
|
FileNetworkManager.Instance.CopyStreamingAssetsToPersistentDataPath(result => {
|
||||||
{
|
|
||||||
Debug.Log("0000000000000000000000000000006");
|
|
||||||
var isSuccess = false;
|
var isSuccess = false;
|
||||||
if (result)
|
if (result) {
|
||||||
{
|
|
||||||
Debug.Log("0000000000000000000000000000007");
|
|
||||||
var names = FileNetworkManager.Instance.GetFileNamesFromPersistentDataPath(FileNetworkManager.FolderName);
|
var names = FileNetworkManager.Instance.GetFileNamesFromPersistentDataPath(FileNetworkManager.FolderName);
|
||||||
if (names.Length > 0)
|
if (names.Length > 0) {
|
||||||
{
|
|
||||||
Debug.Log("0000000000000000000000000000008");
|
|
||||||
Debug.Log("0000000000000000000000000000009"+names[0]);
|
|
||||||
SetSavedConfigFileName(names[0]);
|
SetSavedConfigFileName(names[0]);
|
||||||
isSuccess = true;
|
isSuccess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error("拷贝文件失败 请检查Configs文件夹是否有配置文件");
|
Log.ConfigLoader.Error("拷贝文件失败 请检查Configs文件夹是否有配置文件");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSuccess)
|
if (!isSuccess) {
|
||||||
{
|
|
||||||
IncrementErrorCount();
|
IncrementErrorCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,20 +60,16 @@ namespace SGModule.ConfigLoader
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DownloadConfig(string cdnUrl, string setting, Action<bool, string> callback)
|
private void DownloadConfig(string cdnUrl, string setting, Action<bool, string> callback) {
|
||||||
{
|
|
||||||
var url = $"{cdnUrl}/config/{setting}";
|
var url = $"{cdnUrl}/config/{setting}";
|
||||||
Log.ConfigLoader.Info($"开始下载配置文件 {url}", false);
|
Log.ConfigLoader.Info($"开始下载配置文件 {url}", false);
|
||||||
FileNetworkManager.Instance.ReadData(url, result =>
|
FileNetworkManager.Instance.ReadData(url, result => {
|
||||||
{
|
if (!string.IsNullOrEmpty(result)) {
|
||||||
if (!string.IsNullOrEmpty(result))
|
|
||||||
{
|
|
||||||
SetSavedConfigFileName(setting);
|
SetSavedConfigFileName(setting);
|
||||||
FileNetworkManager.Instance.WriteToPersistentData(FileNetworkManager.Instance.GetConfigFOlderPath(), setting, result);
|
FileNetworkManager.Instance.WriteToPersistentData(FileNetworkManager.Instance.GetConfigFOlderPath(), setting, result);
|
||||||
callback?.Invoke(true, result);
|
callback?.Invoke(true, result);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error("下载配置文件失败");
|
Log.ConfigLoader.Error("下载配置文件失败");
|
||||||
IncrementErrorCount();
|
IncrementErrorCount();
|
||||||
callback?.Invoke(false, null);
|
callback?.Invoke(false, null);
|
||||||
@@ -98,92 +77,40 @@ namespace SGModule.ConfigLoader
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReadLocalConfig(Action<bool, string> callback)
|
private void ReadLocalConfig(Action<bool, string> callback) {
|
||||||
{
|
|
||||||
var savedCfgName = SavedConfigFileName;
|
var savedCfgName = SavedConfigFileName;
|
||||||
Log.ConfigLoader.Info($"开始读取本地配置文件 {savedCfgName}", false);
|
Log.ConfigLoader.Info($"开始读取本地配置文件 {savedCfgName}", false);
|
||||||
if (string.IsNullOrEmpty(savedCfgName))
|
if (string.IsNullOrEmpty(savedCfgName)) {
|
||||||
{
|
|
||||||
IncrementErrorCount();
|
IncrementErrorCount();
|
||||||
callback?.Invoke(false, null);
|
callback?.Invoke(false, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = Path.Combine(FileNetworkManager.Instance.GetConfigFOlderPath(), savedCfgName);
|
var path = Path.Combine(FileNetworkManager.Instance.GetConfigFOlderPath(), savedCfgName);
|
||||||
bool have_config = false;
|
FileNetworkManager.Instance.ReadData(path, result => {
|
||||||
if (Directory.Exists(FileNetworkManager.Instance.GetConfigFOlderPath()))
|
if (!string.IsNullOrEmpty(result)) {
|
||||||
{
|
callback?.Invoke(true, result);
|
||||||
// 获取该目录下的所有文件
|
|
||||||
string[] files = Directory.GetFiles(FileNetworkManager.Instance.GetConfigFOlderPath());
|
|
||||||
|
|
||||||
if (files.Length > 0)
|
|
||||||
{
|
|
||||||
Debug.Log("文件夹下有文件");
|
|
||||||
have_config = true;
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
Log.ConfigLoader.Error("读取本地数据异常");
|
||||||
Debug.Log("文件夹为空");
|
IncrementErrorCount();
|
||||||
|
callback?.Invoke(false, null);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Log("文件夹不存在");
|
|
||||||
|
|
||||||
}
|
|
||||||
if (have_config)
|
|
||||||
{
|
|
||||||
FileNetworkManager.Instance.ReadData(path, result =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(result))
|
|
||||||
{
|
|
||||||
callback?.Invoke(true, result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error("读取本地数据异常");
|
|
||||||
IncrementErrorCount();
|
|
||||||
callback?.Invoke(false, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Log(savedCfgName);
|
|
||||||
FirstLaunchCopyConfig(success =>
|
|
||||||
{
|
|
||||||
path = Path.Combine(FileNetworkManager.Instance.GetConfigFOlderPath(), SavedConfigFileName);
|
|
||||||
FileNetworkManager.Instance.ReadData(path, result =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(result))
|
|
||||||
{
|
|
||||||
|
|
||||||
callback?.Invoke(true, result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置文件检查与加载流程
|
/// 配置文件检查与加载流程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CheckAndLoadConfig(ConfigInitOptions initOptions, Action<string> onConfigLoaded, Action<ConfigLoaderState> callback)
|
public void CheckAndLoadConfig(ConfigInitOptions initOptions, Action<string> onConfigLoaded, Action<ConfigLoaderState> callback) {
|
||||||
{
|
if (HasExceededMaxErrors) {
|
||||||
if (HasExceededMaxErrors)
|
|
||||||
{
|
|
||||||
callback?.Invoke(ConfigLoaderState.Failed);
|
callback?.Invoke(ConfigLoaderState.Failed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Debug.Log("是否第一次登录"+IsFirstLaunch);
|
|
||||||
if (IsFirstLaunch)
|
if (IsFirstLaunch) {
|
||||||
{
|
FirstLaunchCopyConfig(success => {
|
||||||
FirstLaunchCopyConfig(success =>
|
if (!success) {
|
||||||
{
|
|
||||||
if (!success)
|
|
||||||
{
|
|
||||||
IncrementErrorCount();
|
IncrementErrorCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,25 +118,18 @@ Debug.Log("是否第一次登录"+IsFirstLaunch);
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Debug.Log("是否需要下载"+HasNewConfig(initOptions.Setting));
|
|
||||||
if (HasNewConfig(initOptions.Setting))
|
if (HasNewConfig(initOptions.Setting)) {
|
||||||
{
|
DownloadConfig(initOptions.CdnUrl, initOptions.Setting, (success, json) => {
|
||||||
DownloadConfig(initOptions.CdnUrl, initOptions.Setting, (success, json) =>
|
if (success) {
|
||||||
{
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
ReloadConfig(json, onConfigLoaded, callback);
|
ReloadConfig(json, onConfigLoaded, callback);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
ReadLocalConfig((readSuccess, localJson) => {
|
||||||
ReadLocalConfig((readSuccess, localJson) =>
|
if (readSuccess) {
|
||||||
{
|
|
||||||
if (readSuccess)
|
|
||||||
{
|
|
||||||
ReloadConfig(localJson, onConfigLoaded, callback);
|
ReloadConfig(localJson, onConfigLoaded, callback);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
callback?.Invoke(ConfigLoaderState.Failed);
|
callback?.Invoke(ConfigLoaderState.Failed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -218,18 +138,13 @@ Debug.Log("是否需要下载"+HasNewConfig(initOptions.Setting));
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadLocalConfig((success, json) =>
|
ReadLocalConfig((success, json) => {
|
||||||
{
|
if (success) {
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
ReloadConfig(json, onConfigLoaded, callback);
|
ReloadConfig(json, onConfigLoaded, callback);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
FirstLaunchCopyConfig(result => {
|
||||||
FirstLaunchCopyConfig(result =>
|
if (!result) {
|
||||||
{
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
IncrementErrorCount();
|
IncrementErrorCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,10 +154,8 @@ Debug.Log("是否需要下载"+HasNewConfig(initOptions.Setting));
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReloadConfig(string json, Action<string> onConfigLoaded, Action<ConfigLoaderState> callback)
|
private static void ReloadConfig(string json, Action<string> onConfigLoaded, Action<ConfigLoaderState> callback) {
|
||||||
{
|
if (string.IsNullOrWhiteSpace(json)) {
|
||||||
if (string.IsNullOrWhiteSpace(json))
|
|
||||||
{
|
|
||||||
callback?.Invoke(ConfigLoaderState.JsonEmptyError);
|
callback?.Invoke(ConfigLoaderState.JsonEmptyError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ using System.Linq;
|
|||||||
using SGModule.Common.Base;
|
using SGModule.Common.Base;
|
||||||
using SGModule.Common.Helper;
|
using SGModule.Common.Helper;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using System.Threading.Tasks;
|
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
#endif
|
#endif
|
||||||
@@ -16,53 +16,42 @@ using UnityEditor;
|
|||||||
#if USE_ADDRESSABLES
|
#if USE_ADDRESSABLES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace SGModule.ConfigLoader
|
namespace SGModule.ConfigLoader {
|
||||||
{
|
public class FileNetworkManager : SingletonMonoBehaviour<FileNetworkManager> {
|
||||||
public class FileNetworkManager : SingletonMonoBehaviour<FileNetworkManager>
|
|
||||||
{
|
|
||||||
public const string FolderName = "Configs";
|
public const string FolderName = "Configs";
|
||||||
private const string FolderLabel = "config";
|
private const string FolderLabel = "config";
|
||||||
private string _configFolderPath;
|
private string _configFolderPath;
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake() {
|
||||||
{
|
|
||||||
base.Awake();
|
base.Awake();
|
||||||
|
|
||||||
_configFolderPath = Path.Combine(Application.persistentDataPath, FolderName);
|
_configFolderPath = Path.Combine(Application.persistentDataPath, FolderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetConfigFOlderPath()
|
public string GetConfigFOlderPath() {
|
||||||
{
|
|
||||||
return _configFolderPath;
|
return _configFolderPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 示例解析文件列表方法(你可以根据实际需求实现)
|
// 示例解析文件列表方法(你可以根据实际需求实现)
|
||||||
private List<string> ParseFileList(string data)
|
private List<string> ParseFileList(string data) {
|
||||||
{
|
|
||||||
// 假设 data 是文件列表的文本,解析文件名
|
// 假设 data 是文件列表的文本,解析文件名
|
||||||
// 根据实际情况解析,例如通过换行符分割
|
// 根据实际情况解析,例如通过换行符分割
|
||||||
return data.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
return data.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyStreamingAssetsToPersistentDataPath(Action<bool> onComplete = null)
|
public void CopyStreamingAssetsToPersistentDataPath(Action<bool> onComplete = null) {
|
||||||
{
|
|
||||||
Debug.Log("0000000000000000000000000000001");
|
|
||||||
// 如果目标文件夹不存在,创建它
|
// 如果目标文件夹不存在,创建它
|
||||||
if (!Directory.Exists(_configFolderPath))
|
if (!Directory.Exists(_configFolderPath)) {
|
||||||
{
|
|
||||||
Directory.CreateDirectory(_configFolderPath);
|
Directory.CreateDirectory(_configFolderPath);
|
||||||
}
|
}
|
||||||
Debug.Log("0000000000000000000000000000002");
|
|
||||||
// CopyFile(onComplete);
|
|
||||||
StartCoroutine(CopyFile(onComplete));
|
StartCoroutine(CopyFile(onComplete));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleInitializationError()
|
private void HandleInitializationError() {
|
||||||
{
|
|
||||||
// 检查文件是否存在
|
// 检查文件是否存在
|
||||||
var path = $"{Application.dataPath}/Library/com.unity.addressables/aa/Android/settings.json";
|
var path = $"{Application.dataPath}/Library/com.unity.addressables/aa/Android/settings.json";
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path)) {
|
||||||
{
|
|
||||||
Log.ConfigLoader.Warning(
|
Log.ConfigLoader.Warning(
|
||||||
$"Settings file not found at: {path}. Rebuilding Addressables may be required.");
|
$"Settings file not found at: {path}. Rebuilding Addressables may be required.");
|
||||||
}
|
}
|
||||||
@@ -71,104 +60,68 @@ namespace SGModule.ConfigLoader
|
|||||||
// 提示用户或执行其他逻辑
|
// 提示用户或执行其他逻辑
|
||||||
// 比如:显示弹窗或退出程序
|
// 比如:显示弹窗或退出程序
|
||||||
}
|
}
|
||||||
private IEnumerator CopyFile(Action<bool> onComplete = null)
|
|
||||||
{
|
|
||||||
Debug.Log("开始加载 Configs 文件夹");
|
|
||||||
|
|
||||||
TextAsset[] files = Resources.LoadAll<TextAsset>("Configs");
|
private IEnumerator CopyFile(Action<bool> onComplete = null) {
|
||||||
|
#if USE_ADDRESSABLES
|
||||||
|
var handle = Addressables.LoadResourceLocationsAsync(FolderLabel);
|
||||||
|
|
||||||
if (files.Length > 0)
|
yield return handle;
|
||||||
{
|
|
||||||
TextAsset jsonFile = files[0];
|
|
||||||
string jsonFileName = jsonFile.name;
|
|
||||||
|
|
||||||
Log.ConfigLoader.Info($"Loaded JSON Name:{jsonFileName} content: " + jsonFile.text);
|
if (handle.Status == AsyncOperationStatus.Succeeded) {
|
||||||
|
// 查找以 ".json" 结尾的文件
|
||||||
|
var jsonLocation = handle.Result.FirstOrDefault(loc => loc.PrimaryKey.EndsWith(".json"));
|
||||||
|
|
||||||
if (!Directory.Exists(_configFolderPath))
|
if (jsonLocation != null) {
|
||||||
Directory.CreateDirectory(_configFolderPath);
|
var jsonFileName = Path.GetFileName(jsonLocation.PrimaryKey);
|
||||||
|
// 加载 JSON 文件
|
||||||
|
var textAssetAsync = Addressables.LoadAssetAsync<TextAsset>(jsonLocation);
|
||||||
|
|
||||||
var destFilePath = Path.Combine(_configFolderPath, jsonFileName + ".json");
|
yield return textAssetAsync;
|
||||||
|
|
||||||
// 同步写入文件
|
if (textAssetAsync.Status == AsyncOperationStatus.Succeeded) {
|
||||||
File.WriteAllBytes(destFilePath, jsonFile.bytes);
|
var jsonFile = textAssetAsync.Result;
|
||||||
|
Log.ConfigLoader.Info($"Loaded JSON Name:{jsonFileName} content: " + jsonFile.text);
|
||||||
// 等待一帧再执行回调,保持协程风格
|
|
||||||
yield return null;
|
|
||||||
onComplete?.Invoke(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error("Resources/Configs 下没有找到任何 TextAsset 文件");
|
|
||||||
yield return null;
|
|
||||||
onComplete?.Invoke(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// private IEnumerable CopyFile(Action<bool> onComplete = null)
|
|
||||||
// {
|
|
||||||
|
|
||||||
|
|
||||||
// // if (handle.Status == AsyncOperationStatus.Succeeded) {
|
var destFilePath = Path.Combine(_configFolderPath, jsonFileName);
|
||||||
// // 查找以 ".json" 结尾的文件
|
File.WriteAllBytes(destFilePath, jsonFile.bytes);
|
||||||
// // var jsonLocation = handle.Result.FirstOrDefault(loc => loc.PrimaryKey.EndsWith(".json"));
|
onComplete?.Invoke(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.ConfigLoader.Error("Failed to load JSON file");
|
||||||
|
|
||||||
// // if (jsonLocation != null) {
|
onComplete?.Invoke(false);
|
||||||
// // var jsonFileName = Path.GetFileName(jsonLocation.PrimaryKey);
|
}
|
||||||
// // 加载 JSON 文件
|
}
|
||||||
// // var textAssetAsync = Addressables.LoadAssetAsync<TextAsset>(jsonLocation);
|
else {
|
||||||
// Debug.Log("0000000000000000000000000000003");
|
Log.ConfigLoader.Error("No JSON file found in folder");
|
||||||
// TextAsset[] files = Resources.LoadAll<TextAsset>("Configs");
|
|
||||||
// // yield return textAssetAsync;
|
|
||||||
|
|
||||||
// // if (textAssetAsync.Status == AsyncOperationStatus.Succeeded)
|
onComplete?.Invoke(false);
|
||||||
// // {
|
}
|
||||||
// TextAsset jsonFile = files[0];
|
}
|
||||||
// string jsonFileName = jsonFile.name;
|
else {
|
||||||
// Log.ConfigLoader.Info($"Loaded JSON Name:{jsonFileName} content: " + jsonFile.text);
|
Log.ConfigLoader.Error("Failed to load folder resources");
|
||||||
|
|
||||||
// Debug.Log("0000000000000000000000000000004");
|
onComplete?.Invoke(false);
|
||||||
// var destFilePath = Path.Combine(_configFolderPath, jsonFileName);
|
}
|
||||||
// File.WriteAllBytes(destFilePath, jsonFile.bytes);
|
#else
|
||||||
// Debug.Log("0000000000000000000000000000005");
|
Log.Error( "没有 Addressables 插件,请检查 ");
|
||||||
// onComplete?.Invoke(true);
|
yield break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// // }
|
private IEnumerator CopyFile(string sourceFile, string destFile, Action<bool> onComplete = null) {
|
||||||
// // else {
|
|
||||||
// // Log.ConfigLoader.Error("Failed to load JSON file");
|
|
||||||
|
|
||||||
// // onComplete?.Invoke(false);
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // else {
|
|
||||||
// // Log.ConfigLoader.Error("No JSON file found in folder");
|
|
||||||
|
|
||||||
// // onComplete?.Invoke(false);
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // else
|
|
||||||
// // {
|
|
||||||
// // Log.ConfigLoader.Error("Failed to load folder resources");
|
|
||||||
|
|
||||||
// // onComplete?.Invoke(false);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
private IEnumerator CopyFile(string sourceFile, string destFile, Action<bool> onComplete = null)
|
|
||||||
{
|
|
||||||
var filePath = "file://" + sourceFile;
|
var filePath = "file://" + sourceFile;
|
||||||
|
|
||||||
using (var www = UnityWebRequest.Get(filePath))
|
using (var www = UnityWebRequest.Get(filePath)) {
|
||||||
{
|
|
||||||
yield return www.SendWebRequest();
|
yield return www.SendWebRequest();
|
||||||
|
|
||||||
if (www.result == UnityWebRequest.Result.Success)
|
if (www.result == UnityWebRequest.Result.Success) {
|
||||||
{
|
|
||||||
File.WriteAllBytes(destFile, www.downloadHandler.data);
|
File.WriteAllBytes(destFile, www.downloadHandler.data);
|
||||||
Log.ConfigLoader.Info($"File copied to {destFile}");
|
Log.ConfigLoader.Info($"File copied to {destFile}");
|
||||||
onComplete?.Invoke(true);
|
onComplete?.Invoke(true);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error("Failed to copy file: " + www.error);
|
Log.ConfigLoader.Error("Failed to copy file: " + www.error);
|
||||||
|
|
||||||
onComplete?.Invoke(false);
|
onComplete?.Invoke(false);
|
||||||
@@ -181,8 +134,7 @@ namespace SGModule.ConfigLoader
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
public void ReadData(string path, Action<string> callback)
|
public void ReadData(string path, Action<string> callback) {
|
||||||
{
|
|
||||||
StartCoroutine(ReadDataEnumerator(path, callback));
|
StartCoroutine(ReadDataEnumerator(path, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,17 +144,14 @@ namespace SGModule.ConfigLoader
|
|||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerator ReadDataEnumerator(string path, Action<string> callback)
|
private IEnumerator ReadDataEnumerator(string path, Action<string> callback) {
|
||||||
{
|
|
||||||
string fullPath;
|
string fullPath;
|
||||||
|
|
||||||
// 判断是网络URL还是本地文件路径
|
// 判断是网络URL还是本地文件路径
|
||||||
if (path.StartsWith("http://") || path.StartsWith("https://"))
|
if (path.StartsWith("http://") || path.StartsWith("https://")) {
|
||||||
{
|
|
||||||
fullPath = path; // 网络URL
|
fullPath = path; // 网络URL
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (path.StartsWith("http://") && PlayerSettings.insecureHttpOption == InsecureHttpOption.NotAllowed)
|
if (path.StartsWith("http://") && PlayerSettings.insecureHttpOption == InsecureHttpOption.NotAllowed) {
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error("发起了 HTTP 链接,但设置了不允许非Https连接,请检查设置!!!");
|
Log.ConfigLoader.Error("发起了 HTTP 链接,但设置了不允许非Https连接,请检查设置!!!");
|
||||||
|
|
||||||
callback?.Invoke(null);
|
callback?.Invoke(null);
|
||||||
@@ -210,26 +159,22 @@ namespace SGModule.ConfigLoader
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// 本地文件路径
|
// 本地文件路径
|
||||||
fullPath = "file://" + path;
|
fullPath = "file://" + path;
|
||||||
}
|
}
|
||||||
Debug.Log(fullPath);
|
|
||||||
// 使用UnityWebRequest读取数据
|
// 使用UnityWebRequest读取数据
|
||||||
using (var webRequest = UnityWebRequest.Get(fullPath))
|
using (var webRequest = UnityWebRequest.Get(fullPath)) {
|
||||||
{
|
|
||||||
yield return webRequest.SendWebRequest();
|
yield return webRequest.SendWebRequest();
|
||||||
|
|
||||||
if (webRequest.result == UnityWebRequest.Result.ConnectionError ||
|
if (webRequest.result == UnityWebRequest.Result.ConnectionError ||
|
||||||
webRequest.result == UnityWebRequest.Result.ProtocolError)
|
webRequest.result == UnityWebRequest.Result.ProtocolError) {
|
||||||
{
|
|
||||||
Log.ConfigLoader.Error($"Error while reading file: {webRequest.error} path: {fullPath}");
|
Log.ConfigLoader.Error($"Error while reading file: {webRequest.error} path: {fullPath}");
|
||||||
|
|
||||||
callback?.Invoke(null); // 返回null表示出错
|
callback?.Invoke(null); // 返回null表示出错
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
var data = webRequest.downloadHandler.text;
|
var data = webRequest.downloadHandler.text;
|
||||||
callback?.Invoke(data); // 通过回调传出数据
|
callback?.Invoke(data); // 通过回调传出数据
|
||||||
}
|
}
|
||||||
@@ -242,21 +187,18 @@ Debug.Log(fullPath);
|
|||||||
/// <param name="folderName">文件夹名称</param>
|
/// <param name="folderName">文件夹名称</param>
|
||||||
/// <param name="fileName">文件名称</param>
|
/// <param name="fileName">文件名称</param>
|
||||||
/// <param name="content">要写入的内容</param>
|
/// <param name="content">要写入的内容</param>
|
||||||
public void WriteToPersistentData(string folderName, string fileName, string content)
|
public void WriteToPersistentData(string folderName, string fileName, string content) {
|
||||||
{
|
|
||||||
// 获取持久化数据路径
|
// 获取持久化数据路径
|
||||||
var folderPath = Path.Combine(Application.persistentDataPath, folderName);
|
var folderPath = Path.Combine(Application.persistentDataPath, folderName);
|
||||||
|
|
||||||
// 如果文件夹不存在,则创建它
|
// 如果文件夹不存在,则创建它
|
||||||
if (!Directory.Exists(folderPath))
|
if (!Directory.Exists(folderPath)) {
|
||||||
{
|
|
||||||
Directory.CreateDirectory(folderPath);
|
Directory.CreateDirectory(folderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除原有文件
|
// 删除原有文件
|
||||||
var existingFiles = Directory.GetFiles(folderPath);
|
var existingFiles = Directory.GetFiles(folderPath);
|
||||||
foreach (var file in existingFiles)
|
foreach (var file in existingFiles) {
|
||||||
{
|
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,12 +217,11 @@ Debug.Log(fullPath);
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="subdirectory"></param>
|
/// <param name="subdirectory"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string[] GetFileNamesFromPersistentDataPath(string subdirectory)
|
public string[] GetFileNamesFromPersistentDataPath(string subdirectory) {
|
||||||
{
|
|
||||||
var directoryPath = Path.Combine(Application.persistentDataPath, subdirectory);
|
var directoryPath = Path.Combine(Application.persistentDataPath, subdirectory);
|
||||||
|
|
||||||
if (Directory.Exists(directoryPath))
|
if (Directory.Exists(directoryPath))
|
||||||
// 获取目录中的所有文件名
|
// 获取目录中的所有文件名
|
||||||
{
|
{
|
||||||
return Directory.GetFiles(directoryPath)
|
return Directory.GetFiles(directoryPath)
|
||||||
.Select(Path.GetFileName) // 只提取文件名
|
.Select(Path.GetFileName) // 只提取文件名
|
||||||
|
|||||||
@@ -7,24 +7,20 @@ using SGModule.Common.Helper;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
namespace SGModule.Net
|
namespace SGModule.Net {
|
||||||
{
|
public enum ConnectionStatus {
|
||||||
public enum ConnectionStatus
|
|
||||||
{
|
|
||||||
Uninitialized, // 未初始化
|
Uninitialized, // 未初始化
|
||||||
Connected, // 已连接
|
Connected, // 已连接
|
||||||
Disconnected // 未连接
|
Disconnected // 未连接
|
||||||
}
|
}
|
||||||
|
|
||||||
// 网络检测类
|
// 网络检测类
|
||||||
public class NetChecker : SingletonMonoBehaviour<NetChecker>
|
public class NetChecker : SingletonMonoBehaviour<NetChecker> {
|
||||||
{
|
|
||||||
private const float WebRequestInterval = 5f;
|
private const float WebRequestInterval = 5f;
|
||||||
private const float PingInterval = 2;
|
private const float PingInterval = 2;
|
||||||
|
|
||||||
// 可配置多个检测 URL
|
// 可配置多个检测 URL
|
||||||
[SerializeField]
|
[SerializeField] private List<string> checkUrls = new() {
|
||||||
private List<string> checkUrls = new() {
|
|
||||||
"https://www.baidu.com", // 国内 URL
|
"https://www.baidu.com", // 国内 URL
|
||||||
"https://www.google.com" // 国外 URL
|
"https://www.google.com" // 国外 URL
|
||||||
};
|
};
|
||||||
@@ -49,19 +45,16 @@ namespace SGModule.Net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// null = 未检测;true = 联网;false = 未联网
|
/// null = 未检测;true = 联网;false = 未联网
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool? IsConnected
|
private bool? IsConnected {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable() {
|
||||||
{
|
|
||||||
StartCheckingInternet();
|
StartCheckingInternet();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable() {
|
||||||
{
|
|
||||||
StopCheckingInternet();
|
StopCheckingInternet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,84 +64,69 @@ namespace SGModule.Net
|
|||||||
/// <param name="timeout">最多等待的总时间(秒)</param>
|
/// <param name="timeout">最多等待的总时间(秒)</param>
|
||||||
/// <param name="checkInterval">每次重试间隔</param>
|
/// <param name="checkInterval">每次重试间隔</param>
|
||||||
/// <param name="callback">检测结果回调</param>
|
/// <param name="callback">检测结果回调</param>
|
||||||
public IEnumerator WaitUntilNetworkConnected(float timeout, float checkInterval, Action<bool> callback)
|
public IEnumerator WaitUntilNetworkConnected(float timeout, float checkInterval, Action<bool> callback) {
|
||||||
{
|
|
||||||
var elapsed = 0f;
|
var elapsed = 0f;
|
||||||
|
|
||||||
// 阶段 1: 等待初始化完成
|
// 阶段 1: 等待初始化完成
|
||||||
while (!IsConnected.HasValue && elapsed < timeout)
|
while (!IsConnected.HasValue && elapsed < timeout) {
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(checkInterval);
|
yield return new WaitForSeconds(checkInterval);
|
||||||
elapsed += checkInterval;
|
elapsed += checkInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsConnected.HasValue)
|
if (!IsConnected.HasValue) {
|
||||||
{
|
|
||||||
Log.Net.Warning("网络检测初始化超时!");
|
Log.Net.Warning("网络检测初始化超时!");
|
||||||
callback(false);
|
callback(false);
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 阶段 2: 等待网络恢复
|
// 阶段 2: 等待网络恢复
|
||||||
while (IsConnected == false && elapsed < timeout)
|
while (IsConnected == false && elapsed < timeout) {
|
||||||
{
|
|
||||||
Log.Net.Warning($"网络异常,等待中... 已耗时: {elapsed:F1}s");
|
Log.Net.Warning($"网络异常,等待中... 已耗时: {elapsed:F1}s");
|
||||||
yield return new WaitForSeconds(checkInterval);
|
yield return new WaitForSeconds(checkInterval);
|
||||||
elapsed += checkInterval;
|
elapsed += checkInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = IsConnected == true;
|
var success = IsConnected == true;
|
||||||
if (!success)
|
if (!success) {
|
||||||
{
|
|
||||||
Log.Net.Warning("网络连接等待超时!");
|
Log.Net.Warning("网络连接等待超时!");
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(success);
|
callback(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConnectionStatus GetConnectionStatus()
|
public ConnectionStatus GetConnectionStatus() {
|
||||||
{
|
return IsConnected switch {
|
||||||
return IsConnected switch
|
|
||||||
{
|
|
||||||
null => ConnectionStatus.Uninitialized,
|
null => ConnectionStatus.Uninitialized,
|
||||||
true => ConnectionStatus.Connected,
|
true => ConnectionStatus.Connected,
|
||||||
false => ConnectionStatus.Disconnected
|
false => ConnectionStatus.Disconnected
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init()
|
public void Init() {
|
||||||
{
|
|
||||||
StartCheckingInternet();
|
StartCheckingInternet();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartCheckingInternet()
|
private void StartCheckingInternet() {
|
||||||
{
|
|
||||||
_checkInterval = usePingCheck ? PingInterval : WebRequestInterval;
|
_checkInterval = usePingCheck ? PingInterval : WebRequestInterval;
|
||||||
_checkInternetCoroutine ??= StartCoroutine(CheckInternetRoutine());
|
_checkInternetCoroutine ??= StartCoroutine(CheckInternetRoutine());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopCheckingInternet()
|
private void StopCheckingInternet() {
|
||||||
{
|
if (_checkInternetCoroutine != null) {
|
||||||
if (_checkInternetCoroutine != null)
|
|
||||||
{
|
|
||||||
StopCoroutine(_checkInternetCoroutine);
|
StopCoroutine(_checkInternetCoroutine);
|
||||||
_checkInternetCoroutine = null;
|
_checkInternetCoroutine = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator CheckInternetRoutine()
|
private IEnumerator CheckInternetRoutine() {
|
||||||
{
|
while (true) {
|
||||||
while (true)
|
if (_isChecking) {
|
||||||
{
|
|
||||||
if (_isChecking)
|
|
||||||
{
|
|
||||||
yield break; // 避免并发冲突
|
yield break; // 避免并发冲突
|
||||||
}
|
}
|
||||||
|
|
||||||
_isChecking = true;
|
_isChecking = true;
|
||||||
|
|
||||||
if (QuickNetDeviceCheck())
|
if (QuickNetDeviceCheck()) {
|
||||||
{
|
|
||||||
// if (usePingCheck) {
|
// if (usePingCheck) {
|
||||||
yield return CheckWithPing();
|
yield return CheckWithPing();
|
||||||
// }
|
// }
|
||||||
@@ -156,13 +134,11 @@ namespace SGModule.Net
|
|||||||
// yield return CheckWithUnityWebRequest();
|
// yield return CheckWithUnityWebRequest();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
IsConnected = false;
|
IsConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsConnected.HasValue && _lastConnected != IsConnected.Value)
|
if (IsConnected.HasValue && _lastConnected != IsConnected.Value) {
|
||||||
{
|
|
||||||
Log.Net.Info($"网络状态变化: {IsConnected}");
|
Log.Net.Info($"网络状态变化: {IsConnected}");
|
||||||
_lastConnected = IsConnected.Value;
|
_lastConnected = IsConnected.Value;
|
||||||
}
|
}
|
||||||
@@ -175,46 +151,42 @@ namespace SGModule.Net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用 Ping 检测网络连通性
|
/// 使用 Ping 检测网络连通性
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IEnumerator CheckWithPing()
|
private IEnumerator CheckWithPing() {
|
||||||
{
|
|
||||||
var pings = _pingAddresses.Select(ip => new Ping(ip)).ToList();
|
var pings = _pingAddresses.Select(ip => new Ping(ip)).ToList();
|
||||||
|
|
||||||
var startTime = Time.realtimeSinceStartup;
|
var startTime = Time.realtimeSinceStartup;
|
||||||
var success = false;
|
var success = false;
|
||||||
|
|
||||||
// // 等待所有 Ping 返回结果或超时
|
// 等待所有 Ping 返回结果或超时
|
||||||
// while (Time.realtimeSinceStartup - startTime < _checkInterval) {
|
while (Time.realtimeSinceStartup - startTime < _checkInterval) {
|
||||||
// foreach (var ping in pings) {
|
foreach (var ping in pings) {
|
||||||
// if (ping.isDone && ping.time >= 0) {
|
if (ping.isDone && ping.time >= 0) {
|
||||||
// success = true;
|
success = true;
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (success) {
|
if (success) {
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSecondsRealtime(0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
// }
|
|
||||||
yield return new WaitForSecondsRealtime(0.1f);
|
|
||||||
// 如果有任意一个 Ping 成功,网络即为可用
|
// 如果有任意一个 Ping 成功,网络即为可用
|
||||||
IsConnected = true;
|
IsConnected = success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用 UnityWebRequest 检测网络连通性
|
/// 使用 UnityWebRequest 检测网络连通性
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IEnumerator CheckWithUnityWebRequest()
|
private IEnumerator CheckWithUnityWebRequest() {
|
||||||
{
|
if (!string.IsNullOrEmpty(_preferredUrl)) {
|
||||||
if (!string.IsNullOrEmpty(_preferredUrl))
|
|
||||||
{
|
|
||||||
var request = UnityWebRequest.Get(_preferredUrl);
|
var request = UnityWebRequest.Get(_preferredUrl);
|
||||||
request.timeout = (int)_checkInterval;
|
request.timeout = (int) _checkInterval;
|
||||||
yield return request.SendWebRequest();
|
yield return request.SendWebRequest();
|
||||||
|
|
||||||
if (request.result == UnityWebRequest.Result.Success)
|
if (request.result == UnityWebRequest.Result.Success) {
|
||||||
{
|
|
||||||
IsConnected = true;
|
IsConnected = true;
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
yield break;
|
yield break;
|
||||||
@@ -230,30 +202,25 @@ namespace SGModule.Net
|
|||||||
var ops = new List<UnityWebRequestAsyncOperation>();
|
var ops = new List<UnityWebRequestAsyncOperation>();
|
||||||
var requests = new List<UnityWebRequest>();
|
var requests = new List<UnityWebRequest>();
|
||||||
|
|
||||||
foreach (var url in checkUrls)
|
foreach (var url in checkUrls) {
|
||||||
{
|
|
||||||
var req = UnityWebRequest.Get(url);
|
var req = UnityWebRequest.Get(url);
|
||||||
req.timeout = (int)_checkInterval;
|
req.timeout = (int) _checkInterval;
|
||||||
ops.Add(req.SendWebRequest());
|
ops.Add(req.SendWebRequest());
|
||||||
requests.Add(req);
|
requests.Add(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return StartCoroutine(WaitForAnyRequest(ops));
|
yield return StartCoroutine(WaitForAnyRequest(ops));
|
||||||
|
|
||||||
foreach (var req in requests)
|
foreach (var req in requests) {
|
||||||
{
|
|
||||||
req.Dispose();
|
req.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 等待任意一个请求完成并返回
|
// 等待任意一个请求完成并返回
|
||||||
private IEnumerator WaitForAnyRequest(List<UnityWebRequestAsyncOperation> ops)
|
private IEnumerator WaitForAnyRequest(List<UnityWebRequestAsyncOperation> ops) {
|
||||||
{
|
while (ops.Any(op => !op.isDone)) {
|
||||||
while (ops.Any(op => !op.isDone))
|
if (ops.Any(op => op.isDone && op.webRequest.result == UnityWebRequest.Result.Success)) {
|
||||||
{
|
|
||||||
if (ops.Any(op => op.isDone && op.webRequest.result == UnityWebRequest.Result.Success))
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,10 +229,8 @@ namespace SGModule.Net
|
|||||||
|
|
||||||
var successOp = ops.FirstOrDefault(op => op.webRequest.result == UnityWebRequest.Result.Success);
|
var successOp = ops.FirstOrDefault(op => op.webRequest.result == UnityWebRequest.Result.Success);
|
||||||
|
|
||||||
if (successOp == null)
|
if (successOp == null) {
|
||||||
{
|
foreach (var op in ops.Where(op => op.isDone)) {
|
||||||
foreach (var op in ops.Where(op => op.isDone))
|
|
||||||
{
|
|
||||||
Log.Net.Warning($"请求失败: {op.webRequest.url}, 错误: {op.webRequest.error}");
|
Log.Net.Warning($"请求失败: {op.webRequest.url}, 错误: {op.webRequest.error}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,41 +240,32 @@ namespace SGModule.Net
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加或删除检查 URL
|
// 添加或删除检查 URL
|
||||||
public void AddCheckUrl(string url)
|
public void AddCheckUrl(string url) {
|
||||||
{
|
if (!checkUrls.Contains(url)) {
|
||||||
if (!checkUrls.Contains(url))
|
|
||||||
{
|
|
||||||
checkUrls.Add(url);
|
checkUrls.Add(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCheckUrl(string url)
|
public void RemoveCheckUrl(string url) {
|
||||||
{
|
if (checkUrls.Contains(url)) {
|
||||||
if (checkUrls.Contains(url))
|
|
||||||
{
|
|
||||||
checkUrls.Remove(url);
|
checkUrls.Remove(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPingTarget(string ip)
|
public void AddPingTarget(string ip) {
|
||||||
{
|
if (!_pingAddresses.Contains(ip)) {
|
||||||
if (!_pingAddresses.Contains(ip))
|
|
||||||
{
|
|
||||||
_pingAddresses.Add(ip);
|
_pingAddresses.Add(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemovePingTarget(string ip)
|
public void RemovePingTarget(string ip) {
|
||||||
{
|
if (_pingAddresses.Contains(ip)) {
|
||||||
if (_pingAddresses.Contains(ip))
|
|
||||||
{
|
|
||||||
_pingAddresses.Remove(ip);
|
_pingAddresses.Remove(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换是否使用 Ping 检测
|
// 切换是否使用 Ping 检测
|
||||||
public void SetUsePingCheck(bool enablePing)
|
public void SetUsePingCheck(bool enablePing) {
|
||||||
{
|
|
||||||
usePingCheck = enablePing;
|
usePingCheck = enablePing;
|
||||||
#if UNITY_WEBGL
|
#if UNITY_WEBGL
|
||||||
usePingCheck = false;
|
usePingCheck = false;
|
||||||
@@ -317,10 +273,8 @@ usePingCheck = false;
|
|||||||
_checkInterval = usePingCheck ? PingInterval : WebRequestInterval;
|
_checkInterval = usePingCheck ? PingInterval : WebRequestInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool QuickNetDeviceCheck()
|
private bool QuickNetDeviceCheck() {
|
||||||
{
|
if (Application.isEditor) {
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.2d.sprite": "1.0.0",
|
"com.unity.2d.sprite": "1.0.0",
|
||||||
|
"com.unity.addressables": "1.22.3",
|
||||||
"com.unity.collab-proxy": "2.7.1",
|
"com.unity.collab-proxy": "2.7.1",
|
||||||
"com.unity.feature.development": "1.0.1",
|
"com.unity.feature.development": "1.0.1",
|
||||||
"com.unity.nuget.newtonsoft-json": "3.2.1",
|
"com.unity.nuget.newtonsoft-json": "3.2.1",
|
||||||
|
|||||||
@@ -6,6 +6,20 @@
|
|||||||
"source": "builtin",
|
"source": "builtin",
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
},
|
},
|
||||||
|
"com.unity.addressables": {
|
||||||
|
"version": "1.22.3",
|
||||||
|
"depth": 0,
|
||||||
|
"source": "registry",
|
||||||
|
"dependencies": {
|
||||||
|
"com.unity.modules.assetbundle": "1.0.0",
|
||||||
|
"com.unity.modules.jsonserialize": "1.0.0",
|
||||||
|
"com.unity.modules.imageconversion": "1.0.0",
|
||||||
|
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||||
|
"com.unity.scriptablebuildpipeline": "1.21.25",
|
||||||
|
"com.unity.modules.unitywebrequestassetbundle": "1.0.0"
|
||||||
|
},
|
||||||
|
"url": "https://packages.unity.com"
|
||||||
|
},
|
||||||
"com.unity.collab-proxy": {
|
"com.unity.collab-proxy": {
|
||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
@@ -93,6 +107,13 @@
|
|||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
"com.unity.scriptablebuildpipeline": {
|
||||||
|
"version": "1.21.25",
|
||||||
|
"depth": 1,
|
||||||
|
"source": "registry",
|
||||||
|
"dependencies": {},
|
||||||
|
"url": "https://packages.unity.com"
|
||||||
|
},
|
||||||
"com.unity.services.core": {
|
"com.unity.services.core": {
|
||||||
"version": "1.14.0",
|
"version": "1.14.0",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<projectSettings>
|
<projectSettings>
|
||||||
<projectSetting name="com.google.external-dependency-managerAnalyticsCookie" value="500b4bfa68f242ecbf2b37e490522e50" />
|
|
||||||
<projectSetting name="com.google.external-dependency-managerAnalyticsEnabled" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.AutoPodToolInstallInEditor" value="False" />
|
|
||||||
<projectSetting name="Google.IOSResolver.CocoapodsIntegrationMethod" value="2" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodfileAddUseFrameworks" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodfileAllowPodsInMultipleTargets" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodfileAlwaysAddMainTarget" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodfileEnabled" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodfileStaticLinkFrameworks" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodToolExecutionViaShellEnabled" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.PodToolShellExecutionSetLang" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.SwiftFrameworkSupportWorkaroundEnabled" value="True" />
|
|
||||||
<projectSetting name="Google.IOSResolver.SwiftLanguageVersion" value="5.0" />
|
|
||||||
<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" />
|
|
||||||
<projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False" />
|
<projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False" />
|
||||||
<projectSetting name="GooglePlayServices.UseJetifier" value="True" />
|
<projectSetting name="GooglePlayServices.UseJetifier" value="True" />
|
||||||
</projectSettings>
|
</projectSettings>
|
||||||
@@ -898,7 +898,7 @@ PlayerSettings:
|
|||||||
WebGL: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
WebGL: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
||||||
Windows Store Apps: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
Windows Store Apps: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
||||||
XboxOne: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
XboxOne: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
||||||
iPhone: MAX;GAME_RELEASE1;UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI;UNITY_IAP;UNITY_PURCHASING
|
iPhone: MAX;GAME_RELEASE1;UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI;USE_ADDRESSABLES;UNITY_IAP;UNITY_PURCHASING
|
||||||
tvOS: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
tvOS: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI
|
||||||
additionalCompilerArguments: {}
|
additionalCompilerArguments: {}
|
||||||
platformArchitecture: {}
|
platformArchitecture: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user