diff --git a/.gitattributes b/.gitattributes index dfe0770..0ed61ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,129 @@ -# Auto detect text files and perform LF normalization -* text=auto +# https://github.com/alexkaratarakis/gitattributes/blob/master/Unity.gitattributes +# Unity +*.cginc text +*.cs text diff=csharp +*.shader text + +# Unity YAML +*.mat merge=unityyamlmerge eol=lf +*.anim merge=unityyamlmerge eol=lf +*.unity merge=unityyamlmerge eol=lf +*.prefab merge=unityyamlmerge eol=lf +*.asset merge=unityyamlmerge eol=lf +*.meta merge=unityyamlmerge eol=lf +*.controller merge=unityyamlmerge eol=lf + +# "physic" for 3D but "physics" for 2D +*.physicMaterial2D merge=unityyamlmerge eol=lf +*.physicMaterial merge=unityyamlmerge eol=lf +*.physicsMaterial2D merge=unityyamlmerge eol=lf +*.physicsMaterial merge=unityyamlmerge eol=lf + +# Using Git LFS +# Add diff=lfs merge=lfs to the binary files + +# Unity LFS +*.cubemap binary +*.unitypackage binary + +# 3D models +*.3dm binary +*.3ds binary +*.blend binary +*.c4d binary +*.collada binary +*.dae binary +*.dxf binary +*.FBX binary +*.fbx binary +*.jas binary +*.lws binary +*.lxo binary +*.ma binary +*.max binary +*.mb binary +*.obj binary +*.ply binary +*.skp binary +*.stl binary +*.ztl binary + +# Audio +*.aif binary +*.aiff binary +*.it binary +*.mod binary +*.mp3 binary +*.ogg binary +*.s3m binary +*.wav binary +*.xm binary + +# Video +*.asf binary +*.avi binary +*.flv binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.ogv binary +*.wmv binary + +# Images +*.bmp binary +*.exr binary +*.gif binary +*.hdr binary +*.iff binary +*.jpeg binary +*.jpg binary +*.pict binary +*.png binary +*.psd binary +*.tga binary +*.tif binary +*.tiff binary +*.webp binary + +# Compressed Archive +*.7z binary +*.bz2 binary +*.gz binary +*.rar binary +*.tar binary +*.zip binary + +# Compiled Dynamic Library +*.dll binary +*.pdb binary +*.so binary + +# Fonts +*.otf binary +*.ttf binary + +# Executable/Installer +*.apk binary +*.exe binary + +# Documents +*.pdf binary + +# ETC +*.a binary +*.rns binary +*.reason binary + +# Collapse Unity-generated files on GitHub +*.asset linguist-generated +*.mat linguist-generated +*.meta linguist-generated +*.prefab linguist-generated +*.unity linguist-generated + +# Spine export file for Unity +*.skel.bytes binary + +# Ignore stuff in the Alloy folder +Assets/Alloy/** linguist-vendored diff --git a/.gitignore b/.gitignore index ec4efdb..c4ba71b 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ crashlytics-build.properties # I like Rider /.idea/ +/[Aa]ssets/Editor.meta # Built asset bundles AssetBundles/ @@ -79,13 +80,14 @@ AssetBundles/ ImportedBundles/ # MeatKit stuffs -/[Aa]ssets/MeatKit/Managed/DinoFracture.* -/[Aa]ssets/MeatKit/Managed/ES2.* -/[Aa]ssets/MeatKit/Managed/H3VRCode* -/[Aa]ssets/MeatKit/Managed/Atlas.* -/[Aa]ssets/MeatKit/Managed/OtherLoader.* -/[Aa]ssets/MeatKit/Managed/ReadOnlyCollectionsInterfaces.* -/[Aa]ssets/MeatKit/Managed/Stratum.* +/[Aa]ssets/Managed/* +!/[Aa]ssets/Managed/0Harmony.* +!/[Aa]ssets/Managed/BepInEx.* +!/[Aa]ssets/Managed/DotNetZip.* +!/[Aa]ssets/Managed/Mono.Cecil* +!/[Aa]ssets/Managed/MonoMod.* +!/[Aa]ssets/Managed/Sodalite.* +!/[Aa]ssets/Managed/Valve.Newtonsoft.Json.* # No Bakery 4 U /[Aa]ssets/Bakery/ @@ -94,17 +96,14 @@ ImportedBundles/ /[Aa]ssets/Editor/x64.meta /[Aa]ssets/BakeryLightmaps/ /[Aa]ssets/BakeryLightmaps.meta +/[Aa]ssets/Settings +/[Aa]ssets/Settings.meta +/bakery_times.log -# Ignore Samples -Assets/Samples/ - -# Ignore any imported build items -/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/*.cs -/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/*.meta -!/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.* -!/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.* -/[Aa]ssets/MeatKit/Editor/BuildPipeline/OtherLoaderBuildRootEditor.* -/[Aa]ssets/MeatKit/Editor/BuildPipeline/SpawnerEntryEditor.* +# Ignore packages +/[Aa]ssets/Packages/ +/[Aa]ssets/Packages.meta # Cache /meatkit.json +MeatKitUpdate.unitypackage \ No newline at end of file diff --git a/Assets/MeatKit/BuildProfile.asset b/Assets/BuildProfile.asset similarity index 79% rename from Assets/MeatKit/BuildProfile.asset rename to Assets/BuildProfile.asset index 49677b0..922ddad 100644 --- a/Assets/MeatKit/BuildProfile.asset +++ b/Assets/BuildProfile.asset @@ -13,19 +13,18 @@ MonoBehaviour: m_EditorClassIdentifier: PackageName: TNH_Quality_of_Life_Improvements Author: muskit - Version: 1.2.3 - Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3} - ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3} + Version: 1.2.4 + Icon: {fileID: 2800000, guid: af542f3f6d6914f4e96d0326e8b296cc, type: 3} + ReadMe: {fileID: 102900000, guid: efa2d6091ed77bd4b879a74bd81d6cbc, type: 3} WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements Description: Quality of life improvements to the Take and Hold experience. AdditionalDependencies: - BepInEx-BepInExPack_H3VR-5.4.1700 - nrgill28-Sodalite-1.3.5 StripNamespaces: 0 - AdditionalNamespaces: - - TNHQoLImprovements + AdditionalNamespaces: [] + ApplyHarmonyPatches: 1 BuildItems: - {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2} - BundleCompressionType: 2 BuildAction: 1 OutputProfile: C:/Users/Alex/AppData/Roaming/r2modmanPlus-local/H3VR/profiles/dev diff --git a/Assets/MeatKit/BuildProfile.asset.meta b/Assets/BuildProfile.asset.meta similarity index 69% rename from Assets/MeatKit/BuildProfile.asset.meta rename to Assets/BuildProfile.asset.meta index 5f1be0a..2c89065 100644 --- a/Assets/MeatKit/BuildProfile.asset.meta +++ b/Assets/BuildProfile.asset.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: b545caf63c55b0143bd5c4ce2e5eef7c -timeCreated: 1642332594 +guid: 02926509e1e56c64d8258b04e03b04a4 +timeCreated: 1690411169 licenseType: Free NativeFormatImporter: mainObjectFileID: 11400000 diff --git a/Assets/MeatKit/Tools/GunRipper.meta b/Assets/Gizmos.meta similarity index 67% rename from Assets/MeatKit/Tools/GunRipper.meta rename to Assets/Gizmos.meta index 33487ab..5790c64 100644 --- a/Assets/MeatKit/Tools/GunRipper.meta +++ b/Assets/Gizmos.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: bf9dd0c01456ee745baa552ed8b66182 +guid: 929add3db6d432e4da84149d3edb456a folderAsset: yes -timeCreated: 1641758894 +timeCreated: 1649520255 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Gizmos/BuildProfile Icon.png b/Assets/Gizmos/BuildProfile Icon.png new file mode 100644 index 0000000..0168845 Binary files /dev/null and b/Assets/Gizmos/BuildProfile Icon.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png.meta b/Assets/Gizmos/BuildProfile Icon.png.meta similarity index 72% rename from Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png.meta rename to Assets/Gizmos/BuildProfile Icon.png.meta index a66cba7..cfdb25e 100644 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png.meta +++ b/Assets/Gizmos/BuildProfile Icon.png.meta @@ -1,18 +1,17 @@ fileFormatVersion: 2 -guid: e3aa429e1ebaddb41ad13211560ea5e8 +guid: 0b1eb8075ae1d824aaea163aa5cb832c +timeCreated: 1645982992 +licenseType: Pro TextureImporter: fileIDToRecycleName: {} - externalObjects: {} - serializedVersion: 5 + serializedVersion: 4 mipmaps: mipMapMode: 0 enableMipMap: 1 - sRGBTexture: 1 + sRGBTexture: 0 linearTexture: 0 fadeOut: 0 borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: @@ -28,13 +27,10 @@ TextureImporter: textureFormat: 1 maxTextureSize: 2048 textureSettings: - serializedVersion: 2 - filterMode: -1 + filterMode: 2 aniso: -1 mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 + wrapMode: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -46,31 +42,34 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 0 textureShape: 1 - singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - serializedVersion: 2 - buildTarget: DefaultTexturePlatform + - buildTarget: DefaultTexturePlatform maxTextureSize: 2048 - resizeAlgorithm: 0 textureFormat: -1 - textureCompression: 1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] - physicsShape: [] spritePackingTag: userData: assetBundleName: diff --git a/Assets/Gizmos/CreatePathModifier Icon.png b/Assets/Gizmos/CreatePathModifier Icon.png new file mode 100644 index 0000000..3c886b7 Binary files /dev/null and b/Assets/Gizmos/CreatePathModifier Icon.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png.meta b/Assets/Gizmos/CreatePathModifier Icon.png.meta similarity index 72% rename from Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png.meta rename to Assets/Gizmos/CreatePathModifier Icon.png.meta index 29a376d..f4304bf 100644 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png.meta +++ b/Assets/Gizmos/CreatePathModifier Icon.png.meta @@ -1,18 +1,17 @@ fileFormatVersion: 2 -guid: 18223d49715730347b997e6682fe49e5 +guid: 72bfff337624ec0459c46aebab5e81a1 +timeCreated: 1645983392 +licenseType: Pro TextureImporter: fileIDToRecycleName: {} - externalObjects: {} - serializedVersion: 5 + serializedVersion: 4 mipmaps: mipMapMode: 0 enableMipMap: 1 - sRGBTexture: 1 + sRGBTexture: 0 linearTexture: 0 fadeOut: 0 borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: @@ -28,13 +27,10 @@ TextureImporter: textureFormat: 1 maxTextureSize: 2048 textureSettings: - serializedVersion: 2 - filterMode: -1 + filterMode: 2 aniso: -1 mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 + wrapMode: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -46,31 +42,34 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 0 textureShape: 1 - singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - serializedVersion: 2 - buildTarget: DefaultTexturePlatform + - buildTarget: DefaultTexturePlatform maxTextureSize: 2048 - resizeAlgorithm: 0 textureFormat: -1 - textureCompression: 1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] - physicsShape: [] spritePackingTag: userData: assetBundleName: diff --git a/Assets/Gizmos/EnumModifier Icon.png b/Assets/Gizmos/EnumModifier Icon.png new file mode 100644 index 0000000..3c886b7 Binary files /dev/null and b/Assets/Gizmos/EnumModifier Icon.png differ diff --git a/Assets/Gizmos/EnumModifier Icon.png.meta b/Assets/Gizmos/EnumModifier Icon.png.meta new file mode 100644 index 0000000..3c6b91a --- /dev/null +++ b/Assets/Gizmos/EnumModifier Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: ad1e4c81a2272e44a8af9382cea6a7be +timeCreated: 1645983392 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/FVRFireArmRecoilProfile Icon.png b/Assets/Gizmos/FVRFireArmRecoilProfile Icon.png new file mode 100644 index 0000000..915dc42 Binary files /dev/null and b/Assets/Gizmos/FVRFireArmRecoilProfile Icon.png differ diff --git a/Assets/MeatKit/Icons/AtlasSceneBuildItem.png.meta b/Assets/Gizmos/FVRFireArmRecoilProfile Icon.png.meta similarity index 95% rename from Assets/MeatKit/Icons/AtlasSceneBuildItem.png.meta rename to Assets/Gizmos/FVRFireArmRecoilProfile Icon.png.meta index 2433e75..aceba8b 100644 --- a/Assets/MeatKit/Icons/AtlasSceneBuildItem.png.meta +++ b/Assets/Gizmos/FVRFireArmRecoilProfile Icon.png.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: f999bddab1821b94691466e97cc6891f -timeCreated: 1642657287 +guid: 15e3f33b1d6057a44ac91a0ea5a0dc66 +timeCreated: 1649523457 licenseType: Free TextureImporter: fileIDToRecycleName: {} @@ -19,7 +19,7 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 - isReadable: 1 + isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 diff --git a/Assets/Gizmos/FVRFireArmRoundDisplayData Icon.png b/Assets/Gizmos/FVRFireArmRoundDisplayData Icon.png new file mode 100644 index 0000000..dd29c57 Binary files /dev/null and b/Assets/Gizmos/FVRFireArmRoundDisplayData Icon.png differ diff --git a/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png.meta b/Assets/Gizmos/FVRFireArmRoundDisplayData Icon.png.meta similarity index 84% rename from Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png.meta rename to Assets/Gizmos/FVRFireArmRoundDisplayData Icon.png.meta index 84e7315..6a3ef60 100644 --- a/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png.meta +++ b/Assets/Gizmos/FVRFireArmRoundDisplayData Icon.png.meta @@ -1,14 +1,14 @@ fileFormatVersion: 2 -guid: 95d557f2518a98942b8b75fb4c572df2 -timeCreated: 1640801294 +guid: 4779e6e9e7b58184d8d3d3b7778378bf +timeCreated: 1649539868 licenseType: Free TextureImporter: fileIDToRecycleName: {} serializedVersion: 4 mipmaps: mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 + enableMipMap: 1 + sRGBTexture: 0 linearTexture: 0 fadeOut: 0 borderMipMap: 0 @@ -19,7 +19,7 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 - isReadable: 1 + isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -27,14 +27,14 @@ TextureImporter: textureFormat: 1 maxTextureSize: 2048 textureSettings: - filterMode: -1 + filterMode: 2 aniso: -1 mipBias: -1 - wrapMode: 1 - nPOTScale: 0 + wrapMode: -1 + nPOTScale: 1 lightmap: 0 compressionQuality: 50 - spriteMode: 1 + spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 @@ -44,7 +44,7 @@ TextureImporter: alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 - textureType: 8 + textureType: 0 textureShape: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 @@ -53,7 +53,7 @@ TextureImporter: - buildTarget: DefaultTexturePlatform maxTextureSize: 2048 textureFormat: -1 - textureCompression: 1 + textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 @@ -61,7 +61,7 @@ TextureImporter: - buildTarget: Standalone maxTextureSize: 2048 textureFormat: -1 - textureCompression: 1 + textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 diff --git a/Assets/Gizmos/FVRFirearmAudioSet Icon.png b/Assets/Gizmos/FVRFirearmAudioSet Icon.png new file mode 100644 index 0000000..dd3c3dc Binary files /dev/null and b/Assets/Gizmos/FVRFirearmAudioSet Icon.png differ diff --git a/Assets/Gizmos/FVRFirearmAudioSet Icon.png.meta b/Assets/Gizmos/FVRFirearmAudioSet Icon.png.meta new file mode 100644 index 0000000..8a7173f --- /dev/null +++ b/Assets/Gizmos/FVRFirearmAudioSet Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 85fde4e7120e9a641a99b572cd27b3df +timeCreated: 1649523715 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/FVRObject Icon.png b/Assets/Gizmos/FVRObject Icon.png new file mode 100644 index 0000000..a6e7ab0 Binary files /dev/null and b/Assets/Gizmos/FVRObject Icon.png differ diff --git a/Assets/Gizmos/FVRObject Icon.png.meta b/Assets/Gizmos/FVRObject Icon.png.meta new file mode 100644 index 0000000..f785059 --- /dev/null +++ b/Assets/Gizmos/FVRObject Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 1c3a24284d096224b909935965898746 +timeCreated: 1640061322 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/ItemSpawnerEntry Icon.png b/Assets/Gizmos/ItemSpawnerEntry Icon.png new file mode 100644 index 0000000..fc265e5 Binary files /dev/null and b/Assets/Gizmos/ItemSpawnerEntry Icon.png differ diff --git a/Assets/Gizmos/ItemSpawnerEntry Icon.png.meta b/Assets/Gizmos/ItemSpawnerEntry Icon.png.meta new file mode 100644 index 0000000..f3fae06 --- /dev/null +++ b/Assets/Gizmos/ItemSpawnerEntry Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 3441405f7f92f014a87ed402b6daa9a6 +timeCreated: 1649523141 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/OtherLoaderBuildItem Icon.png b/Assets/Gizmos/OtherLoaderBuildItem Icon.png new file mode 100644 index 0000000..cc6fa65 Binary files /dev/null and b/Assets/Gizmos/OtherLoaderBuildItem Icon.png differ diff --git a/Assets/Gizmos/OtherLoaderBuildItem Icon.png.meta b/Assets/Gizmos/OtherLoaderBuildItem Icon.png.meta new file mode 100644 index 0000000..96b4bc2 --- /dev/null +++ b/Assets/Gizmos/OtherLoaderBuildItem Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 1045227fdd9d09944a071eb719a7a4e3 +timeCreated: 1649520892 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/OtherLoaderBuildRoot Icon.png b/Assets/Gizmos/OtherLoaderBuildRoot Icon.png new file mode 100644 index 0000000..9357a34 Binary files /dev/null and b/Assets/Gizmos/OtherLoaderBuildRoot Icon.png differ diff --git a/Assets/Gizmos/OtherLoaderBuildRoot Icon.png.meta b/Assets/Gizmos/OtherLoaderBuildRoot Icon.png.meta new file mode 100644 index 0000000..658e28a --- /dev/null +++ b/Assets/Gizmos/OtherLoaderBuildRoot Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: a43ada798740864459253d240a47493a +timeCreated: 1640061322 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png b/Assets/Gizmos/PreloadAssetsBuildItem Icon.png similarity index 100% rename from Assets/MeatKit/Icons/PreloadAssetsBuildItem.png rename to Assets/Gizmos/PreloadAssetsBuildItem Icon.png diff --git a/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png.meta b/Assets/Gizmos/PreloadAssetsBuildItem Icon.png.meta similarity index 100% rename from Assets/MeatKit/Icons/PreloadAssetsBuildItem.png.meta rename to Assets/Gizmos/PreloadAssetsBuildItem Icon.png.meta diff --git a/Assets/MeatKit/Icons/StoreFilesBuildItem.png b/Assets/Gizmos/StoreFilesBuildItem Icon.png similarity index 100% rename from Assets/MeatKit/Icons/StoreFilesBuildItem.png rename to Assets/Gizmos/StoreFilesBuildItem Icon.png diff --git a/Assets/MeatKit/Icons/StoreFilesBuildItem.png.meta b/Assets/Gizmos/StoreFilesBuildItem Icon.png.meta similarity index 100% rename from Assets/MeatKit/Icons/StoreFilesBuildItem.png.meta rename to Assets/Gizmos/StoreFilesBuildItem Icon.png.meta diff --git a/Assets/Gizmos/TutorialBlock Icon.png b/Assets/Gizmos/TutorialBlock Icon.png new file mode 100644 index 0000000..7201df3 Binary files /dev/null and b/Assets/Gizmos/TutorialBlock Icon.png differ diff --git a/Assets/Gizmos/TutorialBlock Icon.png.meta b/Assets/Gizmos/TutorialBlock Icon.png.meta new file mode 100644 index 0000000..5d4e2fd --- /dev/null +++ b/Assets/Gizmos/TutorialBlock Icon.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 0a3610de08282ff4ba061142a7370a3c +timeCreated: 1649540118 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed.meta b/Assets/Managed.meta similarity index 100% rename from Assets/MeatKit/Managed.meta rename to Assets/Managed.meta diff --git a/Assets/MeatKit/Managed/0Harmony.dll b/Assets/Managed/0Harmony.dll similarity index 100% rename from Assets/MeatKit/Managed/0Harmony.dll rename to Assets/Managed/0Harmony.dll diff --git a/Assets/MeatKit/Managed/0Harmony.dll.meta b/Assets/Managed/0Harmony.dll.meta similarity index 100% rename from Assets/MeatKit/Managed/0Harmony.dll.meta rename to Assets/Managed/0Harmony.dll.meta diff --git a/Assets/MeatKit/Managed/BepInEx.dll b/Assets/Managed/BepInEx.dll similarity index 100% rename from Assets/MeatKit/Managed/BepInEx.dll rename to Assets/Managed/BepInEx.dll diff --git a/Assets/MeatKit/Managed/BepInEx.dll.meta b/Assets/Managed/BepInEx.dll.meta similarity index 100% rename from Assets/MeatKit/Managed/BepInEx.dll.meta rename to Assets/Managed/BepInEx.dll.meta diff --git a/Assets/MeatKit/Managed/DotNetZip.dll b/Assets/Managed/DotNetZip.dll similarity index 100% rename from Assets/MeatKit/Managed/DotNetZip.dll rename to Assets/Managed/DotNetZip.dll diff --git a/Assets/MeatKit/Managed/DotNetZip.dll.meta b/Assets/Managed/DotNetZip.dll.meta similarity index 100% rename from Assets/MeatKit/Managed/DotNetZip.dll.meta rename to Assets/Managed/DotNetZip.dll.meta diff --git a/Assets/Plugins/Mono.Cecil.dll b/Assets/Managed/Mono.Cecil.dll similarity index 100% rename from Assets/Plugins/Mono.Cecil.dll rename to Assets/Managed/Mono.Cecil.dll diff --git a/Assets/Plugins/Mono.Cecil.dll.meta b/Assets/Managed/Mono.Cecil.dll.meta similarity index 90% rename from Assets/Plugins/Mono.Cecil.dll.meta rename to Assets/Managed/Mono.Cecil.dll.meta index 1a33d79..367ce47 100644 --- a/Assets/Plugins/Mono.Cecil.dll.meta +++ b/Assets/Managed/Mono.Cecil.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 437f9ab4673f34e4f96969e0db002b45 -timeCreated: 1641675729 +guid: 82e22a718bb54ac3d5dec469e4f08d3f +timeCreated: 1655418961 licenseType: Pro PluginImporter: serializedVersion: 2 diff --git a/Assets/Managed/MonoMod.RuntimeDetour.dll b/Assets/Managed/MonoMod.RuntimeDetour.dll new file mode 100644 index 0000000..a5f47d1 Binary files /dev/null and b/Assets/Managed/MonoMod.RuntimeDetour.dll differ diff --git a/Assets/Plugins/NStrip.dll.meta b/Assets/Managed/MonoMod.RuntimeDetour.dll.meta similarity index 90% rename from Assets/Plugins/NStrip.dll.meta rename to Assets/Managed/MonoMod.RuntimeDetour.dll.meta index 0783ec1..204039f 100644 --- a/Assets/Plugins/NStrip.dll.meta +++ b/Assets/Managed/MonoMod.RuntimeDetour.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 903902f7b3dcdd94cb58f9fbdfee66f3 -timeCreated: 1641675222 +guid: 3f9863d03507a51b39b6c8a900141759 +timeCreated: 1655418961 licenseType: Pro PluginImporter: serializedVersion: 2 diff --git a/Assets/Managed/MonoMod.Utils.dll b/Assets/Managed/MonoMod.Utils.dll new file mode 100644 index 0000000..8fd1161 Binary files /dev/null and b/Assets/Managed/MonoMod.Utils.dll differ diff --git a/Assets/MeatKit/Managed/MonoMod.Utils.dll.meta b/Assets/Managed/MonoMod.Utils.dll.meta similarity index 96% rename from Assets/MeatKit/Managed/MonoMod.Utils.dll.meta rename to Assets/Managed/MonoMod.Utils.dll.meta index 516cf64..c897662 100644 --- a/Assets/MeatKit/Managed/MonoMod.Utils.dll.meta +++ b/Assets/Managed/MonoMod.Utils.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 7399badb939ce1137fff9ef0738fd1aa -timeCreated: 1637991225 +timeCreated: 1655418961 licenseType: Pro PluginImporter: serializedVersion: 2 diff --git a/Assets/MeatKit/Managed/Sodalite.dll b/Assets/Managed/Sodalite.dll similarity index 94% rename from Assets/MeatKit/Managed/Sodalite.dll rename to Assets/Managed/Sodalite.dll index 8a698e8..a198e96 100644 Binary files a/Assets/MeatKit/Managed/Sodalite.dll and b/Assets/Managed/Sodalite.dll differ diff --git a/Assets/MeatKit/Managed/Sodalite.dll.meta b/Assets/Managed/Sodalite.dll.meta similarity index 100% rename from Assets/MeatKit/Managed/Sodalite.dll.meta rename to Assets/Managed/Sodalite.dll.meta diff --git a/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll b/Assets/Managed/Valve.Newtonsoft.Json.dll similarity index 100% rename from Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll rename to Assets/Managed/Valve.Newtonsoft.Json.dll diff --git a/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll.meta b/Assets/Managed/Valve.Newtonsoft.Json.dll.meta similarity index 100% rename from Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll.meta rename to Assets/Managed/Valve.Newtonsoft.Json.dll.meta diff --git a/Assets/MeatKit/DefaultPathReplacements.asset b/Assets/MeatKit/DefaultPathReplacements.asset new file mode 100644 index 0000000..aab69c5 --- /dev/null +++ b/Assets/MeatKit/DefaultPathReplacements.asset @@ -0,0 +1,186 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6389bd26f6b33074ba8afe182d11c33d, type: 3} + m_Name: DefaultPathReplacements + m_EditorClassIdentifier: + ReplacementPaths: + - ScriptableObjectName: FistVR.MainMenuSceneDef + NewPath: Misc/MainMenuSceneDef + NewDefaultName: MainMenuSceneDef + NewOrder: 0 + - ScriptableObjectName: FistVR.ZosigMoodPreset + NewPath: Sosig/Zosig/MoodPreset + NewDefaultName: MoodPreset + NewOrder: 0 + - ScriptableObjectName: FistVR.ZBldgTileList + NewPath: Sosig/Zosig/zBldgTileList + NewDefaultName: zBldgTileList + NewOrder: 0 + - ScriptableObjectName: FistVR.ZosigEnemyTemplate + NewPath: Sosig/Zosig/ZosigEnemyTemplate + NewDefaultName: ZosigEnemyTemplate + NewOrder: 0 + - ScriptableObjectName: FistVR.ZosigItemSpawnTable + NewPath: Sosig/Zosig/ZosigItemSpawnTable + NewDefaultName: ZosigItemSpawnTable + NewOrder: 0 + - ScriptableObjectName: FistVR.ZosigNPCProfile + NewPath: Sosig/Zosig/ZosigNPCProfile + NewDefaultName: ZosigNPCProfile + NewOrder: 0 + - ScriptableObjectName: FistVR.HangableDef + NewPath: Misc/HangableDef + NewDefaultName: HangableDef + NewOrder: 0 + - ScriptableObjectName: FistVR.AutoMeaterFirearmSoundProfile + NewPath: Misc/AutoMeaterFirearmSoundProfile + NewDefaultName: AutoMeaterFirearmSoundProfile + NewOrder: 0 + - ScriptableObjectName: FistVR.wwBotWurstGunSoundConfig + NewPath: Misc/wwBotWurstGunSoundConfig + NewDefaultName: wwBotWurstGunSoundConfig + NewOrder: 0 + - ScriptableObjectName: FistVR.DestructibleChunkProfile + NewPath: Destruction/DestructibleChunkProfile + NewDefaultName: DestructibleChunkProfile + NewOrder: 0 + - ScriptableObjectName: FistVR.BreakableGlassPattern + NewPath: Destruction/BreakableGlassPattern + NewDefaultName: BreakableGlassPattern + NewOrder: 0 + - ScriptableObjectName: FistVR.CubeGameWaveType + NewPath: Misc/CubeGameWaveType + NewDefaultName: CubeGameWaveType + NewOrder: 0 + - ScriptableObjectName: FistVR.CubeGameWaveElement + NewPath: Misc/CubeGameWaveElement + NewDefaultName: CubeGameWaveElement + NewOrder: 0 + - ScriptableObjectName: FistVR.CubeGameWaveSequence + NewPath: Misc/CubeGameWaveSequence + NewDefaultName: CubeGameWaveSequence + NewOrder: 0 + - ScriptableObjectName: FistVR.UberShatterableDamageConfig + NewPath: Destruction/UberShatterableDamageConfig + NewDefaultName: UberShatterableDamageConfig + NewOrder: 0 + - ScriptableObjectName: FistVR.UberShatterableMeshDecalConfig + NewPath: Destruction/UberShatterableMeshDecalConfig + NewDefaultName: UberShatterableMeshDecalConfig + NewOrder: 0 + - ScriptableObjectName: FistVR.BallisticChart + NewPath: Ballistics/BallisticChart + NewDefaultName: BallisticChart + NewOrder: 0 + - ScriptableObjectName: FistVR.PMaterialDefinition + NewPath: Misc/PMaterialDefinition + NewDefaultName: PMaterialDefinition + NewOrder: 0 + - ScriptableObjectName: FistVR.MatDef + NewPath: Misc/MatDef + NewDefaultName: MatDef + NewOrder: 0 + - ScriptableObjectName: FistVR.FVRControllerDefinition + NewPath: Misc/FVRControllerDefinition + NewDefaultName: FVRControllerDefinition + NewOrder: 0 + - ScriptableObjectName: FistVR.FVREntityFlagUsage + NewPath: Misc/FVREntityFlagUsage + NewDefaultName: FVREntityFlagUsage + NewOrder: 0 + - ScriptableObjectName: FistVR.FVREntityDefinition + NewPath: Misc/FVREntityDefinition + NewDefaultName: FVREntityDefinition + NewOrder: 0 + - ScriptableObjectName: FistVR.HG_ModeProfile + NewPath: Misc/HG_ModeProfile + NewDefaultName: HG_ModeProfile + NewOrder: 0 + - ScriptableObjectName: FistVR.MF_SquadDefinition + NewPath: Misc/MF_SquadDefinition + NewDefaultName: MF_SquadDefinition + NewOrder: 0 + - ScriptableObjectName: FistVR.MG_EventAIConfig + NewPath: Misc/MG_EventAIConfig + NewDefaultName: MG_EventAIConfig + NewOrder: 0 + - ScriptableObjectName: FistVR.MG_IncidenceChart + NewPath: Misc/MG_IncidenceChart + NewDefaultName: MG_IncidenceChart + NewOrder: 0 + - ScriptableObjectName: FistVR.OmniSequencerSequenceDefinition + NewPath: Misc/OmniSequencerSequenceDefinition + NewDefaultName: OmniSequencerSequenceDefinition + NewOrder: 0 + - ScriptableObjectName: FistVR.SV_LootTable + NewPath: Misc/SV_LootTable + NewDefaultName: SV_LootTable + NewOrder: 0 + - ScriptableObjectName: FistVR.wwBotWurstConfig + NewPath: Misc/wwBotWurstConfig + NewDefaultName: wwBotWurstConfig + NewOrder: 0 + - ScriptableObjectName: FistVR.wwMagicKeypadHash + NewPath: Misc/wwMagicKeypadHash + NewDefaultName: wwMagicKeypadHash + NewOrder: 0 + - ScriptableObjectName: FistVR.SlideSequenceDef + NewPath: Misc/SlideSequenceDef + NewDefaultName: SlideSequenceDef + NewOrder: 0 + - ScriptableObjectName: FistVR.PTargetCategoryDic + NewPath: Misc/PTargetCategoryDic + NewDefaultName: PTargetCategoryDic + NewOrder: 0 + - ScriptableObjectName: FistVR.ReticleColorProgression + NewPath: Misc/ReticleColorProgression + NewDefaultName: ReticleColorProgression + NewOrder: 0 + - ScriptableObjectName: FistVR.FVRHapticBuzzProfile + NewPath: Misc/FVRHapticBuzzProfile + NewDefaultName: FVRHapticBuzzProfile + NewOrder: 0 + - ScriptableObjectName: FistVR.ItemSpawnerCategoryDefinitionsV2 + NewPath: ItemSpawner/ItemSpawnerCategoryDefinitionsV2 + NewDefaultName: ItemSpawnerCategoryDefinitionsV2 + NewOrder: 0 + - ScriptableObjectName: FistVR.ItemSpawnerNewItemManifest + NewPath: ItemSpawner/ItemSpawnerNewItemManifest + NewDefaultName: ItemSpawnerNewItemManifest + NewOrder: 0 + - ScriptableObjectName: FistVR.ItemSpawnerV2TagCatDef + NewPath: ItemSpawner/ItemSpawnerV2TagCatDef + NewDefaultName: ItemSpawnerV2TagCatDef + NewOrder: 0 + - ScriptableObjectName: FistVR.EquipmentPoolDef + NewPath: TNH/EquipmentPoolDef + NewDefaultName: EquipmentPoolDef + NewOrder: 0 + - ScriptableObjectName: FistVR.TNH_CharacterDef + NewPath: TNH/TNH_CharacterDef + NewDefaultName: TNH_CharacterDef + NewOrder: 0 + - ScriptableObjectName: FistVR.ObjectTableDef + NewPath: TNH/ObjectTableDef + NewDefaultName: ObjectTableDef + NewOrder: 0 + - ScriptableObjectName: FistVR.TNH_PointSequence + NewPath: TNH/TNH_PointSequence + NewDefaultName: TNH_PointSequence + NewOrder: 0 + - ScriptableObjectName: FistVR.PTargetProfile + NewPath: Misc/PTargetProfile + NewDefaultName: PTargetProfile + NewOrder: 0 + - ScriptableObjectName: FistVR.TutorialBlock + NewPath: ItemSpawner/TutorialBlock + NewDefaultName: TutorialBlock + NewOrder: 0 diff --git a/Assets/Settings/BakeryProjectSettings.asset.meta b/Assets/MeatKit/DefaultPathReplacements.asset.meta similarity index 61% rename from Assets/Settings/BakeryProjectSettings.asset.meta rename to Assets/MeatKit/DefaultPathReplacements.asset.meta index 3b4a284..56d49f9 100644 --- a/Assets/Settings/BakeryProjectSettings.asset.meta +++ b/Assets/MeatKit/DefaultPathReplacements.asset.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: b4e6f6c2117595b4697d03c8b3545474 -timeCreated: 1629140350 -licenseType: Pro +guid: ef60ed33189250d4c8b65b237758ad95 +timeCreated: 1645904809 +licenseType: Free NativeFormatImporter: mainObjectFileID: 11400000 userData: diff --git a/Assets/MeatKit/Editor/AssemblyExporter.cs b/Assets/MeatKit/Editor/AssemblyExporter.cs deleted file mode 100644 index fe084f0..0000000 --- a/Assets/MeatKit/Editor/AssemblyExporter.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Mono.Cecil; -using Mono.Cecil.Cil; - -namespace MeatKit -{ - public static partial class MeatKit - { - private const string EditorAssemblyPath = "Library/ScriptAssemblies/"; - public const string BundleOutputPath = "AssetBundles/"; - - private static void ExportEditorAssembly(string folder) - { - if (!File.Exists(EditorAssemblyPath + AssemblyName + ".dll")) return; - - // Delete the old file - var settings = BuildWindow.SelectedProfile; - var exportPath = folder + settings.PackageName + ".dll"; - if (File.Exists(exportPath)) File.Delete(exportPath); - - var rParams = new ReaderParameters - { - AssemblyResolver = - new RedirectedAssemblyResolver(Path.GetDirectoryName(typeof(UnityEngine.Object).Assembly.Location)) - }; - - // Get the MeatKitPlugin class and rename it - string tempFile = Path.GetTempFileName(); - File.Copy(EditorAssemblyPath + AssemblyName + ".dll", tempFile, true); - using (var asm = AssemblyDefinition.ReadAssembly(tempFile, rParams)) - { - var plugin = asm.MainModule.GetType("MeatKitPlugin"); - plugin.Name = settings.PackageName + "Plugin"; - - // This is some quantum bullshit. - // If you don't enumerate the constructor arguments for attributes their values aren't updated correctly. - foreach (var x in GetAllCustomAttributes(asm).SelectMany(a => a.ConstructorArguments)) - { - } - - // Get the BepInPlugin attribute and replace the values in it with our own - var str = asm.MainModule.TypeSystem.String; - var guid = settings.Author + "." + settings.PackageName; - var pluginAttribute = plugin.CustomAttributes.First(a => a.AttributeType.Name == "BepInPlugin"); - pluginAttribute.ConstructorArguments[0] = new CustomAttributeArgument(str, guid); - pluginAttribute.ConstructorArguments[1] = new CustomAttributeArgument(str, settings.PackageName); - pluginAttribute.ConstructorArguments[2] = new CustomAttributeArgument(str, settings.Version); - - // Get the LoadAssets method and make a new body for it - var loadAssetsMethod = plugin.Methods.First(m => m.Name == "LoadAssets"); - loadAssetsMethod.Body = new MethodBody(loadAssetsMethod); - var il = loadAssetsMethod.Body.GetILProcessor(); - - // Let any build items insert their own code in here - foreach (var item in settings.BuildItems) - item.GenerateLoadAssets(plugin, il); - - // Insert a ret at the end so it's valid - il.Emit(OpCodes.Ret); - - // Module name needs to be changed away from Assembly-CSharp.dll because it is a reserved name. - asm.Name = new AssemblyNameDefinition(settings.PackageName, asm.Name.Version); - asm.MainModule.Name = settings.PackageName + ".dll"; - - // References to renamed unity code must be swapped out. - foreach (var ii in asm.MainModule.AssemblyReferences) - switch (ii.Name) - { - case AssemblyRename: - ii.Name = AssemblyName; - break; - case AssemblyFirstpassRename: - ii.Name = AssemblyFirstpassName; - break; - } - - if (BuildWindow.SelectedProfile.StripNamespaces) - { - // Remove types not in an allowed namespace or the global namespace - string[] allowedNamespaces = BuildWindow.SelectedProfile.GetAllAllowedNamespaces(); - List typesToRemove = new List(); - foreach (var type in asm.MainModule.Types) - { - if (type.Namespace == "" || allowedNamespaces.Any(x => type.Namespace.Contains(x))) - continue; - typesToRemove.Add(type); - } - - foreach (var type in typesToRemove) asm.MainModule.Types.Remove(type); - } - - // Remove the same types we didn't want to import. This cannot be skipped. - foreach (var type in StripAssemblyTypes - .Select(x => asm.MainModule.GetType(x)) - .Where(x => x != null)) - asm.MainModule.Types.Remove(type); - - try - { - // Save it - asm.Write(exportPath); - } - catch (ArgumentException e) - { - throw new MeatKitBuildException("Unable to write exported scripts file. This is likely due to namespace stripping being enabled and a required namespace is not whitelisted.", e); - } - } - - // Delete temp file now that we're done. - File.Delete(tempFile); - } - - private static IEnumerable GetAllCustomAttributes(AssemblyDefinition asm) - { - foreach (var type in asm.MainModule.Types) - { - foreach (var attrib in type.CustomAttributes) yield return attrib; - foreach (CustomAttribute attrib in type.Methods.SelectMany(method => method.CustomAttributes)) - yield return attrib; - } - } - } -} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta index aef1683..562b9a2 100644 --- a/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta +++ b/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta @@ -1,3 +1,12 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: c7e21420a1d84ca5947b2fd9eb9db6d8 -timeCreated: 1628213934 \ No newline at end of file +timeCreated: 1649523855 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/CreatePathModifier.cs b/Assets/MeatKit/Editor/AssemblyModifiers/CreatePathModifier.cs new file mode 100644 index 0000000..c4302ba --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/CreatePathModifier.cs @@ -0,0 +1,80 @@ +using System; +using System.Linq; +using Mono.Cecil; +using UnityEngine; + +namespace MeatKit +{ + [CreateAssetMenu(menuName = "MeatKit/Assembly Editors/Path Replacer", fileName = "New Path Replacer")] + public class CreatePathModifier : AssemblyModifier + { + [Tooltip("The new path replacements")] + public ReplacementPath[] ReplacementPaths = new ReplacementPath[0]; + + public override void ApplyModification(AssemblyDefinition assembly) + { + TypeReference stringRef = assembly.MainModule.TypeSystem.String; + TypeReference intRef = assembly.MainModule.TypeSystem.Int32; + if (stringRef == null || intRef == null) return; + + foreach (ReplacementPath replacementPath in ReplacementPaths) + { + TypeReference type = assembly.MainModule.GetType(replacementPath.ScriptableObjectName); + if (type == null) continue; + + TypeDefinition definition = type.Resolve(); + CustomAttribute createMenuAttribute = GetCreateAssetMenuAttribute(definition); + + if (createMenuAttribute == null) + { + Debug.LogWarning("Could not get CreateAssetMenuAttribute for scriptable object: " + replacementPath.ScriptableObjectName); + continue; + } + + CustomAttributeArgument pathArgumentValue = new CustomAttributeArgument(stringRef, replacementPath.NewPath); + CustomAttributeArgument fileNameArgumentValue = new CustomAttributeArgument(stringRef, replacementPath.NewDefaultName); + CustomAttributeArgument orderArgumentValue = new CustomAttributeArgument(intRef, replacementPath.NewOrder); + + CustomAttributeNamedArgument pathArgument = new CustomAttributeNamedArgument("menuName", pathArgumentValue); + CustomAttributeNamedArgument fileNameArgument = new CustomAttributeNamedArgument("fileName", fileNameArgumentValue); + CustomAttributeNamedArgument orderArgument = new CustomAttributeNamedArgument("order", orderArgumentValue); + + createMenuAttribute.Properties.Clear(); + createMenuAttribute.Properties.Add(pathArgument); + createMenuAttribute.Properties.Add(fileNameArgument); + createMenuAttribute.Properties.Add(orderArgument); + } + + Applied = true; + } + + private CustomAttribute GetCreateAssetMenuAttribute(TypeDefinition definition) + { + CustomAttribute[] foundAttributes = definition.CustomAttributes.Where(ca => ca.AttributeType.FullName.Contains("CreateAssetMenuAttribute")).ToArray(); + + if(foundAttributes.Length > 0) + { + return foundAttributes[0]; + } + + return null; + } + + + [Serializable] + public struct ReplacementPath + { + [Tooltip("Specify the FULL NAME of the scriptable object you wish to modify. e.g. Sub.Namespace.Type")] + public string ScriptableObjectName; + + [Tooltip("The new create asset path of the scriptable object")] + public string NewPath; + + [Tooltip("The new default name of the scriptable object when created")] + public string NewDefaultName; + + [Tooltip("The new ordering of the scriptable object in menu")] + public int NewOrder; + } + } +} diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/CreatePathModifier.cs.meta similarity index 76% rename from Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs.meta rename to Assets/MeatKit/Editor/AssemblyModifiers/CreatePathModifier.cs.meta index c840147..ad554a7 100644 --- a/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs.meta +++ b/Assets/MeatKit/Editor/AssemblyModifiers/CreatePathModifier.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 80429e2d9786fda44b01ab04cadd4b75 -timeCreated: 1641758895 +guid: 6389bd26f6b33074ba8afe182d11c33d +timeCreated: 1649523850 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs index 2d11fdc..31e4645 100644 --- a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using Mono.Cecil; using UnityEngine; @@ -18,8 +19,28 @@ namespace MeatKit public override void ApplyModification(AssemblyDefinition assembly) { - // Try to get this type from the assembly. If it doesn't exist, we can just skip. - TypeReference type = assembly.MainModule.GetType(EnumName); + // Try to get the enum type. If it contains a '+' in the name, it's nested and we have to do a bit of extra stuff + TypeDefinition type; + if (EnumName.Contains("+")) + { + + string[] parts = EnumName.Split('+'); + type = assembly.MainModule.GetType(parts[0]); + if (type != null) + { + for (int i = 1; i < parts.Length; i++) + { + Debug.Log(type); + type = type.NestedTypes.FirstOrDefault(x => x.Name == parts[i]); + if (type == null) break; + } + } + } + + // Otherwise we can just grab it directly if it isn't nested + else type = assembly.MainModule.GetType(EnumName); + + // If we can't find the type, skip. if (type == null) return; var definition = type.Resolve(); diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta index 4f52af5..857767c 100644 --- a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta @@ -1,3 +1,12 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: 486e27304e8449efb6c6136482952c4d -timeCreated: 1628213734 \ No newline at end of file +timeCreated: 1649523858 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs index 211c98d..ec6e415 100644 --- a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs @@ -12,8 +12,10 @@ namespace MeatKit "FistVR.FireArmRoundType", "FistVR.FireArmRoundClass", "FistVR.FireArmMagazineType", - "FistVR.ItemSpawnerObjectDefinition.ItemSpawnerCategory", - "FistVR.SosigEnemyID" + "FistVR.ItemSpawnerObjectDefinition+ItemSpawnerCategory", + "FistVR.SosigEnemyID", + "FistVR.FVRFireArmAttachementMountType", + "FistVR.FireArmClipType" }; private SerializedProperty _addedValues; diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta index 278aa9d..82b77ec 100644 --- a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta @@ -1,3 +1,12 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: 4980597d341c4eed913ae30680f3f9f3 -timeCreated: 1628218472 \ No newline at end of file +timeCreated: 1649523860 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/Build.cs b/Assets/MeatKit/Editor/Build.cs index 5be2129..8325426 100644 --- a/Assets/MeatKit/Editor/Build.cs +++ b/Assets/MeatKit/Editor/Build.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -14,6 +14,8 @@ namespace MeatKit { public static void DoBuild() { + BuildLog.StartNew(); + try { DoBuildInternal(); @@ -23,13 +25,17 @@ namespace MeatKit string message = e.Message; if (e.InnerException != null) message += "\n\n" + e.InnerException.Message; EditorUtility.DisplayDialog("Build failed", message, "Ok."); + BuildLog.SetCompletionStatus(true, "MeatKit Build Exception", e); } catch (Exception e) { EditorUtility.DisplayDialog("Build failed with unknown error", "Error message: " + e.Message + "\n\nCheck console for full exception text.", "Ok."); Debug.LogException(e); + BuildLog.SetCompletionStatus(true, "Unexpected exception during build", e); } + + BuildLog.Finish(); } private static void DoBuildInternal() @@ -41,6 +47,8 @@ namespace MeatKit BuildProfile profile = BuildWindow.SelectedProfile; if (!profile) return; + string bundleOutputPath = profile.ExportPath; + // Start a stopwatch to time the build Stopwatch sw = Stopwatch.StartNew(); @@ -48,39 +56,66 @@ namespace MeatKit if (!profile.EnsureValidForEditor()) return; // Clean the output folder - CleanBuild(); + BuildLog.WriteLine("Cleaning build folder"); + CleanBuild(profile); - // And export the assembly to the folder - ExportEditorAssembly(BundleOutputPath); - - // Then get their asset bundle configurations - var bundles = profile.BuildItems.SelectMany(x => x.ConfigureBuild()).ToArray(); - - BuildPipeline.BuildAssetBundles(BundleOutputPath, bundles, BuildAssetBundleOptions.None, - BuildTarget.StandaloneWindows64); - - // Cleanup the unused files created with building the bundles - foreach (var file in Directory.GetFiles(BundleOutputPath, "*.manifest")) - File.Delete(file); - File.Delete(Path.Combine(BundleOutputPath, "AssetBundles")); - - // With the bundles done building we can process them + // Make a copy of the editor assembly because when we build an asset bundle, Unity will delete it + string editorAssembly = EditorAssemblyPath + AssemblyName + ".dll"; + string tempAssemblyFile = Path.GetTempFileName(); + BuildLog.WriteLine("Copying editor assembly: " + editorAssembly + " -> " + tempAssemblyFile); + File.Copy(editorAssembly, tempAssemblyFile, true); + + // Make sure we have the virtual reality supported checkbox enabled + // If this is not set to true when we build our asset bundles, the shaders will not compile correctly + BuildLog.WriteLine("Forcing VR support on"); + bool wasVirtualRealitySupported = PlayerSettings.virtualRealitySupported; + PlayerSettings.virtualRealitySupported = true; + + // Create a map of assembly names to what we want to rename them to, then enable bundle processing var replaceMap = new Dictionary { - {"Assembly-CSharp.dll", profile.PackageName + ".dll"}, - {"Assembly-CSharp-firstpass.dll", profile.PackageName + "-firstpass.dll"}, - {"H3VRCode-CSharp.dll", "Assembly-CSharp.dll"}, - {"H3VRCode-CSharp-firstpass.dll", "Assembly-CSharp-firstpass.dll"} + {AssemblyName + ".dll", profile.PackageName + ".dll"}, + {AssemblyFirstpassName + ".dll", profile.PackageName + "-firstpass.dll"}, + {AssemblyRename + ".dll", AssemblyName + ".dll"}, + {AssemblyFirstpassRename + ".dll", AssemblyFirstpassName + ".dll"} }; + BuildLog.WriteLine("Enabling bundle processing."); + BuildLog.WriteLine("Replace map:"); + foreach (var key in replaceMap.Keys) + BuildLog.WriteLine(" " + key + " -> " + replaceMap[key]); + BuildLog.WriteLine("Ignored types (Assembly-CSharp.dll):"); + foreach (var type in StripAssemblyTypes) + BuildLog.WriteLine(" " + type); + AssetBundleIO.EnableProcessing(replaceMap, false, true); - foreach (var bundle in bundles) - { - var path = Path.Combine(BundleOutputPath, bundle.assetBundleName); - ProcessBundle(path, path, replaceMap, profile.BundleCompressionType); - } - + // Get the list of asset bundle configurations and build them + BuildLog.WriteLine("Collecting bundles from build items"); + var bundles = profile.BuildItems.SelectMany(x => x.ConfigureBuild()).ToArray(); + BuildLog.WriteLine(bundles.Length + " bundles to build. Building bundles."); + BuildPipeline.BuildAssetBundles(bundleOutputPath, bundles, BuildAssetBundleOptions.ChunkBasedCompression, + BuildTarget.StandaloneWindows64); + + // Disable bundle processing now that we're done with it. + AssetBundleIO.DisableProcessing(); + var requiredScripts = AssetBundleIO.SerializedScriptNames; + BuildLog.WriteLine("Bundles built"); + + // Cleanup the unused files created with building the bundles + BuildLog.WriteLine("Cleaning unused files"); + foreach (var file in Directory.GetFiles(bundleOutputPath, "*.manifest")) + File.Delete(file); + File.Delete(Path.Combine(bundleOutputPath, profile.Version)); + + // Reset the virtual reality supported checkbox, so if the user had it disabled it will stay disabled + PlayerSettings.virtualRealitySupported = wasVirtualRealitySupported; + + // And export the assembly to the folder + BuildLog.WriteLine("Exporting editor assembly"); + ExportEditorAssembly(bundleOutputPath, tempAssemblyFile, requiredScripts); + // Now we can write the Thunderstore stuff to the folder - profile.WriteThunderstoreManifest(BundleOutputPath + "manifest.json"); + BuildLog.WriteLine("Writing Thunderstore manifest"); + profile.WriteThunderstoreManifest(bundleOutputPath + "manifest.json"); // Check if the icon is already 256x256 Texture2D icon = profile.Icon; @@ -90,6 +125,7 @@ namespace MeatKit if (!importSettings.isReadable || importSettings.textureCompression != TextureImporterCompression.Uncompressed) { + BuildLog.WriteLine("Fixing icon import settings"); importSettings.isReadable = true; importSettings.textureCompression = TextureImporterCompression.Uncompressed; importSettings.SaveAndReimport(); @@ -98,41 +134,48 @@ namespace MeatKit if (profile.Icon.width != 256 || profile.Icon.height != 256) { // Resize it for the build + BuildLog.WriteLine("Icon was not 256x256, resizing"); icon = icon.ScaleTexture(256, 256); } // Write the texture to file - File.WriteAllBytes(BundleOutputPath + "icon.png", icon.EncodeToPNG()); + BuildLog.WriteLine("Saving icon"); + File.WriteAllBytes(bundleOutputPath + "icon.png", icon.EncodeToPNG()); // Copy the readme - File.Copy(AssetDatabase.GetAssetPath(profile.ReadMe), BundleOutputPath + "README.md"); + BuildLog.WriteLine("Copying readme"); + File.Copy(AssetDatabase.GetAssetPath(profile.ReadMe), bundleOutputPath + "README.md"); string packageName = profile.Author + "-" + profile.PackageName; if (profile.BuildAction == BuildAction.CopyToProfile) { + BuildLog.WriteLine("Copying built files to profile"); string pluginFolder = Path.Combine(profile.OutputProfile, "BepInEx/plugins/" + packageName); if (Directory.Exists(pluginFolder)) Directory.Delete(pluginFolder, true); Directory.CreateDirectory(pluginFolder); - Extensions.CopyFilesRecursively(BundleOutputPath, pluginFolder); + Extensions.CopyFilesRecursively(bundleOutputPath, pluginFolder); } else if (profile.BuildAction == BuildAction.CreateThunderstorePackage) { + BuildLog.WriteLine("Zipping built files"); using (var zip = new ZipFile()) { - zip.AddDirectory(BundleOutputPath, ""); - zip.Save(Path.Combine(BundleOutputPath, packageName + ".zip")); + zip.AddDirectory(bundleOutputPath, ""); + zip.Save(Path.Combine(bundleOutputPath, packageName + "-" + profile.Version + ".zip")); } } // End the stopwatch and save the time + BuildLog.SetCompletionStatus(false, "", null); MeatKitCache.LastBuildDuration = sw.Elapsed; MeatKitCache.LastBuildTime = DateTime.Now; } - public static void CleanBuild() + public static void CleanBuild(BuildProfile profile) { - if (Directory.Exists(BundleOutputPath)) Directory.Delete(BundleOutputPath, true); - Directory.CreateDirectory(BundleOutputPath); + string outputPath = profile.ExportPath; + if (Directory.Exists(outputPath)) Directory.Delete(outputPath, true); + Directory.CreateDirectory(outputPath); } } -} \ No newline at end of file +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta index 801a684..41bb6e4 100644 --- a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta @@ -1,12 +1,12 @@ fileFormatVersion: 2 guid: d18106ea7c52411db45cabd362f21f16 -timeCreated: 1640061580 -licenseType: Pro +timeCreated: 1649523901 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 151c1f5398ee70041a49c417b23f1846, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta index 57e4eb9..46df36c 100644 --- a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta @@ -1,12 +1,12 @@ fileFormatVersion: 2 guid: f6d6db4144b34551885c304840edfb62 -timeCreated: 1640061353 -licenseType: Pro +timeCreated: 1649523904 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 6fae6dfd178cd184180013acef55632c, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildLog.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildLog.cs new file mode 100644 index 0000000..fc0bff5 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildLog.cs @@ -0,0 +1,100 @@ +using System; +using System.Diagnostics; +using System.IO; + +namespace MeatKit +{ + public static class BuildLog + { + private static StringWriter _temp; + private static Stopwatch _sw; + private static DateTime _startTime; + private static bool _failed; + private static string _completionMessage; + private static Exception _exception; + + public static void StartNew() + { + _temp = new StringWriter(); + _sw = Stopwatch.StartNew(); + _startTime = DateTime.Now; + } + + public static void WriteLine(string text) + { + if (_temp == null) return; + _temp.WriteLine(text); + } + + public static void SetCompletionStatus(bool failed, string message, Exception exception) + { + _failed = failed; + _completionMessage = message; + _exception = exception; + } + + public static void Finish() + { + _sw.Stop(); + + StreamWriter output = new StreamWriter("AssetBundles/buildlog.txt", false); + + WriteProfileInfo(output); + output.WriteLine(); + output.WriteLine("--- MeatKit Build Log ---"); + output.WriteLine("Start Time: " + _startTime.ToString("dddd, dd MMMM yyyy HH:mm:ssK")); + output.WriteLine("Duration : " + _sw.Elapsed.GetReadableTimespan()); + output.WriteLine("Status : " + (_failed ? "FAILED" : "COMPLETED")); + if (!string.IsNullOrEmpty(_completionMessage)) + output.WriteLine("Message : " + _completionMessage); + if (_exception != null) + { + output.WriteLine("Exception :"); + output.WriteLine(_exception.ToString()); + } + + output.WriteLine("\n--- Full build log ---"); + output.Write(_temp.ToString()); + + output.Close(); + output.Dispose(); + _temp = null; + } + + private static void WriteProfileInfo(StreamWriter output) + { + var profile = BuildWindow.SelectedProfile; + var implicitDependencies = profile.GetRequiredDependencies(); + + output.WriteLine("--- Selected Build Profile ---"); + output.WriteLine("Thunderstore Metadata"); + output.WriteLine(" Package Name: " + profile.PackageName); + output.WriteLine(" Author : " + profile.Author); + output.WriteLine(" Version : " + profile.Version); + output.WriteLine(" Icon Set : " + (profile.Icon == null ? "No" : "Yes")); + output.WriteLine(" Readme Set : " + (profile.ReadMe == null ? "No" : "Yes")); + output.WriteLine(" Website URL : " + profile.WebsiteURL); + output.WriteLine(" Description : " + profile.Description); + output.WriteLine(" Implicit Dependencies : (" + implicitDependencies.Length + ")"); + foreach (var dependency in implicitDependencies) + output.WriteLine(" " + dependency); + output.WriteLine(" Additional Dependencies: (" + profile.AdditionalDependencies.Length + ")"); + foreach (var dependency in profile.AdditionalDependencies) + output.WriteLine(" " + dependency); + + output.WriteLine("Script Options"); + output.WriteLine(" Strip Namespaces : " + profile.StripNamespaces); + output.WriteLine(" Additional Namespaces: (" + profile.AdditionalNamespaces.Length + ")"); + foreach (var @namespace in profile.AdditionalNamespaces) + output.WriteLine(" " + @namespace); + output.WriteLine(" Apply Harmony Patches: " + profile.ApplyHarmonyPatches); + + output.WriteLine("Export Options"); + output.WriteLine(" Build Items: (" + profile.BuildItems.Length + ")"); + foreach (var buildItem in profile.BuildItems) + output.WriteLine(" " + buildItem); + output.WriteLine(" Build Action: " + profile.BuildAction); + output.WriteLine(" Export Path : " + profile.ExportPath); + } + } +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildLog.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildLog.cs.meta new file mode 100644 index 0000000..40d454b --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildLog.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f474df2cd776465d8cc9d2f7f52f77c7 +timeCreated: 1664853706 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs index edfe8cc..b9c7c9e 100644 --- a/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; -using AssetsTools.NET; using UnityEditor; using UnityEngine; using Object = UnityEngine.Object; @@ -18,6 +17,8 @@ namespace MeatKit [CreateAssetMenu(menuName = "MeatKit/Build Profile")] public class BuildProfile : ScriptableObject, IValidatable { + private const string BaseOutputPath = "AssetBundles/"; + [Header("Thunderstore Metadata")] public string PackageName = ""; public string Author = ""; @@ -31,10 +32,10 @@ namespace MeatKit [Header("Script Options")] public bool StripNamespaces = true; public string[] AdditionalNamespaces = new string[0]; - + public bool ApplyHarmonyPatches = true; + [Header("Export Options")] public BuildItem[] BuildItems = new BuildItem[0]; - public AssetBundleCompressionType BundleCompressionType = AssetBundleCompressionType.LZ4; public BuildAction BuildAction = BuildAction.JustBuildFiles; [HideInInspector] @@ -49,6 +50,11 @@ namespace MeatKit messages["PackageName"] = BuildMessage.Error("Package name can only contain letters, numbers, and underscores."); + // Author needs to match regex + if (!Regex.IsMatch(Author, @"^[a-zA-Z_0-9]+$")) + messages["Author"] = + BuildMessage.Error("Author can only contain letters, numbers, and underscores."); + // Make sure the version number is a valid x.x.x if (!Regex.IsMatch(Version, @"^\d+\.\d+\.\d+$")) messages["Version"] = BuildMessage.Error("Version number must be in format 'x.x.x'."); @@ -65,18 +71,8 @@ namespace MeatKit if (!ReadMe) messages["ReadMe"] = BuildMessage.Error("Missing readme."); - - switch (BundleCompressionType) - { - case AssetBundleCompressionType.NONE: - messages["BundleCompressionType"] = BuildMessage.Warning( - "Uncompressed bundles are not recommended for publication. They can and will be very large."); - break; - case AssetBundleCompressionType.LZMA: - messages["BundleCompressionType"] = BuildMessage.Info( - "LZMA can take longer to compress than LZ4, however it will result in smaller file sizes usually."); - break; - } + else if (!AssetDatabase.GetAssetPath(ReadMe).EndsWith(".md", StringComparison.InvariantCultureIgnoreCase)) + messages["ReadMe"] = BuildMessage.Warning("Are you sure this is a Markdown file? It doesn't have the .md file extension."); switch (BuildAction) { @@ -109,11 +105,32 @@ namespace MeatKit public bool EnsureValidForEditor() { - // Go over each build item + BuildLog.WriteLine("Starting build profile check..."); + + // Check ourselves bool hasErrors = false, hasWarnings = false; - foreach (var item in BuildItems) - // Check if it has any validation messages + foreach (var message in Validate().Values) + { + // Log them + switch (message.Type) + { + case MessageType.Error: + Debug.LogError(AssetDatabase.GetAssetPath(this) + ": " + message.Message); + hasErrors = true; + break; + case MessageType.Warning: + Debug.LogWarning(AssetDatabase.GetAssetPath(this) + ": " + message.Message); + hasWarnings = true; + break; + } + + BuildLog.WriteLine(" " + message.Type + ": " + this + ": " + message.Message); + } + + // Go over each build item and check for any validation messages + foreach (var item in BuildItems.Where(x => x != null)) foreach (var message in item.Validate().Values) + { // Log them switch (message.Type) { @@ -125,45 +142,54 @@ namespace MeatKit Debug.LogWarning(AssetDatabase.GetAssetPath(item) + ": " + message.Message); hasWarnings = true; break; - case MessageType.Info: - Debug.Log(AssetDatabase.GetAssetPath(item) + ": " + message.Message); - break; - default: - throw new ArgumentOutOfRangeException(); } + BuildLog.WriteLine(" " + message.Type + ": " + item + ": " + message.Message); + } + + // If there's errors don't let anything continue if (hasErrors) { EditorUtility.DisplayDialog("Build errors", "There were errors validating your build items. Please check the console for more info.", "Ok."); + BuildLog.SetCompletionStatus(true, "Build profile failed one or more checks", null); return false; } // If there's only warnings, let the user decide if they want to continue if (hasWarnings) - return EditorUtility.DisplayDialog("Build warnings", + { + var continueAnyway = EditorUtility.DisplayDialog("Build warnings", "Some build items validated with warnings. Continue with build anyway?", "Yes", "No"); - // Otherwise continue - return true; + BuildLog.WriteLine("Build profile has one or more warnings."); + BuildLog.WriteLine(" Continue anyway? " + continueAnyway); + BuildLog.SetCompletionStatus(true, "User canceled build", null); + + return continueAnyway; + } + else + { + // Otherwise continue + BuildLog.WriteLine(" Build profile passed all checks!"); + return true; + } } public string[] GetRequiredDependencies() { return BuildItems .Where(x => x != null) - .SelectMany(x => x.RequiredDependencies).ToArray(); + .SelectMany(x => x.RequiredDependencies) + .Distinct().ToArray(); } public string MainNamespace { - get - { - return Author + "." + PackageName; - } + get { return Author + "." + PackageName; } } - + public string[] GetRequiredNamespaces() { return new[] {MainNamespace}; @@ -173,7 +199,12 @@ namespace MeatKit { return GetRequiredNamespaces().Concat(AdditionalNamespaces).ToArray(); } - + + public string ExportPath + { + get { return Path.Combine(BaseOutputPath, Path.Combine(PackageName, Version)) + Path.DirectorySeparatorChar; } + } + public void WriteThunderstoreManifest(string location) { #if H3VR_IMPORTED @@ -187,7 +218,7 @@ namespace MeatKit // ReSharper disable once CoVariantArrayConversion obj["dependencies"] = new JArray(GetRequiredDependencies().Concat(AdditionalDependencies).ToArray()); - File.WriteAllText(location, JsonConvert.SerializeObject(obj)); + File.WriteAllText(location, JsonConvert.SerializeObject(obj,Formatting.Indented)); #endif } } @@ -198,4 +229,4 @@ namespace MeatKit CopyToProfile, CreateThunderstorePackage } -} \ No newline at end of file +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta index e697a2e..71cf3fe 100644 --- a/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta @@ -1,3 +1,14 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: afed54a239594b8abd631a8047a54987 -timeCreated: 1635004125 \ No newline at end of file +timeCreated: 1649524426 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - Icon: {instanceID: 0} + - ReadMe: {instanceID: 0} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs b/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs index 4994ea8..3af28a9 100644 --- a/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs +++ b/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs @@ -4,9 +4,12 @@ namespace MeatKit { public class MeatKitBuildException : Exception { + public MeatKitBuildException(string message) : base(message) + { + } + public MeatKitBuildException(string message, Exception innerException) : base(message, innerException) { - } } } \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BundleExporter.cs b/Assets/MeatKit/Editor/BundleExporter.cs deleted file mode 100644 index ed22b4f..0000000 --- a/Assets/MeatKit/Editor/BundleExporter.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using AssetsTools.NET; -using AssetsTools.NET.Extra; -using UnityEditor; - -namespace MeatKit -{ - public static partial class MeatKit - { - private static void ProcessBundle(string source, string destination, IDictionary replaceMap, - AssetBundleCompressionType recompressAs) - { - try - { - // Step 1: Load the asset bundle. - EditorUtility.DisplayProgressBar("Processing bundle", "Loading asset bundle...", 0f); - var am = new AssetsManager(); - var bundle = am.LoadBundleFile(source); - var assets = am.LoadAssetsFileFromBundle(bundle, 0); - - // Step 2: For each MonoScript asset, alter it's assembly name - EditorUtility.DisplayProgressBar("Processing bundle", "Modifying assets...", 0.33f); - var modifications = new List(); - foreach (AssetFileInfoEx assetInfo in assets.table.assetFileInfo) - { - // We only want MonoScripts (type 115) - if (assetInfo.curFileType != 115) continue; - - // Get the field for this asset - var field = am.GetTypeInstance(assets, assetInfo).GetBaseField(); - var assemblyNameValue = field["m_AssemblyName"].GetValue(); - - // Check if we want to replace this name - var asmName = assemblyNameValue.AsString(); - if (replaceMap.ContainsKey(asmName)) - { - // Modify it's assembly name - assemblyNameValue.Set(replaceMap[asmName]); - - // Write the modifications to the list - var newBytes = field.WriteToByteArray(); - modifications.Add(new AssetsReplacerFromMemory(0, assetInfo.index, (int) assetInfo.curFileType, - 0xFFFF, newBytes)); - } - } - - // Step 3: Write the modified assets back into an uncompressed bundle - EditorUtility.DisplayProgressBar("Processing bundle", "Saving changes...", 0.66f); - using (var fileStream = new FileStream(destination + ".uncompressed", FileMode.Create)) - { - var bunRepl = new BundleReplacerFromAssets(assets.name, assets.name, assets.file, modifications); - var bunWriter = new AssetsFileWriter(fileStream); - bundle.file.Write(bunWriter, new List {bunRepl}); - } - - // Unload the existing bundle - am.UnloadAll(); - - // Step 4: Re-compress the bundle if requested - EditorUtility.DisplayProgressBar("Processing bundle", "Recompressing bundle...", 1f); - if (recompressAs != AssetBundleCompressionType.NONE) - { - var compressedBundle = am.LoadBundleFile(destination + ".uncompressed"); - using (var fs = File.OpenWrite(destination)) - using (var writer = new AssetsFileWriter(fs)) - { - compressedBundle.file.Pack(compressedBundle.file.reader, writer, recompressAs); - } - - am.UnloadAll(); - File.Delete(destination + ".uncompressed"); - } - else File.Move(destination + ".uncompressed", destination); - - } - finally - { - EditorUtility.ClearProgressBar(); - GC.Collect(); - } - } - } -} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BundleExporter.cs.meta b/Assets/MeatKit/Editor/BundleExporter.cs.meta deleted file mode 100644 index 24eacc5..0000000 --- a/Assets/MeatKit/Editor/BundleExporter.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 69efae90f6bb4c3eadcd9e7c4af6ec67 -timeCreated: 1617337071 \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation.meta b/Assets/MeatKit/Editor/ImportExport.meta similarity index 63% rename from Assets/Plugins/AssetBundles-Browser/Documentation.meta rename to Assets/MeatKit/Editor/ImportExport.meta index 16f0900..b7128b9 100644 --- a/Assets/Plugins/AssetBundles-Browser/Documentation.meta +++ b/Assets/MeatKit/Editor/ImportExport.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 4fd76bb12fd5fae48a3e952d8020bef4 +guid: 0b75c98df00b4b55b3642b3aed976883 folderAsset: yes +timeCreated: 1655428806 DefaultImporter: - externalObjects: {} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/MeatKit/Editor/ImportExport/AssemblyExporter.cs b/Assets/MeatKit/Editor/ImportExport/AssemblyExporter.cs new file mode 100644 index 0000000..72d9247 --- /dev/null +++ b/Assets/MeatKit/Editor/ImportExport/AssemblyExporter.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Reflection; +using BepInEx; +using HarmonyLib; +using Mono.Cecil; +using Mono.Cecil.Cil; +using MethodBody = Mono.Cecil.Cil.MethodBody; + +namespace MeatKit +{ + public static partial class MeatKit + { + private const string EditorAssemblyPath = "Library/ScriptAssemblies/"; + + private static void ExportEditorAssembly(string folder, string tempFile = null, + Dictionary> requiredScripts = null) + { + // Make a copy of the file if we aren't already given one + string editorAssembly = EditorAssemblyPath + AssemblyName + ".dll"; + if (!File.Exists(editorAssembly) && !File.Exists(tempFile)) + { + throw new MeatKitBuildException("Editor assembly missing! Can't export scripts."); + } + if (string.IsNullOrEmpty(tempFile)) + { + tempFile = Path.GetTempFileName(); + File.Copy(editorAssembly, tempFile, true); + } + + // Delete the old file + var settings = BuildWindow.SelectedProfile; + var exportPath = folder + settings.PackageName + ".dll"; + if (File.Exists(exportPath)) File.Delete(exportPath); + + var rParams = new ReaderParameters + { + AssemblyResolver = + new RedirectedAssemblyResolver(Path.GetDirectoryName(typeof(UnityEngine.Object).Assembly.Location), ManagedDirectory) + }; + + // Get the MeatKitPlugin class and rename it + using (var asm = AssemblyDefinition.ReadAssembly(tempFile, rParams)) + { + // Locate the plugin class for this profile and set it's name and namespace + string mainNamespace = BuildWindow.SelectedProfile.MainNamespace; + var plugin = FindPluginClass(asm.MainModule, mainNamespace); + BuildLog.WriteLine("Using plugin class " + plugin.FullName); + plugin.Namespace = mainNamespace; + plugin.Name = settings.PackageName + "Plugin"; + + // Watermark the plugin just in case it's useful to someone + BuildLog.WriteLine("Watermarking plugin class"); + var str = asm.MainModule.TypeSystem.String; + var descriptionAttributeConstructor = typeof(DescriptionAttribute).GetConstructor(new[] {typeof(string)}); + var descriptionAttributeRef = asm.MainModule.ImportReference(descriptionAttributeConstructor); + var descriptionAttribute = new CustomAttribute(descriptionAttributeRef); + descriptionAttribute.ConstructorArguments.Add(new CustomAttributeArgument(str, "Built with MeatKit")); + plugin.CustomAttributes.Add(descriptionAttribute); + + // This is some quantum bullshit. + // If you don't enumerate the constructor arguments for attributes their values aren't updated correctly. + BuildLog.WriteLine("Performing quantum bullshit"); + foreach (var x in GetAllCustomAttributes(asm).SelectMany(a => a.ConstructorArguments)) + { + } + + // Get the BepInPlugin attribute and replace the values in it with our own + BuildLog.WriteLine("Applying BepInPlugin attribute params"); + var guid = settings.Author + "." + settings.PackageName; + var pluginAttribute = plugin.CustomAttributes.First(a => a.AttributeType.Name == "BepInPlugin"); + pluginAttribute.ConstructorArguments[0] = new CustomAttributeArgument(str, guid); + pluginAttribute.ConstructorArguments[1] = new CustomAttributeArgument(str, settings.PackageName); + pluginAttribute.ConstructorArguments[2] = new CustomAttributeArgument(str, settings.Version); + + // Get the LoadAssets method and make a new body for it + BuildLog.WriteLine("Generating LoadAssets()"); + var loadAssetsMethod = plugin.Methods.First(m => m.Name == "LoadAssets"); + loadAssetsMethod.Body = new MethodBody(loadAssetsMethod); + var il = loadAssetsMethod.Body.GetILProcessor(); + + // If we're automatically applying Harmony patches, do that now + // This IL translates to Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "PluginGuid"); + if (settings.ApplyHarmonyPatches) + { + BuildLog.WriteLine(" Code to apply harmony patches"); + var assemblyGetExecutingAssembly = typeof(Assembly).GetMethod("GetExecutingAssembly"); + var harmonyCreateAndPatchALl = typeof(Harmony).GetMethod("CreateAndPatchAll", new[] {typeof(Assembly), typeof(string)}); + il.Emit(OpCodes.Call, plugin.Module.ImportReference(assemblyGetExecutingAssembly)); + il.Emit(OpCodes.Ldstr, guid); + il.Emit(OpCodes.Call, plugin.Module.ImportReference(harmonyCreateAndPatchALl)); + il.Emit(OpCodes.Pop); + } + + // Let any build items insert their own code in here + foreach (var item in settings.BuildItems) + { + BuildLog.WriteLine(" " + item); + item.GenerateLoadAssets(plugin, il); + } + + // Insert a ret at the end so it's valid + il.Emit(OpCodes.Ret); + + // Module name needs to be changed away from Assembly-CSharp.dll because it is a reserved name. + string newAssemblyName = settings.PackageName + ".dll"; + BuildLog.WriteLine("Renaming assembly (" + newAssemblyName + ")"); + asm.Name = new AssemblyNameDefinition(settings.PackageName, asm.Name.Version); + asm.MainModule.Name = newAssemblyName; + + // References to renamed unity code must be swapped out. + BuildLog.WriteLine("Renaming assembly references"); + foreach (var ii in asm.MainModule.AssemblyReferences) + { + // Rename any references to the game's code + if (ii.Name.Contains("H3VRCode-CSharp")) + { + var newReference = ii.Name.Replace("H3VRCode-CSharp", "Assembly-CSharp"); + BuildLog.WriteLine(" " + ii.Name + " -> " + newReference); + ii.Name = newReference; + } + + // And also if we're referencing a MonoMod DLL, we need to fix reference too + if (ii.Name.EndsWith(".mm")) + { + // What the name currently is: + // Assembly-CSharp.PatchName.mm + // What we want: + // Assembly-CSharp + // So just lop off anything past the second to last dot + int idx = ii.Name.LastIndexOf('.', ii.Name.Length - 4); + var newReference = ii.Name.Substring(0, idx); + BuildLog.WriteLine(" " + ii.Name + " -> " + newReference); + ii.Name = newReference; + } + } + + if (BuildWindow.SelectedProfile.StripNamespaces) + { + // Remove types not in an allowed namespace or the global namespace + BuildLog.WriteLine("Stripping namespaces"); + string[] allowedNamespaces = BuildWindow.SelectedProfile.GetAllAllowedNamespaces(); + List typesToRemove = new List(); + foreach (var type in asm.MainModule.Types) + { + if (type.Namespace == "" || allowedNamespaces.Any(x => type.Namespace.Contains(x))) + continue; + BuildLog.WriteLine(" " + type.FullName); + typesToRemove.Add(type); + } + + foreach (var type in typesToRemove) asm.MainModule.Types.Remove(type); + } + + // Remove the same types we didn't want to import. This cannot be skipped. + foreach (var type in StripAssemblyTypes + .Select(x => asm.MainModule.GetType(x)) + .Where(x => x != null)) asm.MainModule.Types.Remove(type); + + // Check if we're now missing any scripts from the export + BuildLog.WriteLine("Checking for missing types"); + List missing = new List(); + string originalAssemblyName = AssemblyName + ".dll"; + if (requiredScripts != null && requiredScripts.ContainsKey(originalAssemblyName)) + { + missing.AddRange(requiredScripts[originalAssemblyName] + .Where(typeName => !StripAssemblyTypes.Contains(typeName) && asm.MainModule.GetType(typeName) == null)); + } + + // If we're missing anything, fail the build. + if (missing.Count > 0) + { + string missingTypes = string.Join("\n", missing.ToArray()); + throw new MeatKitBuildException( + "Exported objects reference scripts which do not exist in the exported assembly... Did you forget to allow a namespace?\n\nMissing types:\n" + + missingTypes, null); + } + + try + { + // Save it + asm.Write(exportPath); + } + catch (ArgumentException e) + { + throw new MeatKitBuildException( + "Unable to write exported scripts file. This is likely due to namespace stripping being enabled and a required namespace is not whitelisted.", + e); + } + } + + // Delete temp file now that we're done. + File.Delete(tempFile); + } + + private static TypeDefinition FindPluginClass(ModuleDefinition module, string mainNamespace) + { + // Get the default MeatKitPlugin class from the module + var pluginClass = module.GetType("MeatKitPlugin"); + + // Try and locate any alternative plugin classes + foreach (var type in module.Types) + { + // We're looking for types that extend the BaseUnityPlugin class and is in the main namespace of our mod + if (type.IsSubtypeOf(typeof(BaseUnityPlugin)) && type.Namespace == mainNamespace) + { + pluginClass = type; + break; + } + } + + return pluginClass; + } + + private static IEnumerable GetAllCustomAttributes(AssemblyDefinition asm) + { + foreach (var type in asm.MainModule.Types) + { + foreach (var attrib in type.CustomAttributes) yield return attrib; + foreach (CustomAttribute attrib in type.Methods.SelectMany(method => method.CustomAttributes)) + yield return attrib; + } + } + } +} diff --git a/Assets/MeatKit/Editor/AssemblyExporter.cs.meta b/Assets/MeatKit/Editor/ImportExport/AssemblyExporter.cs.meta similarity index 100% rename from Assets/MeatKit/Editor/AssemblyExporter.cs.meta rename to Assets/MeatKit/Editor/ImportExport/AssemblyExporter.cs.meta diff --git a/Assets/MeatKit/Editor/AssemblyImporter.cs b/Assets/MeatKit/Editor/ImportExport/AssemblyImporter.cs similarity index 78% rename from Assets/MeatKit/Editor/AssemblyImporter.cs rename to Assets/MeatKit/Editor/ImportExport/AssemblyImporter.cs index 380a35b..d0d6494 100644 --- a/Assets/MeatKit/Editor/AssemblyImporter.cs +++ b/Assets/MeatKit/Editor/ImportExport/AssemblyImporter.cs @@ -17,13 +17,13 @@ namespace MeatKit /// public static partial class MeatKit { - private const string AssemblyName = "Assembly-CSharp"; - private const string AssemblyRename = "H3VRCode-CSharp"; - private const string AssemblyFirstpassName = "Assembly-CSharp-firstpass"; - private const string AssemblyFirstpassRename = "H3VRCode-CSharp-passfirst"; - + public const string AssemblyName = "Assembly-CSharp"; + public const string AssemblyRename = "H3VRCode-CSharp"; + public const string AssemblyFirstpassName = "Assembly-CSharp-firstpass"; + public const string AssemblyFirstpassRename = "H3VRCode-CSharp-firstpass"; + // Types we want to strip from the main Unity assembly - private static readonly string[] StripAssemblyTypes = + public static readonly string[] StripAssemblyTypes = { // Alloy classes "MaterialMapChannelPackerDefinition", @@ -139,6 +139,9 @@ namespace MeatKit // Publicize assembly AssemblyStripper.MakePublic(mainAssembly, new string[0], false, false); + // Apply help URLs + ApplyWikiHelpAttribute(mainAssembly); + // Write the main assembly out into the destination folder and dispose it mainAssembly.Write(Path.Combine(destinationDirectory, AssemblyRename + ".dll")); } @@ -169,23 +172,53 @@ namespace MeatKit new RedirectedAssemblyResolver(Path.GetDirectoryName(assemblyPath), destinationDirectory) }; - // We just want to rename the references to the game's assemblies here + // If this assembly uses the Assembly-CSharp name at all for any reason, replace it with H3VRCode-CSharp + // This would probably only be done on MonoMod patches but is required to make Unity shut up var asm = AssemblyDefinition.ReadAssembly(assemblyPath, rParams); + string name = asm.Name.Name; + if (name.Contains("Assembly-CSharp")) + { + name = name.Replace("Assembly-CSharp", "H3VRCode-CSharp"); + asm.Name = new AssemblyNameDefinition(name, asm.Name.Version); + asm.MainModule.Name = name + ".dll"; + } + + // Replace all occurrences to references of Assembly-CSharp with H3VRCode-CSharp foreach (var reference in asm.MainModule.AssemblyReferences) - switch (reference.Name) + { + if (reference.Name.Contains("Assembly-CSharp")) { - case AssemblyName: - reference.Name = AssemblyRename; - break; - case AssemblyFirstpassName: - reference.Name = AssemblyFirstpassRename; - break; + reference.Name = reference.Name.Replace("Assembly-CSharp", "H3VRCode-CSharp"); } + } - asm.Write(Path.Combine(destinationDirectory, Path.GetFileName(assemblyPath))); + asm.Write(Path.Combine(destinationDirectory, asm.MainModule.Name)); NormalizeMetaFileGUIDs(); } + private static void ApplyWikiHelpAttribute(AssemblyDefinition asm) + { + // For convenience, we can add the Unity HelpURL attribute to the components from the game assembly. + // We'll point the url at the wiki and just append the full type name at the end + + // Iterate over every type in the assembly and just stick the attribute on it + // Probably doesn't matter if types that don't need it have it. + foreach (var type in asm.MainModule.Types) + { + // If the type doesn't already have this attribute, add it. + if (type.CustomAttributes.Any(a => a.AttributeType.Name == "HelpURLAttribute")) continue; + + string helpUrl = "https://h3vr-modding.github.io/wiki/docs/h3vr/" + type.FullName + ".html"; + + var str = asm.MainModule.TypeSystem.String; + var attributeConstructor = typeof(HelpURLAttribute).GetConstructor(new[] {typeof(string)}); + var attributeRef = asm.MainModule.ImportReference(attributeConstructor); + var attribute = new CustomAttribute(attributeRef); + attribute.ConstructorArguments.Add(new CustomAttributeArgument(str, helpUrl)); + type.CustomAttributes.Add(attribute); + } + } + private static void NormalizeMetaFileGUIDs() { // This is a really important step. We need to make sure that the meta files for the assemblies are generated @@ -241,7 +274,6 @@ namespace MeatKit try { var asmPath = Path.Combine(path, name.Name + ".dll"); - Debug.Log("Assembly path: " + asmPath); if (File.Exists(asmPath)) asm = AssemblyDefinition.ReadAssembly(asmPath, new ReaderParameters {AssemblyResolver = this}); diff --git a/Assets/MeatKit/Editor/AssemblyImporter.cs.meta b/Assets/MeatKit/Editor/ImportExport/AssemblyImporter.cs.meta similarity index 100% rename from Assets/MeatKit/Editor/AssemblyImporter.cs.meta rename to Assets/MeatKit/Editor/ImportExport/AssemblyImporter.cs.meta diff --git a/Assets/MeatKit/Editor/ImportExport/AssetBundleIO.cs b/Assets/MeatKit/Editor/ImportExport/AssetBundleIO.cs new file mode 100644 index 0000000..bf1857c --- /dev/null +++ b/Assets/MeatKit/Editor/ImportExport/AssetBundleIO.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + [InitializeOnLoad] + public static class AssetBundleIO + { + // Toggles for keeping track if we're processing reads and/or writes + public static bool ProcessingEnabledRead { get; private set; } + public static bool ProcessingEnabledWrite { get; private set; } + + // Output dictionaries for remembering what scripts got modified. + public static Dictionary> SerializedScriptNames { get; private set; } + public static Dictionary> DeserializedScriptNames { get; private set; } + + private static Dictionary _replaceMap; + + static AssetBundleIO() + { + if (!EditorVersion.IsSupportedVersion) return; + + // Apply the one hook we need here + OrigMonoScriptTransferWrite = NativeHookManager.ApplyEditorDetour(EditorVersion.Current.FunctionOffsets.MonoScriptTransferWrite, new MonoScriptTransferWrite(OnMonoScriptTransferWrite)); + OrigMonoScriptTransferRead = NativeHookManager.ApplyEditorDetour(EditorVersion.Current.FunctionOffsets.MonoScriptTransferRead, new MonoScriptTransferRead(OnMonoScriptTransferRead)); + } + + public static void EnableProcessing(Dictionary replaceMap, bool read, bool write) + { + _replaceMap = replaceMap; + SerializedScriptNames = new Dictionary>(); + DeserializedScriptNames = new Dictionary>(); + ProcessingEnabledRead = read; + ProcessingEnabledWrite = write; + } + + public static void DisableProcessing() + { + ProcessingEnabledRead = false; + ProcessingEnabledWrite = false; + } + + /// + /// This is a detour on some of the native Unity editor code which is part of writing data to asset bundles. + /// When Unity goes to serialize a MonoScript struct, we want to pre-process it a bit before it actually + /// writes the data to the bundle. + /// + /// Our processing includes building a list of used scripts so we can verify the user has their exports setup + /// properly, as well as remapping the assembly names for some scripts so that references are maintained + /// correctly when loaded in the game. + /// + private static void OnMonoScriptTransferWrite(IntPtr monoScript, IntPtr streamedBinaryWrite) + { + // If processing is disabled just run the original and skip. + if (!ProcessingEnabledWrite) + { + OrigMonoScriptTransferWrite(monoScript, streamedBinaryWrite); + return; + } + + // Create a couple variables for later + var applied = false; + + // Read the assembly name and class name from memory + var className = UnityNativeHelper.ReadNativeString(monoScript, MonoScriptClassName); + var assemblyName = UnityNativeHelper.ReadNativeString(monoScript, MonoScriptAssemblyName); + var namespaceName = UnityNativeHelper.ReadNativeString(monoScript, MonoScriptNamespace); + var fullName = string.IsNullOrEmpty(namespaceName) ? className : (namespaceName + "." + className); + + // Add it to the scripts usage dictionary + if (!SerializedScriptNames.ContainsKey(assemblyName)) SerializedScriptNames[assemblyName] = new List(); + SerializedScriptNames[assemblyName].Add(fullName); + + // Prepare some debugging string + string debug = " " + assemblyName + " " + fullName + ": "; + + // Check if we want to remap this assembly name + string newAssemblyName; + if (_replaceMap.TryGetValue(assemblyName, out newAssemblyName)) + { + // If we're processing a type that should exist in the main game assembly, skip translation + if (assemblyName != MeatKit.AssemblyName + ".dll" || !MeatKit.StripAssemblyTypes.Contains(fullName)) + { + // Write the new assembly name into memory + UnityNativeHelper.WriteNativeString(monoScript, MonoScriptAssemblyName, newAssemblyName); + applied = true; + debug += "ReplaceMap"; + } + else + { + debug += "Ignored"; + } + } + + // If it didn't exist in the replace map, check if it contains H3VRCode-CSharp. This is for MonoMod assemblies. + else if (assemblyName.Contains(MeatKit.AssemblyRename)) + { + // Write the new assembly name into memory + UnityNativeHelper.WriteNativeString(monoScript, MonoScriptAssemblyName, assemblyName.Replace(MeatKit.AssemblyRename, MeatKit.AssemblyName)); + applied = true; + debug += "MonoMod"; + } + else + { + debug += "Unchanged"; + } + + BuildLog.WriteLine(debug); + + // Let the original method run + OrigMonoScriptTransferWrite(monoScript, streamedBinaryWrite); + + // If we didn't apply any remapping, skip this last part. + if (!applied) return; + + // Cleanup by writing the original value back to memory and freeing the memory allocated for the new name. + UnityNativeHelper.WriteNativeString(monoScript, MonoScriptAssemblyName, assemblyName); + } + + /// + /// Any time the editor reads from an asset bundle, we want to apply our remapping so that references from + /// the game can be properly deserialized. + /// + private static long OnMonoScriptTransferRead(IntPtr monoScript, IntPtr streamedBinaryRead) + { + // Run the original method and return the result if processing is disabled. + long result = OrigMonoScriptTransferRead(monoScript, streamedBinaryRead); + if (!ProcessingEnabledRead) return result; + + // Read the assembly name and class name from memory + var className = UnityNativeHelper.ReadNativeString(monoScript, MonoScriptClassName); + var assemblyName = UnityNativeHelper.ReadNativeString(monoScript, MonoScriptAssemblyName); + var namespaceName = UnityNativeHelper.ReadNativeString(monoScript, MonoScriptNamespace); + var fullName = string.IsNullOrEmpty(namespaceName) ? className : (namespaceName + "." + className); + + // Add it to the scripts usage dictionary + if (!DeserializedScriptNames.ContainsKey(assemblyName)) DeserializedScriptNames[assemblyName] = new List(); + DeserializedScriptNames[assemblyName].Add(fullName); + + // Check if we want to remap this assembly name + string newAssemblyName; + if (_replaceMap.TryGetValue(assemblyName, out newAssemblyName)) + { + // If we're processing a type that should exist in the main game assembly, skip translation + if (assemblyName != MeatKit.AssemblyName || !MeatKit.StripAssemblyTypes.Contains(fullName)) + // Write the new assembly name into memory + UnityNativeHelper.WriteNativeString(monoScript, MonoScriptAssemblyName, newAssemblyName); + } + + // If it didn't exist in the replace map, check if it contains H3VRCode-CSharp. This is for MonoMod assemblies. + else if (assemblyName.Contains(MeatKit.AssemblyName)) + { + // Write the new assembly name into memory + UnityNativeHelper.WriteNativeString(monoScript, MonoScriptAssemblyName, assemblyName.Replace(MeatKit.AssemblyName, MeatKit.AssemblyRename)); + } + + return result; + } + + // Actual name: MonoScript::Transfer>(StreamedBinaryWrite<0> &) + private delegate void MonoScriptTransferWrite(IntPtr monoScript, IntPtr streamedBinaryWrite); + + private static readonly MonoScriptTransferWrite OrigMonoScriptTransferWrite; + + // Actual name: MonoScript::Transfer>(StreamedBinaryRead<1> &) + private delegate long MonoScriptTransferRead(IntPtr monoScript, IntPtr streamedBinaryRead); + + private static readonly MonoScriptTransferRead OrigMonoScriptTransferRead; + + private const int MonoScriptClassName = 224; + + private const int MonoScriptNamespace = 272; + + private const int MonoScriptAssemblyName = 320; + } +} diff --git a/Assets/MeatKit/Editor/ImportExport/AssetBundleIO.cs.meta b/Assets/MeatKit/Editor/ImportExport/AssetBundleIO.cs.meta new file mode 100644 index 0000000..281f98e --- /dev/null +++ b/Assets/MeatKit/Editor/ImportExport/AssetBundleIO.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3994182a62444e7e97029b92adc131f5 +timeCreated: 1655415474 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/MeatKit.cs b/Assets/MeatKit/Editor/MeatKit.cs index b29b186..31abe9e 100644 --- a/Assets/MeatKit/Editor/MeatKit.cs +++ b/Assets/MeatKit/Editor/MeatKit.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.IO; -using AssetsTools.NET; using UnityEditor; using UnityEngine; using Debug = UnityEngine.Debug; @@ -9,7 +7,7 @@ namespace MeatKit { public static partial class MeatKit { - private static readonly string ManagedDirectory = Path.Combine(Application.dataPath, "MeatKit/Managed/"); + private static readonly string ManagedDirectory = Path.Combine(Application.dataPath, "Managed/"); private static bool ShowErrorIfH3VRNotImported() { @@ -28,13 +26,35 @@ namespace MeatKit var gameManagedLocation = MeatKitCache.GameManagedLocation; if (string.IsNullOrEmpty(gameManagedLocation) || !Directory.Exists(gameManagedLocation)) { - gameManagedLocation = EditorUtility.OpenFolderPanel("Select H3VR Managed directory", string.Empty, "Managed"); - MeatKitCache.GameManagedLocation = gameManagedLocation; + // Cache wasn't set or directory doesn't exist. Lets see if we can find it automatically via Steam + gameManagedLocation = SteamAppLocator.LocateGame(); + if (string.IsNullOrEmpty(gameManagedLocation)) + { + // Still nope. Ask the user for it directly. + gameManagedLocation = + EditorUtility.OpenFolderPanel("Select H3VR Managed directory", string.Empty, "Managed"); + } + else gameManagedLocation = Path.Combine(gameManagedLocation, "h3vr_Data/Managed"); } - // If it's _still_ empty, the user must have cancelled. + // If it's _still_ empty, the user must have cancelled the input prompt, so cancel the import. if (string.IsNullOrEmpty(gameManagedLocation)) return; + + // Also, check if the path is even valid + if (!File.Exists(Path.Combine(gameManagedLocation, "Assembly-CSharp.dll"))) + { + EditorUtility.DisplayDialog("Error", + "Looks like the path you selected is invalid. Make sure you are selecting the h3vr_Data/Managed folder in the game directory.", + "Ok"); + return; + } + + // Import the assemblies and update the cache so we can find it in the future ImportAssemblies(gameManagedLocation, ManagedDirectory); + MeatKitCache.GameManagedLocation = gameManagedLocation; + + // Let the user know we've completed the action + EditorUtility.DisplayDialog("Success", "Game scripts imported", "Ok"); } [MenuItem("MeatKit/Scripts/Import Single", priority = 0)] @@ -66,38 +86,10 @@ namespace MeatKit { // Make sure the scripts are imported and there are no errors before exporting if (ShowErrorIfH3VRNotImported()) return; + if (!BuildWindow.SelectedProfile) return; + if (!BuildWindow.SelectedProfile.EnsureValidForEditor()) return; - ExportEditorAssembly(BundleOutputPath); - } - - - [MenuItem("MeatKit/Asset Bundle/Export", priority = 1)] - public static void ExportBundle() - { - var assetBundlePath = EditorUtility.OpenFilePanel("Select asset bundle", Application.dataPath, ""); - var settings = BuildWindow.SelectedProfile; - var replaceMap = new Dictionary - { - {"Assembly-CSharp.dll", settings.PackageName + ".dll"}, - {"Assembly-CSharp-firstpass.dll", settings.PackageName + "-firstpass.dll"}, - {"H3VRCode-CSharp.dll", "Assembly-CSharp.dll"}, - {"H3VRCode-CSharp-firstpass.dll", "Assembly-CSharp-firstpass.dll"} - }; - - ProcessBundle(assetBundlePath, assetBundlePath, replaceMap, AssetBundleCompressionType.LZ4); - } - - [MenuItem("MeatKit/Asset Bundle/Import", priority = 1)] - public static void ImportBundle() - { - var assetBundlePath = EditorUtility.OpenFilePanel("Select asset bundle", Application.dataPath, ""); - var replaceMap = new Dictionary - { - {"Assembly-CSharp.dll", "H3VRCode-CSharp.dll"}, - {"Assembly-CSharp-firstpass.dll", "H3VRCode-CSharp-firstpass.dll"} - }; - - ProcessBundle(assetBundlePath, assetBundlePath + "-imported", replaceMap, AssetBundleCompressionType.NONE); + ExportEditorAssembly(BuildWindow.SelectedProfile.ExportPath); } public static void ClearCache() @@ -110,4 +102,4 @@ namespace MeatKit AssetDatabase.Refresh(); } } -} \ No newline at end of file +} diff --git a/Assets/MeatKit/Editor/MeatKitCache.cs b/Assets/MeatKit/Editor/MeatKitCache.cs index c6729ab..a8f81d1 100644 --- a/Assets/MeatKit/Editor/MeatKitCache.cs +++ b/Assets/MeatKit/Editor/MeatKitCache.cs @@ -25,6 +25,9 @@ namespace MeatKit [SerializeField] private string _lastSelectedProfileGuid; + + [SerializeField] + private string _lastUpdateCheckTime = default(DateTime).ToString(CultureInfo.InvariantCulture); private static string CacheFilePath { @@ -108,5 +111,15 @@ namespace MeatKit WriteCache(); } } + + public static DateTime LastUpdateCheckTime + { + get { return DateTime.Parse(Instance._lastUpdateCheckTime); } + set + { + Instance._lastUpdateCheckTime = value.ToString(CultureInfo.InvariantCulture); + WriteCache(); + } + } } } \ No newline at end of file diff --git a/Assets/Plugins/Editor/NavMeshComponents.meta b/Assets/MeatKit/Editor/NavMeshComponents.meta similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents.meta rename to Assets/MeatKit/Editor/NavMeshComponents.meta diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshLinkEditor.cs similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshLinkEditor.cs diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierEditor.cs similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierEditor.cs diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta b/Assets/MeatKit/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta similarity index 100% rename from Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta rename to Assets/MeatKit/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta diff --git a/Assets/MeatKit/Tools.meta b/Assets/MeatKit/Editor/Tools.meta similarity index 100% rename from Assets/MeatKit/Tools.meta rename to Assets/MeatKit/Editor/Tools.meta diff --git a/Assets/MeatKit/Tools/Editor/EnumPicker.cs b/Assets/MeatKit/Editor/Tools/EnumPicker.cs similarity index 92% rename from Assets/MeatKit/Tools/Editor/EnumPicker.cs rename to Assets/MeatKit/Editor/Tools/EnumPicker.cs index 283ec6d..3609f84 100644 --- a/Assets/MeatKit/Tools/Editor/EnumPicker.cs +++ b/Assets/MeatKit/Editor/Tools/EnumPicker.cs @@ -132,7 +132,17 @@ public class EnumPicker : PropertyDrawer { Array valuesRaw = null; Type enumType = fieldInfo.FieldType; - if (enumType.IsArray) enumType = enumType.GetElementType(); //this turns the enum array into just the enum to prevent issues with arrays of enums + + // Check if the property is an array or a list + if (enumType.IsArray) enumType = enumType.GetElementType(); + else if (enumType.IsGenericType && enumType.GetGenericTypeDefinition() == typeof(List<>)) + enumType = enumType.GetGenericArguments()[0]; + + if (enumType == null || !enumType.IsEnum) + { + Debug.LogError("Can't determine how to draw a field for " + fieldInfo.FieldType); + return; + } valuesRaw = Enum.GetValues(enumType); if (valuesRaw.Length <= 0) @@ -175,6 +185,7 @@ public class EnumPicker : PropertyDrawer [CustomPropertyDrawer(typeof(ItemSpawnerID.ESubCategory))] [CustomPropertyDrawer(typeof(FireArmRoundType))] [CustomPropertyDrawer(typeof(SosigEnemyID))] +[CustomPropertyDrawer(typeof(FVRFireArmAttachementMountType))] public class EnumDrawers : EnumPicker { } diff --git a/Assets/MeatKit/Tools/Editor/EnumPicker.cs.meta b/Assets/MeatKit/Editor/Tools/EnumPicker.cs.meta similarity index 100% rename from Assets/MeatKit/Tools/Editor/EnumPicker.cs.meta rename to Assets/MeatKit/Editor/Tools/EnumPicker.cs.meta diff --git a/Assets/Plugins/Editor/HiddenGameObjectTools.cs b/Assets/MeatKit/Editor/Tools/HiddenGameObjectTools.cs similarity index 100% rename from Assets/Plugins/Editor/HiddenGameObjectTools.cs rename to Assets/MeatKit/Editor/Tools/HiddenGameObjectTools.cs diff --git a/Assets/Plugins/Editor/HiddenGameObjectTools.cs.meta b/Assets/MeatKit/Editor/Tools/HiddenGameObjectTools.cs.meta similarity index 100% rename from Assets/Plugins/Editor/HiddenGameObjectTools.cs.meta rename to Assets/MeatKit/Editor/Tools/HiddenGameObjectTools.cs.meta diff --git a/Assets/MeatKit/Editor/Tools/PrefabLoader.cs b/Assets/MeatKit/Editor/Tools/PrefabLoader.cs new file mode 100644 index 0000000..798e454 --- /dev/null +++ b/Assets/MeatKit/Editor/Tools/PrefabLoader.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using MeatKit; +using UnityEditor; +using UnityEngine; + +public class PrefabLoader : EditorWindow +{ + private AssetBundle _bundle; + private string[] _assets = new string[0]; + private int _selectedAsset = 0; + + private static readonly Dictionary AssemblyNameReplaceMap = new Dictionary + { + {MeatKit.MeatKit.AssemblyName + ".dll", MeatKit.MeatKit.AssemblyRename + ".dll"}, + {MeatKit.MeatKit.AssemblyFirstpassName + ".dll", MeatKit.MeatKit.AssemblyFirstpassRename + ".dll"} + }; + + private static readonly Dictionary LoadedAssetBundles = new Dictionary(); + + [MenuItem("MeatKit/Prefab Loader")] + private static void Init() + { + GetWindow().Show(); + } + + private void OnGUI() + { + if (GUILayout.Button("Select Asset Bundle")) + { + // If there's already a bundle loaded, unload it. + if (_bundle) _bundle = null; + + // Ask for the new bundle, load it, and get its assets + string assetBundlePath = EditorUtility.OpenFilePanel("Select Asset Bundle", string.Empty, string.Empty); + + // Make sure the user actually selected a file + if (!string.IsNullOrEmpty(assetBundlePath)) + { + // Check if we already loaded it + if (!LoadedAssetBundles.TryGetValue(assetBundlePath, out _bundle)) + { + _bundle = AssetBundle.LoadFromFile(assetBundlePath); + LoadedAssetBundles[assetBundlePath] = _bundle; + } + + // Make sure a valid bundle was selected + if (_bundle != null) + { + _assets = _bundle.GetAllAssetNames(); + _selectedAsset = 0; + } + } + } + + // Only show spawn button if there's at least one asset + if (_bundle != null && _assets.Length > 0) + { + _selectedAsset = EditorGUILayout.Popup(_selectedAsset, _assets); + if (GUILayout.Button("Spawn")) + { + AssetBundleIO.EnableProcessing(AssemblyNameReplaceMap, true, false); + Instantiate(_bundle.LoadAsset(_assets[_selectedAsset])); + AssetBundleIO.DisableProcessing(); + } + + // Warn the user about the play mode thing + if (!EditorApplication.isPlaying) + { + EditorGUILayout.HelpBox("References on a prefab loaded object will break after a restart of the editor unless you enter play mode first.", MessageType.Warning); + } + } + } +} diff --git a/Assets/MeatKit/Tools/Editor/PrefabLoader.cs.meta b/Assets/MeatKit/Editor/Tools/PrefabLoader.cs.meta similarity index 100% rename from Assets/MeatKit/Tools/Editor/PrefabLoader.cs.meta rename to Assets/MeatKit/Editor/Tools/PrefabLoader.cs.meta diff --git a/Assets/MeatKit/Editor/Updater.meta b/Assets/MeatKit/Editor/Updater.meta new file mode 100644 index 0000000..7296357 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7972e859acde43c3983695df50bff302 +timeCreated: 1684891967 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/AsyncDownloader.cs b/Assets/MeatKit/Editor/Updater/AsyncDownloader.cs new file mode 100644 index 0000000..10c69ef --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/AsyncDownloader.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine.Networking; + +namespace MeatKit +{ + [InitializeOnLoad] + public static class AsyncDownloader + { + private static readonly Dictionary> ActiveRequests = new Dictionary>(); + + static AsyncDownloader() + { + EditorApplication.update += Update; + } + + public static void WaitForCompletion(UnityWebRequest request, Action callback) + { + if (request == null) throw new ArgumentException("Request cannot be null", "request"); + request.Send(); + ActiveRequests.Add(request, callback); + } + + private static void Update() + { + foreach (var kv in ActiveRequests.ToArray()) + { + UnityWebRequest request = kv.Key; + Action callback = kv.Value; + if (!request.isDone) continue; + if (callback != null) callback(request); + ActiveRequests.Remove(request); + } + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/AsyncDownloader.cs.meta b/Assets/MeatKit/Editor/Updater/AsyncDownloader.cs.meta new file mode 100644 index 0000000..c0ca79b --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/AsyncDownloader.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bd989610b12e49edbdc6f03afc4b598f +timeCreated: 1684959395 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/CreateUpdatePackage.cs b/Assets/MeatKit/Editor/Updater/CreateUpdatePackage.cs new file mode 100644 index 0000000..fad3178 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/CreateUpdatePackage.cs @@ -0,0 +1,29 @@ +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + public static class CreateUpdatePackage + { + private static readonly string[] ExportAssets = + { + "Assets/MeatKit", + "Assets/Managed/0Harmony.dll", + "Assets/Managed/BepInEx.dll", + "Assets/Managed/DotNetZip.dll", + "Assets/Managed/Mono.Cecil.dll", + "Assets/Managed/MonoMod.RuntimeDetour.dll", + "Assets/Managed/MonoMod.Utils.dll", + "Assets/Managed/Sodalite.dll", + "Assets/Managed/Valve.Newtonsoft.Json.dll", + }; + + [MenuItem("MeatKit/Developer/Create update package")] + public static void Create() + { + AssetDatabase.ExportPackage(ExportAssets, Updater.UpdatePackageName, ExportPackageOptions.Recurse); + Debug.Log("Exported an update package to " + Path.Combine(Path.GetDirectoryName(Application.dataPath) , Updater.UpdatePackageName)); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/CreateUpdatePackage.cs.meta b/Assets/MeatKit/Editor/Updater/CreateUpdatePackage.cs.meta new file mode 100644 index 0000000..ff58eb6 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/CreateUpdatePackage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9075e2699d46423fbc049d02942b6f09 +timeCreated: 1684962211 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/SimpleVersion.cs b/Assets/MeatKit/Editor/Updater/SimpleVersion.cs new file mode 100644 index 0000000..cc53b74 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/SimpleVersion.cs @@ -0,0 +1,138 @@ +using System; +using System.Text; +using System.Text.RegularExpressions; + +namespace MeatKit +{ + public class SimpleVersion : IComparable + { + private const string RegexPattern = @"^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"; + + public int Major { get; private set; } + public int Minor { get; private set; } + public int Patch { get; private set; } + public string Prerelease { get; private set; } + public string BuildMetadata { get; private set; } + + public static SimpleVersion Parse(string version) + { + var match = Regex.Match(version, RegexPattern); + if (!match.Success) throw new ArgumentException("Provided version is not valid SemVer.", "version"); + + return new SimpleVersion + { + Major = int.Parse(match.Groups[1].Value), + Minor = int.Parse(match.Groups[2].Value), + Patch = int.Parse(match.Groups[3].Value), + Prerelease = match.Groups[4].Value, + BuildMetadata = match.Groups[5].Value, + }; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append(Major).Append(".").Append(Minor).Append(".").Append(Patch); + if (!string.IsNullOrEmpty(Prerelease)) sb.Append("-").Append(Prerelease); + if (!string.IsNullOrEmpty(BuildMetadata)) sb.Append("+").Append(BuildMetadata); + return sb.ToString(); + } + + public int CompareByPrecedence(SimpleVersion other) + { + if (other == null) + return 1; + + var r = Major.CompareTo(other.Major); + if (r != 0) return r; + + r = Minor.CompareTo(other.Minor); + if (r != 0) return r; + + r = Patch.CompareTo(other.Patch); + if (r != 0) return r; + + return CompareComponent(Prerelease, other.Prerelease, true); + } + + private static int CompareComponent(string a, string b, bool nonemptyIsLower = false) + { + var aEmpty = string.IsNullOrEmpty(a); + var bEmpty = string.IsNullOrEmpty(b); + if (aEmpty && bEmpty) + return 0; + + if (aEmpty) + return nonemptyIsLower ? 1 : -1; + if (bEmpty) + return nonemptyIsLower ? -1 : 1; + + var aComps = a.Split('.'); + var bComps = b.Split('.'); + + var minLen = Math.Min(aComps.Length, bComps.Length); + for (int i = 0; i < minLen; i++) + { + var ac = aComps[i]; + var bc = bComps[i]; + int aNum; + var aIsNum = int.TryParse(ac, out aNum); + int bNum; + var bIsNum = int.TryParse(bc, out bNum); + int r; + if (aIsNum && bIsNum) + { + r = aNum.CompareTo(bNum); + if (r != 0) return r; + } + else + { + if (aIsNum) + return -1; + if (bIsNum) + return 1; + r = string.CompareOrdinal(ac, bc); + if (r != 0) + return r; + } + } + + return aComps.Length.CompareTo(bComps.Length); + } + + public override bool Equals(object obj) + { + if (obj == null) + return false; + + if (ReferenceEquals(this, obj)) + return true; + + var other = (SimpleVersion)obj; + + return Major == other.Major + && Minor == other.Minor + && Patch == other.Patch + && string.Equals(Prerelease, other.Prerelease, StringComparison.Ordinal) + && string.Equals(BuildMetadata, other.BuildMetadata, StringComparison.Ordinal); + } + + public override int GetHashCode() + { + unchecked + { + int result = Major.GetHashCode(); + result = result * 31 + Minor.GetHashCode(); + result = result * 31 + Patch.GetHashCode(); + result = result * 31 + Prerelease.GetHashCode(); + result = result * 31 + BuildMetadata.GetHashCode(); + return result; + } + } + + public int CompareTo(SimpleVersion other) + { + return CompareByPrecedence(other); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/SimpleVersion.cs.meta b/Assets/MeatKit/Editor/Updater/SimpleVersion.cs.meta new file mode 100644 index 0000000..959a667 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/SimpleVersion.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 06b3949a4ca64e09af4d019e93c4dd73 +timeCreated: 1684948996 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/Updater.cs b/Assets/MeatKit/Editor/Updater/Updater.cs new file mode 100644 index 0000000..1534f23 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/Updater.cs @@ -0,0 +1,123 @@ +using System; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; +using UnityEngine.Networking; +using Valve.Newtonsoft.Json.Linq; + +namespace MeatKit +{ + public static class Updater + { + public const string UpdatePackageName = "MeatKitUpdate.unitypackage"; + public const string UpdateUrl = "https://api.github.com/repos/H3VR-Modding/MeatKit/releases"; + + + public static bool CheckingForUpdate { get; private set; } + private static bool AllowPreReleases { get; set; } + + public static SimpleVersion _currentVersion; + + public static SimpleVersion CurrentVersion + { + get + { + if (_currentVersion == null) + { + if (File.Exists("ProjectSettings/MeatKitVersion.txt")) + _currentVersion = SimpleVersion.Parse(File.ReadAllText("ProjectSettings/MeatKitVersion.txt")); + else + { + File.WriteAllText("ProjectSettings/MeatKitVersion.txt", "0.0.0"); + _currentVersion = SimpleVersion.Parse("0.0.0"); + } + } + + return _currentVersion; + } + } + + public static SimpleVersion OnlineVersion { get; private set; } + + private static long OnlineReleaseId { get; set; } + + public static void CheckForUpdate(bool allowPrerelease) + { + CheckingForUpdate = true; + AllowPreReleases = allowPrerelease; + var request = UnityWebRequest.Get(UpdateUrl); + AsyncDownloader.WaitForCompletion(request, UpdateCheckComplete); + } + + private static void UpdateCheckComplete(UnityWebRequest request) + { + if (request.isError) + { + Debug.LogError("Error fetching releases for " + request.url + "\n" + request.error); + } + else + { + var response = JArray.Parse(request.downloadHandler.text); + var latestRelease = response.First(r => !r["prerelease"].Value() || AllowPreReleases); + OnlineVersion = SimpleVersion.Parse(latestRelease["tag_name"].Value()); + OnlineReleaseId = latestRelease["id"].Value(); + } + + MeatKitCache.LastUpdateCheckTime = DateTime.Now; + CheckingForUpdate = false; + + // Force a repaint on the update window if it's open + UpdaterEditorWindow window = EditorWindow.GetWindow(); + if (window) window.Repaint(); + } + + public static void StartUpdate() + { + if (OnlineVersion == null || OnlineReleaseId == 0) return; + + // Try and fetch the assets on the release + AsyncDownloader.WaitForCompletion(UnityWebRequest.Get(UpdateUrl + "/" + OnlineReleaseId + "/assets"), CheckForUpdateAsset); + } + + private static void CheckForUpdateAsset(UnityWebRequest request) + { + var response = JArray.Parse(request.downloadHandler.text); + + // Check if any of the filenames are "MeatKitUpdate.unitypackage" + var updateAsset = response.FirstOrDefault(t => t["name"].Value() == "MeatKitUpdate.unitypackage"); + if (updateAsset == null) + { + EditorUtility.DisplayDialog("Failed to update", "Could not find the unity package associated with the target version. Nothing has been modified.", "Ok."); + return; + } + + // Start a new request to download the package. + AsyncDownloader.WaitForCompletion(UnityWebRequest.Get(updateAsset["browser_download_url"].Value()), ApplyUpdatePackage); + } + + private static void ApplyUpdatePackage(UnityWebRequest request) + { + // Save the downloaded file to a temp location + string tempFile = Path.GetTempFileName(); + File.WriteAllBytes(tempFile, request.downloadHandler.data); + + // Wipe the MeatKit folder so it's fresh and ready for the new stuff + string dataDir = Path.Combine(Application.dataPath, "MeatKit"); + Directory.Delete(dataDir, true); + File.Delete(dataDir + ".meta"); + + // Import all the files from it + AssetDatabase.ImportPackage(tempFile, false); + + // Kick the asset database to refresh now that we're done + AssetDatabase.Refresh(); + + // Remove the temp file + File.Delete(tempFile); + + // Update the saved version number + File.WriteAllText("ProjectSettings/MeatKitVersion.txt", OnlineVersion.ToString()); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/Updater.cs.meta b/Assets/MeatKit/Editor/Updater/Updater.cs.meta new file mode 100644 index 0000000..50d24f9 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/Updater.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 406166d3dc514f5bb884a2b40b183e26 +timeCreated: 1684892343 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/UpdaterEditorWindow.cs b/Assets/MeatKit/Editor/Updater/UpdaterEditorWindow.cs new file mode 100644 index 0000000..343414b --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/UpdaterEditorWindow.cs @@ -0,0 +1,55 @@ +using System; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + public class UpdaterEditorWindow : EditorWindow + { + private bool _allowPrerelease; + + [MenuItem("MeatKit/Check for updates")] + public static void Open() + { + GetWindow("MeatKit Updater").Show(); + } + + private void OnGUI() + { + EditorGUILayout.LabelField("MeatKit Updater", EditorStyles.boldLabel); + EditorGUILayout.LabelField("Installed version: " + Updater.CurrentVersion); + + SimpleVersion onlineVersion = Updater.OnlineVersion; + if (onlineVersion == null) EditorGUILayout.LabelField("Online version: Unknown (check for updates)"); + else EditorGUILayout.LabelField("Online version: " + onlineVersion); + + if (MeatKitCache.LastUpdateCheckTime != default(DateTime)) + GUILayout.Label("Last update check: " + MeatKitCache.LastUpdateCheckTime); + else GUILayout.Label("Last update check: Never"); + + if (!Updater.CheckingForUpdate) + { + if (GUILayout.Button("Check for updates")) + { + Updater.CheckForUpdate(_allowPrerelease); + } + + _allowPrerelease = GUILayout.Toggle(_allowPrerelease, "Allow pre-release versions"); + + if (Updater.CurrentVersion.CompareTo(onlineVersion) < 0) + { + if (GUILayout.Button("Update to " + onlineVersion, GUILayout.Height(50))) + { + Updater.StartUpdate(); + } + } + } + else + { + EditorGUI.BeginDisabledGroup(true); + GUILayout.Button("Checking..."); + EditorGUI.EndDisabledGroup(); + } + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Updater/UpdaterEditorWindow.cs.meta b/Assets/MeatKit/Editor/Updater/UpdaterEditorWindow.cs.meta new file mode 100644 index 0000000..feb0de7 --- /dev/null +++ b/Assets/MeatKit/Editor/Updater/UpdaterEditorWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b54e300d191d47d4a2666733d6bd77e2 +timeCreated: 1684891987 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils.meta b/Assets/MeatKit/Editor/Utils.meta new file mode 100644 index 0000000..17c80bb --- /dev/null +++ b/Assets/MeatKit/Editor/Utils.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e064a960324f477e9d8eb84cd5115b51 +timeCreated: 1655418891 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/AssemblyStripper.cs b/Assets/MeatKit/Editor/Utils/AssemblyStripper.cs new file mode 100644 index 0000000..435b68d --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/AssemblyStripper.cs @@ -0,0 +1,95 @@ +/* + * This code is from BepInEx's NStrip library, licensed under MIT + * https://github.com/BepInEx/NStrip/blob/f1e9887b3eb77c0e02acb5919b5e26a6e7c2c342/NStrip/AssemblyStripper.cs + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using Mono.Cecil; +using UnityEngine; + +namespace NStrip +{ + public static class AssemblyStripper + { + static IEnumerable GetAllTypeDefinitions(AssemblyDefinition assembly) + { + var typeQueue = new Queue(assembly.MainModule.Types); + + while (typeQueue.Count > 0) + { + var type = typeQueue.Dequeue(); + + yield return type; + + foreach (var nestedType in type.NestedTypes) + typeQueue.Enqueue(nestedType); + } + } + + private static bool CheckCompilerGeneratedAttribute(IMemberDefinition member) + { + return member.CustomAttributes.Any(x => + x.AttributeType.FullName == "System.Runtime.CompilerServices.CompilerGeneratedAttribute"); + } + + public static void MakePublic(AssemblyDefinition assembly, IList typeNameBlacklist, bool includeCompilerGenerated, bool excludeCgEvents) + { + + foreach (var type in GetAllTypeDefinitions(assembly)) + { + if (typeNameBlacklist.Contains(type.Name)) + continue; + + if (!includeCompilerGenerated && CheckCompilerGeneratedAttribute(type)) + continue; + + if (type.IsNested) + type.IsNestedPublic = true; + else + type.IsPublic = true; + + foreach (var method in type.Methods) + { + if (!includeCompilerGenerated && + (CheckCompilerGeneratedAttribute(method) || method.IsCompilerControlled)) + continue; + + method.IsPublic = true; + } + + foreach (var field in type.Fields) + { + if (!includeCompilerGenerated && + (CheckCompilerGeneratedAttribute(field) || field.IsCompilerControlled)) + continue; + + if (includeCompilerGenerated && excludeCgEvents) + { + if (type.Events.Any(x => x.Name == field.Name)) + continue; + } + + if (field.IsPublic) continue; + + field.IsPublic = true; + var attributes = field.CustomAttributes; + CustomAttribute isExplicitlySerialized = attributes.FirstOrDefault(x => x.AttributeType.Name == "SerializeField"); + + if (isExplicitlySerialized == null) + { + var nonSerializedAttributeCtor = typeof(NonSerializedAttribute).GetConstructor(Type.EmptyTypes); + var nonSerializedAttributeRef = assembly.MainModule.ImportReference(nonSerializedAttributeCtor); + attributes.Add(new CustomAttribute(nonSerializedAttributeRef)); + + var hideInInspectorCtor = typeof(MeatKit.HideInNormalInspectorAttribute).GetConstructor(Type.EmptyTypes); + var hideInInspectorRef = assembly.MainModule.ImportReference(hideInInspectorCtor); + attributes.Add(new CustomAttribute(hideInInspectorRef)); + + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/AssemblyStripper.cs.meta b/Assets/MeatKit/Editor/Utils/AssemblyStripper.cs.meta new file mode 100644 index 0000000..05f7910 --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/AssemblyStripper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4c62b8c488f64d298e5bc464fdee9f17 +timeCreated: 1646326380 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/EditorVersion.cs b/Assets/MeatKit/Editor/Utils/EditorVersion.cs new file mode 100644 index 0000000..2d0ed38 --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/EditorVersion.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + public class NativeHookFunctionOffsets + { + public long MonoScriptTransferWrite { get; set; } + public long MonoScriptTransferRead { get; set; } + public long ShutdownManaged { get; set; } + public long StringAssign { get; set; } + } + + public class EditorVersion + { + public NativeHookFunctionOffsets FunctionOffsets { get; set; } + + private static bool _hasShownPopup = false; + + public static bool IsSupportedVersion + { + get + { + bool supported = SupportedVersions.ContainsKey(Application.unityVersion); + + if (!supported && !_hasShownPopup) + { + // Show the warning popup about the wrong version if is hasn't come up already. + string validVersion = string.Join(", ", SupportedVersions.Keys.ToArray()); + EditorUtility.DisplayDialog("Wrong editor version", + "You are using Unity version " + Application.unityVersion + ", MeatKit requires one of the following: " + validVersion, + "I'll go install that."); + _hasShownPopup = true; + } + + return supported; + } + } + + public static EditorVersion Current + { + get + { + EditorVersion currentVersion; + if (SupportedVersions.TryGetValue(Application.unityVersion, out currentVersion)) + return currentVersion; + throw new NotSupportedException("The current editor version is not in the list of supported versions."); + } + } + + private static readonly Dictionary SupportedVersions = new Dictionary() + { + { + "5.6.3p4", new EditorVersion + { + FunctionOffsets = new NativeHookFunctionOffsets + { + MonoScriptTransferWrite = 0xE321E0, + MonoScriptTransferRead = 0xE34000, + ShutdownManaged = 0x17542D0, + StringAssign = 0x1480 + } + } + }, + { + "5.6.7f1", new EditorVersion + { + FunctionOffsets = new NativeHookFunctionOffsets + { + MonoScriptTransferWrite = 0xE39BF0, + MonoScriptTransferRead = 0xE3BA10, + ShutdownManaged = 0x175D2C0, + StringAssign = 0x1480 + } + } + }, + }; + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/EditorVersion.cs.meta b/Assets/MeatKit/Editor/Utils/EditorVersion.cs.meta new file mode 100644 index 0000000..19a09b1 --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/EditorVersion.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f6222c8b0cb74878820d6fe4c55aae88 +timeCreated: 1684366513 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Extensions.cs b/Assets/MeatKit/Editor/Utils/Extensions.cs similarity index 100% rename from Assets/MeatKit/Editor/Extensions.cs rename to Assets/MeatKit/Editor/Utils/Extensions.cs diff --git a/Assets/MeatKit/Editor/Extensions.cs.meta b/Assets/MeatKit/Editor/Utils/Extensions.cs.meta similarity index 100% rename from Assets/MeatKit/Editor/Extensions.cs.meta rename to Assets/MeatKit/Editor/Utils/Extensions.cs.meta diff --git a/Assets/MeatKit/Editor/Utils/HideInNormalInspectorDrawer.cs b/Assets/MeatKit/Editor/Utils/HideInNormalInspectorDrawer.cs new file mode 100644 index 0000000..f50020b --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/HideInNormalInspectorDrawer.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using UnityEditor; + +namespace MeatKit +{ + [CustomPropertyDrawer(typeof(HideInNormalInspectorAttribute))] + class HideInNormalInspectorDrawer : PropertyDrawer + { + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return 0f; + } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Tools/IconCamera.cs.meta b/Assets/MeatKit/Editor/Utils/HideInNormalInspectorDrawer.cs.meta similarity index 75% rename from Assets/MeatKit/Tools/IconCamera.cs.meta rename to Assets/MeatKit/Editor/Utils/HideInNormalInspectorDrawer.cs.meta index b83d3d2..519a2fc 100644 --- a/Assets/MeatKit/Tools/IconCamera.cs.meta +++ b/Assets/MeatKit/Editor/Utils/HideInNormalInspectorDrawer.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: dcb72b0d9a9ea3b43a48a22b952f43c5 -timeCreated: 1637536229 +guid: 0c4b5d56cc4522845a6ca6bb3d6d76f0 +timeCreated: 1667603705 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/Assets/MeatKit/Editor/Utils/NativeHookManager.cs b/Assets/MeatKit/Editor/Utils/NativeHookManager.cs new file mode 100644 index 0000000..a7d2bcf --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/NativeHookManager.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using MonoMod.RuntimeDetour; +using MonoMod.Utils; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + /// + /// This class helps manage detours into the native code of the Editor. + /// Any detours into native code should be registered using this as it will automatically dispose of them + /// right before the Editor reloads the mono domain, preventing editor crashes. + /// + [InitializeOnLoad] + public static class NativeHookManager + { + // Actual name: ShutdownPlatformSupportModulesInManaged(void) + private delegate void ShutdownManaged(); + + private static readonly ShutdownManaged OrigShutdownManaged; + + // Keep track of all the applied detours so we can quickly undo them before the mono domain is reloaded + private static readonly List Detours = new List(); + + static NativeHookManager() + { + if (!EditorVersion.IsSupportedVersion) return; + + // Apply our detours here and save the trampoline to call the original function + OrigShutdownManaged = ApplyEditorDetour(EditorVersion.Current.FunctionOffsets.ShutdownManaged, new ShutdownManaged(OnShutdownManaged)); + } + + public static T ApplyEditorDetour(long from, Delegate to) where T : class + { + // Avoid crashing the editor if we're loaded in the wrong Unity version + if (!EditorVersion.IsSupportedVersion) return null; + + // Get the base address of the Unity module and the address in memory of the function + IntPtr editorBase = DynDll.OpenLibrary("Unity.exe"); + IntPtr fromPtr = (IntPtr)(editorBase.ToInt64() + from); + + // Get a function pointer for the managed callback + var toPtr = Marshal.GetFunctionPointerForDelegate(to); + + // Make a detour and add it to the list + var detour = new NativeDetour(fromPtr, toPtr, new NativeDetourConfig { ManualApply = true }); + Detours.Add(detour); + + // Apply the detour and generate a trampoline for it, which we return + var original = detour.GenerateTrampoline(to.GetType().GetMethod("Invoke")).CreateDelegate(typeof(T)) as T; + detour.Apply(); + return original; + } + + public static Delegate GetDelegateForFunctionPointer(long from) + { + // Avoid crashing the editor if we're loaded in the wrong Unity version + if (!EditorVersion.IsSupportedVersion) return null; + + // Get the base address for the Unity module and apply the offset + IntPtr editorBase = DynDll.OpenLibrary("Unity.exe"); + return Marshal.GetDelegateForFunctionPointer((IntPtr)(editorBase.ToInt64() + from), typeof(T)); + } + + private static void OnShutdownManaged() + { + // Unity is about to shutdown the mono runtime! Quickly dispose of our detours! + OrigShutdownManaged(); + foreach (var detour in Detours) detour.Dispose(); + } + } +} diff --git a/Assets/MeatKit/Editor/Utils/NativeHookManager.cs.meta b/Assets/MeatKit/Editor/Utils/NativeHookManager.cs.meta new file mode 100644 index 0000000..cfe3eed --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/NativeHookManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9a51d43ba1fe4baf8e3b0a90d7f8ec88 +timeCreated: 1654485214 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/SteamAppLocator.cs b/Assets/MeatKit/Editor/Utils/SteamAppLocator.cs new file mode 100644 index 0000000..3564407 --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/SteamAppLocator.cs @@ -0,0 +1,45 @@ +using System.IO; +using System.Text.RegularExpressions; +using Microsoft.Win32; + +namespace MeatKit +{ + public static class SteamAppLocator + { + private const int AppId = 450540; + private const string AppFolderName = "H3VR"; + + public static string LocateGame() + { + // Get the main steam installation location via registry. + var steamDir = ( + Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam", "InstallPath", null) ?? + Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam", "InstallPath", null)) + as string; + + // If we can't find it, return. This should really only happen if Steam isn't installed. + if (string.IsNullOrEmpty(steamDir)) return null; + + // Check main steamapps library folder for h3 manifest. + var manifestFile = @"steamapps\appmanifest_" + AppId + ".acf"; + var gameFolder = @"steamapps\common\" + AppFolderName + @"\"; + if (File.Exists(Path.Combine(steamDir, manifestFile))) + { + return Path.Combine(steamDir, gameFolder); + } + + // We didn't find it, look at other library folders by lazily parsing libraryfolders. + var libraryFolders = Path.Combine(steamDir, @"steamapps\libraryfolders.vdf"); + foreach (Match match in Regex.Matches(File.ReadAllText(libraryFolders), @"^\s+\""path\""\s+\""(.+)\""$", + RegexOptions.Multiline)) + { + var folder = match.Groups[1].Value; + if (!File.Exists(Path.Combine(folder, manifestFile))) continue; + return Path.Combine(folder, gameFolder); + } + + // Nope. Still can't find it. + return null; + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/SteamAppLocator.cs.meta b/Assets/MeatKit/Editor/Utils/SteamAppLocator.cs.meta new file mode 100644 index 0000000..90d3214 --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/SteamAppLocator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4c50a485a68d43caa9c30a864c2d8b25 +timeCreated: 1655693881 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Utils/UnityNativeHelper.cs b/Assets/MeatKit/Editor/Utils/UnityNativeHelper.cs new file mode 100644 index 0000000..417be8f --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/UnityNativeHelper.cs @@ -0,0 +1,60 @@ +using System; +using System.Runtime.InteropServices; + +namespace MeatKit +{ + public static class UnityNativeHelper + { + private delegate IntPtr StringAssignType(IntPtr ptr, string str, ulong len, IntPtr nul); + + private static readonly StringAssignType AssignNativeString; + + static UnityNativeHelper() + { + if (!EditorVersion.IsSupportedVersion) return; + + AssignNativeString = (StringAssignType) NativeHookManager.GetDelegateForFunctionPointer(EditorVersion.Current.FunctionOffsets.StringAssign); + } + + /// + /// Reads a native string structure from unmanaged memory + /// + /// The pointer to the structure + /// Offset to the pointer + /// A copy of the structure in managed memory + public static string ReadNativeString(IntPtr ptr, int ofs) + { + // Apply the offset + var real = (IntPtr) (ptr.ToInt64() + ofs); + + // Get the pointer to the string in memory + var stringPointer = Marshal.ReadIntPtr(real); + if (stringPointer == IntPtr.Zero) + { + // If the pointer is null, that means it's stored in the struct directly. + // In this format, the string is 16 chars or less. + var length = Marshal.ReadInt64(real, 24); + return Marshal.PtrToStringAnsi((IntPtr) (real.ToInt64() + 8), (int) length); + } + else + { + // If it isn't null, we can just go out into that memory location and read it. + var length = Marshal.ReadInt64(real, 24); + return Marshal.PtrToStringAnsi(stringPointer, (int) length); + } + } + + /// + /// Writes a managed string to the unmanaged memory location of a string structure + /// + /// The pointer to the structure in memory + /// Offset to the pointer + /// The string to write + public static void WriteNativeString(IntPtr ptr, int ofs, string str) + { + // Apply the offset and call the assign function of native Unity code + var real = (IntPtr) (ptr.ToInt64() + ofs); + AssignNativeString(real, str, (ulong) str.Length, IntPtr.Zero); + } + } +} diff --git a/Assets/MeatKit/Editor/Utils/UnityNativeHelper.cs.meta b/Assets/MeatKit/Editor/Utils/UnityNativeHelper.cs.meta new file mode 100644 index 0000000..d01ba45 --- /dev/null +++ b/Assets/MeatKit/Editor/Utils/UnityNativeHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ba90027061ca46f88e2e0cf4fefc0224 +timeCreated: 1655406646 \ No newline at end of file diff --git a/Assets/MeatKit/HideInNormalInspectorAttribute.cs b/Assets/MeatKit/HideInNormalInspectorAttribute.cs new file mode 100644 index 0000000..1d997ce --- /dev/null +++ b/Assets/MeatKit/HideInNormalInspectorAttribute.cs @@ -0,0 +1,5 @@ +using UnityEngine; +namespace MeatKit +{ + public class HideInNormalInspectorAttribute : PropertyAttribute { } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs.meta b/Assets/MeatKit/HideInNormalInspectorAttribute.cs.meta similarity index 69% rename from Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs.meta rename to Assets/MeatKit/HideInNormalInspectorAttribute.cs.meta index 15abab4..2ad1c99 100644 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs.meta +++ b/Assets/MeatKit/HideInNormalInspectorAttribute.cs.meta @@ -1,7 +1,8 @@ fileFormatVersion: 2 -guid: 15478322cbd3d2f4a862552f839978da +guid: 3f2d0027e67ba7c45bebe5483a614d44 +timeCreated: 1667603705 +licenseType: Pro MonoImporter: - externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 diff --git a/Assets/MeatKit/Icons.meta b/Assets/MeatKit/Icons.meta deleted file mode 100644 index 053262a..0000000 --- a/Assets/MeatKit/Icons.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c302b95892ac1244bbc2d7eb2a4584a2 -folderAsset: yes -timeCreated: 1640060210 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Icons/AtlasSceneBuildItem.png b/Assets/MeatKit/Icons/AtlasSceneBuildItem.png deleted file mode 100644 index 521f137..0000000 Binary files a/Assets/MeatKit/Icons/AtlasSceneBuildItem.png and /dev/null differ diff --git a/Assets/MeatKit/Managed/MonoMod.Utils.dll b/Assets/MeatKit/Managed/MonoMod.Utils.dll deleted file mode 100644 index 0bfd861..0000000 Binary files a/Assets/MeatKit/Managed/MonoMod.Utils.dll and /dev/null differ diff --git a/Assets/MeatKit/MeatKitPlugin.cs b/Assets/MeatKit/MeatKitPlugin.cs index 6e6f75f..7d48654 100644 --- a/Assets/MeatKit/MeatKitPlugin.cs +++ b/Assets/MeatKit/MeatKitPlugin.cs @@ -1,9 +1,12 @@ #if H3VR_IMPORTED +using System.Collections; +using System; using HarmonyLib; using System.IO; using System.Reflection; using BepInEx; using BepInEx.Bootstrap; +using BepInEx.Logging; using BepInEx.Configuration; using UnityEngine; using UnityEngine.UI; @@ -16,29 +19,31 @@ using Sodalite; /* * SUPER LARGE WARNING ABOUT THIS CLASS - * This class can be used to add custom behaviour to your generated BepInEx plugin. - * Please note, however, that all of the things in here already are REQUIRED and CANNOT BE CHANGED. - * There are LARGE TEXT WARNINGS above such items so you don't forget. - * You may add to this class so long as you do not modify anything with those notices (lest you want build errors) + * This is the default and fallback class that MeatKit uses as a template to generate a BepInEx plugin + * when building your mod. DO NOT MODIFY THIS FILE AT ALL, IN ANY WAY. * - * The class name and BepInPlugin attribute are modified at build-time to reflect your build settings. - * BepInDependency attributes will automatically be generated if they're required by a build item, otherwise - * may add it yourself here. + * If you want to add custom behavior to your mod, you should make a copy of this class, and put it inside + * the main namespace of your mod (that namespace can be found by opening the 'Allowed Namespaces' list on your build + * profile). MeatKit will then detect and use that class instead of this one, for that one specific profile. + * + * HOWEVER, YOU MUST KEEP ALL OF THE STUFF FROM THIS TEMPLATE, otherwise MeatKit may fail to correctly build + * your plugin, or your mod may fail to correctly load. */ // DO NOT REMOVE OR CHANGE ANY OF THESE ATTRIBUTES [BepInPlugin("MeatKit", "MeatKit Plugin", "1.0.0")] [BepInProcess("h3vr.exe")] -// DO NOT CHANGE THE NAME OF THIS CLASS. +// DO NOT CHANGE THE NAME OF THIS CLASS OR THE BASE CLASS. If you're making a custom plugin, make sure it extends BaseUnityPlugin. public class MeatKitPlugin : BaseUnityPlugin { // DO NOT CHANGE OR REMOVE THIS FIELD. #pragma warning disable 414 private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + internal new static ManualLogSource Logger; #pragma warning restore 414 - public static AssetBundle bundle; +public static AssetBundle bundle; public static Font fontAgencyFB; public static Font fontBombardier; @@ -99,13 +104,29 @@ public class MeatKitPlugin : BaseUnityPlugin WristMenuAPI.Buttons.Remove(wmbHPToggle); } - // TNH patches - if (GameObject.Find("_GameManager") != null || FindObjectOfType() != null) + StartCoroutine("TryTNH"); + } + + private IEnumerator TryTNH() + { + for (int i = 0; i < 11; ++i) { - Logger.LogInfo("We are in a TNH game!"); - instance = new GameObject().AddComponent(); + // TNH patches + if (GameObject.Find("_GameManager") != null || FindObjectOfType() != null) + { + Logger.LogInfo("We are in a TNH game!"); + instance = new GameObject().AddComponent(); + break; + } + else + { + Logger.LogInfo(String.Format("Couldn't find a TNH game. Trying again...({0}/10)", i)); + yield return new WaitForEndOfFrame(); + } } - else + + // destroy self only if we are FOR SURE not in a TNH game + if (GameObject.Find("_GameManager") == null || FindObjectOfType() == null) { Logger.LogInfo("We are NOT in a TNH game!"); Destroy(instance); @@ -140,13 +161,20 @@ public class MeatKitPlugin : BaseUnityPlugin public MeatKitPlugin(): base() { harmony = new Harmony("muskit.TNHQualityOfLifeImprovements"); - lpcSearchTime = 30f + 30f * Mathf.Sin(System.DateTime.Today.DayOfYear / 365f); + lpcSearchTime = 30f + 30f * Mathf.Sin(System.DateTime.Today.DayOfYear / 365f); // lolz } + // You are free to edit this method, however please ensure LoadAssets is still called somewhere inside it. private void Awake() { - // MeatKit requirement + // ----- BEGIN MEATKIT REQ. CODE ----- + // This lets you use your BepInEx-provided logger from other scripts in your project + Logger = base.Logger; + + // You may place code before/after this, but do not remove this call to LoadAssets LoadAssets(); + // ----- END MEATKIT REQ. CODE ----- + // get Agency FB from system (BAD IDEA, NOT EVERYONE WILL HAVE IT; MAY SET TO DEFAULT FONT) //fontAgencyFB = Font.CreateDynamicFontFromOSFont("Agency FB", 16); @@ -224,9 +252,6 @@ public class MeatKitPlugin : BaseUnityPlugin RunPatches(); } - // DO NOT EDIT. - private void LoadAssets() {} - private void RunPatches() { if (harmony == null) @@ -292,5 +317,11 @@ public class MeatKitPlugin : BaseUnityPlugin lpcStopSearching = true; } } + + // DO NOT CHANGE OR REMOVE THIS METHOD. It's contents will be overwritten when building your package. + private void LoadAssets() + { + // Code to load your build items will be generated at build-time and inserted here + } } -#endif \ No newline at end of file +#endif diff --git a/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage b/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage deleted file mode 100644 index 1a2f313..0000000 Binary files a/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage and /dev/null differ diff --git a/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage.meta b/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage.meta deleted file mode 100644 index fb4b362..0000000 --- a/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f69811f758fe69d4a8db916798dae1d0 -timeCreated: 1641677517 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor.meta b/Assets/MeatKit/Tools/Editor.meta deleted file mode 100644 index 0ad09bd..0000000 --- a/Assets/MeatKit/Tools/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 909a2b7b1c734764287b9acd96752fc7 -folderAsset: yes -timeCreated: 1640643655 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs b/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs deleted file mode 100644 index 217a0cf..0000000 --- a/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -[CustomEditor(typeof(IconCamera))] -[CanEditMultipleObjects] -public class IconCameraEditor : Editor { - - - Texture2D previewTexture = null; - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - var property = serializedObject.GetIterator(); - if (!property.NextVisible(true)) return; - do EditorGUILayout.PropertyField(property, true); - while (property.NextVisible(false)); - - serializedObject.ApplyModifiedProperties(); - - IconCamera iconCamera = serializedObject.targetObject as IconCamera; - iconCamera.thisCamera.depthTextureMode = iconCamera.CameraDepthMode; - - if (previewTexture != null) - { - GUILayout.BeginVertical("Box"); - - GUIStyle style = new GUIStyle(); - style.alignment = TextAnchor.UpperCenter; - style.fixedWidth = Screen.width - 50; - style.fixedHeight = Screen.width - 50; - GUILayout.Label(previewTexture, style); - - GUILayout.EndVertical(); - } - - - - if (GUILayout.Button("Update Preview")) - { - if (iconCamera.renderTexture != null) - { - RenderTexture temp = RenderTexture.active; - RenderTexture.active = iconCamera.renderTexture; - Texture2D texture = new Texture2D(iconCamera.renderTexture.width, iconCamera.renderTexture.height); - texture.ReadPixels(new Rect(0, 0, iconCamera.renderTexture.width, iconCamera.renderTexture.height), 0, 0); - texture.Apply(); - RenderTexture.active = temp; - - texture = iconCamera.FlipTexture(texture); - - if (iconCamera.background != null) - { - texture = iconCamera.AddBackground(texture, iconCamera.background); - } - - previewTexture = texture; - } - } - - - if (GUILayout.Button("Take Picture")) - { - Selection.activeGameObject.GetComponent().Capture(); - } - } -} diff --git a/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs.meta b/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs.meta deleted file mode 100644 index bde636b..0000000 --- a/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b4607bcf07fdb67428d41b6bd2f9b2fb -timeCreated: 1640645560 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor/PrefabLoader.cs b/Assets/MeatKit/Tools/Editor/PrefabLoader.cs deleted file mode 100644 index 8582b43..0000000 --- a/Assets/MeatKit/Tools/Editor/PrefabLoader.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using UnityEditor; -using UnityEngine; - -public class PrefabLoader : EditorWindow -{ - private AssetBundle _bundle; - private string[] _assets = new string[0]; - private int _selectedAsset = 0; - - [MenuItem("MeatKit/Asset Bundle/Prefab Loader")] - private static void Init() - { - GetWindow().Show(); - } - - private void OnGUI() - { - if (GUILayout.Button("Select Asset Bundle")) - { - // If there's already a bundle loaded, unload it. - if (_bundle) _bundle.Unload(false); - - // Ask for the new bundle, load it, and get its assets - string assetBundlePath = EditorUtility.OpenFilePanel("Select Asset Bundle", string.Empty, string.Empty); - _bundle = AssetBundle.LoadFromFile(assetBundlePath); - _assets = _bundle.GetAllAssetNames(); - _selectedAsset = 0; - } - - if (_assets.Length > 0) - { - _selectedAsset = EditorGUILayout.Popup(_selectedAsset, _assets); - if (GUILayout.Button("Spawn")) Instantiate(_bundle.LoadAsset(_assets[_selectedAsset])); - } - } -} \ No newline at end of file diff --git a/Assets/MeatKit/Tools/GunRipper/Editor.meta b/Assets/MeatKit/Tools/GunRipper/Editor.meta deleted file mode 100644 index c3d7f35..0000000 --- a/Assets/MeatKit/Tools/GunRipper/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b2cc9af527c35194481307c551f26f04 -folderAsset: yes -timeCreated: 1641758894 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs b/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs deleted file mode 100644 index c3aed0f..0000000 --- a/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs +++ /dev/null @@ -1,230 +0,0 @@ -#if H3VR_IMPORTED -using FistVR; -#endif -using MeatKit; -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -public class GunRipperWindow : EditorWindow -{ - - public GameObject SelectedGameObject; - public string ExportPath = "Meatkit/Tools/GunRipper/Export"; - - - [MenuItem("Tools/Gun Ripper")] - public static void Open() - { - GetWindow("Gun Ripper").Show(); - } - - #if H3VR_IMPORTED - - private void OnGUI() - { - EditorGUILayout.LabelField("Selected GameObject", EditorStyles.boldLabel); - - EditorGUI.BeginChangeCheck(); - SelectedGameObject = EditorGUILayout.ObjectField(SelectedGameObject, typeof(GameObject), true) as GameObject; - - if (string.IsNullOrEmpty(ExportPath)) ExportPath = "Meatkit/Tools/GunRipper/Export"; - ExportPath = EditorGUILayout.TextField(ExportPath); - - if (!SelectedGameObject) - { - GUILayout.Label("Please select a game object"); - return; - } - - EditorGUILayout.Space(); - - FVRFireArm firearmComp = SelectedGameObject.GetComponent(); - FVRFireArmMagazine magazineComp = SelectedGameObject.GetComponent(); - FVRFireArmAttachment attachment = SelectedGameObject.GetComponent(); - - if (firearmComp != null && firearmComp.AudioClipSet != null && GUILayout.Button("Rip Firearm Audio")) - { - Debug.Log("Ripping Audio!"); - RipAudio(firearmComp.AudioClipSet, "AudioSet"); - } - - if (magazineComp != null && magazineComp.Profile != null && GUILayout.Button("Rip Magazine Audio")) - { - Debug.Log("Ripping Audio!"); - RipAudio(magazineComp.Profile, "AudioSet"); - } - - if(attachment != null && (attachment.AudClipAttach != null || attachment.AudClipDettach != null) && GUILayout.Button("Rip Attachment Audio")) - { - if(attachment.AudClipAttach != null) - { - Debug.Log("Ripping Audio!"); - RipAudio(attachment.AudClipAttach, "AudioAttach"); - } - - if (attachment.AudClipDettach != null) - { - Debug.Log("Ripping Audio!"); - RipAudio(attachment.AudClipDettach, "AudioDettach"); - } - } - - if (firearmComp != null && (firearmComp.RecoilProfile != null || firearmComp.RecoilProfileStocked != null) && GUILayout.Button("Rip Firearm Recoil")) - { - if(firearmComp.RecoilProfile != null) - { - Debug.Log("Ripping Stockless Recoil!"); - RipRecoil(firearmComp.RecoilProfile, "Recoil"); - } - - if(firearmComp.RecoilProfileStocked != null) - { - Debug.Log("Ripping Stocked Recoil!"); - RipRecoil(firearmComp.RecoilProfileStocked, "RecoilStocked"); - } - } - - - } - - - - private void RipAudio(AudioEvent audioEvent, string suffix) - { - string exportFolderPath = "Assets/" + ExportPath.Trim('/'); - string destinationFolderName = SelectedGameObject.name + "_Rip"; - string destinationFolderPath = exportFolderPath + "/" + destinationFolderName; - - if (!AssetDatabase.IsValidFolder(destinationFolderPath)) - { - AssetDatabase.CreateFolder(exportFolderPath, destinationFolderName); - } - - RipAudioClips(audioEvent, destinationFolderPath); - } - - - private void RipAudio(FVRFirearmAudioSet audioSet, string suffix) - { - string exportFolderPath = "Assets/" + ExportPath.Trim('/'); - string destinationFolderName = SelectedGameObject.name + "_Rip"; - string destinationFolderPath = exportFolderPath + "/" + destinationFolderName; - string audioPath = destinationFolderPath + "/" + SelectedGameObject.name + "_" + suffix + ".asset"; - - if (!AssetDatabase.IsValidFolder(destinationFolderPath)) - { - AssetDatabase.CreateFolder(exportFolderPath, destinationFolderName); - } - - FVRFirearmAudioSet audioCopy = CreateInstance(); - CopyFields(audioCopy, audioSet); - RipAudioClips(audioCopy, destinationFolderPath); - - AssetDatabase.DeleteAsset(audioPath); - AssetDatabase.CreateAsset(audioCopy, audioPath); - AssetDatabase.SaveAssets(); - } - - private void RipRecoil(FVRFireArmRecoilProfile recoil, string suffix) - { - string exportFolderPath = "Assets/" + ExportPath.Trim('/'); - string destinationFolderName = SelectedGameObject.name + "_Rip"; - string destinationFolderPath = exportFolderPath + "/" + destinationFolderName; - string recoilPath = destinationFolderPath + "/" + SelectedGameObject.name + "_" + suffix + ".asset"; - - if (!AssetDatabase.IsValidFolder(destinationFolderPath)) - { - AssetDatabase.CreateFolder(exportFolderPath, destinationFolderName); - } - - FVRFireArmRecoilProfile recoilCopy = CreateInstance(); - CopyFields(recoilCopy, recoil); - - AssetDatabase.DeleteAsset(recoilPath); - AssetDatabase.CreateAsset(recoilCopy, recoilPath); - AssetDatabase.SaveAssets(); - } - - - - - private void CopyFields(UnityEngine.Object copyAsset, UnityEngine.Object origAsset, bool allowMismatch = false) - { - Type type = origAsset.GetType(); - if (!allowMismatch && type != copyAsset.GetType()) - { - return; - } - - BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Default; - PropertyInfo[] pinfos = type.GetProperties(flags); - foreach (var pinfo in pinfos) - { - - if (pinfo.CanWrite) - { - try - { - pinfo.SetValue(copyAsset, pinfo.GetValue(origAsset, null), null); - } - catch - { - - } - } - } - FieldInfo[] finfos = type.GetFields(flags); - foreach (var finfo in finfos) - { - finfo.SetValue(copyAsset, finfo.GetValue(origAsset)); - } - } - - - private void RipAudioClips(System.Object asset, string exportPath) - { - Type type = asset.GetType(); - BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Default; - - FieldInfo[] finfos = type.GetFields(flags); - foreach (var finfo in finfos) - { - Debug.Log("Field: " + finfo.Name + ", Type: " + finfo.FieldType); - - if(finfo.GetValue(asset) is List) - { - Debug.Log("List!"); - - List audioList = finfo.GetValue(asset) as List; - - for (int i = 0; i < audioList.Count; i++) - { - AudioClip clip = audioList[i]; - if(clip != null) - { - Debug.Log("Audio Clip! " + clip.name); - audioList[i] = SavWav.Save(exportPath, clip); - } - } - } - - if(finfo.FieldType == typeof(AudioEvent)) - { - Debug.Log("Audio Event!"); - RipAudioClips(finfo.GetValue(asset), exportPath); - } - } - } - -#endif -} - - - - - diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs b/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs deleted file mode 100644 index 8680646..0000000 --- a/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using UnityEditor; -using UnityEngine; - -/// -/// Allows for saving audio clips to wav file. -/// Code found here: https://gist.github.com/darktable/2317063 -/// -public static class SavWav -{ - - const int HEADER_SIZE = 44; - struct ClipData - { - - public int samples; - public int channels; - public float[] samplesData; - - } - - public static AudioClip Save(string path, AudioClip clip) - { - var assetPath = path.Trim('/') + "/" + clip.name + ".wav"; - var filepath = Directory.GetParent(Application.dataPath) + "/" + path.Trim('/') + "/" + clip.name + ".wav"; - - Debug.Log(filepath); - Debug.Log(assetPath); - - AssetDatabase.DeleteAsset(assetPath); - - // Make sure directory exists if user is saving to sub dir. - ClipData clipdata = new ClipData(); - clipdata.samples = clip.samples; - clipdata.channels = clip.channels; - float[] dataFloat = new float[clip.samples * clip.channels]; - clip.GetData(dataFloat, 0); - clipdata.samplesData = dataFloat; - - using (var fileStream = CreateEmpty(filepath)) - { - MemoryStream memstrm = new MemoryStream(); - ConvertAndWrite(memstrm, clipdata); - memstrm.WriteTo(fileStream); - WriteHeader(fileStream, clip); - } - - AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); - AssetDatabase.Refresh(); - - return (AudioClip)AssetDatabase.LoadAssetAtPath(assetPath, typeof(AudioClip)); - } - - public static AudioClip TrimSilence(AudioClip clip, float min) - { - var samples = new float[clip.samples]; - - clip.GetData(samples, 0); - - return TrimSilence(new List(samples), min, clip.channels, clip.frequency); - } - - public static AudioClip TrimSilence(List samples, float min, int channels, int hz) - { - return TrimSilence(samples, min, channels, hz, false, false); - } - - public static AudioClip TrimSilence(List samples, float min, int channels, int hz, bool _3D, bool stream) - { - int i; - - for (i = 0; i < samples.Count; i++) - { - if (Mathf.Abs(samples[i]) > min) - { - break; - } - } - - samples.RemoveRange(0, i); - - for (i = samples.Count - 1; i > 0; i--) - { - if (Mathf.Abs(samples[i]) > min) - { - break; - } - } - - samples.RemoveRange(i, samples.Count - i); - - var clip = AudioClip.Create("TempClip", samples.Count, channels, hz, _3D, stream); - - clip.SetData(samples.ToArray(), 0); - - return clip; - } - - static FileStream CreateEmpty(string filepath) - { - var fileStream = new FileStream(filepath, FileMode.Create); - byte emptyByte = new byte(); - - for (int i = 0; i < HEADER_SIZE; i++) //preparing the header - { - fileStream.WriteByte(emptyByte); - } - - return fileStream; - } - - static void ConvertAndWrite(MemoryStream memStream, ClipData clipData) - { - float[] samples = new float[clipData.samples * clipData.channels]; - - samples = clipData.samplesData; - - Int16[] intData = new Int16[samples.Length]; - - Byte[] bytesData = new Byte[samples.Length * 2]; - - const float rescaleFactor = 32767; //to convert float to Int16 - - for (int i = 0; i < samples.Length; i++) - { - intData[i] = (short)(samples[i] * rescaleFactor); - //Debug.Log (samples [i]); - } - Buffer.BlockCopy(intData, 0, bytesData, 0, bytesData.Length); - memStream.Write(bytesData, 0, bytesData.Length); - } - - static void WriteHeader(FileStream fileStream, AudioClip clip) - { - - var hz = clip.frequency; - var channels = clip.channels; - var samples = clip.samples; - - fileStream.Seek(0, SeekOrigin.Begin); - - Byte[] riff = System.Text.Encoding.UTF8.GetBytes("RIFF"); - fileStream.Write(riff, 0, 4); - - Byte[] chunkSize = BitConverter.GetBytes(fileStream.Length - 8); - fileStream.Write(chunkSize, 0, 4); - - Byte[] wave = System.Text.Encoding.UTF8.GetBytes("WAVE"); - fileStream.Write(wave, 0, 4); - - Byte[] fmt = System.Text.Encoding.UTF8.GetBytes("fmt "); - fileStream.Write(fmt, 0, 4); - - Byte[] subChunk1 = BitConverter.GetBytes(16); - fileStream.Write(subChunk1, 0, 4); - - UInt16 two = 2; - UInt16 one = 1; - - Byte[] audioFormat = BitConverter.GetBytes(one); - fileStream.Write(audioFormat, 0, 2); - - Byte[] numChannels = BitConverter.GetBytes(channels); - fileStream.Write(numChannels, 0, 2); - - Byte[] sampleRate = BitConverter.GetBytes(hz); - fileStream.Write(sampleRate, 0, 4); - - Byte[] byteRate = BitConverter.GetBytes(hz * channels * 2); // sampleRate * bytesPerSample*number of channels, here 44100*2*2 - fileStream.Write(byteRate, 0, 4); - - UInt16 blockAlign = (ushort)(channels * 2); - fileStream.Write(BitConverter.GetBytes(blockAlign), 0, 2); - - UInt16 bps = 16; - Byte[] bitsPerSample = BitConverter.GetBytes(bps); - fileStream.Write(bitsPerSample, 0, 2); - - Byte[] datastring = System.Text.Encoding.UTF8.GetBytes("data"); - fileStream.Write(datastring, 0, 4); - - Byte[] subChunk2 = BitConverter.GetBytes(samples * channels * 2); - fileStream.Write(subChunk2, 0, 4); - - // fileStream.Close(); - } -} diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs.meta b/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs.meta deleted file mode 100644 index bb73ef1..0000000 --- a/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 16f4f028d3b75704fbc40b3122b0c568 -timeCreated: 1641758895 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets.meta b/Assets/MeatKit/Tools/IconAssets.meta deleted file mode 100644 index 7910a30..0000000 --- a/Assets/MeatKit/Tools/IconAssets.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 67b0d6a5c1b85824bbcb13aefd6b9879 -folderAsset: yes -timeCreated: 1640644671 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Backgrounds.meta b/Assets/MeatKit/Tools/IconAssets/Backgrounds.meta deleted file mode 100644 index f71b5c4..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Backgrounds.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7390fd4499410bb4da9b31d5f5773db7 -folderAsset: yes -timeCreated: 1640720511 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png b/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png deleted file mode 100644 index 0f162c9..0000000 Binary files a/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png and /dev/null differ diff --git a/Assets/MeatKit/Tools/IconAssets/Materials.meta b/Assets/MeatKit/Tools/IconAssets/Materials.meta deleted file mode 100644 index 86ae946..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Materials.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e2c6465d11669fe48a03a5e0a4858961 -folderAsset: yes -timeCreated: 1640644677 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat b/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat deleted file mode 100644 index d88f8ee..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat +++ /dev/null @@ -1,86 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: BlackWhiteEffect - m_Shader: {fileID: 4800000, guid: ca1ad64f6fe2663418174309f73c9ec5, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - _BumpScale: 1 - - _ClipDistance: 10 - - _ColorBands: 2 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _GlossMapScale: 1 - - _Glossiness: 0.5 - - _GlossyReflections: 1 - - _LightToNormalFactor: 0.366 - - _MaxBrightness: 9.34 - - _Metallic: 0 - - _MinBrightness: -1.57 - - _Mode: 0 - - _NormalCutoff: 0.548 - - _NormalMultiplier: 11.1 - - _NormalPower: 4.08 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 1 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _BrightColor: {r: 1, g: 1, b: 1, a: 1} - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _DarkColor: {r: 0, g: 0, b: 0, a: 1} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat.meta b/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat.meta deleted file mode 100644 index 5131d26..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 95bd255dc1046994d88a5333bd4df105 -timeCreated: 1640641178 -licenseType: Free -NativeFormatImporter: - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Shaders.meta b/Assets/MeatKit/Tools/IconAssets/Shaders.meta deleted file mode 100644 index 1bc468d..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Shaders.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3d764943143e36d439f718a1ba9ad47c -folderAsset: yes -timeCreated: 1640644682 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader b/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader deleted file mode 100644 index 5933b32..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader +++ /dev/null @@ -1,83 +0,0 @@ -Shader "Image/BlackWhiteEffect" -{ - Properties - { - _MainTex ("Texture", 2D) = "white" {} - _MinBrightness("Min Brightness", Float) = 0 - _MaxBrightness("Max Brightness", Float) = 1 - _ColorBands("Color Bands", Float) = 1000 - _DarkColor("Dark Color", Color) = (0, 0, 0, 1) - _BrightColor("Bright Color", Color) = (1, 1, 1, 1) - _LightToNormalFactor("Light To Normal Factor", Range(0, 1)) = 1 - } - SubShader - { - // No culling or depth - Cull Off ZWrite Off ZTest Always - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - - #include "UnityCG.cginc" - - struct appdata - { - float4 vertex : POSITION; - float2 uv : TEXCOORD0; - }; - - struct v2f - { - float2 uv : TEXCOORD0; - float4 vertex : SV_POSITION; - }; - - float remap(float value, float from1, float to1, float from2, float to2) { - return (value - from1) / (to1 - from1) * (to2 - from2) + from2; - } - - - v2f vert (appdata v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.uv = v.uv; - return o; - } - - sampler2D _MainTex, _CameraDepthNormalsTexture; - float _MinBrightness, _MaxBrightness, _ColorBands, _LightToNormalFactor; - fixed4 _DarkColor, _BrightColor; - - fixed4 frag (v2f i) : SV_Target - { - float4 depthnormal = tex2D(_CameraDepthNormalsTexture, i.uv); - fixed4 col = tex2D(_MainTex, i.uv); - - //decode depthnormal - float3 normal; - float depth; - DecodeDepthNormal(depthnormal, depth, normal); - - //Get the luminance and process it - fixed normalLuminance = Luminance(fixed3(normal.b, normal.b, normal.b)); - fixed lightLuminance = Luminance(fixed3(col.r, col.g, col.b)); - - fixed luminance = lerp(normalLuminance, lightLuminance, _LightToNormalFactor); - - luminance = remap(luminance, 0, 1, _MinBrightness, _MaxBrightness); - luminance = floor(luminance * _ColorBands) / _ColorBands; - - float depthFactor = 1 - step(1, depth); - fixed4 output = lerp(_DarkColor, _BrightColor, luminance); - output = fixed4(output.r, output.g, output.b, depthFactor); - - return output; - } - ENDCG - } - } -} diff --git a/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader.meta b/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader.meta deleted file mode 100644 index 4a72a2c..0000000 --- a/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ca1ad64f6fe2663418174309f73c9ec5 -timeCreated: 1640641164 -licenseType: Free -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconCamera.cs b/Assets/MeatKit/Tools/IconCamera.cs deleted file mode 100644 index 41a7eea..0000000 --- a/Assets/MeatKit/Tools/IconCamera.cs +++ /dev/null @@ -1,204 +0,0 @@ - -#if UNITY_EDITOR -using System.IO; -using UnityEngine; -using UnityEditor; - -[ExecuteInEditMode] -public class IconCamera : MonoBehaviour -{ - [Header("Hover over variables to show additional tooltips.")] - [Tooltip("Use this to trigger the capture of an icon IN PLAYMODE ONLY!")] - public KeyCode iconCaptureKey; - - [Tooltip("Use this checkbox like a button to trigger the capture of an icon (Editor or Playmode).")] - public bool iconCaptureButton; - - [Tooltip("Path to icons folder (without \"Assets\" in the beginning).")] - public string path = "Icons"; - - [Tooltip("Name of the generated Icon without a file extension (no \".png\" required).")] - public string iconName = "ExampleIcon"; - - [Tooltip("The depth texture mode of the camera. Some effects will require either DepthNormals or Depth to work correctly")] - public DepthTextureMode CameraDepthMode = DepthTextureMode.DepthNormals; - - [Tooltip("Material that determines the post effect of the image")] - public Material effectMaterial; - - [Tooltip("The background image that will be applied in areas with full transparency")] - public Texture2D background; - - [HideInInspector] - public RenderTexture renderTexture; - - - public Camera thisCamera - { - get - { - if (!_camera) - { - _camera = this.gameObject.GetComponent(); - } - - return _camera; - } - } - private Camera _camera; - - - private void Update() - { - if (Input.GetKeyDown(iconCaptureKey)) - { - Capture(); - } - } - - - void OnRenderImage(RenderTexture source, RenderTexture destination) - { - if(renderTexture != null) - { - RenderTexture.ReleaseTemporary(renderTexture); - } - - if (effectMaterial != null) - { - Graphics.Blit(source, destination, effectMaterial); - } - else - { - Graphics.Blit(source, destination); - } - - renderTexture = RenderTexture.GetTemporary(source.width, source.height); - Graphics.Blit(destination, renderTexture); - } - - public void Capture() - { - Debug.Log("Say Cheese!"); - - //Manually calling render on the camera caused editor lockup with larger resolutions - //thisCamera.Render(); - - RenderTexture.active = renderTexture; - Texture2D texture = new Texture2D(renderTexture.width, renderTexture.height); - texture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0); - texture.Apply(); - - texture = FlipTexture(texture); - - if(background != null) - { - texture = AddBackground(texture, background); - } - - - byte[] bytes = texture.EncodeToPNG(); - - string imagePath = Application.dataPath + "/" + path + "/" + iconName + ".png"; - string assetPath = "Assets" + "/" + path + "/" + iconName + ".png"; - File.WriteAllBytes(imagePath, bytes); - - AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); - - - TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(assetPath); - - importer.isReadable = true; - importer.textureType = TextureImporterType.Sprite; - importer.spriteImportMode = SpriteImportMode.Single; - importer.alphaSource = TextureImporterAlphaSource.FromInput; - importer.alphaIsTransparency = true; - importer.mipmapEnabled = false; - importer.wrapMode = TextureWrapMode.Clamp; - - EditorUtility.SetDirty(importer); - importer.SaveAndReimport(); - - AssetDatabase.Refresh(); - } - - - - /// - /// Returns a flipped copy of the given texture - /// Taken from this forum: https://forum.unity.com/threads/flipping-texture2d-image-within-unity.35974/ - /// - /// - /// - public Texture2D FlipTexture(Texture2D original) - { - Texture2D flipped = new Texture2D(original.width, original.height); - - int origWidth = original.width; - int origHeight = original.height; - - for (int x = 0; x < origWidth; x++) - { - for (int y = 0; y < origHeight; y++) - { - flipped.SetPixel(x, origHeight - y - 1, original.GetPixel(x, y)); - } - } - flipped.Apply(); - - return flipped; - } - - - public Texture2D AddBackground(Texture2D original, Texture2D background) - { - Texture2D result = new Texture2D(original.width, original.height); - - int origWidth = original.width; - int origHeight = original.height; - int backWidth = background.width; - int backHeight = background.height; - - for (int x = 0; x < origWidth; x++) - { - for (int y = 0; y < origHeight; y++) - { - Color originalPixel = original.GetPixel(x, y); - - if(originalPixel.a == 0) - { - int backX = (int)Remap(x, 0, origWidth, 0, backWidth); - int backY = (int)Remap(y, 0, origHeight, 0, backHeight); - result.SetPixel(x, y, background.GetPixel(backX, backY)); - } - else - { - result.SetPixel(x, y, originalPixel); - } - } - } - - result.Apply(); - - return result; - } - - /// - /// Maps a given value from one range to another - /// Taken from this forum: https://forum.unity.com/threads/re-map-a-number-from-one-range-to-another.119437/ - /// - /// - /// - /// - /// - /// - /// - public float Remap(float value, float from1, float to1, float from2, float to2) - { - return (value - from1) / (to1 - from1) * (to2 - from2) + from2; - } - - -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta deleted file mode 100644 index 2c6b38f..0000000 --- a/Assets/Plugins.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 22d59494e378ae94689f270e528c3066 -folderAsset: yes -timeCreated: 1617326059 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser.meta b/Assets/Plugins/AssetBundles-Browser.meta deleted file mode 100644 index 84fd02e..0000000 --- a/Assets/Plugins/AssetBundles-Browser.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2a7416319c4fe624c9f4a9167c4ab09c -folderAsset: yes -timeCreated: 1617332848 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/.gitignore b/Assets/Plugins/AssetBundles-Browser/.gitignore deleted file mode 100644 index a0142e7..0000000 --- a/Assets/Plugins/AssetBundles-Browser/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -artifacts/** -build/** -Documentation/ApiDocs/** -.DS_Store -.npmrc diff --git a/Assets/Plugins/AssetBundles-Browser/.npmignore b/Assets/Plugins/AssetBundles-Browser/.npmignore deleted file mode 100644 index facf810..0000000 --- a/Assets/Plugins/AssetBundles-Browser/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -artifacts/** -build/** -Documentation/ApiDocs/** -.npmrc -.npmignore -.gitignore -QAReport.md -QAReport.md.meta \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md b/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md deleted file mode 100644 index bb48547..0000000 --- a/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md +++ /dev/null @@ -1,36 +0,0 @@ -# Changelog -All notable changes to this package will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [1.8.0] - 2018-XX-XX -- Added more details to bundle detail view. -- fix for folder containing only non-asset items. - -## [1.7.0] - 2018-07-23 -- Sorting dependencies for easier identification. -- fix to windows file sharing violation error. -- minor bug fixes. - -## [1.6.0] - 2018-04-25 -- Stopped altering global styles. - -## [1.5.0] - 2018-02-28 -- Code static analysis cleanup. -- Documentation updates. -- fix to missing bundle-icon bug. - -## [1.4.0] - 2018-02-23 -- Added a search bar to the main tab. Searches based on asset name. - -## [1.3.0] - 2018-01-08 -- serialization fix for inspect tab (was causing entire window to potentially be blank). -- documentation fix - -## [1.2.0] - 2017-12-08 -- Added asmdef to keep browser in its own assembly -- minor null check fixes - -## [1.1.4] - 2017-11-09 -- Initial submission for package distribution diff --git a/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md.meta b/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md.meta deleted file mode 100644 index 7bb0060..0000000 --- a/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: eae989b9583e0794592d5e9b747bc280 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md b/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md deleted file mode 100644 index 33a05b3..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md +++ /dev/null @@ -1,173 +0,0 @@ -# Unity Asset Bundle Browser tool - -This tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality. - -Use this tool as an alternative to selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in __Window__ > __AssetBundle Browser__. The bundle configuration, build functionality, and build-bundle inspection are split into three tabs within the new window. - -![BrowserHeader](images/browser_header.png) - -### Requires Unity 5.6+ - -# Usage - Configure - -This window provides an explorer like interface to managing and modifying asset bundles in your project. When first opened, the tool will parse all bundle data in the background, slowly marking warnings or errors it detects. It does what it can to stay in sync with the project, but cannot always be aware of activity outside the tool. To force a quick pass at error detection, or to update the tool with changes made externally, hit the Refresh button in the upper left. - -The window is broken into four sections: Bundle List, Bundle Details, Asset List, and Asset Details. -![BrowserConfigure](images/browser_configure2.png) - -### Bundle List - -Left hand pane showing a list of all bundles in the project. Available functionality: - -* Select a bundle or set of bundles to see a list of the assets that will be in the bundle in the Asset List pane. - -* Bundles with variants are a darker grey and can be expanded to show the list of variants. - -* Right-click or slow-double-click to rename bundle or bundle folder. - -* If a bundle has any error, warning, or info message, an icon will appear on the right side. Mouse over the icon for more information. - -* If a bundle has at least one scene in it (making it a scene bundle) and non-scene assets explicitly included, it will be marked as having an error. This bundle will not build until fixed. - -* Bundles with duplicated assets will be marked with a warning (more information on duplication in Asset List section below) - -* Empty bundles will be marked with an info message. For a number of reasons, empty bundles are not very stable and can disappear from this list at times. - -* Folders of bundles will be marked with the highest message from the contained bundles. - -* To fix the duplicated inclusion of assets in bundles, you can: - - * Right click on a single bundle to move all assets determined to be duplicates into a new bundle. - - * Right click on multiple bundles to either move the assets from all selected bundles that are duplicates into a new bundle, or only those that are shared within the selection. - - * You can also drag duplicate assets out of the Asset List pane into the Bundle List to explicitly include them in a bundle. More info on this in the Asset List feature set below. - -* Right click or hit DEL to delete bundles. - -* Drag bundles around to move them into and out of folders, or merge them. - -* Drag assets from the Project Explorer onto bundles to add them. - -* Drag assets onto empty space to create a new bundle. - -* Right click to create new bundles or bundle folders. - -* Right click to "Convert to Variant" - - * This will add a variant (initially called "newvariant") to the selected bundle. - - * All assets currently in selected bundle will be moved into the new variant - - * ComingSoon: Mismatch detection between variants. - -Icons indicate if the bundle is a standard or a scene bundle. - -![Icon for standard bundle](images/ABundleBrowserIconY1756Basic.png) - -![Icon for scene bundle](images/ABundleBrowserIconY1756Scene.png) - -### Bundle Details - -Lower left hand pane showing details of the bundles(s) selected in the Bundle List pane. This pane will show the following information if it is available: - -* Total bundle size. This is a sum of the on-disk size of all assets. - -* Bundles that the current bundle depends on. - - * Assets in that bundle referenced from the current bundle. - - * Assets in the current bundle referencing the asset in the dependency bundle. - -* Any messages (error/warning/info) associated with the current bundle. - -* Select bundles or assets to select assets in the Asset List that are dependent on the selection. - -### Asset List - -Upper right hand pane providing a list of assets contained in whichever bundles are selected in the Bundle List. The search field above this list will match with assets in any bundle. The Asset List will only display matching assets, and the Bundle List will only display bundles that contain matching assets. Available functionality: - -* View all assets anticipated to be included in bundle. Sort asset list by any column header. - -* View assets explicitly included in bundle. These are assets that have been assigned a bundle explicitly. The inspector will reflect the bundle inclusion, and in this view they will say the bundle name next to the asset name. - -* View assets implicitly included in bundle. These assets will say *auto* as the name of the bundle next to the asset name. If looking at these assets in the inspector they will say *None* as the assigned bundle. - - * These assets have been added to the selected bundle(s) due to a dependency on another included asset. Only assets that are not explicitly assigned to a bundle will be implicitly included in any bundles. - - * Note that this list of implicit includes can be incomplete. There are known issues with materials and textures not always showing up correctly. - - * As multiple assets can share dependencies, it is common for a given asset to be implicitly included in multiple bundles. If the tool detects this case, it will mark both the bundle and the asset in question with a warning icon. - - * To fix the duplicate-inclusion warnings, you can manually move assets into a new bundle or right click the bundle and selecting one of the "Move duplicate" options. - -* Drag assets from the Project Explorer into this view to add them to the selected bundle. This is only valid if only one bundle is selected, and the asset type is compatible (scenes onto scene bundles, etc.) - -* Drag assets (explicit or implicit) from the Asset List into the Bundle List (to add them to different bundles, or a newly created bundle). - -* Right click or hit DEL to remove assets from bundles (does not remove assets from project). - -* Select or double-click assets to reveal them in the Project Explorer. - -A note on including folders in bundles. It is possible to assign an asset folder (from the Project Explorer) to a bundle. When viewing this in the browser, the folder itself will be listed as explicit and the contents implicit. This reflects the priority system used to assign assets to bundles. For example, say your game had five prefabs in Assets/Prefabs, and you marked the folder "Prefabs" as being in one bundle, and one of the actual prefabs ("PrefabA") as being in another. Once built, "PrefabA" would be in one bundle, and the other four prefabs would be in the other. - -### Asset Details - -Lower right hand pane showing details of the asset(s) selected in the Asset List pane. This pane cannot be interacted with, but will show the following information if it is available: - -* Full path of asset - -* Reason for implicit inclusion in bundles if it is implicit. - -* Reason for warning if any. - -* Reason for error if any. - -### Troubleshooting - -* *Can't rename or delete a specific bundle.* This is occasionally caused when first adding this tool to an existing project. Please force a reimport of your assets through the Unity menu system to refresh the data. - -### External Tool Integration -Other tools that generate asset bundle data can choose to integrate with the browser. Currently the primary example is the [Asset Bundle Graph Tool](https://bitbucket.org/Unity-Technologies/assetbundlegraphtool). If integrations are detected, then a selection bar will appear near the top of the browser. It will allow you to select the Default data source (Unity's AssetDatabase) or an integrated tool. If none are detected, the selector is not present, though you can add it by right-clicking on the tab header and selecting "Custom Sources". - -# Usage - Build - -The Build tab provides basic build functionality to get you started using asset bundles. In most professional scenarios, users will end up needing a more advanced build setup. All are welcome to use the build code in this tool as a starting point for writing their own once this no longer meets their needs. For the most part, the options here are directly tied to the options the engine expects in [BuildAssetBundleOptions](https://docs.unity3d.com/ScriptReference/BuildAssetBundleOptions.html). Interface: - -* *Build Target* - Platform the bundles will be built for - -* *Output Path* - Path for saving built bundles. By default this is AssetBundles/. You can edit the path manually, or by selecting "Browse". To return to the default naming convention, hit "Reset". - -* *Clear Folders* - This will delete all data from the build path folder prior to building. - -* *Copy to StreamingAssets* - After the build is complete, this will copy the results to Assets/StreamingAssets. This can be useful for testing, but would not be used in production. - -* *Advanced Settings* - - * *Compression* - Choose between no compression, standard LZMA, or chunk-based LZ4 compression. - - * *Exclude Type Information* - Do not include type information within the asset bundle - - * *Force Rebuild* - Rebuild bundles needing to be built. This is different than "Clear Folders" as this option will not delete bundles that no longer exist. - - * *Ignore Type Tree Changes* - Ignore the type tree changes when doing the incremental build check. - - * *Append Hash* - Append the hash to the asset bundle name. - - * *Strict Mode* - Do not allow the build to succeed if any errors are reporting during it. - - * *Dry Run Build* - Do a dry run build. - -* *Build* - Executes build. - -# Usage - Inspect -This tab enables you to inspect the contents of bundles that have already been built. -### Usage -* If you use the Browser to build, then the path you built to will automatically be added here. -* Click "Add File" or "Add Folder" to add bundles to inspect. -* Click the "-" next to each row to remove that file or folder. Note, you cannot remove individual files that were added by adding a folder. -* Select any bundle listed to see details: - * Name - * Size on disk - * Source Asset Paths - the assets explicitly added to this bundle. Note this list is incomplete for scene bundles. - * Advanced Data - includes information on the Preload Table, Container (explicit assets) and Dependencies. diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md.meta deleted file mode 100644 index a01d1be..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 04fe18d2a84db4c46ad123537efe6941 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images.meta deleted file mode 100644 index 45550b0..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/images.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f6ee6573a237b7e46adb95566c600038 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png deleted file mode 100644 index de1091a..0000000 Binary files a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png and /dev/null differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png.meta deleted file mode 100644 index 77bb242..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png.meta +++ /dev/null @@ -1,83 +0,0 @@ -fileFormatVersion: 2 -guid: 521ac7d05d42f41408ec95eaedef87cd -TextureImporter: - fileIDToRecycleName: {} - externalObjects: {} - serializedVersion: 5 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - serializedVersion: 2 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - vertices: [] - indices: - edges: [] - weights: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png deleted file mode 100644 index 26cecc9..0000000 Binary files a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png and /dev/null differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png.meta deleted file mode 100644 index d480d23..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png.meta +++ /dev/null @@ -1,83 +0,0 @@ -fileFormatVersion: 2 -guid: 63255dcf53aebf34a8b1162ee502ebe1 -TextureImporter: - fileIDToRecycleName: {} - externalObjects: {} - serializedVersion: 5 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - serializedVersion: 2 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - vertices: [] - indices: - edges: [] - weights: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png deleted file mode 100644 index 58dea7c..0000000 Binary files a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png and /dev/null differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png deleted file mode 100644 index 4621bee..0000000 Binary files a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png and /dev/null differ diff --git a/Assets/Plugins/AssetBundles-Browser/Editor.meta b/Assets/Plugins/AssetBundles-Browser/Editor.meta deleted file mode 100644 index f6ce389..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 946ae3b25c7026b49b4fc66e969e5475 -folderAsset: yes -timeCreated: 1507818222 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs deleted file mode 100644 index 4a56455..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Collections.Generic; -using AssetBundleBrowser.AssetBundleDataSource; -using UnityEditor; -using UnityEngine; - -[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Unity.AssetBundleBrowser.Editor.Tests")] - -namespace AssetBundleBrowser -{ - public class AssetBundleBrowserMain : EditorWindow, IHasCustomMenu, ISerializationCallbackReceiver - { - private static AssetBundleBrowserMain s_instance = null; - - internal static AssetBundleBrowserMain instance - { - get - { - if (s_instance == null) - s_instance = GetWindow(); - return s_instance; - } - } - - internal const float kButtonWidth = 150; - - private enum Mode - { - Browser, - Builder, - Inspect - } - - [SerializeField] private Mode m_Mode; - - [SerializeField] private int m_DataSourceIndex; - - [SerializeField] internal AssetBundleManageTab m_ManageTab; - - [SerializeField] internal AssetBundleBuildTab m_BuildTab; - - [SerializeField] internal AssetBundleInspectTab m_InspectTab; - - private Texture2D m_RefreshTexture; - - private const float k_ToolbarPadding = 15; - private const float k_MenubarPadding = 32; - - [MenuItem("Window/AssetBundle Browser", priority = 2050)] - private static void ShowWindow() - { - s_instance = null; - instance.titleContent = new GUIContent("AssetBundles"); - instance.Show(); - } - - [SerializeField] internal bool multiDataSource = false; - - private List m_DataSourceList = null; - - public virtual void AddItemsToMenu(GenericMenu menu) - { - if (menu != null) - menu.AddItem(new GUIContent("Custom Sources"), multiDataSource, FlipDataSource); - } - - internal void FlipDataSource() - { - multiDataSource = !multiDataSource; - } - - private void OnEnable() - { - Rect subPos = GetSubWindowArea(); - if (m_ManageTab == null) - m_ManageTab = new AssetBundleManageTab(); - m_ManageTab.OnEnable(subPos, this); - if (m_BuildTab == null) - m_BuildTab = new AssetBundleBuildTab(); - m_BuildTab.OnEnable(this); - if (m_InspectTab == null) - m_InspectTab = new AssetBundleInspectTab(); - m_InspectTab.OnEnable(subPos); - - m_RefreshTexture = EditorGUIUtility.FindTexture("Refresh"); - - InitDataSources(); - } - - private void InitDataSources() - { - //determine if we are "multi source" or not... - multiDataSource = false; - m_DataSourceList = new List(); - foreach (Type info in AssetBundleDataSource.ABDataSourceProviderUtility.CustomABDataSourceTypes) m_DataSourceList.AddRange(info.GetMethod("CreateDataSources").Invoke(null, null) as List); - - if (m_DataSourceList.Count > 1) - { - multiDataSource = true; - if (m_DataSourceIndex >= m_DataSourceList.Count) - m_DataSourceIndex = 0; - AssetBundleModel.Model.DataSource = m_DataSourceList[m_DataSourceIndex]; - } - } - - private void OnDisable() - { - if (m_BuildTab != null) - m_BuildTab.OnDisable(); - if (m_InspectTab != null) - m_InspectTab.OnDisable(); - } - - public void OnBeforeSerialize() - { - } - - public void OnAfterDeserialize() - { - } - - private Rect GetSubWindowArea() - { - float padding = k_MenubarPadding; - if (multiDataSource) - padding += k_MenubarPadding * 0.5f; - Rect subPos = new Rect(0, padding, position.width, position.height - padding); - return subPos; - } - - private void Update() - { - switch (m_Mode) - { - case Mode.Builder: - break; - case Mode.Inspect: - break; - case Mode.Browser: - default: - m_ManageTab.Update(); - break; - } - } - - private void OnGUI() - { - ModeToggle(); - - switch (m_Mode) - { - case Mode.Builder: - m_BuildTab.OnGUI(); - break; - case Mode.Inspect: - m_InspectTab.OnGUI(GetSubWindowArea()); - break; - case Mode.Browser: - default: - m_ManageTab.OnGUI(GetSubWindowArea()); - break; - } - } - - private void ModeToggle() - { - GUILayout.BeginHorizontal(); - GUILayout.Space(k_ToolbarPadding); - bool clicked = false; - switch (m_Mode) - { - case Mode.Browser: - clicked = GUILayout.Button(m_RefreshTexture); - if (clicked) - m_ManageTab.ForceReloadData(); - break; - case Mode.Builder: - GUILayout.Space(m_RefreshTexture.width + k_ToolbarPadding); - break; - case Mode.Inspect: - clicked = GUILayout.Button(m_RefreshTexture); - if (clicked) - m_InspectTab.RefreshBundles(); - break; - } - - float toolbarWidth = position.width - k_ToolbarPadding * 4 - m_RefreshTexture.width; - //string[] labels = new string[2] { "Configure", "Build"}; - string[] labels = new string[3] {"Configure", "Build", "Inspect"}; - m_Mode = (Mode) GUILayout.Toolbar((int) m_Mode, labels, "LargeButton", GUILayout.Width(toolbarWidth)); - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); - if (multiDataSource) - { - //GUILayout.BeginArea(r); - GUILayout.BeginHorizontal(); - - using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) - { - GUILayout.Label("Bundle Data Source:"); - GUILayout.FlexibleSpace(); - GUIContent c = new GUIContent(string.Format("{0} ({1})", AssetBundleModel.Model.DataSource.Name, AssetBundleModel.Model.DataSource.ProviderName), "Select Asset Bundle Set"); - if (GUILayout.Button(c, EditorStyles.toolbarPopup)) - { - GenericMenu menu = new GenericMenu(); - - for (int index = 0; index < m_DataSourceList.Count; index++) - { - ABDataSource ds = m_DataSourceList[index]; - if (ds == null) - continue; - - if (index > 0) - menu.AddSeparator(""); - - int counter = index; - menu.AddItem(new GUIContent(string.Format("{0} ({1})", ds.Name, ds.ProviderName)), false, - () => - { - m_DataSourceIndex = counter; - ABDataSource thisDataSource = ds; - AssetBundleModel.Model.DataSource = thisDataSource; - m_ManageTab.ForceReloadData(); - } - ); - } - - menu.ShowAsContext(); - } - - GUILayout.FlexibleSpace(); - if (AssetBundleModel.Model.DataSource.IsReadOnly()) - { - GUIStyle tbLabel = new GUIStyle(EditorStyles.toolbar); - tbLabel.alignment = TextAnchor.MiddleRight; - - GUILayout.Label("Read Only", tbLabel); - } - } - - GUILayout.EndHorizontal(); - //GUILayout.EndArea(); - } - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs deleted file mode 100644 index 7521d72..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs +++ /dev/null @@ -1,451 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using AssetBundleBrowser.AssetBundleDataSource; - -namespace AssetBundleBrowser -{ - [System.Serializable] - internal class AssetBundleBuildTab - { - private const string k_BuildPrefPrefix = "ABBBuild:"; - - private string m_streamingPath = "Assets/StreamingAssets"; - - [SerializeField] private bool m_AdvancedSettings; - - [SerializeField] private Vector2 m_ScrollPosition; - - - private class ToggleData - { - internal ToggleData(bool s, - string title, - string tooltip, - List onToggles, - BuildAssetBundleOptions opt = BuildAssetBundleOptions.None) - { - if (onToggles.Contains(title)) - state = true; - else - state = s; - content = new GUIContent(title, tooltip); - option = opt; - } - - //internal string prefsKey - //{ get { return k_BuildPrefPrefix + content.text; } } - internal bool state; - internal GUIContent content; - internal BuildAssetBundleOptions option; - } - - private AssetBundleInspectTab m_InspectTab; - - [SerializeField] private BuildTabData m_UserData; - - private List m_ToggleData; - private ToggleData m_ForceRebuild; - private ToggleData m_CopyToStreaming; - private GUIContent m_TargetContent; - private GUIContent m_CompressionContent; - - internal enum CompressOptions - { - Uncompressed = 0, - StandardCompression, - ChunkBasedCompression - } - - private GUIContent[] m_CompressionOptions = - { - new GUIContent("No Compression"), - new GUIContent("Standard Compression (LZMA)"), - new GUIContent("Chunk Based Compression (LZ4)") - }; - - private int[] m_CompressionValues = {0, 1, 2}; - - - internal AssetBundleBuildTab() - { - m_AdvancedSettings = false; - m_UserData = new BuildTabData(); - m_UserData.m_OnToggles = new List(); - m_UserData.m_UseDefaultPath = true; - } - - internal void OnDisable() - { - string dataPath = Path.GetFullPath("."); - dataPath = dataPath.Replace("\\", "/"); - dataPath += "/Library/AssetBundleBrowserBuild.dat"; - - BinaryFormatter bf = new BinaryFormatter(); - FileStream file = File.Create(dataPath); - - bf.Serialize(file, m_UserData); - file.Close(); - } - - internal void OnEnable(EditorWindow parent) - { - m_InspectTab = (parent as AssetBundleBrowserMain).m_InspectTab; - - //LoadData... - string dataPath = Path.GetFullPath("."); - dataPath = dataPath.Replace("\\", "/"); - dataPath += "/Library/AssetBundleBrowserBuild.dat"; - - if (File.Exists(dataPath)) - { - BinaryFormatter bf = new BinaryFormatter(); - FileStream file = File.Open(dataPath, FileMode.Open); - BuildTabData data = bf.Deserialize(file) as BuildTabData; - if (data != null) - m_UserData = data; - file.Close(); - } - - m_ToggleData = new List(); - m_ToggleData.Add(new ToggleData( - false, - "Exclude Type Information", - "Do not include type information within the asset bundle (don't write type tree).", - m_UserData.m_OnToggles, - BuildAssetBundleOptions.DisableWriteTypeTree)); - m_ToggleData.Add(new ToggleData( - false, - "Force Rebuild", - "Force rebuild the asset bundles", - m_UserData.m_OnToggles, - BuildAssetBundleOptions.ForceRebuildAssetBundle)); - m_ToggleData.Add(new ToggleData( - false, - "Ignore Type Tree Changes", - "Ignore the type tree changes when doing the incremental build check.", - m_UserData.m_OnToggles, - BuildAssetBundleOptions.IgnoreTypeTreeChanges)); - m_ToggleData.Add(new ToggleData( - false, - "Append Hash", - "Append the hash to the assetBundle name.", - m_UserData.m_OnToggles, - BuildAssetBundleOptions.AppendHashToAssetBundleName)); - m_ToggleData.Add(new ToggleData( - false, - "Strict Mode", - "Do not allow the build to succeed if any errors are reporting during it.", - m_UserData.m_OnToggles, - BuildAssetBundleOptions.StrictMode)); - m_ToggleData.Add(new ToggleData( - false, - "Dry Run Build", - "Do a dry run build.", - m_UserData.m_OnToggles, - BuildAssetBundleOptions.DryRunBuild)); - - - m_ForceRebuild = new ToggleData( - false, - "Clear Folders", - "Will wipe out all contents of build directory as well as StreamingAssets/AssetBundles if you are choosing to copy build there.", - m_UserData.m_OnToggles); - m_CopyToStreaming = new ToggleData( - false, - "Copy to StreamingAssets", - "After build completes, will copy all build content to " + m_streamingPath + " for use in stand-alone player.", - m_UserData.m_OnToggles); - - m_TargetContent = new GUIContent("Build Target", "Choose target platform to build for."); - m_CompressionContent = new GUIContent("Compression", "Choose no compress, standard (LZMA), or chunk based (LZ4)"); - - if (m_UserData.m_UseDefaultPath) ResetPathToDefault(); - } - - internal void OnGUI() - { - m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); - bool newState = false; - GUIStyle centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label")); - centeredStyle.alignment = TextAnchor.UpperCenter; - GUILayout.Label(new GUIContent("Example build setup"), centeredStyle); - //basic options - EditorGUILayout.Space(); - GUILayout.BeginVertical(); - - // build target - using (new EditorGUI.DisabledScope(!AssetBundleModel.Model.DataSource.CanSpecifyBuildTarget)) - { - ValidBuildTarget tgt = (ValidBuildTarget) EditorGUILayout.EnumPopup(m_TargetContent, m_UserData.m_BuildTarget); - if (tgt != m_UserData.m_BuildTarget) - { - m_UserData.m_BuildTarget = tgt; - if (m_UserData.m_UseDefaultPath) - { - m_UserData.m_OutputPath = "AssetBundles/"; - m_UserData.m_OutputPath += m_UserData.m_BuildTarget.ToString(); - //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); - } - } - } - - - ////output path - using (new EditorGUI.DisabledScope(!AssetBundleModel.Model.DataSource.CanSpecifyBuildOutputDirectory)) - { - EditorGUILayout.Space(); - GUILayout.BeginHorizontal(); - string newPath = EditorGUILayout.TextField("Output Path", m_UserData.m_OutputPath); - if (!string.IsNullOrEmpty(newPath) && newPath != m_UserData.m_OutputPath) - { - m_UserData.m_UseDefaultPath = false; - m_UserData.m_OutputPath = newPath; - //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - if (GUILayout.Button("Browse", GUILayout.MaxWidth(75f))) - BrowseForFolder(); - if (GUILayout.Button("Reset", GUILayout.MaxWidth(75f))) - ResetPathToDefault(); - //if (string.IsNullOrEmpty(m_OutputPath)) - // m_OutputPath = EditorUserBuildSettings.GetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath"); - GUILayout.EndHorizontal(); - EditorGUILayout.Space(); - - newState = GUILayout.Toggle( - m_ForceRebuild.state, - m_ForceRebuild.content); - if (newState != m_ForceRebuild.state) - { - if (newState) - m_UserData.m_OnToggles.Add(m_ForceRebuild.content.text); - else - m_UserData.m_OnToggles.Remove(m_ForceRebuild.content.text); - m_ForceRebuild.state = newState; - } - - newState = GUILayout.Toggle( - m_CopyToStreaming.state, - m_CopyToStreaming.content); - if (newState != m_CopyToStreaming.state) - { - if (newState) - m_UserData.m_OnToggles.Add(m_CopyToStreaming.content.text); - else - m_UserData.m_OnToggles.Remove(m_CopyToStreaming.content.text); - m_CopyToStreaming.state = newState; - } - } - - // advanced options - using (new EditorGUI.DisabledScope(!AssetBundleModel.Model.DataSource.CanSpecifyBuildOptions)) - { - EditorGUILayout.Space(); - m_AdvancedSettings = EditorGUILayout.Foldout(m_AdvancedSettings, "Advanced Settings"); - if (m_AdvancedSettings) - { - int indent = EditorGUI.indentLevel; - EditorGUI.indentLevel = 1; - CompressOptions cmp = (CompressOptions) EditorGUILayout.IntPopup( - m_CompressionContent, - (int) m_UserData.m_Compression, - m_CompressionOptions, - m_CompressionValues); - - if (cmp != m_UserData.m_Compression) m_UserData.m_Compression = cmp; - foreach (ToggleData tog in m_ToggleData) - { - newState = EditorGUILayout.ToggleLeft( - tog.content, - tog.state); - if (newState != tog.state) - { - if (newState) - m_UserData.m_OnToggles.Add(tog.content.text); - else - m_UserData.m_OnToggles.Remove(tog.content.text); - tog.state = newState; - } - } - - EditorGUILayout.Space(); - EditorGUI.indentLevel = indent; - } - } - - // build. - EditorGUILayout.Space(); - if (GUILayout.Button("Build")) EditorApplication.delayCall += ExecuteBuild; - GUILayout.EndVertical(); - EditorGUILayout.EndScrollView(); - } - - private void ExecuteBuild() - { - if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOutputDirectory) - { - if (string.IsNullOrEmpty(m_UserData.m_OutputPath)) - BrowseForFolder(); - - if (string.IsNullOrEmpty(m_UserData.m_OutputPath)) //in case they hit "cancel" on the open browser - { - Debug.LogError("AssetBundle Build: No valid output path for build."); - return; - } - - if (m_ForceRebuild.state) - { - string message = "Do you want to delete all files in the directory " + m_UserData.m_OutputPath; - if (m_CopyToStreaming.state) - message += " and " + m_streamingPath; - message += "?"; - if (EditorUtility.DisplayDialog("File delete confirmation", message, "Yes", "No")) - try - { - if (Directory.Exists(m_UserData.m_OutputPath)) - Directory.Delete(m_UserData.m_OutputPath, true); - - if (m_CopyToStreaming.state) - if (Directory.Exists(m_streamingPath)) - Directory.Delete(m_streamingPath, true); - } - catch (System.Exception e) - { - Debug.LogException(e); - } - } - - if (!Directory.Exists(m_UserData.m_OutputPath)) - Directory.CreateDirectory(m_UserData.m_OutputPath); - } - - BuildAssetBundleOptions opt = BuildAssetBundleOptions.None; - - if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOptions) - { - if (m_UserData.m_Compression == CompressOptions.Uncompressed) - opt |= BuildAssetBundleOptions.UncompressedAssetBundle; - else if (m_UserData.m_Compression == CompressOptions.ChunkBasedCompression) - opt |= BuildAssetBundleOptions.ChunkBasedCompression; - foreach (ToggleData tog in m_ToggleData) - if (tog.state) - opt |= tog.option; - } - - ABBuildInfo buildInfo = new ABBuildInfo(); - - buildInfo.outputDirectory = m_UserData.m_OutputPath; - buildInfo.options = opt; - buildInfo.buildTarget = (BuildTarget) m_UserData.m_BuildTarget; - buildInfo.onBuild = (assetBundleName) => - { - if (m_InspectTab == null) - return; - m_InspectTab.AddBundleFolder(buildInfo.outputDirectory); - m_InspectTab.RefreshBundles(); - }; - - AssetBundleModel.Model.DataSource.BuildAssetBundles(buildInfo); - - AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); - - if (m_CopyToStreaming.state) - DirectoryCopy(m_UserData.m_OutputPath, m_streamingPath); - } - - private static void DirectoryCopy(string sourceDirName, string destDirName) - { - // If the destination directory doesn't exist, create it. - if (!Directory.Exists(destDirName)) Directory.CreateDirectory(destDirName); - - foreach (string folderPath in Directory.GetDirectories(sourceDirName, "*", SearchOption.AllDirectories)) - if (!Directory.Exists(folderPath.Replace(sourceDirName, destDirName))) - Directory.CreateDirectory(folderPath.Replace(sourceDirName, destDirName)); - - foreach (string filePath in Directory.GetFiles(sourceDirName, "*.*", SearchOption.AllDirectories)) - { - string fileDirName = Path.GetDirectoryName(filePath).Replace("\\", "/"); - string fileName = Path.GetFileName(filePath); - string newFilePath = Path.Combine(fileDirName.Replace(sourceDirName, destDirName), fileName); - - File.Copy(filePath, newFilePath, true); - } - } - - private void BrowseForFolder() - { - m_UserData.m_UseDefaultPath = false; - string newPath = EditorUtility.OpenFolderPanel("Bundle Folder", m_UserData.m_OutputPath, string.Empty); - if (!string.IsNullOrEmpty(newPath)) - { - string gamePath = Path.GetFullPath("."); - gamePath = gamePath.Replace("\\", "/"); - if (newPath.StartsWith(gamePath) && newPath.Length > gamePath.Length) - newPath = newPath.Remove(0, gamePath.Length + 1); - m_UserData.m_OutputPath = newPath; - //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); - } - } - - private void ResetPathToDefault() - { - m_UserData.m_UseDefaultPath = true; - m_UserData.m_OutputPath = "AssetBundles/"; - m_UserData.m_OutputPath += m_UserData.m_BuildTarget.ToString(); - //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); - } - - //Note: this is the provided BuildTarget enum with some entries removed as they are invalid in the dropdown - internal enum ValidBuildTarget - { - //NoTarget = -2, --doesn't make sense - //iPhone = -1, --deprecated - //BB10 = -1, --deprecated - //MetroPlayer = -1, --deprecated - StandaloneOSXUniversal = 2, - StandaloneOSXIntel = 4, - StandaloneWindows = 5, - WebPlayer = 6, - WebPlayerStreamed = 7, - iOS = 9, - PS3 = 10, - XBOX360 = 11, - Android = 13, - StandaloneLinux = 17, - StandaloneWindows64 = 19, - WebGL = 20, - WSAPlayer = 21, - StandaloneLinux64 = 24, - StandaloneLinuxUniversal = 25, - WP8Player = 26, - StandaloneOSXIntel64 = 27, - BlackBerry = 28, - Tizen = 29, - PSP2 = 30, - PS4 = 31, - PSM = 32, - XboxOne = 33, - SamsungTV = 34, - N3DS = 35, - WiiU = 36, - tvOS = 37, - Switch = 38 - } - - [System.Serializable] - internal class BuildTabData - { - internal List m_OnToggles; - internal ValidBuildTarget m_BuildTarget = ValidBuildTarget.StandaloneWindows; - internal CompressOptions m_Compression = CompressOptions.StandardCompression; - internal string m_OutputPath = string.Empty; - internal bool m_UseDefaultPath = true; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs.meta deleted file mode 100644 index 7bcbb58..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 10d204eff91c2e844b26a7dee989f978 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource.meta deleted file mode 100644 index 4db6b41..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 37cf1ee934b7c254e92e69eb6f19f186 -folderAsset: yes -timeCreated: 1497630438 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs deleted file mode 100644 index 677959f..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs +++ /dev/null @@ -1,141 +0,0 @@ -using UnityEditor; -using System; - -namespace AssetBundleBrowser.AssetBundleDataSource -{ - /// - /// Build Info struct used by ABDataSource to pass needed build data around. - /// - public partial class ABBuildInfo - { - /// - /// Directory to place build result - /// - public string outputDirectory - { - get { return m_outputDirectory; } - set { m_outputDirectory = value; } - } - - private string m_outputDirectory; - - /// - /// Standard asset bundle build options. - /// - public BuildAssetBundleOptions options - { - get { return m_options; } - set { m_options = value; } - } - - private BuildAssetBundleOptions m_options; - - /// - /// Target platform for build. - /// - public BuildTarget buildTarget - { - get { return m_buildTarget; } - set { m_buildTarget = value; } - } - - private BuildTarget m_buildTarget; - - /// - /// Callback for build event. - /// - public Action onBuild - { - get { return m_onBuild; } - set { m_onBuild = value; } - } - - private Action m_onBuild; - } - - /// - /// Interface class used by browser. It is expected to contain all information needed to display predicted bundle layout. - /// Any class deriving from this interface AND implementing CreateDataSources() will be picked up by the browser automatically - /// and displayed in an in-tool dropdown. By default, that dropdown is hidden if the browser detects no external data sources. - /// To turn it on, right click on tab header "AssetBundles" and enable "Custom Sources" - /// - /// Must implement CreateDataSources() to be picked up by the browser. - /// public static List CreateDataSources(); - /// - /// - public partial interface ABDataSource - { - //// all derived classes must implement the following interface in order to be picked up by the browser. - //public static List CreateDataSources(); - - /// - /// Name of DataSource. Displayed in menu as "Name (ProvidorName)" - /// - string Name { get; } - - /// - /// Name of provider for DataSource. Displayed in menu as "Name (ProvidorName)" - /// - string ProviderName { get; } - - /// - /// Array of paths in bundle. - /// - string[] GetAssetPathsFromAssetBundle(string assetBundleName); - - /// - /// Name of bundle explicitly associated with asset at path. - /// - string GetAssetBundleName(string assetPath); - - /// - /// Name of bundle associated with asset at path. - /// The difference between this and GetAssetBundleName() is for assets unassigned to a bundle, but - /// residing inside a folder that is assigned to a bundle. Those assets will implicitly associate - /// with the bundle associated with the parent folder. - /// - string GetImplicitAssetBundleName(string assetPath); - - /// - /// Array of asset bundle names in project - /// - string[] GetAllAssetBundleNames(); - - /// - /// If this data source is read only. - /// If this returns true, much of the Browsers's interface will be disabled (drag&drop, etc.) - /// - bool IsReadOnly(); - - /// - /// Sets the asset bundle name (and variant) on a given asset - /// - void SetAssetBundleNameAndVariant(string assetPath, string bundleName, string variantName); - - /// - /// Clears out any asset bundle names that do not have assets associated with them. - /// - void RemoveUnusedAssetBundleNames(); - - /// - /// Signals if this data source can have build target set by tool - /// - bool CanSpecifyBuildTarget { get; } - - /// - /// Signals if this data source can have output directory set by tool - /// - bool CanSpecifyBuildOutputDirectory { get; } - - /// - /// Signals if this data source can have build options set by tool - /// - bool CanSpecifyBuildOptions { get; } - - /// - /// Executes data source's implementation of asset bundle building. - /// Called by "build" button in build tab of tool. - /// - bool BuildAssetBundles(ABBuildInfo info); - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs.meta deleted file mode 100644 index 0ed262d..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 919244bce66418940b1be40b992ffb7c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs deleted file mode 100644 index b212bed..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace AssetBundleBrowser.AssetBundleDataSource -{ - internal class ABDataSourceProviderUtility - { - private static List s_customNodes; - - internal static List CustomABDataSourceTypes - { - get - { - if (s_customNodes == null) s_customNodes = BuildCustomABDataSourceList(); - return s_customNodes; - } - } - - private static List BuildCustomABDataSourceList() - { - List properList = new List(); - properList.Add(null); //empty spot for "default" - Assembly[] x = AppDomain.CurrentDomain.GetAssemblies(); - foreach (Assembly assembly in x) - try - { - List list = new List( - assembly - .GetTypes() - .Where(t => t != typeof(ABDataSource)) - .Where(t => typeof(ABDataSource).IsAssignableFrom(t))); - - - for (int count = 0; count < list.Count; count++) - if (list[count].Name == "AssetDatabaseABDataSource") - properList[0] = list[count]; - else if (list[count] != null) - properList.Add(list[count]); - } - catch (Exception) - { - //assembly which raises exception on the GetTypes() call - ignore it - } - - - return properList; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs.meta deleted file mode 100644 index 4aa110f..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d8b537f111d73db4dac7f6a47a53b8d8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs deleted file mode 100644 index dc7cb56..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using UnityEngine.Assertions; -using System.Collections.Generic; -using System.Linq; -using UnityEditor.IMGUI.Controls; - -namespace AssetBundleBrowser.AssetBundleDataSource -{ - internal class AssetDatabaseABDataSource : ABDataSource - { - public static List CreateDataSources() - { - AssetDatabaseABDataSource op = new AssetDatabaseABDataSource(); - List retList = new List(); - retList.Add(op); - return retList; - } - - public string Name - { - get { return "Default"; } - } - - public string ProviderName - { - get { return "Built-in"; } - } - - public string[] GetAssetPathsFromAssetBundle(string assetBundleName) - { - return AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName); - } - - public string GetAssetBundleName(string assetPath) - { - AssetImporter importer = AssetImporter.GetAtPath(assetPath); - if (importer == null) return string.Empty; - string bundleName = importer.assetBundleName; - if (importer.assetBundleVariant.Length > 0) bundleName = bundleName + "." + importer.assetBundleVariant; - return bundleName; - } - - public string GetImplicitAssetBundleName(string assetPath) - { - return AssetDatabase.GetImplicitAssetBundleName(assetPath); - } - - public string[] GetAllAssetBundleNames() - { - return AssetDatabase.GetAllAssetBundleNames(); - } - - public bool IsReadOnly() - { - return false; - } - - public void SetAssetBundleNameAndVariant(string assetPath, string bundleName, string variantName) - { - AssetImporter.GetAtPath(assetPath).SetAssetBundleNameAndVariant(bundleName, variantName); - } - - public void RemoveUnusedAssetBundleNames() - { - AssetDatabase.RemoveUnusedAssetBundleNames(); - } - - public bool CanSpecifyBuildTarget - { - get { return true; } - } - - public bool CanSpecifyBuildOutputDirectory - { - get { return true; } - } - - public bool CanSpecifyBuildOptions - { - get { return true; } - } - - public bool BuildAssetBundles(ABBuildInfo info) - { - if (info == null) - { - Debug.Log("Error in build"); - return false; - } - - AssetBundleManifest buildManifest = BuildPipeline.BuildAssetBundles(info.outputDirectory, info.options, info.buildTarget); - if (buildManifest == null) - { - Debug.Log("Error in build"); - return false; - } - - foreach (string assetBundleName in buildManifest.GetAllAssetBundles()) - if (info.onBuild != null) - info.onBuild(assetBundleName); - return true; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs.meta deleted file mode 100644 index 21c93b3..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 22084e56372f59e47a3fcd9c3b291923 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs deleted file mode 100644 index ed0be08..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs +++ /dev/null @@ -1,265 +0,0 @@ -using UnityEditor; -using UnityEditor.IMGUI.Controls; -using UnityEngine; -using System.Collections.Generic; - - -namespace AssetBundleBrowser -{ - [System.Serializable] - internal class AssetBundleManageTab - { - [SerializeField] private TreeViewState m_BundleTreeState; - [SerializeField] private TreeViewState m_AssetListState; - [SerializeField] private MultiColumnHeaderState m_AssetListMCHState; - [SerializeField] private TreeViewState m_BundleDetailState; - - private Rect m_Position; - - private AssetBundleTree m_BundleTree; - private AssetListTree m_AssetList; - private MessageList m_MessageList; - private BundleDetailList m_DetailsList; - private bool m_ResizingHorizontalSplitter = false; - private bool m_ResizingVerticalSplitterRight = false; - private bool m_ResizingVerticalSplitterLeft = false; - private Rect m_HorizontalSplitterRect, m_VerticalSplitterRectRight, m_VerticalSplitterRectLeft; - [SerializeField] private float m_HorizontalSplitterPercent; - [SerializeField] private float m_VerticalSplitterPercentRight; - [SerializeField] private float m_VerticalSplitterPercentLeft; - private const float k_SplitterWidth = 3f; - private static float s_UpdateDelay = 0f; - - private SearchField m_searchField; - - private EditorWindow m_Parent = null; - - internal AssetBundleManageTab() - { - m_HorizontalSplitterPercent = 0.4f; - m_VerticalSplitterPercentRight = 0.7f; - m_VerticalSplitterPercentLeft = 0.85f; - } - - internal void OnEnable(Rect pos, EditorWindow parent) - { - m_Parent = parent; - m_Position = pos; - m_HorizontalSplitterRect = new Rect( - (int) (m_Position.x + m_Position.width * m_HorizontalSplitterPercent), - m_Position.y, - k_SplitterWidth, - m_Position.height); - m_VerticalSplitterRectRight = new Rect( - m_HorizontalSplitterRect.x, - (int) (m_Position.y + m_HorizontalSplitterRect.height * m_VerticalSplitterPercentRight), - m_Position.width - m_HorizontalSplitterRect.width - k_SplitterWidth, - k_SplitterWidth); - m_VerticalSplitterRectLeft = new Rect( - m_Position.x, - (int) (m_Position.y + m_HorizontalSplitterRect.height * m_VerticalSplitterPercentLeft), - m_HorizontalSplitterRect.width - k_SplitterWidth, - k_SplitterWidth); - - m_searchField = new SearchField(); - } - - - internal void Update() - { - float t = Time.realtimeSinceStartup; - if (t - s_UpdateDelay > 0.1f || - s_UpdateDelay > t) //something went strangely wrong if this second check is true. - { - s_UpdateDelay = t - 0.001f; - - if (AssetBundleModel.Model.Update()) m_Parent.Repaint(); - - if (m_DetailsList != null) - m_DetailsList.Update(); - - if (m_AssetList != null) - m_AssetList.Update(); - } - } - - internal void ForceReloadData() - { - UpdateSelectedBundles(new List()); - SetSelectedItems(new List()); - m_BundleTree.SetSelection(new int[0]); - AssetBundleModel.Model.ForceReloadData(m_BundleTree); - m_Parent.Repaint(); - } - - internal void OnGUI(Rect pos) - { - m_Position = pos; - - if (m_BundleTree == null) - { - if (m_AssetListState == null) - m_AssetListState = new TreeViewState(); - - MultiColumnHeaderState headerState = AssetListTree.CreateDefaultMultiColumnHeaderState(); // multiColumnTreeViewRect.width); - if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_AssetListMCHState, headerState)) - MultiColumnHeaderState.OverwriteSerializedFields(m_AssetListMCHState, headerState); - m_AssetListMCHState = headerState; - - - m_AssetList = new AssetListTree(m_AssetListState, m_AssetListMCHState, this); - m_AssetList.Reload(); - m_MessageList = new MessageList(); - - if (m_BundleDetailState == null) - m_BundleDetailState = new TreeViewState(); - m_DetailsList = new BundleDetailList(m_BundleDetailState); - m_DetailsList.Reload(); - - if (m_BundleTreeState == null) - m_BundleTreeState = new TreeViewState(); - m_BundleTree = new AssetBundleTree(m_BundleTreeState, this); - m_BundleTree.Refresh(); - m_Parent.Repaint(); - } - - HandleHorizontalResize(); - HandleVerticalResize(); - - - if (AssetBundleModel.Model.BundleListIsEmpty()) - { - m_BundleTree.OnGUI(m_Position); - GUIStyle style = new GUIStyle(GUI.skin.label); - style.alignment = TextAnchor.MiddleCenter; - style.wordWrap = true; - GUI.Label( - new Rect(m_Position.x + 1f, m_Position.y + 1f, m_Position.width - 2f, m_Position.height - 2f), - new GUIContent(AssetBundleModel.Model.GetEmptyMessage()), - style); - } - else - { - //Left half - Rect bundleTreeRect = new Rect( - m_Position.x, - m_Position.y, - m_HorizontalSplitterRect.x, - m_VerticalSplitterRectLeft.y - m_Position.y); - - m_BundleTree.OnGUI(bundleTreeRect); - m_DetailsList.OnGUI(new Rect( - bundleTreeRect.x, - bundleTreeRect.y + bundleTreeRect.height + k_SplitterWidth, - bundleTreeRect.width, - m_Position.height - bundleTreeRect.height - k_SplitterWidth * 2)); - - //Right half. - float panelLeft = m_HorizontalSplitterRect.x + k_SplitterWidth; - float panelWidth = m_VerticalSplitterRectRight.width - k_SplitterWidth * 2; - float searchHeight = 20f; - float panelTop = m_Position.y + searchHeight; - float panelHeight = m_VerticalSplitterRectRight.y - panelTop; - OnGUISearchBar(new Rect(panelLeft, m_Position.y, panelWidth, searchHeight)); - m_AssetList.OnGUI(new Rect( - panelLeft, - panelTop, - panelWidth, - panelHeight)); - m_MessageList.OnGUI(new Rect( - panelLeft, - panelTop + panelHeight + k_SplitterWidth, - panelWidth, - m_Position.height - panelHeight - k_SplitterWidth * 2)); - - if (m_ResizingHorizontalSplitter || m_ResizingVerticalSplitterRight || m_ResizingVerticalSplitterLeft) - m_Parent.Repaint(); - } - } - - private void OnGUISearchBar(Rect rect) - { - m_BundleTree.searchString = m_searchField.OnGUI(rect, m_BundleTree.searchString); - m_AssetList.searchString = m_BundleTree.searchString; - } - - public bool hasSearch - { - get { return m_BundleTree.hasSearch; } - } - - private void HandleHorizontalResize() - { - m_HorizontalSplitterRect.x = (int) (m_Position.width * m_HorizontalSplitterPercent); - m_HorizontalSplitterRect.height = m_Position.height; - - EditorGUIUtility.AddCursorRect(m_HorizontalSplitterRect, MouseCursor.ResizeHorizontal); - if (Event.current.type == EventType.MouseDown && m_HorizontalSplitterRect.Contains(Event.current.mousePosition)) - m_ResizingHorizontalSplitter = true; - - if (m_ResizingHorizontalSplitter) - { - m_HorizontalSplitterPercent = Mathf.Clamp(Event.current.mousePosition.x / m_Position.width, 0.1f, 0.9f); - m_HorizontalSplitterRect.x = (int) (m_Position.width * m_HorizontalSplitterPercent); - } - - if (Event.current.type == EventType.MouseUp) - m_ResizingHorizontalSplitter = false; - } - - private void HandleVerticalResize() - { - m_VerticalSplitterRectRight.x = m_HorizontalSplitterRect.x; - m_VerticalSplitterRectRight.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentRight); - m_VerticalSplitterRectRight.width = m_Position.width - m_HorizontalSplitterRect.x; - m_VerticalSplitterRectLeft.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentLeft); - m_VerticalSplitterRectLeft.width = m_VerticalSplitterRectRight.width; - - - EditorGUIUtility.AddCursorRect(m_VerticalSplitterRectRight, MouseCursor.ResizeVertical); - if (Event.current.type == EventType.MouseDown && m_VerticalSplitterRectRight.Contains(Event.current.mousePosition)) - m_ResizingVerticalSplitterRight = true; - - EditorGUIUtility.AddCursorRect(m_VerticalSplitterRectLeft, MouseCursor.ResizeVertical); - if (Event.current.type == EventType.MouseDown && m_VerticalSplitterRectLeft.Contains(Event.current.mousePosition)) - m_ResizingVerticalSplitterLeft = true; - - - if (m_ResizingVerticalSplitterRight) - { - m_VerticalSplitterPercentRight = Mathf.Clamp(Event.current.mousePosition.y / m_HorizontalSplitterRect.height, 0.2f, 0.98f); - m_VerticalSplitterRectRight.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentRight); - } - else if (m_ResizingVerticalSplitterLeft) - { - m_VerticalSplitterPercentLeft = Mathf.Clamp(Event.current.mousePosition.y / m_HorizontalSplitterRect.height, 0.25f, 0.98f); - m_VerticalSplitterRectLeft.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentLeft); - } - - - if (Event.current.type == EventType.MouseUp) - { - m_ResizingVerticalSplitterRight = false; - m_ResizingVerticalSplitterLeft = false; - } - } - - internal void UpdateSelectedBundles(IEnumerable bundles) - { - AssetBundleModel.Model.AddBundlesToUpdate(bundles); - m_AssetList.SetSelectedBundles(bundles); - m_DetailsList.SetItems(bundles); - m_MessageList.SetItems(null); - } - - internal void SetSelectedItems(IEnumerable items) - { - m_MessageList.SetItems(items); - } - - internal void SetAssetListSelection(List assets) - { - m_AssetList.SetSelection(assets); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs.meta deleted file mode 100644 index 680fa38..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f53b921dc74d344a98b8624b7b95a8b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel.meta deleted file mode 100644 index 873e199..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b59abcdb3531bd64ab43572babec263e -folderAsset: yes -timeCreated: 1488835755 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs deleted file mode 100644 index 5e3518d..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs +++ /dev/null @@ -1,766 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using UnityEngine.Assertions; -using System.Collections.Generic; -using System.Linq; -using UnityEditor.IMGUI.Controls; -using AssetBundleBrowser.AssetBundleDataSource; - -namespace AssetBundleBrowser.AssetBundleModel -{ - /// - /// Static class holding model data for Asset Bundle Browser tool. Data in Model is read from DataSource, but is not pushed. - /// - /// If not using a custom DataSource, then the data comes from the AssetDatabase. If you wish to alter the data from code, - /// you should just push changes to the AssetDatabase then tell the Model to Rebuild(). If needed, you can also loop over - /// Update() until it returns true to force all sub-items to refresh. - /// - /// - public static class Model - { - private const string k_NewBundleBaseName = "newbundle"; - private const string k_NewVariantBaseName = "newvariant"; - internal static /*const*/ Color k_LightGrey = Color.grey * 1.5f; - - private static ABDataSource s_DataSource; - private static BundleFolderConcreteInfo s_RootLevelBundles = new BundleFolderConcreteInfo("", null); - private static List s_MoveData = new List(); - private static List s_BundlesToUpdate = new List(); - private static Dictionary s_GlobalAssetList = new Dictionary(); - private static Dictionary> s_DependencyTracker = new Dictionary>(); - - private static bool s_InErrorState = false; - private const string k_DefaultEmptyMessage = "Drag assets here or right-click to begin creating bundles."; - private const string k_ProblemEmptyMessage = "There was a problem parsing the list of bundles. See console."; - private static string s_EmptyMessageString; - - private static Texture2D s_folderIcon = null; - private static Texture2D s_bundleIcon = null; - private static Texture2D s_sceneIcon = null; - - /// - /// If using a custom source of asset bundles, you can implement your own ABDataSource and set it here as the active - /// DataSource. This will allow you to use the Browser with data that you provide. - /// - /// If no custom DataSource is provided, then the Browser will create one that feeds off of and into the - /// AssetDatabase. - /// - /// - public static ABDataSource DataSource - { - get - { - if (s_DataSource == null) s_DataSource = new AssetDatabaseABDataSource(); - return s_DataSource; - } - set { s_DataSource = value; } - } - - /// - /// Update will loop over bundles that need updating and update them. It will only update one bundle - /// per frame and will continue on the same bundle next frame until that bundle is marked as doneUpdating. - /// By default, this will cause a very slow collection of dependency data as it will only update one bundle per - /// - public static bool Update() - { - bool shouldRepaint = false; - ExecuteAssetMove(false); //this should never do anything. just a safety check. - - //TODO - look into EditorApplication callback functions. - - int size = s_BundlesToUpdate.Count; - if (size > 0) - { - s_BundlesToUpdate[size - 1].Update(); - s_BundlesToUpdate.RemoveAll(item => item.doneUpdating == true); - if (s_BundlesToUpdate.Count == 0) - { - shouldRepaint = true; - foreach (BundleInfo bundle in s_RootLevelBundles.GetChildList()) bundle.RefreshDupeAssetWarning(); - } - } - - return shouldRepaint; - } - - internal static void ForceReloadData(TreeView tree) - { - s_InErrorState = false; - Rebuild(); - tree.Reload(); - bool doneUpdating = s_BundlesToUpdate.Count == 0; - - EditorUtility.DisplayProgressBar("Updating Bundles", "", 0); - int fullBundleCount = s_BundlesToUpdate.Count; - while (!doneUpdating && !s_InErrorState) - { - int currCount = s_BundlesToUpdate.Count; - EditorUtility.DisplayProgressBar("Updating Bundles", s_BundlesToUpdate[currCount - 1].displayName, (float) (fullBundleCount - currCount) / (float) fullBundleCount); - doneUpdating = Update(); - } - - EditorUtility.ClearProgressBar(); - } - - /// - /// Clears and rebuilds model data. - /// - public static void Rebuild() - { - s_RootLevelBundles = new BundleFolderConcreteInfo("", null); - s_MoveData = new List(); - s_BundlesToUpdate = new List(); - s_GlobalAssetList = new Dictionary(); - Refresh(); - } - - internal static void AddBundlesToUpdate(IEnumerable bundles) - { - foreach (BundleInfo bundle in bundles) - { - bundle.ForceNeedUpdate(); - s_BundlesToUpdate.Add(bundle); - } - } - - internal static void Refresh() - { - s_EmptyMessageString = k_ProblemEmptyMessage; - if (s_InErrorState) - return; - - string[] bundleList = ValidateBundleList(); - if (bundleList != null) - { - s_EmptyMessageString = k_DefaultEmptyMessage; - foreach (string bundleName in bundleList) AddBundleToModel(bundleName); - AddBundlesToUpdate(s_RootLevelBundles.GetChildList()); - } - - if (s_InErrorState) - { - s_RootLevelBundles = new BundleFolderConcreteInfo("", null); - s_EmptyMessageString = k_ProblemEmptyMessage; - } - } - - internal static string[] ValidateBundleList() - { - string[] bundleList = DataSource.GetAllAssetBundleNames(); - bool valid = true; - HashSet bundleSet = new HashSet(); - int index = 0; - bool attemptedBundleReset = false; - while (index < bundleList.Length) - { - string name = bundleList[index]; - if (!bundleSet.Add(name)) - { - LogError("Two bundles share the same name: " + name); - valid = false; - } - - int lastDot = name.LastIndexOf('.'); - if (lastDot > -1) - { - string bunName = name.Substring(0, lastDot); - int extraDot = bunName.LastIndexOf('.'); - if (extraDot > -1) - { - if (attemptedBundleReset) - { - string message = "Bundle name '" + bunName + "' contains a period."; - message += " Internally Unity keeps 'bundleName' and 'variantName' separate, but externally treat them as 'bundleName.variantName'."; - message += " If a bundleName contains a period, the build will (probably) succeed, but this tool cannot tell which portion is bundle and which portion is variant."; - LogError(message); - valid = false; - } - else - { - if (!DataSource.IsReadOnly()) DataSource.RemoveUnusedAssetBundleNames(); - index = 0; - bundleSet.Clear(); - bundleList = DataSource.GetAllAssetBundleNames(); - attemptedBundleReset = true; - continue; - } - } - - - if (bundleList.Contains(bunName)) - { - //there is a bundle.none and a bundle.variant coexisting. Need to fix that or return an error. - if (attemptedBundleReset) - { - valid = false; - string message = "Bundle name '" + bunName + "' exists without a variant as well as with variant '" + name.Substring(lastDot + 1) + "'."; - message += " That is an illegal state that will not build and must be cleaned up."; - LogError(message); - } - else - { - if (!DataSource.IsReadOnly()) DataSource.RemoveUnusedAssetBundleNames(); - index = 0; - bundleSet.Clear(); - bundleList = DataSource.GetAllAssetBundleNames(); - attemptedBundleReset = true; - continue; - } - } - } - - index++; - } - - if (valid) - return bundleList; - else - return null; - } - - internal static bool BundleListIsEmpty() - { - return s_RootLevelBundles.GetChildList().Count() == 0; - } - - internal static string GetEmptyMessage() - { - return s_EmptyMessageString; - } - - internal static BundleInfo CreateEmptyBundle(BundleFolderInfo folder = null, string newName = null) - { - if (folder as BundleVariantFolderInfo != null) - return CreateEmptyVariant(folder as BundleVariantFolderInfo); - - folder = folder == null ? s_RootLevelBundles : folder; - string name = GetUniqueName(folder, newName); - BundleNameData nameData; - nameData = new BundleNameData(folder.m_Name.bundleName, name); - return AddBundleToFolder(folder, nameData); - } - - internal static BundleInfo CreateEmptyVariant(BundleVariantFolderInfo folder) - { - string name = GetUniqueName(folder, k_NewVariantBaseName); - string variantName = folder.m_Name.bundleName + "." + name; - BundleNameData nameData = new BundleNameData(variantName); - return AddBundleToFolder(folder.parent, nameData); - } - - internal static BundleFolderInfo CreateEmptyBundleFolder(BundleFolderConcreteInfo folder = null) - { - folder = folder == null ? s_RootLevelBundles : folder; - string name = GetUniqueName(folder) + "/dummy"; - BundleNameData nameData = new BundleNameData(folder.m_Name.bundleName, name); - return AddFoldersToBundle(s_RootLevelBundles, nameData); - } - - private static BundleInfo AddBundleToModel(string name) - { - if (name == null) - return null; - - BundleNameData nameData = new BundleNameData(name); - - BundleFolderInfo folder = AddFoldersToBundle(s_RootLevelBundles, nameData); - BundleInfo currInfo = AddBundleToFolder(folder, nameData); - - return currInfo; - } - - private static BundleFolderConcreteInfo AddFoldersToBundle(BundleFolderInfo root, BundleNameData nameData) - { - BundleInfo currInfo = root; - BundleFolderConcreteInfo folder = currInfo as BundleFolderConcreteInfo; - int size = nameData.pathTokens.Count; - for (int index = 0; index < size; index++) - if (folder != null) - { - currInfo = folder.GetChild(nameData.pathTokens[index]); - if (currInfo == null) - { - currInfo = new BundleFolderConcreteInfo(nameData.pathTokens, index + 1, folder); - folder.AddChild(currInfo); - } - - folder = currInfo as BundleFolderConcreteInfo; - if (folder == null) - { - s_InErrorState = true; - LogFolderAndBundleNameConflict(currInfo.m_Name.fullNativeName); - break; - } - } - - return currInfo as BundleFolderConcreteInfo; - } - - private static void LogFolderAndBundleNameConflict(string name) - { - string message = "Bundle '"; - message += name; - message += "' has a name conflict with a bundle-folder."; - message += "Display of bundle data and building of bundles will not work."; - message += "\nDetails: If you name a bundle 'x/y', then the result of your build will be a bundle named 'y' in a folder named 'x'. You thus cannot also have a bundle named 'x' at the same level as the folder named 'x'."; - LogError(message); - } - - private static BundleInfo AddBundleToFolder(BundleFolderInfo root, BundleNameData nameData) - { - BundleInfo currInfo = root.GetChild(nameData.shortName); - if (!string.IsNullOrEmpty(nameData.variant)) - { - if (currInfo == null) - { - currInfo = new BundleVariantFolderInfo(nameData.bundleName, root); - root.AddChild(currInfo); - } - - BundleVariantFolderInfo folder = currInfo as BundleVariantFolderInfo; - if (folder == null) - { - string message = "Bundle named " + nameData.shortName; - message += " exists both as a standard bundle, and a bundle with variants. "; - message += "This message is not supported for display or actual bundle building. "; - message += "You must manually fix bundle naming in the inspector."; - - LogError(message); - return null; - } - - - currInfo = folder.GetChild(nameData.variant); - if (currInfo == null) - { - currInfo = new BundleVariantDataInfo(nameData.fullNativeName, folder); - folder.AddChild(currInfo); - } - } - else - { - if (currInfo == null) - { - currInfo = new BundleDataInfo(nameData.fullNativeName, root); - root.AddChild(currInfo); - } - else - { - BundleDataInfo dataInfo = currInfo as BundleDataInfo; - if (dataInfo == null) - { - s_InErrorState = true; - LogFolderAndBundleNameConflict(nameData.fullNativeName); - } - } - } - - return currInfo; - } - - private static string GetUniqueName(BundleFolderInfo folder, string suggestedName = null) - { - suggestedName = suggestedName == null ? k_NewBundleBaseName : suggestedName; - string name = suggestedName; - int index = 1; - bool foundExisting = folder.GetChild(name) != null; - while (foundExisting) - { - name = suggestedName + index; - index++; - foundExisting = folder.GetChild(name) != null; - } - - return name; - } - - internal static BundleTreeItem CreateBundleTreeView() - { - return s_RootLevelBundles.CreateTreeView(-1); - } - - internal static AssetTreeItem CreateAssetListTreeView(IEnumerable selectedBundles) - { - AssetTreeItem root = new AssetTreeItem(); - if (selectedBundles != null) - foreach (BundleInfo bundle in selectedBundles) - bundle.AddAssetsToNode(root); - return root; - } - - internal static bool HandleBundleRename(BundleTreeItem item, string newName) - { - BundleNameData originalName = new BundleNameData(item.bundle.m_Name.fullNativeName); - - int findDot = newName.LastIndexOf('.'); - int findSlash = newName.LastIndexOf('/'); - int findBSlash = newName.LastIndexOf('\\'); - if (findDot == 0 || findSlash == 0 || findBSlash == 0) - return false; //can't start a bundle with a / or . - - bool result = item.bundle.HandleRename(newName, 0); - - if (findDot > 0 || findSlash > 0 || findBSlash > 0) item.bundle.parent.HandleChildRename(newName, string.Empty); - - ExecuteAssetMove(); - - BundleInfo node = FindBundle(originalName); - if (node != null) - { - string message = "Failed to rename bundle named: "; - message += originalName.fullNativeName; - message += ". Most likely this is due to the bundle being assigned to a folder in your Assets directory, AND that folder is either empty or only contains assets that are explicitly assigned elsewhere."; - Debug.LogError(message); - } - - return result; - } - - internal static void HandleBundleReparent(IEnumerable bundles, BundleFolderInfo parent) - { - parent = parent == null ? s_RootLevelBundles : parent; - foreach (BundleInfo bundle in bundles) bundle.HandleReparent(parent.m_Name.bundleName, parent); - ExecuteAssetMove(); - } - - internal static void HandleBundleMerge(IEnumerable bundles, BundleDataInfo target) - { - foreach (BundleInfo bundle in bundles) bundle.HandleDelete(true, target.m_Name.bundleName, target.m_Name.variant); - ExecuteAssetMove(); - } - - internal static void HandleBundleDelete(IEnumerable bundles) - { - List nameList = new List(); - foreach (BundleInfo bundle in bundles) - { - nameList.Add(bundle.m_Name); - bundle.HandleDelete(true); - } - - ExecuteAssetMove(); - - //check to see if any bundles are still there... - foreach (BundleNameData name in nameList) - { - BundleInfo node = FindBundle(name); - if (node != null) - { - string message = "Failed to delete bundle named: "; - message += name.fullNativeName; - message += ". Most likely this is due to the bundle being assigned to a folder in your Assets directory, AND that folder is either empty or only contains assets that are explicitly assigned elsewhere."; - Debug.LogError(message); - } - } - } - - internal static BundleInfo FindBundle(BundleNameData name) - { - BundleInfo currNode = s_RootLevelBundles; - foreach (string token in name.pathTokens) - if (currNode is BundleFolderInfo) - { - currNode = (currNode as BundleFolderInfo).GetChild(token); - if (currNode == null) - return null; - } - else - { - return null; - } - - if (currNode is BundleFolderInfo) - { - currNode = (currNode as BundleFolderInfo).GetChild(name.shortName); - if (currNode is BundleVariantFolderInfo) currNode = (currNode as BundleVariantFolderInfo).GetChild(name.variant); - return currNode; - } - else - { - return null; - } - } - - internal static BundleInfo HandleDedupeBundles(IEnumerable bundles, bool onlyOverlappedAssets) - { - BundleInfo newBundle = CreateEmptyBundle(); - HashSet dupeAssets = new HashSet(); - HashSet fullAssetList = new HashSet(); - - //if they were just selected, then they may still be updating. - bool doneUpdating = s_BundlesToUpdate.Count == 0; - while (!doneUpdating) - doneUpdating = Update(); - - foreach (BundleInfo bundle in bundles) - foreach (AssetInfo asset in bundle.GetDependencies()) - if (onlyOverlappedAssets) - { - if (!fullAssetList.Add(asset.fullAssetName)) - dupeAssets.Add(asset.fullAssetName); - } - else - { - if (asset.IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) - dupeAssets.Add(asset.fullAssetName); - } - - if (dupeAssets.Count == 0) - return null; - - MoveAssetToBundle(dupeAssets, newBundle.m_Name.bundleName, string.Empty); - ExecuteAssetMove(); - return newBundle; - } - - internal static BundleInfo HandleConvertToVariant(BundleDataInfo bundle) - { - bundle.HandleDelete(true, bundle.m_Name.bundleName, k_NewVariantBaseName); - ExecuteAssetMove(); - BundleVariantFolderInfo root = bundle.parent.GetChild(bundle.m_Name.shortName) as BundleVariantFolderInfo; - - if (root != null) - { - return root.GetChild(k_NewVariantBaseName); - } - else - { - //we got here because the converted bundle was empty. - BundleVariantFolderInfo vfolder = new BundleVariantFolderInfo(bundle.m_Name.bundleName, bundle.parent); - BundleVariantDataInfo vdata = new BundleVariantDataInfo(bundle.m_Name.bundleName + "." + k_NewVariantBaseName, vfolder); - bundle.parent.AddChild(vfolder); - vfolder.AddChild(vdata); - return vdata; - } - } - - internal class ABMoveData - { - internal string assetName; - internal string bundleName; - internal string variantName; - - internal ABMoveData(string asset, string bundle, string variant) - { - assetName = asset; - bundleName = bundle; - variantName = variant; - } - - internal void Apply() - { - if (!DataSource.IsReadOnly()) DataSource.SetAssetBundleNameAndVariant(assetName, bundleName, variantName); - } - } - - internal static void MoveAssetToBundle(AssetInfo asset, string bundleName, string variant) - { - s_MoveData.Add(new ABMoveData(asset.fullAssetName, bundleName, variant)); - } - - internal static void MoveAssetToBundle(string assetName, string bundleName, string variant) - { - s_MoveData.Add(new ABMoveData(assetName, bundleName, variant)); - } - - internal static void MoveAssetToBundle(IEnumerable assets, string bundleName, string variant) - { - foreach (AssetInfo asset in assets) - MoveAssetToBundle(asset, bundleName, variant); - } - - internal static void MoveAssetToBundle(IEnumerable assetNames, string bundleName, string variant) - { - foreach (string assetName in assetNames) - MoveAssetToBundle(assetName, bundleName, variant); - } - - internal static void ExecuteAssetMove(bool forceAct = true) - { - int size = s_MoveData.Count; - if (forceAct) - { - if (size > 0) - { - bool autoRefresh = EditorPrefs.GetBool("kAutoRefresh"); - EditorPrefs.SetBool("kAutoRefresh", false); - AssetDatabase.StartAssetEditing(); - EditorUtility.DisplayProgressBar("Moving assets to bundles", "", 0); - for (int i = 0; i < size; i++) - { - EditorUtility.DisplayProgressBar("Moving assets to bundle " + s_MoveData[i].bundleName, System.IO.Path.GetFileNameWithoutExtension(s_MoveData[i].assetName), (float) i / (float) size); - s_MoveData[i].Apply(); - } - - EditorUtility.ClearProgressBar(); - AssetDatabase.StopAssetEditing(); - EditorPrefs.SetBool("kAutoRefresh", autoRefresh); - s_MoveData.Clear(); - } - - if (!DataSource.IsReadOnly()) DataSource.RemoveUnusedAssetBundleNames(); - Refresh(); - } - } - - //this version of CreateAsset is only used for dependent assets. - internal static AssetInfo CreateAsset(string name, AssetInfo parent) - { - if (ValidateAsset(name)) - { - string bundleName = GetBundleName(name); - return CreateAsset(name, bundleName, parent); - } - - return null; - } - - internal static AssetInfo CreateAsset(string name, string bundleName) - { - if (ValidateAsset(name)) return CreateAsset(name, bundleName, null); - return null; - } - - private static AssetInfo CreateAsset(string name, string bundleName, AssetInfo parent) - { - if (!string.IsNullOrEmpty(bundleName)) - { - return new AssetInfo(name, bundleName); - } - else - { - AssetInfo info = null; - if (!s_GlobalAssetList.TryGetValue(name, out info)) - { - info = new AssetInfo(name, string.Empty); - s_GlobalAssetList.Add(name, info); - } - - info.AddParent(parent.displayName); - return info; - } - } - - internal static bool ValidateAsset(string name) - { - if (!name.StartsWith("Assets/")) - return false; - string ext = System.IO.Path.GetExtension(name); - if (ext == ".dll" || ext == ".cs" || ext == ".meta" || ext == ".js" || ext == ".boo") - return false; - - return true; - } - - internal static string GetBundleName(string asset) - { - return DataSource.GetAssetBundleName(asset); - } - - internal static int RegisterAsset(AssetInfo asset, string bundle) - { - if (s_DependencyTracker.ContainsKey(asset.fullAssetName)) - { - s_DependencyTracker[asset.fullAssetName].Add(bundle); - int count = s_DependencyTracker[asset.fullAssetName].Count; - if (count > 1) - asset.SetMessageFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, true); - return count; - } - - HashSet bundles = new HashSet(); - bundles.Add(bundle); - s_DependencyTracker.Add(asset.fullAssetName, bundles); - return 1; - } - - internal static void UnRegisterAsset(AssetInfo asset, string bundle) - { - if (s_DependencyTracker == null || asset == null) - return; - - if (s_DependencyTracker.ContainsKey(asset.fullAssetName)) - { - s_DependencyTracker[asset.fullAssetName].Remove(bundle); - int count = s_DependencyTracker[asset.fullAssetName].Count; - switch (count) - { - case 0: - s_DependencyTracker.Remove(asset.fullAssetName); - break; - case 1: - asset.SetMessageFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, false); - break; - default: - break; - } - } - } - - internal static IEnumerable CheckDependencyTracker(AssetInfo asset) - { - if (s_DependencyTracker.ContainsKey(asset.fullAssetName)) return s_DependencyTracker[asset.fullAssetName]; - return new HashSet(); - } - - //TODO - switch local cache server on and utilize this method to stay up to date. - //static List m_importedAssets = new List(); - //static List m_deletedAssets = new List(); - //static List> m_movedAssets = new List>(); - //class AssetBundleChangeListener : AssetPostprocessor - //{ - // static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) - // { - // m_importedAssets.AddRange(importedAssets); - // m_deletedAssets.AddRange(deletedAssets); - // for (int i = 0; i < movedAssets.Length; i++) - // m_movedAssets.Add(new KeyValuePair(movedFromAssetPaths[i], movedAssets[i])); - // //m_dirty = true; - // } - //} - - internal static void LogError(string message) - { - Debug.LogError("AssetBundleBrowser: " + message); - } - - internal static void LogWarning(string message) - { - Debug.LogWarning("AssetBundleBrowser: " + message); - } - - internal static Texture2D GetFolderIcon() - { - if (s_folderIcon == null) - FindBundleIcons(); - return s_folderIcon; - } - - internal static Texture2D GetBundleIcon() - { - if (s_bundleIcon == null) - FindBundleIcons(); - return s_bundleIcon; - } - - internal static Texture2D GetSceneIcon() - { - if (s_sceneIcon == null) - FindBundleIcons(); - return s_sceneIcon; - } - - private static void FindBundleIcons() - { - s_folderIcon = EditorGUIUtility.FindTexture("Folder Icon"); - - string packagePath = System.IO.Path.GetFullPath("Packages/com.unity.assetbundlebrowser"); - if (System.IO.Directory.Exists(packagePath)) - { - s_bundleIcon = (Texture2D) AssetDatabase.LoadAssetAtPath("Packages/com.unity.assetbundlebrowser/Editor/Icons/ABundleBrowserIconY1756Basic.png", typeof(Texture2D)); - s_sceneIcon = (Texture2D) AssetDatabase.LoadAssetAtPath("Packages/com.unity.assetbundlebrowser/Editor/Icons/ABundleBrowserIconY1756Scene.png", typeof(Texture2D)); - } - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs.meta deleted file mode 100644 index eecd723..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8f45129f30a7a9b4caf06fa3cbb90882 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs deleted file mode 100644 index b788896..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs +++ /dev/null @@ -1,248 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEditor.IMGUI.Controls; - -namespace AssetBundleBrowser.AssetBundleModel -{ - internal sealed class AssetTreeItem : TreeViewItem - { - private AssetInfo m_asset; - - internal AssetInfo asset - { - get { return m_asset; } - } - - internal AssetTreeItem() : base(-1, -1) - { - } - - internal AssetTreeItem(AssetInfo a) : base(a != null ? a.fullAssetName.GetHashCode() : Random.Range(int.MinValue, int.MaxValue), 0, a != null ? a.displayName : "failed") - { - m_asset = a; - if (a != null) - icon = AssetDatabase.GetCachedIcon(a.fullAssetName) as Texture2D; - } - - private Color m_color = new Color(0, 0, 0, 0); - - internal Color itemColor - { - get - { - if (m_color.a == 0.0f && m_asset != null) m_color = m_asset.GetColor(); - return m_color; - } - set { m_color = value; } - } - - internal Texture2D MessageIcon() - { - return MessageSystem.GetIcon(HighestMessageLevel()); - } - - internal MessageType HighestMessageLevel() - { - return m_asset != null ? m_asset.HighestMessageLevel() : MessageType.Error; - } - - internal bool ContainsChild(AssetInfo asset) - { - bool contains = false; - if (children == null) - return contains; - - if (asset == null) - return false; - foreach (TreeViewItem child in children) - { - AssetTreeItem c = child as AssetTreeItem; - if (c != null && c.asset != null && c.asset.fullAssetName == asset.fullAssetName) - { - contains = true; - break; - } - } - - return contains; - } - } - - internal class AssetInfo - { - internal bool isScene { get; set; } - internal bool isFolder { get; set; } - internal long fileSize; - - private HashSet m_Parents; - private string m_AssetName; - private string m_DisplayName; - private string m_BundleName; - private MessageSystem.MessageState m_AssetMessages = new MessageSystem.MessageState(); - - internal AssetInfo(string inName, string bundleName = "") - { - fullAssetName = inName; - m_BundleName = bundleName; - m_Parents = new HashSet(); - isScene = false; - isFolder = false; - } - - internal string fullAssetName - { - get { return m_AssetName; } - set - { - m_AssetName = value; - m_DisplayName = System.IO.Path.GetFileNameWithoutExtension(m_AssetName); - - //TODO - maybe there's a way to ask the AssetDatabase for this size info. - FileInfo fileInfo = new System.IO.FileInfo(m_AssetName); - if (fileInfo.Exists) - fileSize = fileInfo.Length; - else - fileSize = 0; - } - } - - internal string displayName - { - get { return m_DisplayName; } - } - - internal string bundleName - { - get { return string.IsNullOrEmpty(m_BundleName) ? "auto" : m_BundleName; } - } - - internal Color GetColor() - { - if (string.IsNullOrEmpty(m_BundleName)) - return Model.k_LightGrey; - else - return Color.white; - } - - internal bool IsMessageSet(MessageSystem.MessageFlag flag) - { - return m_AssetMessages.IsSet(flag); - } - - internal void SetMessageFlag(MessageSystem.MessageFlag flag, bool on) - { - m_AssetMessages.SetFlag(flag, on); - } - - internal MessageType HighestMessageLevel() - { - return m_AssetMessages.HighestMessageLevel(); - } - - internal IEnumerable GetMessages() - { - List messages = new List(); - if (IsMessageSet(MessageSystem.MessageFlag.SceneBundleConflict)) - { - string message = displayName + "\n"; - if (isScene) - message += "Is a scene that is in a bundle with non-scene assets. Scene bundles must have only one or more scene assets."; - else - message += "Is included in a bundle with a scene. Scene bundles must have only one or more scene assets."; - messages.Add(new MessageSystem.Message(message, MessageType.Error)); - } - - if (IsMessageSet(MessageSystem.MessageFlag.DependencySceneConflict)) - { - string message = displayName + "\n"; - message += MessageSystem.GetMessage(MessageSystem.MessageFlag.DependencySceneConflict).message; - messages.Add(new MessageSystem.Message(message, MessageType.Error)); - } - - if (IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) - { - IEnumerable bundleNames = Model.CheckDependencyTracker(this); - string message = displayName + "\n" + "Is auto-included in multiple bundles:\n"; - foreach (string bundleName in bundleNames) message += bundleName + ", "; - message = message.Substring(0, message.Length - 2); //remove trailing comma. - messages.Add(new MessageSystem.Message(message, MessageType.Warning)); - } - - if (string.IsNullOrEmpty(m_BundleName) && m_Parents.Count > 0) - { - //TODO - refine the parent list to only include those in the current asset list - string message = displayName + "\n" + "Is auto included in bundle(s) due to parent(s): \n"; - foreach (string parent in m_Parents) message += parent + ", "; - message = message.Substring(0, message.Length - 2); //remove trailing comma. - messages.Add(new MessageSystem.Message(message, MessageType.Info)); - } - - if (m_dependencies != null && m_dependencies.Count > 0) - { - string message = string.Empty; - IOrderedEnumerable sortedDependencies = m_dependencies.OrderBy(d => d.bundleName); - foreach (AssetInfo dependent in sortedDependencies) - if (dependent.bundleName != bundleName) - message += dependent.bundleName + " : " + dependent.displayName + "\n"; - if (string.IsNullOrEmpty(message) == false) - { - message = message.Insert(0, displayName + "\n" + "Is dependent on other bundle's asset(s) or auto included asset(s): \n"); - message = message.Substring(0, message.Length - 1); //remove trailing line break. - messages.Add(new MessageSystem.Message(message, MessageType.Info)); - } - } - - messages.Add(new MessageSystem.Message(displayName + "\n" + "Path: " + fullAssetName, MessageType.Info)); - - return messages; - } - - internal void AddParent(string name) - { - m_Parents.Add(name); - } - - internal void RemoveParent(string name) - { - m_Parents.Remove(name); - } - - internal string GetSizeString() - { - if (fileSize == 0) - return "--"; - return EditorUtility.FormatBytes(fileSize); - } - - private List m_dependencies = null; - - internal List GetDependencies() - { - //TODO - not sure this refreshes enough. need to build tests around that. - if (m_dependencies == null) - { - m_dependencies = new List(); - if (AssetDatabase.IsValidFolder(m_AssetName)) - { - //if we have a folder, its dependencies were already pulled in through alternate means. no need to GatherFoldersAndFiles - //GatherFoldersAndFiles(); - } - else - { - foreach (string dep in AssetDatabase.GetDependencies(m_AssetName, true)) - if (dep != m_AssetName) - { - AssetInfo asset = Model.CreateAsset(dep, this); - if (asset != null) - m_dependencies.Add(asset); - } - } - } - - return m_dependencies; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs.meta deleted file mode 100644 index de3d371..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9f5923f93f7306f4182aecb2dd06ef8d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs deleted file mode 100644 index d26333b..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs +++ /dev/null @@ -1,1027 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System.Linq; -using UnityEditor.IMGUI.Controls; - -namespace AssetBundleBrowser.AssetBundleModel -{ - internal sealed class BundleTreeItem : TreeViewItem - { - private BundleInfo m_Bundle; - - internal BundleInfo bundle - { - get { return m_Bundle; } - } - - internal BundleTreeItem(BundleInfo b, int depth, Texture2D iconTexture) : base(b.nameHashCode, depth, b.displayName) - { - m_Bundle = b; - icon = iconTexture; - children = new List(); - } - - internal MessageSystem.Message BundleMessage() - { - return m_Bundle.HighestMessage(); - } - - public override string displayName - { - get { return AssetBundleBrowserMain.instance.m_ManageTab.hasSearch ? m_Bundle.m_Name.fullNativeName : m_Bundle.displayName; } - } - } - - internal class BundleNameData - { - private List m_PathTokens; - private string m_FullBundleName; - private string m_ShortName; - private string m_VariantName; - private string m_FullNativeName; - - //input (received from native) is a string of format: - // /folder0/.../folderN/name.variant - //it's broken into: - // /m_pathTokens[0]/.../m_pathTokens[n]/m_shortName.m_variantName - // and... - // m_fullBundleName = /m_pathTokens[0]/.../m_pathTokens[n]/m_shortName - // and... - // m_fullNativeName = m_fullBundleName.m_variantName which is the same as the initial input. - internal BundleNameData(string name) - { - SetName(name); - } - - internal BundleNameData(string path, string name) - { - string finalName = string.IsNullOrEmpty(path) ? "" : path + '/'; - finalName += name; - SetName(finalName); - } - - public override int GetHashCode() - { - return fullNativeName.GetHashCode(); - } - - internal string fullNativeName - { - get { return m_FullNativeName; } - } - - internal void SetBundleName(string bundleName, string variantName) - { - string name = bundleName; - name += string.IsNullOrEmpty(variantName) ? "" : "." + variantName; - SetName(name); - } - - internal string bundleName - { - get { return m_FullBundleName; } - //set { SetName(value); } - } - - internal string shortName - { - get { return m_ShortName; } - } - - internal string variant - { - get { return m_VariantName; } - set - { - m_VariantName = value; - m_FullNativeName = m_FullBundleName; - m_FullNativeName += string.IsNullOrEmpty(m_VariantName) ? "" : "." + m_VariantName; - } - } - - internal List pathTokens - { - get { return m_PathTokens; } - set - { - m_PathTokens = value.GetRange(0, value.Count - 1); - SetShortName(value.Last()); - GenerateFullName(); - } - } - - private void SetName(string name) - { - if (m_PathTokens == null) - m_PathTokens = new List(); - else - m_PathTokens.Clear(); - - int indexOfSlash = name.IndexOf('/'); - int previousIndex = 0; - while (indexOfSlash != -1) - { - m_PathTokens.Add(name.Substring(previousIndex, indexOfSlash - previousIndex)); - previousIndex = indexOfSlash + 1; - indexOfSlash = name.IndexOf('/', previousIndex); - } - - SetShortName(name.Substring(previousIndex)); - GenerateFullName(); - } - - private void SetShortName(string inputName) - { - m_ShortName = inputName; - int indexOfDot = m_ShortName.LastIndexOf('.'); - if (indexOfDot > -1) - { - m_VariantName = m_ShortName.Substring(indexOfDot + 1); - m_ShortName = m_ShortName.Substring(0, indexOfDot); - } - else - { - m_VariantName = string.Empty; - } - } - - internal void PartialNameChange(string newToken, int indexFromBack) - { - if (indexFromBack == 0) - SetShortName(newToken); - else if (indexFromBack - 1 < m_PathTokens.Count) m_PathTokens[m_PathTokens.Count - indexFromBack] = newToken; - GenerateFullName(); - } - - private void GenerateFullName() - { - m_FullBundleName = string.Empty; - for (int i = 0; i < m_PathTokens.Count; i++) - { - m_FullBundleName += m_PathTokens[i]; - m_FullBundleName += '/'; - } - - m_FullBundleName += m_ShortName; - m_FullNativeName = m_FullBundleName; - m_FullNativeName += string.IsNullOrEmpty(m_VariantName) ? "" : "." + m_VariantName; - } - } - - internal abstract class BundleInfo - { - protected BundleFolderInfo m_Parent; - protected bool m_DoneUpdating; - protected bool m_Dirty; - internal BundleNameData m_Name; - protected MessageSystem.MessageState m_BundleMessages = new MessageSystem.MessageState(); - protected MessageSystem.Message m_CachedHighMessage = null; - - internal BundleInfo(string name, BundleFolderInfo parent) - { - m_Name = new BundleNameData(name); - m_Parent = parent; - } - - internal BundleFolderInfo parent - { - get { return m_Parent; } - } - - internal virtual string displayName - { - get { return m_Name.shortName; } - } - - internal virtual int nameHashCode - { - get { return m_Name.GetHashCode(); } - } - - internal abstract BundleTreeItem CreateTreeView(int depth); - - protected virtual void RefreshMessages() - { - RefreshEmptyStatus(); - RefreshDupeAssetWarning(); - MessageSystem.MessageFlag flag = m_BundleMessages.HighestMessageFlag(); - m_CachedHighMessage = MessageSystem.GetMessage(flag); - } - - internal abstract bool RefreshEmptyStatus(); - internal abstract bool RefreshDupeAssetWarning(); - - internal virtual MessageSystem.Message HighestMessage() - { - if (m_CachedHighMessage == null) - RefreshMessages(); - return m_CachedHighMessage; - } - - internal bool IsMessageSet(MessageSystem.MessageFlag flag) - { - return m_BundleMessages.IsSet(flag); - } - - internal void SetMessageFlag(MessageSystem.MessageFlag flag, bool on) - { - m_BundleMessages.SetFlag(flag, on); - } - - internal List GetMessages() - { - return m_BundleMessages.GetMessages(); - } - - internal bool HasMessages() - { - return m_BundleMessages.HasMessages(); - } - - internal virtual bool HandleRename(string newName, int reverseDepth) - { - if (reverseDepth == 0) - if (!m_Parent.HandleChildRename(m_Name.shortName, newName)) - return false; - m_Name.PartialNameChange(newName, reverseDepth); - return true; - } - - internal virtual void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") - { - if (isRootOfDelete) m_Parent.HandleChildRename(m_Name.shortName, string.Empty); - } - - internal abstract void RefreshAssetList(); - internal abstract void AddAssetsToNode(AssetTreeItem node); - internal abstract void Update(); - - internal virtual bool doneUpdating - { - get { return m_DoneUpdating; } - } - - internal virtual bool dirty - { - get { return m_Dirty; } - } - - internal void ForceNeedUpdate() - { - m_DoneUpdating = false; - m_Dirty = true; - } - - internal abstract void HandleReparent(string parentName, BundleFolderInfo newParent = null); - internal abstract List GetDependencies(); - - internal abstract bool DoesItemMatchSearch(string search); - } - - internal class BundleDependencyInfo - { - public string m_BundleName; - public List m_FromAssets; - public List m_ToAssets; - - public BundleDependencyInfo(string bundleName, AssetInfo fromAsset, AssetInfo toAsset) - { - m_BundleName = bundleName; - m_FromAssets = new List(); - m_FromAssets.Add(fromAsset); - m_ToAssets = new List(); - m_ToAssets.Add(toAsset); - } - } - - internal class BundleDataInfo : BundleInfo - { - protected List m_ConcreteAssets; - protected List m_DependentAssets; - protected List m_BundleDependencies; - protected int m_ConcreteCounter; - protected int m_DependentCounter; - protected bool m_IsSceneBundle; - protected long m_TotalSize; - - internal BundleDataInfo(string name, BundleFolderInfo parent) : base(name, parent) - { - m_ConcreteAssets = new List(); - m_DependentAssets = new List(); - m_BundleDependencies = new List(); - m_ConcreteCounter = 0; - m_DependentCounter = 0; - } - - ~BundleDataInfo() - { - foreach (AssetInfo asset in m_DependentAssets) Model.UnRegisterAsset(asset, m_Name.fullNativeName); - } - - internal override bool HandleRename(string newName, int reverseDepth) - { - RefreshAssetList(); - if (!base.HandleRename(newName, reverseDepth)) - return false; - Model.MoveAssetToBundle(m_ConcreteAssets, m_Name.bundleName, m_Name.variant); - return true; - } - - internal override void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") - { - RefreshAssetList(); - base.HandleDelete(isRootOfDelete); - Model.MoveAssetToBundle(m_ConcreteAssets, forcedNewName, forcedNewVariant); - } - - internal string TotalSize() - { - if (m_TotalSize == 0) - return "--"; - return EditorUtility.FormatBytes(m_TotalSize); - } - - internal override void RefreshAssetList() - { - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, false); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.SceneBundleConflict, false); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.DependencySceneConflict, false); - - m_ConcreteAssets.Clear(); - m_TotalSize = 0; - m_IsSceneBundle = false; - - foreach (AssetInfo asset in m_DependentAssets) Model.UnRegisterAsset(asset, m_Name.fullNativeName); - m_DependentAssets.Clear(); - m_BundleDependencies.Clear(); - - bool assetInBundle = false; - bool sceneError = false; - string[] assets = Model.DataSource.GetAssetPathsFromAssetBundle(m_Name.fullNativeName); - foreach (string assetName in assets) - { - if (AssetDatabase.GetMainAssetTypeAtPath(assetName) == typeof(SceneAsset)) - { - m_IsSceneBundle = true; - if (assetInBundle) - sceneError = true; - } - else - { - assetInBundle = true; - if (m_IsSceneBundle) - sceneError = true; - } - - string bundleName = Model.GetBundleName(assetName); - if (string.IsNullOrEmpty(bundleName)) - { - ///we get here if the current asset is only added due to being in an explicitly added folder - - - string partialPath = assetName; - while ( - !string.IsNullOrEmpty(partialPath) && - partialPath != "Assets" && - string.IsNullOrEmpty(bundleName)) - { - partialPath = partialPath.Substring(0, partialPath.LastIndexOf('/')); - bundleName = Model.GetBundleName(partialPath); - } - - if (!string.IsNullOrEmpty(bundleName)) - { - AssetInfo folderAsset = Model.CreateAsset(partialPath, bundleName); - folderAsset.isFolder = true; - if (m_ConcreteAssets.FindIndex(a => a.displayName == folderAsset.displayName) == -1) m_ConcreteAssets.Add(folderAsset); - - AssetInfo newAsset = Model.CreateAsset(assetName, folderAsset); - if (newAsset != null) - { - m_DependentAssets.Add(newAsset); - if (m_DependentAssets != null && m_DependentAssets.Count > 0) - { - AssetInfo last = m_DependentAssets.Last(); - if (last != null) - m_TotalSize += last.fileSize; - } - } - } - } - else - { - AssetInfo newAsset = Model.CreateAsset(assetName, m_Name.fullNativeName); - if (newAsset != null) - { - m_ConcreteAssets.Add(newAsset); - m_TotalSize += m_ConcreteAssets.Last().fileSize; - if (AssetDatabase.GetMainAssetTypeAtPath(assetName) == typeof(SceneAsset)) - { - m_IsSceneBundle = true; - m_ConcreteAssets.Last().isScene = true; - } - } - } - } - - if (sceneError) - foreach (AssetInfo asset in m_ConcreteAssets) - if (asset.isFolder) - { - asset.SetMessageFlag(MessageSystem.MessageFlag.DependencySceneConflict, true); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.DependencySceneConflict, true); - } - else - { - asset.SetMessageFlag(MessageSystem.MessageFlag.SceneBundleConflict, true); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.SceneBundleConflict, true); - } - - - m_ConcreteCounter = 0; - m_DependentCounter = 0; - m_Dirty = true; - } - - internal override void AddAssetsToNode(AssetTreeItem node) - { - foreach (AssetInfo asset in m_ConcreteAssets) - node.AddChild(new AssetTreeItem(asset)); - - foreach (AssetInfo asset in m_DependentAssets) - if (!node.ContainsChild(asset)) - node.AddChild(new AssetTreeItem(asset)); - - m_Dirty = false; - } - - internal List GetBundleDependencies() - { - return m_BundleDependencies; - } - - internal override void Update() - { - int dependents = m_DependentAssets.Count; - int bundleDep = m_BundleDependencies.Count; - if (m_ConcreteCounter < m_ConcreteAssets.Count) - { - GatherDependencies(m_ConcreteAssets[m_ConcreteCounter]); - m_ConcreteCounter++; - m_DoneUpdating = false; - } - else if (m_DependentCounter < m_DependentAssets.Count) - { - GatherDependencies(m_DependentAssets[m_DependentCounter], m_Name.fullNativeName); - m_DependentCounter++; - m_DoneUpdating = false; - } - else - { - m_DoneUpdating = true; - } - - m_Dirty = dependents != m_DependentAssets.Count || bundleDep != m_BundleDependencies.Count; - if (m_Dirty || m_DoneUpdating) - RefreshMessages(); - } - - private void GatherDependencies(AssetInfo asset, string parentBundle = "") - { - if (string.IsNullOrEmpty(parentBundle)) - parentBundle = asset.bundleName; - - if (asset == null) - return; - - List deps = asset.GetDependencies(); - if (deps == null) - return; - - foreach (AssetInfo ai in deps) - { - if (ai == asset || m_ConcreteAssets.Contains(ai) || m_DependentAssets.Contains(ai)) - continue; - - string bundleName = Model.DataSource.GetImplicitAssetBundleName(ai.fullAssetName); - if (string.IsNullOrEmpty(bundleName)) - { - m_DependentAssets.Add(ai); - m_TotalSize += ai.fileSize; - if (Model.RegisterAsset(ai, parentBundle) > 1) SetDuplicateWarning(); - } - else if (bundleName != m_Name.fullNativeName) - { - BundleDependencyInfo dependencyInfo = m_BundleDependencies.Find(m => m.m_BundleName == bundleName); - - if (dependencyInfo == null) - { - dependencyInfo = new BundleDependencyInfo(bundleName, asset, ai); - m_BundleDependencies.Add(dependencyInfo); - } - else - { - dependencyInfo.m_FromAssets.Add(asset); - dependencyInfo.m_ToAssets.Add(ai); - } - } - } - } - - internal override bool RefreshDupeAssetWarning() - { - foreach (AssetInfo asset in m_DependentAssets) - if (asset != null && asset.IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) - { - SetDuplicateWarning(); - return true; - } - - return false; - } - - internal bool IsEmpty() - { - return m_ConcreteAssets.Count == 0; - } - - internal override bool RefreshEmptyStatus() - { - bool empty = IsEmpty(); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.EmptyBundle, empty); - return empty; - } - - protected void SetDuplicateWarning() - { - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, true); - m_Dirty = true; - } - - internal bool isSceneBundle - { - get { return m_IsSceneBundle; } - } - - internal override BundleTreeItem CreateTreeView(int depth) - { - RefreshAssetList(); - RefreshMessages(); - if (isSceneBundle) - return new BundleTreeItem(this, depth, Model.GetSceneIcon()); - else - return new BundleTreeItem(this, depth, Model.GetBundleIcon()); - } - - internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null) - { - RefreshAssetList(); - string newName = string.IsNullOrEmpty(parentName) ? "" : parentName + '/'; - newName += m_Name.shortName; - if (newName == m_Name.bundleName) - return; - - if (newParent != null && newParent.GetChild(newName) != null) - { - Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); - return; - } - - foreach (AssetInfo asset in m_ConcreteAssets) Model.MoveAssetToBundle(asset, newName, m_Name.variant); - - if (newParent != null) - { - m_Parent.HandleChildRename(m_Name.shortName, string.Empty); - m_Parent = newParent; - m_Parent.AddChild(this); - } - - m_Name.SetBundleName(newName, m_Name.variant); - } - - internal override List GetDependencies() - { - return m_DependentAssets; - } - - internal override bool DoesItemMatchSearch(string search) - { - foreach (AssetInfo asset in m_ConcreteAssets) - if (asset.displayName.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) - return true; - foreach (AssetInfo asset in m_DependentAssets) - if (asset.displayName.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) - return true; - return false; - } - } - - internal class BundleVariantDataInfo : BundleDataInfo - { - protected List m_FolderIncludeAssets = new List(); - - internal BundleVariantDataInfo(string name, BundleFolderInfo parent) : base(name, parent) - { - } - - internal override string displayName - { - get { return m_Name.variant; } - } - - internal override void Update() - { - base.Update(); - (m_Parent as BundleVariantFolderInfo).ValidateVariants(); - } - - internal override void RefreshAssetList() - { - m_FolderIncludeAssets.Clear(); - base.RefreshAssetList(); - if (m_DependentAssets.Count > 0) - m_FolderIncludeAssets = new List(m_DependentAssets); - } - - internal bool IsSceneVariant() - { - RefreshAssetList(); - return isSceneBundle; - } - - internal override bool HandleRename(string newName, int reverseDepth) - { - if (reverseDepth == 0) - { - RefreshAssetList(); - if (!m_Parent.HandleChildRename(m_Name.variant, newName)) - return false; - m_Name.variant = newName; - Model.MoveAssetToBundle(m_ConcreteAssets, m_Name.bundleName, m_Name.variant); - } - else if (reverseDepth == 1) - { - RefreshAssetList(); - m_Name.PartialNameChange(newName + "." + m_Name.variant, 0); - Model.MoveAssetToBundle(m_ConcreteAssets, m_Name.bundleName, m_Name.variant); - } - else - { - return base.HandleRename(newName, reverseDepth - 1); - } - - return true; - } - - internal override void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") - { - RefreshAssetList(); - if (isRootOfDelete) m_Parent.HandleChildRename(m_Name.variant, string.Empty); - Model.MoveAssetToBundle(m_ConcreteAssets, forcedNewName, forcedNewVariant); - } - - internal bool FindContentMismatch(BundleVariantDataInfo other) - { - bool result = false; - - if (m_FolderIncludeAssets.Count != 0 || other.m_FolderIncludeAssets.Count != 0) - { - HashSet myUniqueAssets = new HashSet(); - HashSet otherUniqueAssets = new HashSet(other.m_FolderIncludeAssets.Select(x => x.displayName)); - - foreach (AssetInfo asset in m_FolderIncludeAssets) - if (!otherUniqueAssets.Remove(asset.displayName)) - myUniqueAssets.Add(asset.displayName); - - if (myUniqueAssets.Count > 0) - { - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); - result = true; - } - - if (otherUniqueAssets.Count > 0) - { - other.m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); - result = true; - } - } - else //this doesn't cover the super weird case of including a folder and some explicit assets. TODO - fix that. - { - HashSet myUniqueAssets = new HashSet(); - HashSet otherUniqueAssets = new HashSet(other.m_ConcreteAssets.Select(x => x.displayName)); - - foreach (AssetInfo asset in m_ConcreteAssets) - if (!otherUniqueAssets.Remove(asset.displayName)) - myUniqueAssets.Add(asset.displayName); - - if (myUniqueAssets.Count > 0) - { - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); - result = true; - } - - if (otherUniqueAssets.Count > 0) - { - other.m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); - result = true; - } - } - - return result; - } - } - - - internal abstract class BundleFolderInfo : BundleInfo - { - protected Dictionary m_Children; - - internal BundleFolderInfo(string name, BundleFolderInfo parent) : base(name, parent) - { - m_Children = new Dictionary(); - } - - internal BundleFolderInfo(List path, int depth, BundleFolderInfo parent) : base("", parent) - { - m_Children = new Dictionary(); - m_Name = new BundleNameData(""); - m_Name.pathTokens = path.GetRange(0, depth); - } - - internal BundleInfo GetChild(string name) - { - if (name == null) - return null; - - BundleInfo info = null; - if (m_Children.TryGetValue(name, out info)) - return info; - return null; - } - - internal Dictionary.ValueCollection GetChildList() - { - return m_Children.Values; - } - - internal abstract void AddChild(BundleInfo info); - - internal override bool HandleRename(string newName, int reverseDepth) - { - if (!base.HandleRename(newName, reverseDepth)) - return false; - - foreach (KeyValuePair child in m_Children) child.Value.HandleRename(newName, reverseDepth + 1); - return true; - } - - internal override void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") - { - base.HandleDelete(isRootOfDelete); - foreach (KeyValuePair child in m_Children) child.Value.HandleDelete(false, forcedNewName, forcedNewVariant); - m_Children.Clear(); - } - - internal override bool DoesItemMatchSearch(string search) - { - return false; //folders don't ever match. - } - - protected override void RefreshMessages() - { - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.ErrorInChildren, false); - foreach (KeyValuePair child in m_Children) - if (child.Value.IsMessageSet(MessageSystem.MessageFlag.Error)) - { - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.ErrorInChildren, true); - break; - } - - base.RefreshMessages(); - } - - internal override bool RefreshEmptyStatus() - { - bool empty = m_Children.Count == 0; - foreach (KeyValuePair child in m_Children) empty |= child.Value.RefreshEmptyStatus(); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.EmptyFolder, empty); - return empty; - } - - internal override void RefreshAssetList() - { - foreach (KeyValuePair child in m_Children) child.Value.RefreshAssetList(); - } - - internal override bool RefreshDupeAssetWarning() - { - bool dupeWarning = false; - foreach (KeyValuePair child in m_Children) dupeWarning |= child.Value.RefreshDupeAssetWarning(); - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.WarningInChildren, dupeWarning); - return dupeWarning; - } - - internal override void AddAssetsToNode(AssetTreeItem node) - { - foreach (KeyValuePair child in m_Children) child.Value.AddAssetsToNode(node); - m_Dirty = false; - } - - internal virtual bool HandleChildRename(string oldName, string newName) - { - if (!string.IsNullOrEmpty(newName) && m_Children.ContainsKey(newName)) - { - Model.LogWarning("Attempting to name an item '" + newName + "' which matches existing name at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); - return false; - } - - BundleInfo info = null; - if (m_Children.TryGetValue(oldName, out info)) - { - m_Children.Remove(oldName); - if (!string.IsNullOrEmpty(newName)) - m_Children.Add(newName, info); - } - - return true; - } - - internal override void Update() - { - m_Dirty = false; - m_DoneUpdating = true; - foreach (KeyValuePair child in m_Children) - { - child.Value.Update(); - m_Dirty |= child.Value.dirty; - m_DoneUpdating &= child.Value.doneUpdating; - } - - if (m_Dirty || m_DoneUpdating) - RefreshMessages(); - } - - internal override bool doneUpdating - { - get - { - foreach (KeyValuePair child in m_Children) m_DoneUpdating &= child.Value.doneUpdating; - return base.doneUpdating; - } - } - - - internal override List GetDependencies() - { - List assets = new List(); - foreach (KeyValuePair child in m_Children) assets.AddRange(child.Value.GetDependencies()); - return assets; - } - } - - internal class BundleFolderConcreteInfo : BundleFolderInfo - { - internal BundleFolderConcreteInfo(string name, BundleFolderInfo parent) : base(name, parent) - { - } - - internal BundleFolderConcreteInfo(List path, int depth, BundleFolderInfo parent) : base(path, depth, parent) - { - } - - internal override void AddChild(BundleInfo info) - { - m_Children.Add(info.displayName, info); - } - - internal override BundleTreeItem CreateTreeView(int depth) - { - RefreshMessages(); - BundleTreeItem result = new BundleTreeItem(this, depth, Model.GetFolderIcon()); - foreach (KeyValuePair child in m_Children) result.AddChild(child.Value.CreateTreeView(depth + 1)); - return result; - } - - internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null) - { - string newName = string.IsNullOrEmpty(parentName) ? "" : parentName + '/'; - newName += displayName; - if (newName == m_Name.bundleName) - return; - - if (newParent != null && newParent.GetChild(newName) != null) - { - Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); - return; - } - - foreach (KeyValuePair child in m_Children) child.Value.HandleReparent(newName); - - if (newParent != null) - { - m_Parent.HandleChildRename(m_Name.shortName, string.Empty); - m_Parent = newParent; - m_Parent.AddChild(this); - } - - m_Name.SetBundleName(newName, m_Name.variant); - } - } - - - internal class BundleVariantFolderInfo : BundleFolderInfo - { - internal BundleVariantFolderInfo(string name, BundleFolderInfo parent) : base(name, parent) - { - } - - internal override void AddChild(BundleInfo info) - { - m_Children.Add(info.m_Name.variant, info); - } - - private bool m_validated; - - internal override void Update() - { - m_validated = false; - base.Update(); - if (!m_validated) - ValidateVariants(); - } - - internal void ValidateVariants() - { - m_validated = true; - bool childMismatch = false; - if (m_Children.Count > 1) - { - BundleVariantDataInfo goldChild = null; - foreach (KeyValuePair c in m_Children) - { - BundleVariantDataInfo child = c.Value as BundleVariantDataInfo; - child.SetMessageFlag(MessageSystem.MessageFlag.VariantBundleMismatch, false); - if (goldChild == null) - { - goldChild = child; - continue; - } - - childMismatch |= goldChild.FindContentMismatch(child); - } - } - - m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, childMismatch); - } - - internal override BundleTreeItem CreateTreeView(int depth) - { - RefreshMessages(); - Texture2D icon = null; - if (m_Children.Count > 0 && - (m_Children.First().Value as BundleVariantDataInfo).IsSceneVariant()) - icon = Model.GetSceneIcon(); - else - icon = Model.GetBundleIcon(); - - BundleTreeItem result = new BundleTreeItem(this, depth, icon); - foreach (KeyValuePair child in m_Children) result.AddChild(child.Value.CreateTreeView(depth + 1)); - return result; - } - - internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null) - { - string newName = string.IsNullOrEmpty(parentName) ? "" : parentName + '/'; - newName += displayName; - if (newName == m_Name.bundleName) - return; - - if (newParent != null && newParent.GetChild(newName) != null) - { - Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); - return; - } - - foreach (KeyValuePair child in m_Children) child.Value.HandleReparent(parentName); - - if (newParent != null) - { - m_Parent.HandleChildRename(m_Name.shortName, string.Empty); - m_Parent = newParent; - m_Parent.AddChild(this); - } - - m_Name.SetBundleName(newName, string.Empty); - } - - internal override bool HandleChildRename(string oldName, string newName) - { - bool result = base.HandleChildRename(oldName, newName); - if (m_Children.Count == 0) - HandleDelete(true); - return result; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs.meta deleted file mode 100644 index 75d82f4..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0909f7af70db1114abcc90714f37acb2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs deleted file mode 100644 index fc6ebc0..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs +++ /dev/null @@ -1,630 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; -using UnityEditor.IMGUI.Controls; -using System.Linq; -using System; -using AssetBundleBrowser.AssetBundleModel; - - -namespace AssetBundleBrowser -{ - internal class AssetBundleTree : TreeView - { - private AssetBundleManageTab m_Controller; - private bool m_ContextOnItem = false; - private List m_EmptyObjectList = new List(); - - internal AssetBundleTree(TreeViewState state, AssetBundleManageTab ctrl) : base(state) - { - AssetBundleModel.Model.Rebuild(); - m_Controller = ctrl; - showBorder = true; - } - - protected override bool CanMultiSelect(TreeViewItem item) - { - return true; - } - - protected override bool CanRename(TreeViewItem item) - { - return item != null && item.displayName.Length > 0; - } - - protected override bool DoesItemMatchSearch(TreeViewItem item, string search) - { - BundleTreeItem bundleItem = item as AssetBundleModel.BundleTreeItem; - return bundleItem.bundle.DoesItemMatchSearch(search); - } - - protected override void RowGUI(RowGUIArgs args) - { - BundleTreeItem bundleItem = args.item as AssetBundleModel.BundleTreeItem; - if (args.item.icon == null) - extraSpaceBeforeIconAndLabel = 16f; - else - extraSpaceBeforeIconAndLabel = 0f; - - Color old = GUI.color; - if (bundleItem.bundle as AssetBundleModel.BundleVariantFolderInfo != null) - GUI.color = AssetBundleModel.Model.k_LightGrey; //new Color(0.3f, 0.5f, 0.85f); - base.RowGUI(args); - GUI.color = old; - - MessageSystem.Message message = bundleItem.BundleMessage(); - if (message.severity != MessageType.None) - { - float size = args.rowRect.height; - float right = args.rowRect.xMax; - Rect messageRect = new Rect(right - size, args.rowRect.yMin, size, size); - GUI.Label(messageRect, new GUIContent(message.icon, message.message)); - } - } - - protected override void RenameEnded(RenameEndedArgs args) - { - base.RenameEnded(args); - if (args.newName.Length > 0 && args.newName != args.originalName) - { - args.newName = args.newName.ToLower(); - args.acceptedRename = true; - - BundleTreeItem renamedItem = FindItem(args.itemID, rootItem) as AssetBundleModel.BundleTreeItem; - args.acceptedRename = AssetBundleModel.Model.HandleBundleRename(renamedItem, args.newName); - ReloadAndSelect(renamedItem.bundle.nameHashCode, false); - } - else - { - args.acceptedRename = false; - } - } - - protected override TreeViewItem BuildRoot() - { - AssetBundleModel.Model.Refresh(); - BundleTreeItem root = AssetBundleModel.Model.CreateBundleTreeView(); - return root; - } - - protected override void SelectionChanged(IList selectedIds) - { - List selectedBundles = new List(); - if (selectedIds != null) - foreach (int id in selectedIds) - { - BundleTreeItem item = FindItem(id, rootItem) as AssetBundleModel.BundleTreeItem; - if (item != null && item.bundle != null) - { - item.bundle.RefreshAssetList(); - selectedBundles.Add(item.bundle); - } - } - - m_Controller.UpdateSelectedBundles(selectedBundles); - } - - public override void OnGUI(Rect rect) - { - base.OnGUI(rect); - if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) SetSelection(new int[0], TreeViewSelectionOptions.FireSelectionChanged); - } - - - protected override void ContextClicked() - { - if (m_ContextOnItem) - { - m_ContextOnItem = false; - return; - } - - List selectedNodes = new List(); - GenericMenu menu = new GenericMenu(); - - if (!AssetBundleModel.Model.DataSource.IsReadOnly()) - { - menu.AddItem(new GUIContent("Add new bundle"), false, CreateNewBundle, selectedNodes); - menu.AddItem(new GUIContent("Add new folder"), false, CreateFolder, selectedNodes); - } - - menu.AddItem(new GUIContent("Reload all data"), false, ForceReloadData, selectedNodes); - menu.ShowAsContext(); - } - - protected override void ContextClickedItem(int id) - { - if (AssetBundleModel.Model.DataSource.IsReadOnly()) return; - - m_ContextOnItem = true; - List selectedNodes = new List(); - foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.BundleTreeItem); - - GenericMenu menu = new GenericMenu(); - - if (selectedNodes.Count == 1) - { - if (selectedNodes[0].bundle as AssetBundleModel.BundleFolderConcreteInfo != null) - { - menu.AddItem(new GUIContent("Add Child/New Bundle"), false, CreateNewBundle, selectedNodes); - menu.AddItem(new GUIContent("Add Child/New Folder"), false, CreateFolder, selectedNodes); - menu.AddItem(new GUIContent("Add Sibling/New Bundle"), false, CreateNewSiblingBundle, selectedNodes); - menu.AddItem(new GUIContent("Add Sibling/New Folder"), false, CreateNewSiblingFolder, selectedNodes); - } - else if (selectedNodes[0].bundle as AssetBundleModel.BundleVariantFolderInfo != null) - { - menu.AddItem(new GUIContent("Add Child/New Variant"), false, CreateNewVariant, selectedNodes); - menu.AddItem(new GUIContent("Add Sibling/New Bundle"), false, CreateNewSiblingBundle, selectedNodes); - menu.AddItem(new GUIContent("Add Sibling/New Folder"), false, CreateNewSiblingFolder, selectedNodes); - } - else - { - BundleVariantDataInfo variant = selectedNodes[0].bundle as AssetBundleModel.BundleVariantDataInfo; - if (variant == null) - { - menu.AddItem(new GUIContent("Add Sibling/New Bundle"), false, CreateNewSiblingBundle, selectedNodes); - menu.AddItem(new GUIContent("Add Sibling/New Folder"), false, CreateNewSiblingFolder, selectedNodes); - menu.AddItem(new GUIContent("Convert to variant"), false, ConvertToVariant, selectedNodes); - } - else - { - menu.AddItem(new GUIContent("Add Sibling/New Variant"), false, CreateNewSiblingVariant, selectedNodes); - } - } - - if (selectedNodes[0].bundle.IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) - menu.AddItem(new GUIContent("Move duplicates to new bundle"), false, DedupeAllBundles, selectedNodes); - menu.AddItem(new GUIContent("Rename"), false, RenameBundle, selectedNodes); - menu.AddItem(new GUIContent("Delete " + selectedNodes[0].displayName), false, DeleteBundles, selectedNodes); - } - else if (selectedNodes.Count > 1) - { - menu.AddItem(new GUIContent("Move duplicates shared by selected"), false, DedupeOverlappedBundles, selectedNodes); - menu.AddItem(new GUIContent("Move duplicates existing in any selected"), false, DedupeAllBundles, selectedNodes); - menu.AddItem(new GUIContent("Delete " + selectedNodes.Count + " selected bundles"), false, DeleteBundles, selectedNodes); - } - - menu.ShowAsContext(); - } - - private void ForceReloadData(object context) - { - AssetBundleModel.Model.ForceReloadData(this); - } - - private void CreateNewSiblingFolder(object context) - { - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count > 0) - { - AssetBundleModel.BundleFolderConcreteInfo folder = null; - folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleFolderConcreteInfo; - CreateFolderUnderParent(folder); - } - else - { - Debug.LogError("could not add 'sibling' with no bundles selected"); - } - } - - private void CreateFolder(object context) - { - AssetBundleModel.BundleFolderConcreteInfo folder = null; - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count > 0) folder = selectedNodes[0].bundle as AssetBundleModel.BundleFolderConcreteInfo; - CreateFolderUnderParent(folder); - } - - private void CreateFolderUnderParent(AssetBundleModel.BundleFolderConcreteInfo folder) - { - BundleFolderInfo newBundle = AssetBundleModel.Model.CreateEmptyBundleFolder(folder); - ReloadAndSelect(newBundle.nameHashCode, true); - } - - private void RenameBundle(object context) - { - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count > 0) BeginRename(FindItem(selectedNodes[0].bundle.nameHashCode, rootItem)); - } - - private void CreateNewSiblingBundle(object context) - { - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count > 0) - { - AssetBundleModel.BundleFolderConcreteInfo folder = null; - folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleFolderConcreteInfo; - CreateBundleUnderParent(folder); - } - else - { - Debug.LogError("could not add 'sibling' with no bundles selected"); - } - } - - private void CreateNewBundle(object context) - { - AssetBundleModel.BundleFolderConcreteInfo folder = null; - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count > 0) folder = selectedNodes[0].bundle as AssetBundleModel.BundleFolderConcreteInfo; - CreateBundleUnderParent(folder); - } - - private void CreateBundleUnderParent(AssetBundleModel.BundleFolderInfo folder) - { - BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyBundle(folder); - ReloadAndSelect(newBundle.nameHashCode, true); - } - - - private void CreateNewSiblingVariant(object context) - { - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count > 0) - { - AssetBundleModel.BundleVariantFolderInfo folder = null; - folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleVariantFolderInfo; - CreateVariantUnderParent(folder); - } - else - { - Debug.LogError("could not add 'sibling' with no bundles selected"); - } - } - - private void CreateNewVariant(object context) - { - AssetBundleModel.BundleVariantFolderInfo folder = null; - List selectedNodes = context as List; - if (selectedNodes != null && selectedNodes.Count == 1) - { - folder = selectedNodes[0].bundle as AssetBundleModel.BundleVariantFolderInfo; - CreateVariantUnderParent(folder); - } - } - - private void CreateVariantUnderParent(AssetBundleModel.BundleVariantFolderInfo folder) - { - if (folder != null) - { - BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyVariant(folder); - ReloadAndSelect(newBundle.nameHashCode, true); - } - } - - private void ConvertToVariant(object context) - { - List selectedNodes = context as List; - if (selectedNodes.Count == 1) - { - BundleDataInfo bundle = selectedNodes[0].bundle as AssetBundleModel.BundleDataInfo; - BundleInfo newBundle = AssetBundleModel.Model.HandleConvertToVariant(bundle); - int hash = 0; - if (newBundle != null) - hash = newBundle.nameHashCode; - ReloadAndSelect(hash, true); - } - } - - private void DedupeOverlappedBundles(object context) - { - DedupeBundles(context, true); - } - - private void DedupeAllBundles(object context) - { - DedupeBundles(context, false); - } - - private void DedupeBundles(object context, bool onlyOverlappedAssets) - { - List selectedNodes = context as List; - BundleInfo newBundle = AssetBundleModel.Model.HandleDedupeBundles(selectedNodes.Select(item => item.bundle), onlyOverlappedAssets); - if (newBundle != null) - { - List selection = new List(); - selection.Add(newBundle.nameHashCode); - ReloadAndSelect(selection); - } - else - { - if (onlyOverlappedAssets) - Debug.LogWarning("There were no duplicated assets that existed across all selected bundles."); - else - Debug.LogWarning("No duplicate assets found after refreshing bundle contents."); - } - } - - private void DeleteBundles(object b) - { - List selectedNodes = b as List; - AssetBundleModel.Model.HandleBundleDelete(selectedNodes.Select(item => item.bundle)); - ReloadAndSelect(new List()); - } - - protected override void KeyEvent() - { - if (Event.current.keyCode == KeyCode.Delete && GetSelection().Count > 0) - { - List selectedNodes = new List(); - foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.BundleTreeItem); - DeleteBundles(selectedNodes); - } - } - - private class DragAndDropData - { - internal bool hasBundleFolder = false; - internal bool hasScene = false; - internal bool hasNonScene = false; - internal bool hasVariantChild = false; - internal List draggedNodes; - internal AssetBundleModel.BundleTreeItem targetNode; - internal DragAndDropArgs args; - internal string[] paths; - - internal DragAndDropData(DragAndDropArgs a) - { - args = a; - draggedNodes = DragAndDrop.GetGenericData("AssetBundleModel.BundleInfo") as List; - targetNode = args.parentItem as AssetBundleModel.BundleTreeItem; - paths = DragAndDrop.paths; - - if (draggedNodes != null) - foreach (BundleInfo bundle in draggedNodes) - if (bundle as AssetBundleModel.BundleFolderInfo != null) - { - hasBundleFolder = true; - } - else - { - BundleDataInfo dataBundle = bundle as AssetBundleModel.BundleDataInfo; - if (dataBundle != null) - { - if (dataBundle.isSceneBundle) - hasScene = true; - else - hasNonScene = true; - - if (dataBundle as AssetBundleModel.BundleVariantDataInfo != null) - hasVariantChild = true; - } - } - else if (DragAndDrop.paths != null) - foreach (string assetPath in DragAndDrop.paths) - if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(SceneAsset)) - hasScene = true; - else - hasNonScene = true; - } - } - - protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) - { - DragAndDropVisualMode visualMode = DragAndDropVisualMode.None; - DragAndDropData data = new DragAndDropData(args); - - if (AssetBundleModel.Model.DataSource.IsReadOnly()) return DragAndDropVisualMode.Rejected; - - if (data.hasScene && data.hasNonScene || - data.hasVariantChild) - return DragAndDropVisualMode.Rejected; - - switch (args.dragAndDropPosition) - { - case DragAndDropPosition.UponItem: - visualMode = HandleDragDropUpon(data); - break; - case DragAndDropPosition.BetweenItems: - visualMode = HandleDragDropBetween(data); - break; - case DragAndDropPosition.OutsideItems: - if (data.draggedNodes != null) - { - visualMode = DragAndDropVisualMode.Copy; - if (data.args.performDrop) - { - AssetBundleModel.Model.HandleBundleReparent(data.draggedNodes, null); - Reload(); - } - } - else if (data.paths != null) - { - visualMode = DragAndDropVisualMode.Copy; - if (data.args.performDrop) DragPathsToNewSpace(data.paths, null); - } - - break; - } - - return visualMode; - } - - private DragAndDropVisualMode HandleDragDropUpon(DragAndDropData data) - { - DragAndDropVisualMode visualMode = DragAndDropVisualMode.Copy; //Move; - BundleDataInfo targetDataBundle = data.targetNode.bundle as AssetBundleModel.BundleDataInfo; - if (targetDataBundle != null) - { - if (targetDataBundle.isSceneBundle) - { - if (data.hasNonScene) - return DragAndDropVisualMode.Rejected; - } - else - { - if (data.hasBundleFolder) - return DragAndDropVisualMode.Rejected; - else if (data.hasScene && !targetDataBundle.IsEmpty()) return DragAndDropVisualMode.Rejected; - } - - - if (data.args.performDrop) - { - if (data.draggedNodes != null) - { - AssetBundleModel.Model.HandleBundleMerge(data.draggedNodes, targetDataBundle); - ReloadAndSelect(targetDataBundle.nameHashCode, false); - } - else if (data.paths != null) - { - AssetBundleModel.Model.MoveAssetToBundle(data.paths, targetDataBundle.m_Name.bundleName, targetDataBundle.m_Name.variant); - AssetBundleModel.Model.ExecuteAssetMove(); - ReloadAndSelect(targetDataBundle.nameHashCode, false); - } - } - } - else - { - BundleFolderInfo folder = data.targetNode.bundle as AssetBundleModel.BundleFolderInfo; - if (folder != null) - { - if (data.args.performDrop) - { - if (data.draggedNodes != null) - { - AssetBundleModel.Model.HandleBundleReparent(data.draggedNodes, folder); - Reload(); - } - else if (data.paths != null) - { - DragPathsToNewSpace(data.paths, folder); - } - } - } - else - { - visualMode = DragAndDropVisualMode.Rejected; //must be a variantfolder - } - } - - return visualMode; - } - - private DragAndDropVisualMode HandleDragDropBetween(DragAndDropData data) - { - DragAndDropVisualMode visualMode = DragAndDropVisualMode.Copy; //Move; - - BundleTreeItem parent = data.args.parentItem as AssetBundleModel.BundleTreeItem; - - if (parent != null) - { - BundleVariantFolderInfo variantFolder = parent.bundle as AssetBundleModel.BundleVariantFolderInfo; - if (variantFolder != null) - return DragAndDropVisualMode.Rejected; - - if (data.args.performDrop) - { - BundleFolderConcreteInfo folder = parent.bundle as AssetBundleModel.BundleFolderConcreteInfo; - if (folder != null) - { - if (data.draggedNodes != null) - { - AssetBundleModel.Model.HandleBundleReparent(data.draggedNodes, folder); - Reload(); - } - else if (data.paths != null) - { - DragPathsToNewSpace(data.paths, folder); - } - } - } - } - - return visualMode; - } - - private string[] dragToNewSpacePaths = null; - private AssetBundleModel.BundleFolderInfo dragToNewSpaceRoot = null; - - private void DragPathsAsOneBundle() - { - BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyBundle(dragToNewSpaceRoot); - AssetBundleModel.Model.MoveAssetToBundle(dragToNewSpacePaths, newBundle.m_Name.bundleName, newBundle.m_Name.variant); - AssetBundleModel.Model.ExecuteAssetMove(); - ReloadAndSelect(newBundle.nameHashCode, true); - } - - private void DragPathsAsManyBundles() - { - List hashCodes = new List(); - foreach (string assetPath in dragToNewSpacePaths) - { - BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyBundle(dragToNewSpaceRoot, System.IO.Path.GetFileNameWithoutExtension(assetPath).ToLower()); - AssetBundleModel.Model.MoveAssetToBundle(assetPath, newBundle.m_Name.bundleName, newBundle.m_Name.variant); - hashCodes.Add(newBundle.nameHashCode); - } - - AssetBundleModel.Model.ExecuteAssetMove(); - ReloadAndSelect(hashCodes); - } - - private void DragPathsToNewSpace(string[] paths, AssetBundleModel.BundleFolderInfo root) - { - dragToNewSpacePaths = paths; - dragToNewSpaceRoot = root; - if (paths.Length > 1) - { - GenericMenu menu = new GenericMenu(); - menu.AddItem(new GUIContent("Create 1 Bundle"), false, DragPathsAsOneBundle); - string message = "Create "; - message += paths.Length; - message += " Bundles"; - menu.AddItem(new GUIContent(message), false, DragPathsAsManyBundles); - menu.ShowAsContext(); - } - else - { - DragPathsAsManyBundles(); - } - } - - protected override void SetupDragAndDrop(SetupDragAndDropArgs args) - { - if (args.draggedItemIDs == null) - return; - - DragAndDrop.PrepareStartDrag(); - - List selectedBundles = new List(); - foreach (int id in args.draggedItemIDs) - { - BundleTreeItem item = FindItem(id, rootItem) as AssetBundleModel.BundleTreeItem; - selectedBundles.Add(item.bundle); - } - - DragAndDrop.paths = null; - DragAndDrop.objectReferences = m_EmptyObjectList.ToArray(); - DragAndDrop.SetGenericData("AssetBundleModel.BundleInfo", selectedBundles); - DragAndDrop.visualMode = DragAndDropVisualMode.Copy; //Move; - DragAndDrop.StartDrag("AssetBundleTree"); - } - - protected override bool CanStartDrag(CanStartDragArgs args) - { - return true; - } - - internal void Refresh() - { - IList selection = GetSelection(); - Reload(); - SelectionChanged(selection); - } - - private void ReloadAndSelect(int hashCode, bool rename) - { - List selection = new List(); - selection.Add(hashCode); - ReloadAndSelect(selection); - if (rename) BeginRename(FindItem(hashCode, rootItem), 0.25f); - } - - private void ReloadAndSelect(IList hashCodes) - { - Reload(); - SetSelection(hashCodes, TreeViewSelectionOptions.RevealAndFrame); - SelectionChanged(hashCodes); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs.meta deleted file mode 100644 index ef357c3..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 54744ac396176e74aaed3c5053b12150 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs deleted file mode 100644 index c30c948..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs +++ /dev/null @@ -1,447 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; -using UnityEditor.IMGUI.Controls; -using System.Linq; -using AssetBundleBrowser.AssetBundleModel; - -//using System; - - -namespace AssetBundleBrowser -{ - internal class AssetListTree : TreeView - { - private List m_SourceBundles = new List(); - private AssetBundleManageTab m_Controller; - private List m_EmptyObjectList = new List(); - - internal static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState() - { - return new MultiColumnHeaderState(GetColumns()); - } - - private static MultiColumnHeaderState.Column[] GetColumns() - { - MultiColumnHeaderState.Column[] retVal = new MultiColumnHeaderState.Column[] - { - new MultiColumnHeaderState.Column(), - new MultiColumnHeaderState.Column(), - new MultiColumnHeaderState.Column(), - new MultiColumnHeaderState.Column() - }; - retVal[0].headerContent = new GUIContent("Asset", "Short name of asset. For full name select asset and see message below"); - retVal[0].minWidth = 50; - retVal[0].width = 100; - retVal[0].maxWidth = 300; - retVal[0].headerTextAlignment = TextAlignment.Left; - retVal[0].canSort = true; - retVal[0].autoResize = true; - - retVal[1].headerContent = new GUIContent("Bundle", "Bundle name. 'auto' means asset was pulled in due to dependency"); - retVal[1].minWidth = 50; - retVal[1].width = 100; - retVal[1].maxWidth = 300; - retVal[1].headerTextAlignment = TextAlignment.Left; - retVal[1].canSort = true; - retVal[1].autoResize = true; - - retVal[2].headerContent = new GUIContent("Size", "Size on disk"); - retVal[2].minWidth = 30; - retVal[2].width = 75; - retVal[2].maxWidth = 100; - retVal[2].headerTextAlignment = TextAlignment.Left; - retVal[2].canSort = true; - retVal[2].autoResize = true; - - retVal[3].headerContent = new GUIContent("!", "Errors, Warnings, or Info"); - retVal[3].minWidth = 16; - retVal[3].width = 16; - retVal[3].maxWidth = 16; - retVal[3].headerTextAlignment = TextAlignment.Left; - retVal[3].canSort = true; - retVal[3].autoResize = false; - - return retVal; - } - - private enum MyColumns - { - Asset, - Bundle, - Size, - Message - } - - internal enum SortOption - { - Asset, - Bundle, - Size, - Message - } - - private SortOption[] m_SortOptions = - { - SortOption.Asset, - SortOption.Bundle, - SortOption.Size, - SortOption.Message - }; - - internal AssetListTree(TreeViewState state, MultiColumnHeaderState mchs, AssetBundleManageTab ctrl) : base(state, new MultiColumnHeader(mchs)) - { - m_Controller = ctrl; - showBorder = true; - showAlternatingRowBackgrounds = true; - multiColumnHeader.sortingChanged += OnSortingChanged; - } - - - internal void Update() - { - bool dirty = false; - foreach (BundleInfo bundle in m_SourceBundles) dirty |= bundle.dirty; - if (dirty) - Reload(); - } - - public override void OnGUI(Rect rect) - { - base.OnGUI(rect); - if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) SetSelection(new int[0], TreeViewSelectionOptions.FireSelectionChanged); - } - - - protected override IList BuildRows(TreeViewItem root) - { - IList rows = base.BuildRows(root); - SortIfNeeded(root, rows); - return rows; - } - - internal void SetSelectedBundles(IEnumerable bundles) - { - m_Controller.SetSelectedItems(null); - m_SourceBundles = bundles.ToList(); - SetSelection(new List()); - Reload(); - } - - protected override TreeViewItem BuildRoot() - { - AssetTreeItem root = AssetBundleModel.Model.CreateAssetListTreeView(m_SourceBundles); - return root; - } - - protected override void RowGUI(RowGUIArgs args) - { - for (int i = 0; i < args.GetNumVisibleColumns(); ++i) - CellGUI(args.GetCellRect(i), args.item as AssetBundleModel.AssetTreeItem, args.GetColumn(i), ref args); - } - - private void CellGUI(Rect cellRect, AssetBundleModel.AssetTreeItem item, int column, ref RowGUIArgs args) - { - Color oldColor = GUI.color; - CenterRectUsingSingleLineHeight(ref cellRect); - if (column != 3) - GUI.color = item.itemColor; - - switch (column) - { - case 0: - { - Rect iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); - if (item.icon != null) - GUI.DrawTexture(iconRect, item.icon, ScaleMode.ScaleToFit); - DefaultGUI.Label( - new Rect(cellRect.x + iconRect.xMax + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height), - item.displayName, - args.selected, - args.focused); - } - break; - case 1: - DefaultGUI.Label(cellRect, item.asset.bundleName, args.selected, args.focused); - break; - case 2: - DefaultGUI.Label(cellRect, item.asset.GetSizeString(), args.selected, args.focused); - break; - case 3: - Texture2D icon = item.MessageIcon(); - if (icon != null) - { - Rect iconRect = new Rect(cellRect.x, cellRect.y, cellRect.height, cellRect.height); - GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); - } - - break; - } - - GUI.color = oldColor; - } - - protected override void DoubleClickedItem(int id) - { - AssetTreeItem assetItem = FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem; - if (assetItem != null) - { - Object o = AssetDatabase.LoadAssetAtPath(assetItem.asset.fullAssetName); - EditorGUIUtility.PingObject(o); - Selection.activeObject = o; - } - } - - public void SetSelection(List paths) - { - List selected = new List(); - AddIfInPaths(paths, selected, rootItem); - SetSelection(selected); - } - - private void AddIfInPaths(List paths, List selected, TreeViewItem me) - { - AssetTreeItem assetItem = me as AssetBundleModel.AssetTreeItem; - if (assetItem != null && assetItem.asset != null) - if (paths.Contains(assetItem.asset.fullAssetName)) - if (selected.Contains(me.id) == false) - selected.Add(me.id); - - if (me.hasChildren) - foreach (TreeViewItem item in me.children) - AddIfInPaths(paths, selected, item); - } - - protected override void SelectionChanged(IList selectedIds) - { - if (selectedIds == null) - return; - - List selectedObjects = new List(); - List selectedAssets = new List(); - foreach (int id in selectedIds) - { - AssetTreeItem assetItem = FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem; - if (assetItem != null) - { - Object o = AssetDatabase.LoadAssetAtPath(assetItem.asset.fullAssetName); - selectedObjects.Add(o); - Selection.activeObject = o; - selectedAssets.Add(assetItem.asset); - } - } - - m_Controller.SetSelectedItems(selectedAssets); - Selection.objects = selectedObjects.ToArray(); - } - - protected override bool CanBeParent(TreeViewItem item) - { - return false; - } - - protected override bool CanStartDrag(CanStartDragArgs args) - { - args.draggedItemIDs = GetSelection(); - return true; - } - - protected override void SetupDragAndDrop(SetupDragAndDropArgs args) - { - DragAndDrop.PrepareStartDrag(); - DragAndDrop.objectReferences = m_EmptyObjectList.ToArray(); - List items = - new List(args.draggedItemIDs.Select(id => FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem)); - DragAndDrop.paths = items.Select(a => a.asset.fullAssetName).ToArray(); - DragAndDrop.SetGenericData("AssetListTreeSource", this); - DragAndDrop.StartDrag("AssetListTree"); - } - - protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) - { - if (IsValidDragDrop()) - { - if (args.performDrop) - { - AssetBundleModel.Model.MoveAssetToBundle(DragAndDrop.paths, m_SourceBundles[0].m_Name.bundleName, m_SourceBundles[0].m_Name.variant); - AssetBundleModel.Model.ExecuteAssetMove(); - foreach (BundleInfo bundle in m_SourceBundles) bundle.RefreshAssetList(); - m_Controller.UpdateSelectedBundles(m_SourceBundles); - } - - return DragAndDropVisualMode.Copy; //Move; - } - - return DragAndDropVisualMode.Rejected; - } - - protected bool IsValidDragDrop() - { - //can't do drag & drop if data source is read only - if (AssetBundleModel.Model.DataSource.IsReadOnly()) - return false; - - //can't drag onto none or >1 bundles - if (m_SourceBundles.Count == 0 || m_SourceBundles.Count > 1) - return false; - - //can't drag nothing - if (DragAndDrop.paths == null || DragAndDrop.paths.Length == 0) - return false; - - //can't drag into a folder - BundleFolderInfo folder = m_SourceBundles[0] as AssetBundleModel.BundleFolderInfo; - if (folder != null) - return false; - - BundleDataInfo data = m_SourceBundles[0] as AssetBundleModel.BundleDataInfo; - if (data == null) - return false; // this should never happen. - - AssetListTree thing = DragAndDrop.GetGenericData("AssetListTreeSource") as AssetListTree; - if (thing != null) - return false; - - if (data.IsEmpty()) - return true; - - - if (data.isSceneBundle) - { - foreach (string assetPath in DragAndDrop.paths) - if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) != typeof(SceneAsset) && - !AssetDatabase.IsValidFolder(assetPath)) - return false; - } - else - { - foreach (string assetPath in DragAndDrop.paths) - if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(SceneAsset)) - return false; - } - - return true; - } - - protected override void ContextClickedItem(int id) - { - if (AssetBundleModel.Model.DataSource.IsReadOnly()) return; - - List selectedNodes = new List(); - foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.AssetTreeItem); - - if (selectedNodes.Count > 0) - { - GenericMenu menu = new GenericMenu(); - menu.AddItem(new GUIContent("Remove asset(s) from bundle."), false, RemoveAssets, selectedNodes); - menu.ShowAsContext(); - } - } - - private void RemoveAssets(object obj) - { - List selectedNodes = obj as List; - List assets = new List(); - //var bundles = new List(); - foreach (AssetTreeItem node in selectedNodes) - if (!string.IsNullOrEmpty(node.asset.bundleName)) - assets.Add(node.asset); - AssetBundleModel.Model.MoveAssetToBundle(assets, string.Empty, string.Empty); - AssetBundleModel.Model.ExecuteAssetMove(); - foreach (BundleInfo bundle in m_SourceBundles) bundle.RefreshAssetList(); - m_Controller.UpdateSelectedBundles(m_SourceBundles); - //ReloadAndSelect(new List()); - } - - protected override void KeyEvent() - { - if (m_SourceBundles.Count > 0 && Event.current.keyCode == KeyCode.Delete && GetSelection().Count > 0) - { - List selectedNodes = new List(); - foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.AssetTreeItem); - - RemoveAssets(selectedNodes); - } - } - - private void OnSortingChanged(MultiColumnHeader multiColumnHeader) - { - SortIfNeeded(rootItem, GetRows()); - } - - private void SortIfNeeded(TreeViewItem root, IList rows) - { - if (rows.Count <= 1) - return; - - if (multiColumnHeader.sortedColumnIndex == -1) - return; - - SortByColumn(); - - rows.Clear(); - for (int i = 0; i < root.children.Count; i++) - rows.Add(root.children[i]); - - Repaint(); - } - - private void SortByColumn() - { - int[] sortedColumns = multiColumnHeader.state.sortedColumns; - - if (sortedColumns.Length == 0) - return; - - List assetList = new List(); - foreach (TreeViewItem item in rootItem.children) assetList.Add(item as AssetBundleModel.AssetTreeItem); - IOrderedEnumerable orderedItems = InitialOrder(assetList, sortedColumns); - - rootItem.children = orderedItems.Cast().ToList(); - } - - private IOrderedEnumerable InitialOrder(IEnumerable myTypes, int[] columnList) - { - SortOption sortOption = m_SortOptions[columnList[0]]; - bool ascending = multiColumnHeader.IsSortedAscending(columnList[0]); - switch (sortOption) - { - case SortOption.Asset: - return myTypes.Order(l => l.displayName, ascending); - case SortOption.Size: - return myTypes.Order(l => l.asset.fileSize, ascending); - case SortOption.Message: - return myTypes.Order(l => l.HighestMessageLevel(), ascending); - case SortOption.Bundle: - default: - return myTypes.Order(l => l.asset.bundleName, ascending); - } - } - - private void ReloadAndSelect(IList hashCodes) - { - Reload(); - SetSelection(hashCodes); - SelectionChanged(hashCodes); - } - } - - internal static class MyExtensionMethods - { - internal static IOrderedEnumerable Order(this IEnumerable source, System.Func selector, bool ascending) - { - if (ascending) - return source.OrderBy(selector); - else - return source.OrderByDescending(selector); - } - - internal static IOrderedEnumerable ThenBy(this IOrderedEnumerable source, System.Func selector, bool ascending) - { - if (ascending) - return source.ThenBy(selector); - else - return source.ThenByDescending(selector); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs.meta deleted file mode 100644 index ca9d508..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a3caba452c4f3a543b831e94871aebc6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs b/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs deleted file mode 100644 index 4c61e29..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs +++ /dev/null @@ -1,300 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; -using AssetBundleBrowser.AssetBundleModel; -using UnityEditor.IMGUI.Controls; - -namespace AssetBundleBrowser -{ - internal class BundleDetailItem : TreeViewItem - { - internal BundleDetailItem(int id, int depth, string displayName, MessageType type) : base(id, depth, displayName) - { - MessageLevel = type; - } - - internal MessageType MessageLevel { get; set; } - } - - internal class TogglePathTreeViewItem : TreeViewItem - { - private static bool m_DisplayAlt = false; - - private string m_DisplayNamePrefix; - private string m_Path; - - public string Path - { - get { return m_Path; } - } - - public string DisplayNamePrefix - { - get { return m_DisplayNamePrefix; } - } - - public TogglePathTreeViewItem(int id, int depth, string displayName, string path) - { - base.depth = depth; - base.id = id; - base.displayName = displayName; - m_Path = path; - m_DisplayNamePrefix = ""; - } - - public TogglePathTreeViewItem(int id, int depth, string displayNamePrefix, string displayName, string path) - { - base.depth = depth; - base.id = id; - base.displayName = displayName; - m_Path = path; - m_DisplayNamePrefix = displayNamePrefix; - } - - public override string displayName - { - get - { - // TODO this is a bit unresponsive here in large projects, see if can be better elsewhere - Event e = Event.current; - if (e.alt && e.type == EventType.MouseDown) - m_DisplayAlt = !m_DisplayAlt; - - return m_DisplayNamePrefix + (m_DisplayAlt ? m_Path : base.displayName); - } - set { base.displayName = value; } - } - } - - internal class BundleDetailList : TreeView - { - private HashSet m_Selecteditems; - private Rect m_TotalRect; - - private const float k_DoubleIndent = 32f; - private const string k_SizeHeader = "Size: "; - private const string k_DependencyHeader = "Dependent On:"; - private const string k_DependencyEmpty = k_DependencyHeader + " - None"; - private const string k_MessageHeader = "Messages:"; - private const string k_MessageEmpty = k_MessageHeader + " - None"; - private const string k_ReferencedPrefix = "- "; - - - internal BundleDetailList(TreeViewState state) : base(state) - { - m_Selecteditems = new HashSet(); - showBorder = true; - } - - internal void Update() - { - bool dirty = false; - foreach (BundleDataInfo bundle in m_Selecteditems) dirty |= bundle.dirty; - if (dirty) - { - Reload(); - ExpandAll(2); - } - } - - protected override TreeViewItem BuildRoot() - { - TreeViewItem root = new TreeViewItem(-1, -1); - root.children = new List(); - if (m_Selecteditems != null) - foreach (BundleDataInfo bundle in m_Selecteditems) - root.AddChild(AppendBundleToTree(bundle)); - return root; - } - - protected override void RowGUI(RowGUIArgs args) - { - if (args.item as BundleDetailItem != null) - { - EditorGUI.HelpBox( - new Rect(args.rowRect.x + k_DoubleIndent, args.rowRect.y, args.rowRect.width - k_DoubleIndent, args.rowRect.height), - args.item.displayName, - (args.item as BundleDetailItem).MessageLevel); - } - else - { - Color old = GUI.color; - if (args.item.depth == 1 && - (args.item.displayName == k_MessageEmpty || args.item.displayName == k_DependencyEmpty)) - GUI.color = Model.k_LightGrey; - base.RowGUI(args); - GUI.color = old; - } - } - - public override void OnGUI(Rect rect) - { - m_TotalRect = rect; - base.OnGUI(rect); - } - - protected override float GetCustomRowHeight(int row, TreeViewItem item) - { - if (item as BundleDetailItem != null) - { - float height = DefaultStyles.backgroundEven.CalcHeight(new GUIContent(item.displayName), m_TotalRect.width); - return height + 3f; - } - - return base.GetCustomRowHeight(row, item); - } - - - protected override void SelectionChanged(IList selectedIds) - { - base.SelectionChanged(selectedIds); - List pathList = new List(); - - for (int i = 0; i < selectedIds.Count; ++i) - { - TreeViewItem item = FindItem(selectedIds[i], rootItem); - if (item != null) AddDependentAssetsRecursive(item, pathList); - } - - AssetBundleBrowserMain.instance.m_ManageTab.SetAssetListSelection(pathList); - } - - private void AddDependentAssetsRecursive(TreeViewItem item, List pathList) - { - TogglePathTreeViewItem pathItem = item as TogglePathTreeViewItem; - if (pathItem != null) - if (string.IsNullOrEmpty(pathItem.DisplayNamePrefix) == false && pathList.Contains(pathItem.Path) == false) - pathList.Add(pathItem.Path); - - if (item.hasChildren) - for (int i = 0; i < item.children.Count; ++i) - AddDependentAssetsRecursive(item.children[i], pathList); - } - - protected override void DoubleClickedItem(int id) - { - base.DoubleClickedItem(id); - TreeViewItem item = FindItem(id, rootItem); - if (item != null) - { - TogglePathTreeViewItem pathItem = item as TogglePathTreeViewItem; - if (pathItem != null) - { - Object o = AssetDatabase.LoadAssetAtPath(pathItem.Path); - if (o != null) - { - Selection.activeObject = o; - EditorGUIUtility.PingObject(o); - } - } - } - } - - internal static TreeViewItem AppendBundleToTree(BundleDataInfo bundle) - { - string itemName = bundle.m_Name.fullNativeName; - TreeViewItem bunRoot = new TreeViewItem(itemName.GetHashCode(), 0, itemName); - - string str = itemName + k_SizeHeader; - TreeViewItem sz = new TreeViewItem(str.GetHashCode(), 1, k_SizeHeader + bundle.TotalSize()); - - str = itemName + k_DependencyHeader; - TreeViewItem dependency = new TreeViewItem(str.GetHashCode(), 1, k_DependencyEmpty); - List depList = bundle.GetBundleDependencies(); - if (depList.Count > 0) - { - dependency.displayName = k_DependencyHeader; - foreach (BundleDependencyInfo dep in bundle.GetBundleDependencies()) - { - str = itemName + dep.m_BundleName; - TreeViewItem newItem = new TreeViewItem(str.GetHashCode(), 2, dep.m_BundleName); - newItem.icon = Model.GetBundleIcon(); - dependency.AddChild(newItem); - - Dictionary toAssetItems = new Dictionary(); - - for (int i = 0; i < dep.m_FromAssets.Count; ++i) - { - TogglePathTreeViewItem item = null; - - if (!toAssetItems.TryGetValue(dep.m_ToAssets[i].fullAssetName, out item)) - { - str = itemName + dep.m_BundleName + dep.m_ToAssets[i].displayName; - item = new TogglePathTreeViewItem(str.GetHashCode(), 3, "/" + dep.m_ToAssets[i].displayName, "/" + dep.m_ToAssets[i].fullAssetName); - item.icon = AssetDatabase.GetCachedIcon(dep.m_ToAssets[i].fullAssetName) as Texture2D; - newItem.AddChild(item); - toAssetItems.Add(dep.m_ToAssets[i].fullAssetName, item); - } - - str = str + dep.m_FromAssets[i].displayName; - TreeViewItem refItem = new TogglePathTreeViewItem(str.GetHashCode(), 4, k_ReferencedPrefix, - dep.m_FromAssets[i].displayName, dep.m_FromAssets[i].fullAssetName); - refItem.icon = AssetDatabase.GetCachedIcon(dep.m_FromAssets[i].fullAssetName) as Texture2D; - item.AddChild(refItem); - } - } - } - - str = itemName + k_MessageHeader; - TreeViewItem msg = new TreeViewItem(str.GetHashCode(), 1, k_MessageEmpty); - if (bundle.HasMessages()) - { - msg.displayName = k_MessageHeader; - List currMessages = bundle.GetMessages(); - - foreach (MessageSystem.Message currMsg in currMessages) - { - str = itemName + currMsg.message; - msg.AddChild(new BundleDetailItem(str.GetHashCode(), 2, currMsg.message, currMsg.severity)); - } - } - - - bunRoot.AddChild(sz); - bunRoot.AddChild(dependency); - bunRoot.AddChild(msg); - - return bunRoot; - } - - - internal void SetItems(IEnumerable items) - { - m_Selecteditems.Clear(); - foreach (BundleInfo item in items) CollectBundles(item); - SetSelection(new List()); - Reload(); - ExpandAll(2); - } - - internal void CollectBundles(BundleInfo bundle) - { - BundleDataInfo bunData = bundle as BundleDataInfo; - if (bunData != null) - { - m_Selecteditems.Add(bunData); - } - else - { - BundleFolderInfo bunFolder = bundle as BundleFolderInfo; - foreach (BundleInfo bun in bunFolder.GetChildList()) CollectBundles(bun); - } - } - - internal void ExpandAll(int maximumDepth) - { - List expanded = new List(GetExpanded()); - FindItems(rootItem, maximumDepth, expanded); - SetExpanded(expanded); - } - - internal void FindItems(TreeViewItem item, int maximumDepth, List expanded) - { - if (item.depth >= maximumDepth || !item.hasChildren) - return; - - expanded.Add(item.id); - for (int i = 0; i < item.children.Count; ++i) FindItems(item.children[i], maximumDepth, expanded); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs.meta deleted file mode 100644 index a49595f..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37b2e435499908144b0d282ed2719039 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Icons.meta deleted file mode 100644 index 05ddae1..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/Icons.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fabc705ac6bb6b746ac5ade02708d0b9 -folderAsset: yes -timeCreated: 1491494491 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png deleted file mode 100644 index de1091a..0000000 Binary files a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png and /dev/null differ diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png.meta deleted file mode 100644 index b4d455b..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png.meta +++ /dev/null @@ -1,77 +0,0 @@ -fileFormatVersion: 2 -guid: e0af1b5107fe5c2428026d9f032c64c0 -TextureImporter: - fileIDToRecycleName: {} - externalObjects: {} - serializedVersion: 5 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - serializedVersion: 2 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png deleted file mode 100644 index 26cecc9..0000000 Binary files a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png and /dev/null differ diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png.meta deleted file mode 100644 index 4c67514..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png.meta +++ /dev/null @@ -1,77 +0,0 @@ -fileFormatVersion: 2 -guid: 2c52be92045472a4bb2d2fa348b08d6d -TextureImporter: - fileIDToRecycleName: {} - externalObjects: {} - serializedVersion: 5 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - serializedVersion: 2 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab.meta deleted file mode 100644 index 4636434..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5d1c1f5fd30f85c4f971269388fad046 -folderAsset: yes -timeCreated: 1497983785 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs deleted file mode 100644 index 1e47136..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs +++ /dev/null @@ -1,460 +0,0 @@ -using UnityEditor; -using UnityEngine; -using UnityEditor.IMGUI.Controls; -using System.Collections.Generic; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using System.Linq; - -namespace AssetBundleBrowser -{ - [System.Serializable] - internal class AssetBundleInspectTab - { - private Rect m_Position; - - [SerializeField] private InspectTabData m_Data; - - - private Dictionary> m_BundleList; - private InspectBundleTree m_BundleTreeView; - [SerializeField] private TreeViewState m_BundleTreeState; - - internal Editor m_Editor = null; - - private SingleBundleInspector m_SingleInspector; - - /// - /// Collection of loaded asset bundle records indexed by bundle name - /// - private Dictionary m_loadedAssetBundles; - - /// - /// Returns the record for a loaded asset bundle by name if it exists in our container. - /// - /// Asset bundle record instance if loaded, otherwise null. - /// Name of the loaded asset bundle, excluding the variant extension - private AssetBundleRecord GetLoadedBundleRecordByName(string bundleName) - { - if (string.IsNullOrEmpty(bundleName)) return null; - - if (!m_loadedAssetBundles.ContainsKey(bundleName)) return null; - - return m_loadedAssetBundles[bundleName]; - } - - internal AssetBundleInspectTab() - { - m_BundleList = new Dictionary>(); - m_SingleInspector = new SingleBundleInspector(); - m_loadedAssetBundles = new Dictionary(); - } - - internal void OnEnable(Rect pos) - { - m_Position = pos; - if (m_Data == null) - m_Data = new InspectTabData(); - - //LoadData... - string dataPath = Path.GetFullPath("."); - dataPath = dataPath.Replace("\\", "/"); - dataPath += "/Library/AssetBundleBrowserInspect.dat"; - - if (File.Exists(dataPath)) - { - BinaryFormatter bf = new BinaryFormatter(); - FileStream file = File.Open(dataPath, FileMode.Open); - InspectTabData data = bf.Deserialize(file) as InspectTabData; - if (data != null) - m_Data = data; - file.Close(); - } - - - if (m_BundleList == null) - m_BundleList = new Dictionary>(); - - if (m_BundleTreeState == null) - m_BundleTreeState = new TreeViewState(); - m_BundleTreeView = new InspectBundleTree(m_BundleTreeState, this); - - - RefreshBundles(); - } - - internal void OnDisable() - { - ClearData(); - - string dataPath = Path.GetFullPath("."); - dataPath = dataPath.Replace("\\", "/"); - dataPath += "/Library/AssetBundleBrowserInspect.dat"; - - BinaryFormatter bf = new BinaryFormatter(); - FileStream file = File.Create(dataPath); - - bf.Serialize(file, m_Data); - file.Close(); - } - - internal void OnGUI(Rect pos) - { - m_Position = pos; - - if (Application.isPlaying) - { - GUIStyle style = new GUIStyle(GUI.skin.label); - style.alignment = TextAnchor.MiddleCenter; - style.wordWrap = true; - GUI.Label( - new Rect(m_Position.x + 1f, m_Position.y + 1f, m_Position.width - 2f, m_Position.height - 2f), - new GUIContent("Inspector unavailable while in PLAY mode"), - style); - } - else - { - OnGUIEditor(); - } - } - - private void OnGUIEditor() - { - EditorGUILayout.Space(); - GUILayout.BeginHorizontal(); - - if (GUILayout.Button("Add File", GUILayout.MaxWidth(75f))) BrowseForFile(); - if (GUILayout.Button("Add Folder", GUILayout.MaxWidth(75f))) BrowseForFolder(); - - GUILayout.EndHorizontal(); - EditorGUILayout.Space(); - - if (m_BundleList.Count > 0) - { - int halfWidth = (int) (m_Position.width / 2.0f); - m_BundleTreeView.OnGUI(new Rect(m_Position.x, m_Position.y + 30, halfWidth, m_Position.height - 30)); - m_SingleInspector.OnGUI(new Rect(m_Position.x + halfWidth, m_Position.y + 30, halfWidth, m_Position.height - 30)); - } - } - - internal void RemoveBundlePath(string pathToRemove) - { - UnloadBundle(pathToRemove); - m_Data.RemovePath(pathToRemove); - } - - internal void RemoveBundleFolder(string pathToRemove) - { - List paths = null; - if (m_BundleList.TryGetValue(pathToRemove, out paths)) - foreach (string p in paths) - UnloadBundle(p); - m_Data.RemoveFolder(pathToRemove); - } - - private void BrowseForFile() - { - string newPath = EditorUtility.OpenFilePanelWithFilters("Bundle Folder", string.Empty, new string[] { }); - if (!string.IsNullOrEmpty(newPath)) - { - string gamePath = Path.GetFullPath("."); //TODO - FileUtil.GetProjectRelativePath?? - gamePath = gamePath.Replace("\\", "/"); - if (newPath.StartsWith(gamePath)) - newPath = newPath.Remove(0, gamePath.Length + 1); - - m_Data.AddPath(newPath); - - RefreshBundles(); - } - } - - //TODO - this is largely copied from BuildTab, should maybe be shared code. - private void BrowseForFolder(string folderPath = null) - { - folderPath = EditorUtility.OpenFolderPanel("Bundle Folder", string.Empty, string.Empty); - if (!string.IsNullOrEmpty(folderPath)) - { - string gamePath = Path.GetFullPath("."); //TODO - FileUtil.GetProjectRelativePath?? - gamePath = gamePath.Replace("\\", "/"); - if (folderPath.Length > gamePath.Length && folderPath.StartsWith(gamePath)) - folderPath = folderPath.Remove(0, gamePath.Length + 1); - - AddBundleFolder(folderPath); - - RefreshBundles(); - } - } - - internal void AddBundleFolder(string folderPath) - { - m_Data.AddFolder(folderPath); - } - - private void ClearData() - { - m_SingleInspector.SetBundle(null); - - if (null != m_loadedAssetBundles) - { - List records = new List(m_loadedAssetBundles.Values); - foreach (AssetBundleRecord record in records) record.bundle.Unload(true); - - m_loadedAssetBundles.Clear(); - } - } - - internal void RefreshBundles() - { - ClearData(); - - - if (m_Data.BundlePaths == null) - return; - - //find assets - if (m_BundleList == null) - m_BundleList = new Dictionary>(); - - m_BundleList.Clear(); - List pathsToRemove = new List(); - foreach (string filePath in m_Data.BundlePaths) - if (File.Exists(filePath)) - { - AddBundleToList(string.Empty, filePath); - } - else - { - Debug.Log("Expected bundle not found: " + filePath); - pathsToRemove.Add(filePath); - } - - foreach (string path in pathsToRemove) m_Data.RemovePath(path); - pathsToRemove.Clear(); - - foreach (InspectTabData.BundleFolderData folder in m_Data.BundleFolders) - if (Directory.Exists(folder.path)) - { - AddFilePathToList(folder.path, folder.path); - } - else - { - Debug.Log("Expected folder not found: " + folder); - pathsToRemove.Add(folder.path); - } - - foreach (string path in pathsToRemove) m_Data.RemoveFolder(path); - - m_BundleTreeView.Reload(); - } - - private void AddBundleToList(string parent, string bundlePath) - { - List bundles = null; - m_BundleList.TryGetValue(parent, out bundles); - - if (bundles == null) - { - bundles = new List(); - m_BundleList.Add(parent, bundles); - } - - bundles.Add(bundlePath); - } - - private void AddFilePathToList(string rootPath, string path) - { - string[] notAllowedExtensions = new string[] {".meta", ".manifest", ".dll", ".cs", ".exe", ".js"}; - foreach (string file in Directory.GetFiles(path)) - { - string ext = Path.GetExtension(file); - if (!notAllowedExtensions.Contains(ext)) - { - string f = file.Replace('\\', '/'); - if (File.Exists(file) && !m_Data.FolderIgnoresFile(rootPath, f)) AddBundleToList(rootPath, f); - } - } - - foreach (string dir in Directory.GetDirectories(path)) AddFilePathToList(rootPath, dir); - } - - internal Dictionary> BundleList - { - get { return m_BundleList; } - } - - - internal void SetBundleItem(IList selected) - { - //m_SelectedBundleTreeItems = selected; - if (selected == null || selected.Count == 0 || selected[0] == null) - { - m_SingleInspector.SetBundle(null); - } - else if (selected.Count == 1) - { - AssetBundle bundle = LoadBundle(selected[0].bundlePath); - m_SingleInspector.SetBundle(bundle, selected[0].bundlePath, m_Data, this); - } - else - { - m_SingleInspector.SetBundle(null); - - //perhaps there should be a way to set a message in the inspector, to tell it... - //var style = GUI.skin.label; - //style.alignment = TextAnchor.MiddleCenter; - //style.wordWrap = true; - //GUI.Label( - // inspectorRect, - // new GUIContent("Multi-select inspection not supported"), - // style); - } - } - - [System.Serializable] - internal class InspectTabData - { - [SerializeField] private List m_BundlePaths = new List(); - [SerializeField] private List m_BundleFolders = new List(); - - internal IList BundlePaths - { - get { return m_BundlePaths.AsReadOnly(); } - } - - internal IList BundleFolders - { - get { return m_BundleFolders.AsReadOnly(); } - } - - internal void AddPath(string newPath) - { - if (!m_BundlePaths.Contains(newPath)) - { - BundleFolderData possibleFolderData = FolderDataContainingFilePath(newPath); - if (possibleFolderData == null) - m_BundlePaths.Add(newPath); - else - possibleFolderData.ignoredFiles.Remove(newPath); - } - } - - internal void AddFolder(string newPath) - { - if (!BundleFolderContains(newPath)) - m_BundleFolders.Add(new BundleFolderData(newPath)); - } - - internal void RemovePath(string pathToRemove) - { - m_BundlePaths.Remove(pathToRemove); - } - - internal void RemoveFolder(string pathToRemove) - { - m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.path == pathToRemove)); - } - - internal bool FolderIgnoresFile(string folderPath, string filePath) - { - if (BundleFolders == null) - return false; - BundleFolderData bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.path == folderPath); - return bundleFolderData != null && bundleFolderData.ignoredFiles.Contains(filePath); - } - - internal BundleFolderData FolderDataContainingFilePath(string filePath) - { - foreach (BundleFolderData bundleFolderData in BundleFolders) - if (Path.GetFullPath(filePath).StartsWith(Path.GetFullPath(bundleFolderData.path))) - return bundleFolderData; - return null; - } - - private bool BundleFolderContains(string folderPath) - { - foreach (BundleFolderData bundleFolderData in BundleFolders) - if (Path.GetFullPath(bundleFolderData.path) == Path.GetFullPath(folderPath)) - return true; - return false; - } - - [System.Serializable] - internal class BundleFolderData - { - [SerializeField] internal string path; - - [SerializeField] private List m_ignoredFiles; - - internal List ignoredFiles - { - get - { - if (m_ignoredFiles == null) - m_ignoredFiles = new List(); - return m_ignoredFiles; - } - } - - internal BundleFolderData(string p) - { - path = p; - } - } - } - - /// - /// Returns the bundle at the specified path, loading it if necessary. - /// Unloads previously loaded bundles if necessary when dealing with variants. - /// - /// Returns the loaded bundle, null if it could not be loaded. - /// Path of bundle to get - private AssetBundle LoadBundle(string path) - { - if (string.IsNullOrEmpty(path)) return null; - - string extension = Path.GetExtension(path); - - string bundleName = path.Substring(0, path.Length - extension.Length); - - // Check if we have a record for this bundle - AssetBundleRecord record = GetLoadedBundleRecordByName(bundleName); - AssetBundle bundle = null; - if (null != record) - { - // Unload existing bundle if variant names differ, otherwise use existing bundle - if (!record.path.Equals(path)) - UnloadBundle(bundleName); - else - bundle = record.bundle; - } - - if (null == bundle) - { - // Load the bundle - bundle = AssetBundle.LoadFromFile(path); - if (null == bundle) return null; - - m_loadedAssetBundles[bundleName] = new AssetBundleRecord(path, bundle); - - // Load the bundle's assets - string[] assetNames = bundle.GetAllAssetNames(); - foreach (string name in assetNames) bundle.LoadAsset(name); - } - - return bundle; - } - - /// - /// Unloads the bundle with the given name. - /// - /// Name of the bundle to unload without variant extension - private void UnloadBundle(string bundleName) - { - AssetBundleRecord record = GetLoadedBundleRecordByName(bundleName); - if (null == record) return; - - record.bundle.Unload(true); - m_loadedAssetBundles.Remove(bundleName); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs.meta deleted file mode 100644 index 629e210..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c6578866792bb814088661383f4a7471 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs deleted file mode 100644 index fb0328c..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs +++ /dev/null @@ -1,60 +0,0 @@ -using UnityEngine; - -namespace AssetBundleBrowser -{ - /// - /// This class maintains a record of a loaded asset bundle, allowing us - /// to associate the full path of an asset bundle with the actual bundle, - /// so that we can: - /// - /// 1. distinguish between bundle variants, which, when loaded - /// resolve to the same name. - /// - /// 2. Differentiate between the same asset bundles built for different platforms. - /// - /// ex: - /// - /// Two asset bundle variants: - /// - /// - variant one: mycylinder.one - /// - variant two: mycylinder.two - /// - /// Will Resolve to "mycylinder" when loaded. - /// - /// Likewise, - /// - /// - iOS: AssetBundles/iOS/myBundle - /// - Android: AssetBundle/Android/myBundle - /// - /// Will both resolve to "mybundle" when loaded. - /// - /// - internal class AssetBundleRecord - { - /// - /// Full path of the asset bundle. - /// - internal string path { get; private set; } - - /// - /// Reference to the loaded asset bundle associated with the path. - /// - internal AssetBundle bundle { get; private set; } - - internal AssetBundleRecord(string path, AssetBundle bundle) - { - if (string.IsNullOrEmpty(path) || - null == bundle) - { - string msg = string.Format("AssetBundleRecord encountered invalid parameters path={0}, bundle={1}", - path, - bundle); - - throw new System.ArgumentException(msg); - } - - this.path = path; - this.bundle = bundle; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs.meta deleted file mode 100644 index e29312a..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0544e0691b210254c9301d8fb106c04a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs deleted file mode 100644 index 5153a47..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs +++ /dev/null @@ -1,127 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.IO; - -namespace AssetBundleBrowser -{ - internal class SingleBundleInspector - { - internal static string currentPath { get; set; } - - - internal SingleBundleInspector() - { - } - - private Editor m_Editor = null; - - private Rect m_Position; - - [SerializeField] private Vector2 m_ScrollPosition; - - private AssetBundleInspectTab m_assetBundleInspectTab = null; - private AssetBundleInspectTab.InspectTabData m_inspectTabData = null; - - internal void SetBundle(AssetBundle bundle, string path = "", AssetBundleInspectTab.InspectTabData inspectTabData = null, AssetBundleInspectTab assetBundleInspectTab = null) - { - //static var... - currentPath = path; - m_inspectTabData = inspectTabData; - m_assetBundleInspectTab = assetBundleInspectTab; - - //members - m_Editor = null; - if (bundle != null) m_Editor = Editor.CreateEditor(bundle); - } - - internal void OnGUI(Rect pos) - { - m_Position = pos; - - DrawBundleData(); - } - - private void DrawBundleData() - { - if (m_Editor != null) - { - GUILayout.BeginArea(m_Position); - m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); - m_Editor.OnInspectorGUI(); - EditorGUILayout.EndScrollView(); - GUILayout.EndArea(); - } - else if (!string.IsNullOrEmpty(currentPath)) - { - GUIStyle style = new GUIStyle(GUI.skin.label); - style.alignment = TextAnchor.MiddleCenter; - style.wordWrap = true; - GUI.Label(m_Position, new GUIContent("Invalid bundle selected"), style); - - if (m_inspectTabData != null && GUI.Button(new Rect(new Vector2(m_Position.position.x + m_Position.width / 2f - 37.5f, m_Position.position.y + m_Position.height / 2f + 15), new Vector2(75, 30)), "Ignore file")) - { - AssetBundleInspectTab.InspectTabData.BundleFolderData possibleFolderData = m_inspectTabData.FolderDataContainingFilePath(currentPath); - if (possibleFolderData != null) - { - if (!possibleFolderData.ignoredFiles.Contains(currentPath)) - possibleFolderData.ignoredFiles.Add(currentPath); - - if (m_assetBundleInspectTab != null) - m_assetBundleInspectTab.RefreshBundles(); - } - } - } - } - } - - [CustomEditor(typeof(AssetBundle))] - internal class AssetBundleEditor : Editor - { - internal bool pathFoldout = false; - internal bool advancedFoldout = false; - - public override void OnInspectorGUI() - { - AssetBundle bundle = target as AssetBundle; - - using (new EditorGUI.DisabledScope(true)) - { - GUIStyle leftStyle = new GUIStyle(GUI.skin.GetStyle("Label")); - leftStyle.alignment = TextAnchor.UpperLeft; - GUILayout.Label(new GUIContent("Name: " + bundle.name), leftStyle); - - long fileSize = -1; - if (!string.IsNullOrEmpty(SingleBundleInspector.currentPath) && File.Exists(SingleBundleInspector.currentPath)) - { - FileInfo fileInfo = new FileInfo(SingleBundleInspector.currentPath); - fileSize = fileInfo.Length; - } - - if (fileSize < 0) - GUILayout.Label(new GUIContent("Size: unknown"), leftStyle); - else - GUILayout.Label(new GUIContent("Size: " + EditorUtility.FormatBytes(fileSize)), leftStyle); - - string[] assetNames = bundle.GetAllAssetNames(); - pathFoldout = EditorGUILayout.Foldout(pathFoldout, "Source Asset Paths"); - if (pathFoldout) - { - EditorGUI.indentLevel++; - foreach (string asset in assetNames) - EditorGUILayout.LabelField(asset); - EditorGUI.indentLevel--; - } - - - advancedFoldout = EditorGUILayout.Foldout(advancedFoldout, "Advanced Data"); - } - - if (advancedFoldout) - { - EditorGUI.indentLevel++; - base.OnInspectorGUI(); - EditorGUI.indentLevel--; - } - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs.meta deleted file mode 100644 index a116365..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3573b64da26ccbb44a0ad5b58ba36d25 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs deleted file mode 100644 index 39522c1..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs +++ /dev/null @@ -1,132 +0,0 @@ -using UnityEngine; -using UnityEditor.IMGUI.Controls; -using System.Collections.Generic; -using System.Linq; - -namespace AssetBundleBrowser -{ - internal class InspectTreeItem : TreeViewItem - { - internal string bundlePath { get; private set; } - - internal InspectTreeItem(string path, int depth) : base(path.GetHashCode(), depth, path) - { - bundlePath = path; - } - - internal InspectTreeItem(string path, int depth, string prettyName) : base(path.GetHashCode(), depth, prettyName) - { - bundlePath = path; - } - - internal InspectTreeItem(string path, string parentPath, int depth, string prettyName) : base((path + parentPath).GetHashCode(), depth, prettyName) - { - bundlePath = path; - } - } - - internal class InspectBundleTree : TreeView - { - private AssetBundleInspectTab m_InspectTab; - - internal InspectBundleTree(TreeViewState s, AssetBundleInspectTab parent) : base(s) - { - m_InspectTab = parent; - showBorder = true; - } - - protected override TreeViewItem BuildRoot() - { - TreeViewItem root = new TreeViewItem(-1, -1); - root.children = new List(); - if (m_InspectTab == null) - Debug.Log("Unknown problem in AssetBundle Browser Inspect tab. Restart Browser and try again, or file ticket on github."); - else - foreach (KeyValuePair> folder in m_InspectTab.BundleList) - if (string.IsNullOrEmpty(folder.Key)) - { - foreach (string path in folder.Value) - root.AddChild(new InspectTreeItem(path, 0)); - } - else - { - TreeViewItem folderItem = new TreeViewItem(folder.Key.GetHashCode(), 0, folder.Key); - foreach (string path in folder.Value) - { - string prettyName = path; - if (path.StartsWith(folder.Key)) //how could it not? - prettyName = path.Remove(0, folder.Key.Length + 1); - - folderItem.AddChild(new InspectTreeItem(path, folder.Key, 1, prettyName)); - } - - root.AddChild(folderItem); - } - - return root; - } - - public override void OnGUI(Rect rect) - { - base.OnGUI(rect); - if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) SetSelection(new int[0], TreeViewSelectionOptions.FireSelectionChanged); - } - - protected override void RowGUI(RowGUIArgs args) - { - base.RowGUI(args); - if (args.item.depth == 0) - { - int width = 16; - Rect edgeRect = new Rect(args.rowRect.xMax - width, args.rowRect.y, width, args.rowRect.height); - if (GUI.Button(edgeRect, "-")) - { - if (GetSelection().Contains(args.item.id)) - { - IList selection = GetSelection(); - foreach (int id in selection) - { - TreeViewItem item = FindItem(id, rootItem); - if (item.depth == 0) - RemoveItem(item); - } - } - else - { - RemoveItem(args.item); - } - - m_InspectTab.RefreshBundles(); - } - } - } - - private void RemoveItem(TreeViewItem item) - { - InspectTreeItem inspectItem = item as InspectTreeItem; - if (inspectItem != null) - m_InspectTab.RemoveBundlePath(inspectItem.bundlePath); - else - m_InspectTab.RemoveBundleFolder(item.displayName); - } - - protected override void SelectionChanged(IList selectedIds) - { - base.SelectionChanged(selectedIds); - - if (selectedIds == null) - return; - - if (selectedIds.Count > 0) - m_InspectTab.SetBundleItem(FindRows(selectedIds).Select(tvi => tvi as InspectTreeItem).ToList()); - //m_InspectTab.SetBundleItem(FindItem(selectedIds[0], rootItem) as InspectTreeItem); - else - m_InspectTab.SetBundleItem(null); - } - - protected override bool CanMultiSelect(TreeViewItem item) - { - return true; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs.meta deleted file mode 100644 index 1f0d6ca..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eae882f6f29224b4092f04878a38a0cb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs b/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs deleted file mode 100644 index 67dbf31..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs +++ /dev/null @@ -1,112 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; -using AssetBundleBrowser.AssetBundleModel; - -namespace AssetBundleBrowser -{ - internal class MessageList - { - private Vector2 m_ScrollPosition = Vector2.zero; - - private GUIStyle[] m_Style = new GUIStyle[2]; - - private IEnumerable m_Selecteditems; - private List m_Messages; - - private Vector2 m_Dimensions = new Vector2(0, 0); - private const float k_ScrollbarPadding = 16f; - private const float k_BorderSize = 1f; - - - internal MessageList() - { - Init(); - } - - private void Init() - { - m_Style[0] = "OL EntryBackOdd"; - m_Style[1] = "OL EntryBackEven"; - m_Style[0].wordWrap = true; - m_Style[1].wordWrap = true; - m_Style[0].padding = new RectOffset(32, 0, 1, 4); - m_Style[1].padding = new RectOffset(32, 0, 1, 4); - m_Messages = new List(); - } - - internal void OnGUI(Rect fullPos) - { - DrawOutline(fullPos, 1f); - - Rect pos = new Rect(fullPos.x + k_BorderSize, fullPos.y + k_BorderSize, fullPos.width - 2 * k_BorderSize, fullPos.height - 2 * k_BorderSize); - - - if (m_Dimensions.y == 0 || m_Dimensions.x != pos.width - k_ScrollbarPadding) - { - //recalculate height. - m_Dimensions.x = pos.width - k_ScrollbarPadding; - m_Dimensions.y = 0; - foreach (MessageSystem.Message message in m_Messages) m_Dimensions.y += m_Style[0].CalcHeight(new GUIContent(message.message), m_Dimensions.x); - } - - m_ScrollPosition = GUI.BeginScrollView(pos, m_ScrollPosition, new Rect(0, 0, m_Dimensions.x, m_Dimensions.y)); - int counter = 0; - float runningHeight = 0.0f; - foreach (MessageSystem.Message message in m_Messages) - { - int index = counter % 2; - GUIContent content = new GUIContent(message.message); - float height = m_Style[index].CalcHeight(content, m_Dimensions.x); - - GUI.Box(new Rect(0, runningHeight, m_Dimensions.x, height), content, m_Style[index]); - GUI.DrawTexture(new Rect(0, runningHeight, 32f, 32f), message.icon); - //TODO - cleanup formatting issues and switch to HelpBox - //EditorGUI.HelpBox(new Rect(0, runningHeight, m_dimensions.x, height), message.message, (MessageType)message.severity); - - counter++; - runningHeight += height; - } - - GUI.EndScrollView(); - } - - internal void SetItems(IEnumerable items) - { - m_Selecteditems = items; - CollectMessages(); - } - - internal void CollectMessages() - { - m_Messages.Clear(); - m_Dimensions.y = 0f; - if (m_Selecteditems != null) - foreach (AssetInfo asset in m_Selecteditems) - m_Messages.AddRange(asset.GetMessages()); - } - - internal static void DrawOutline(Rect rect, float size) - { - Color color = new Color(0.6f, 0.6f, 0.6f, 1.333f); - if (EditorGUIUtility.isProSkin) - { - color.r = 0.12f; - color.g = 0.12f; - color.b = 0.12f; - } - - if (Event.current.type != EventType.Repaint) - return; - - Color orgColor = GUI.color; - GUI.color = GUI.color * color; - GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, size), EditorGUIUtility.whiteTexture); - GUI.DrawTexture(new Rect(rect.x, rect.yMax - size, rect.width, size), EditorGUIUtility.whiteTexture); - GUI.DrawTexture(new Rect(rect.x, rect.y + 1, size, rect.height - 2 * size), EditorGUIUtility.whiteTexture); - GUI.DrawTexture(new Rect(rect.xMax - size, rect.y + 1, size, rect.height - 2 * size), EditorGUIUtility.whiteTexture); - - GUI.color = orgColor; - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs.meta deleted file mode 100644 index 31374ad..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e706f069c95acf9439828b4a3144c2a7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs b/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs deleted file mode 100644 index 2dae9d8..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using UnityEngine.Assertions; -using System.Collections.Generic; -using System.Linq; -using UnityEditor.IMGUI.Controls; - -namespace AssetBundleBrowser -{ - internal class MessageSystem - { - private static Texture2D s_ErrorIcon = null; - private static Texture2D s_WarningIcon = null; - private static Texture2D s_InfoIcon = null; - private static Dictionary s_MessageLookup = null; - - [Flags] - internal enum MessageFlag - { - None = 0x0, - - Info = 0x80, //this flag is only used to check bits, not set. - EmptyBundle = 0x81, - EmptyFolder = 0x82, - - Warning = 0x8000, //this flag is only used to check bits, not set. - WarningInChildren = 0x8100, - AssetsDuplicatedInMultBundles = 0x8200, - VariantBundleMismatch = 0x8400, - - Error = 0x800000, //this flag is only used to check bits, not set. - ErrorInChildren = 0x810000, - SceneBundleConflict = 0x820000, - DependencySceneConflict = 0x840000 - } - - internal class MessageState - { - //I have an enum and a set of enums to make some logic cleaner. - // The enum has masks for Error/Warning/Info that won't ever be in the set - // this allows for easy checking of IsSet for error rather than specific errors. - private MessageFlag m_MessageFlags; - private HashSet m_MessageSet; - - - internal MessageState() - { - m_MessageFlags = MessageFlag.None; - m_MessageSet = new HashSet(); - } - - internal void Clear() - { - m_MessageFlags = MessageFlag.None; - m_MessageSet.Clear(); - } - - internal void SetFlag(MessageFlag flag, bool on) - { - if (flag == MessageFlag.Info || flag == MessageFlag.Warning || flag == MessageFlag.Error) - return; - - if (on) - { - m_MessageFlags |= flag; - m_MessageSet.Add(flag); - } - else - { - m_MessageFlags &= ~flag; - m_MessageSet.Remove(flag); - } - } - - internal bool IsSet(MessageFlag flag) - { - return (m_MessageFlags & flag) == flag; - } - - internal bool HasMessages() - { - return m_MessageFlags != MessageFlag.None; - } - - internal MessageType HighestMessageLevel() - { - if (IsSet(MessageFlag.Error)) - return MessageType.Error; - if (IsSet(MessageFlag.Warning)) - return MessageType.Warning; - if (IsSet(MessageFlag.Info)) - return MessageType.Info; - return MessageType.None; - } - - internal MessageFlag HighestMessageFlag() - { - MessageFlag high = MessageFlag.None; - foreach (MessageFlag f in m_MessageSet) - if (f > high) - high = f; - return high; - } - - internal List GetMessages() - { - List msgs = new List(); - foreach (MessageFlag f in m_MessageSet) msgs.Add(GetMessage(f)); - return msgs; - } - } - - internal static Texture2D GetIcon(MessageType sev) - { - if (sev == MessageType.Error) - return GetErrorIcon(); - else if (sev == MessageType.Warning) - return GetWarningIcon(); - else if (sev == MessageType.Info) - return GetInfoIcon(); - else - return null; - } - - private static Texture2D GetErrorIcon() - { - if (s_ErrorIcon == null) - FindMessageIcons(); - return s_ErrorIcon; - } - - private static Texture2D GetWarningIcon() - { - if (s_WarningIcon == null) - FindMessageIcons(); - return s_WarningIcon; - } - - private static Texture2D GetInfoIcon() - { - if (s_InfoIcon == null) - FindMessageIcons(); - return s_InfoIcon; - } - - private static void FindMessageIcons() - { - s_ErrorIcon = EditorGUIUtility.FindTexture("console.errorIcon"); - s_WarningIcon = EditorGUIUtility.FindTexture("console.warnicon"); - s_InfoIcon = EditorGUIUtility.FindTexture("console.infoIcon"); - } - - internal class Message - { - internal Message(string msg, MessageType sev) - { - message = msg; - severity = sev; - } - - internal MessageType severity; - internal string message; - - internal Texture2D icon - { - get { return GetIcon(severity); } - } - } - - internal static Message GetMessage(MessageFlag lookup) - { - if (s_MessageLookup == null) - InitMessages(); - - Message msg = null; - s_MessageLookup.TryGetValue(lookup, out msg); - if (msg == null) - msg = s_MessageLookup[MessageFlag.None]; - return msg; - } - - private static void InitMessages() - { - s_MessageLookup = new Dictionary(); - - s_MessageLookup.Add(MessageFlag.None, new Message(string.Empty, MessageType.None)); - s_MessageLookup.Add(MessageFlag.EmptyBundle, new Message("This bundle is empty. Empty bundles cannot get saved with the scene and will disappear from this list if Unity restarts or if various other bundle rename or move events occur.", MessageType.Info)); - s_MessageLookup.Add(MessageFlag.EmptyFolder, new Message("This folder is either empty or contains only empty children. Empty bundles cannot get saved with the scene and will disappear from this list if Unity restarts or if various other bundle rename or move events occur.", MessageType.Info)); - s_MessageLookup.Add(MessageFlag.WarningInChildren, new Message("Warning in child(ren)", MessageType.Warning)); - s_MessageLookup.Add(MessageFlag.AssetsDuplicatedInMultBundles, new Message("Assets being pulled into this bundle due to dependencies are also being pulled into another bundle. This will cause duplication in memory", MessageType.Warning)); - s_MessageLookup.Add(MessageFlag.VariantBundleMismatch, new Message("Variants of a given bundle must have exactly the same assets between them based on a Name.Extension (without Path) comparison. These bundle variants fail that check.", MessageType.Warning)); - s_MessageLookup.Add(MessageFlag.ErrorInChildren, new Message("Error in child(ren)", MessageType.Error)); - s_MessageLookup.Add(MessageFlag.SceneBundleConflict, new Message("A bundle with one or more scenes must only contain scenes. This bundle has scenes and non-scene assets.", MessageType.Error)); - s_MessageLookup.Add(MessageFlag.DependencySceneConflict, new Message("The folder added to this bundle has pulled in scenes and non-scene assets. A bundle must only have one type or the other.", MessageType.Error)); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs.meta deleted file mode 100644 index 61c9790..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d88fac5a61f1ec947afdfb1d3124030c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef b/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef deleted file mode 100644 index a6660ec..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "Unity.AssetBundleBrowser.Editor", - "references": [ - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [] -} diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef.meta deleted file mode 100644 index dd42f0a..0000000 --- a/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c4b8fc492eac8184fb9a42684cf8c464 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/QAReport.md b/Assets/Plugins/AssetBundles-Browser/QAReport.md deleted file mode 100644 index d1122d7..0000000 --- a/Assets/Plugins/AssetBundles-Browser/QAReport.md +++ /dev/null @@ -1,18 +0,0 @@ -# Quality Report - -## QA Owner: @davidla - -## Test strategy -* Unit test coverage: - * Bundle renaming - * Bundle folder movement - * Bundle creation - * Asset movement - * Internal bundle updating - * Bundle merge and delete - * Basic variant functionality - * Internal data (model) stability - -## Package Status -* open bugs: https://github.com/Unity-Technologies/AssetBundles-Browser/issues -* package has been openly available on github since April, officially released on github and the asset store since June. Users have been able to report bugs through github (see above link) and give feedback in the asset store. Current asset store rating is 5 stars after 19 votes. diff --git a/Assets/Plugins/AssetBundles-Browser/QAReport.md.meta b/Assets/Plugins/AssetBundles-Browser/QAReport.md.meta deleted file mode 100644 index fabbb93..0000000 --- a/Assets/Plugins/AssetBundles-Browser/QAReport.md.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b596f3cdbada8164aa95baafaa47dd5c -timeCreated: 1511283002 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/README.md b/Assets/Plugins/AssetBundles-Browser/README.md deleted file mode 100644 index 9b96f89..0000000 --- a/Assets/Plugins/AssetBundles-Browser/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Unity Asset Bundle Browser tool - -This tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality. - -This tool is intended to replace the current workflow of selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in *Window->AssetBundle Browser*. - -## Full Documentation -#### Official Released Features -See [the official manual page](https://docs.unity3d.com/Manual/AssetBundles-Browser.html) or view the included [project manual page](Documentation/com.unity.assetbundlebrowser.md) - diff --git a/Assets/Plugins/AssetBundles-Browser/README.md.meta b/Assets/Plugins/AssetBundles-Browser/README.md.meta deleted file mode 100644 index d95c186..0000000 --- a/Assets/Plugins/AssetBundles-Browser/README.md.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8ed8819a06e39ed4499b36b63173497f -timeCreated: 1507818222 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/license.md b/Assets/Plugins/AssetBundles-Browser/license.md deleted file mode 100644 index e284167..0000000 --- a/Assets/Plugins/AssetBundles-Browser/license.md +++ /dev/null @@ -1,5 +0,0 @@ -Asset Bundle Browser copyright © 2017 Unity Technologies ApS - -Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). - -Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/license.md.meta b/Assets/Plugins/AssetBundles-Browser/license.md.meta deleted file mode 100644 index ad4ff5f..0000000 --- a/Assets/Plugins/AssetBundles-Browser/license.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 117b47f9a23bec44b9cff2e62d6a3222 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/package.json b/Assets/Plugins/AssetBundles-Browser/package.json deleted file mode 100644 index 829a314..0000000 --- a/Assets/Plugins/AssetBundles-Browser/package.json +++ /dev/null @@ -1,12 +0,0 @@ - -{ - "name": "com.unity.assetbundlebrowser", - "displayName": "Asset Bundle Browser", - "version": "1.7.0", - "unity": "2018.1", - "description": "The Asset Bundle Browser tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality.\n\nUse this tool as an alternative to selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in Window > AssetBundle Browser. The bundle configuration, build functionality, and built-bundle inspection are split into three tabs within the new window.", - "keywords": ["asset", "bundle", "bundles", "assetbundles"], - "category": "Asset Bundles", - "dependencies": { - } -} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/package.json.meta b/Assets/Plugins/AssetBundles-Browser/package.json.meta deleted file mode 100644 index 4422c64..0000000 --- a/Assets/Plugins/AssetBundles-Browser/package.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 4581cc1523d2d3e489a8bd6c62aaa345 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/AssetsTools.NET.dll b/Assets/Plugins/AssetsTools.NET.dll deleted file mode 100644 index c9e4f5c..0000000 Binary files a/Assets/Plugins/AssetsTools.NET.dll and /dev/null differ diff --git a/Assets/Plugins/AssetsTools.NET.dll.meta b/Assets/Plugins/AssetsTools.NET.dll.meta deleted file mode 100644 index 917c4f7..0000000 --- a/Assets/Plugins/AssetsTools.NET.dll.meta +++ /dev/null @@ -1,34 +0,0 @@ -fileFormatVersion: 2 -guid: 9df90215fee869340954bb3e0b27b3e6 -timeCreated: 1617340512 -licenseType: Free -PluginImporter: - serializedVersion: 2 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - data: - first: - Any: - second: - enabled: 1 - settings: {} - data: - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - data: - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Editor.meta b/Assets/Plugins/Editor.meta deleted file mode 100644 index 71ace47..0000000 --- a/Assets/Plugins/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d29f50c70a40c5145885ef38984b0754 -folderAsset: yes -timeCreated: 1628215191 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/NStrip.dll b/Assets/Plugins/NStrip.dll deleted file mode 100644 index 467be4a..0000000 Binary files a/Assets/Plugins/NStrip.dll and /dev/null differ diff --git a/Assets/Plugins/SimpleLightProbePlacer.meta b/Assets/Plugins/SimpleLightProbePlacer.meta deleted file mode 100644 index 0802430..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 281fe393411cf9e4499b670ae33722a9 -folderAsset: yes -timeCreated: 1629344783 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor.meta deleted file mode 100644 index 30082da..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 32648b2beb0d5ff438a79aa97cd1b1a9 -folderAsset: yes -timeCreated: 1457191637 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons.meta deleted file mode 100644 index 41807b6..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7bfb3f51474066d41bd9bd4b08f148ea -folderAsset: yes -timeCreated: 1457269144 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png deleted file mode 100644 index 4806fbe..0000000 Binary files a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png and /dev/null differ diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png.meta deleted file mode 100644 index 7995dee..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png.meta +++ /dev/null @@ -1,57 +0,0 @@ -fileFormatVersion: 2 -guid: 34a11416a6b53ee4795f603273b9a46d -timeCreated: 1457269160 -licenseType: Free -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png deleted file mode 100644 index c393446..0000000 Binary files a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png and /dev/null differ diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png.meta deleted file mode 100644 index 72258fc..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png.meta +++ /dev/null @@ -1,57 +0,0 @@ -fileFormatVersion: 2 -guid: 152cd48aa35f97f45b3522bf745d7712 -timeCreated: 1457269160 -licenseType: Free -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs deleted file mode 100644 index f78bc6c..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace SimpleLightProbePlacer.Editor -{ - [CustomEditor(typeof(LightProbeGroupControl))] - public class LightProbeGroupControlEditor : UnityEditor.Editor - { - public override void OnInspectorGUI() - { - var control = (LightProbeGroupControl)target; - - if (GUILayout.Button("Delete All Light Probes")) - { - Undo.RecordObject(control.LightProbeGroup, "Light Probe Group - delete all"); - control.DeleteAll(); - } - - if (control.LightProbeGroup != null) - { - string message = "Light Probes count: {0}\nMerged Probes: {1}"; - message = string.Format(message, control.LightProbeGroup.probePositions.Length, control.MergedProbes); - - EditorGUILayout.HelpBox(message, MessageType.Info); - } - - if (GUILayout.Button("Create Light Probes")) - { - Undo.RecordObject(control.LightProbeGroup, "Light Probe Group - create"); - control.Create(); - } - - GUILayout.Space(10); - - if (GUILayout.Button("Merge Closest Light Probes")) - { - Undo.RecordObject(control.LightProbeGroup, "Light Probe Group - merge"); - control.Merge(); - } - - EditorGUI.BeginChangeCheck(); - - var mergeDist = EditorGUILayout.Slider("Merge distance", control.MergeDistance, 0, 10); - - GUILayout.Space(20); - EditorGUILayout.LabelField("Point Light Settings", EditorStyles.boldLabel); - - var useLights = EditorGUILayout.Toggle("Use Point Lights", control.UsePointLights); - - GUI.enabled = control.UsePointLights; - var lightRange = EditorGUILayout.FloatField("Range", control.PointLightRange); - GUI.enabled = true; - - if (EditorGUI.EndChangeCheck()) - { - Undo.RecordObject(control, "Light Probe Group Control changes"); - - control.MergeDistance = mergeDist; - control.UsePointLights = useLights; - control.PointLightRange = lightRange; - - EditorUtility.SetDirty(target); - } - } - - [MenuItem("GameObject/Light/Light Probe Group Control")] - private static void CreateLightProbeGroupControl(MenuCommand menuCommand) - { - var go = new GameObject("Light Probe Group Control"); - - go.AddComponent(); - GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); - Undo.RegisterCreatedObjectUndo(go, "Create Light Probe Group Control"); - - Selection.activeGameObject = go; - } - - [DrawGizmo(GizmoType.Selected | GizmoType.InSelectionHierarchy | GizmoType.Active)] - private static void DrawGizmoPointLight(Light light, GizmoType gizmoType) - { - var control = FindObjectOfType(); - - if (control == null || !control.UsePointLights || light.type != LightType.Point) return; - - List probes = LightProbeGroupControl.CreatePositionsAround(light.transform, control.PointLightRange); - - for (int i = 0; i < probes.Count; i++) - { - Gizmos.DrawIcon(probes[i], "NONE", false); - } - } - } -} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs.meta deleted file mode 100644 index 7f24706..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 66045cdc4e8e7c844a763795dc422257 -timeCreated: 1457268398 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs deleted file mode 100644 index a350657..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs +++ /dev/null @@ -1,92 +0,0 @@ -using UnityEditor; -using UnityEngine; - -namespace SimpleLightProbePlacer.Editor -{ - [CanEditMultipleObjects, CustomEditor(typeof(LightProbeVolume))] - public class LightProbeVolumeEditor : UnityEditor.Editor - { - public override void OnInspectorGUI() - { - var volume = (LightProbeVolume)target; - - EditorGUI.BeginChangeCheck(); - - GUILayout.Space(10); - EditorGUILayout.LabelField("Volume", EditorStyles.boldLabel); - var origin = EditorGUILayout.Vector3Field("Origin", volume.Origin); - var size = EditorGUILayout.Vector3Field("Size", volume.Size); - - GUILayout.Space(10); - EditorGUILayout.LabelField("Density", EditorStyles.boldLabel); - var type = (LightProbeVolumeType)EditorGUILayout.EnumPopup("Density Type", volume.Type); - - float densityMin = volume.Type == LightProbeVolumeType.Fixed ? 1 : 0.1f; - float densityMax = volume.Type == LightProbeVolumeType.Fixed ? 100 : 50; - - var density = volume.Density; - density.x = EditorGUILayout.Slider("DensityX", volume.Density.x, densityMin, densityMax); - density.y = EditorGUILayout.Slider("DensityY", volume.Density.y, densityMin, densityMax); - density.z = EditorGUILayout.Slider("DensityZ", volume.Density.z, densityMin, densityMax); - - if (EditorGUI.EndChangeCheck()) - { - Undo.RecordObject(target, "Light Probe Volume changes"); - - volume.Density = density; - volume.Type = type; - volume.Volume = new Volume(origin, size); - - EditorUtility.SetDirty(target); - } - } - - private void OnSceneGUI() - { - var lightProbeVolume = (LightProbeVolume)target; - - var volume = TransformVolume.EditorVolumeControl(lightProbeVolume, 0.1f, LightProbeVolume.EditorColor); - - if (volume != lightProbeVolume.Volume) - { - Undo.RecordObject(target, "Light Probe Volume changes"); - lightProbeVolume.Volume = volume; - EditorUtility.SetDirty(target); - } - } - - [DrawGizmo(GizmoType.Selected | GizmoType.InSelectionHierarchy | GizmoType.Active)] - private static void DrawGizmoVolume(LightProbeVolume volume, GizmoType gizmoType) - { - var color = LightProbeVolume.EditorColor; - Gizmos.color = color; - Gizmos.matrix = Matrix4x4.TRS(volume.transform.position, volume.transform.rotation, Vector3.one); - Gizmos.DrawWireCube(volume.Origin, volume.Size); - - if (gizmoType != (GizmoType.Selected | GizmoType.InSelectionHierarchy | GizmoType.Active)) return; - - color.a = 0.25f; - Gizmos.color = color; - Gizmos.DrawCube(volume.Origin, volume.Size); - - var probes = volume.CreatePositions(); - - for (int i = 0; i < probes.Count; i++) - { - Gizmos.DrawIcon(probes[i], "NONE", false); - } - } - - [MenuItem("GameObject/Light/Light Probe Volume")] - private static void CreateLightProbeVolume(MenuCommand menuCommand) - { - var go = new GameObject("Light Probe Volume"); - - go.AddComponent(); - GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); - Undo.RegisterCreatedObjectUndo(go, "Create Light Probe Volume"); - - Selection.activeGameObject = go; - } - } -} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs.meta deleted file mode 100644 index 6ddef42..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ed7bb5f68f00e944da65fd411da6fd53 -timeCreated: 1457260999 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts.meta deleted file mode 100644 index 28c05e0..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fb0bc3e0b33493443b1caeaaee1a0196 -folderAsset: yes -timeCreated: 1457191632 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs deleted file mode 100644 index ac5ca8c..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs +++ /dev/null @@ -1,153 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - -namespace SimpleLightProbePlacer -{ - [RequireComponent(typeof(LightProbeGroup))] - [AddComponentMenu("Rendering/Light Probe Group Control")] - public class LightProbeGroupControl : MonoBehaviour - { - [SerializeField] private float m_mergeDistance = 0.5f; - [SerializeField] private bool m_usePointLights = true; - [SerializeField] private float m_pointLightRange = 1; - - public float MergeDistance { get { return m_mergeDistance; } set { m_mergeDistance = value; } } - public int MergedProbes { get { return m_mergedProbes; } } - public bool UsePointLights { get { return m_usePointLights; } set { m_usePointLights = value; } } - public float PointLightRange { get { return m_pointLightRange; } set { m_pointLightRange = value; } } - - public LightProbeGroup LightProbeGroup - { - get - { - if (m_lightProbeGroup != null) return m_lightProbeGroup; - return m_lightProbeGroup = GetComponent(); - } - } - - private int m_mergedProbes; - private LightProbeGroup m_lightProbeGroup; - - public void DeleteAll() - { - LightProbeGroup.probePositions = null; - m_mergedProbes = 0; - } - - public void Create() - { - DeleteAll(); - - List positions = CreatePositions(); - positions.AddRange(CreateAroundPointLights(m_pointLightRange)); - positions = MergeClosestPositions(positions, m_mergeDistance, out m_mergedProbes); - - ApplyPositions(positions); - } - - public void Merge() - { - if (LightProbeGroup.probePositions == null) return; - - List positions = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes); - positions = positions.Select(x => transform.TransformPoint(x)).ToList(); - - ApplyPositions(positions); - } - - private void ApplyPositions(List positions) - { - LightProbeGroup.probePositions = positions.Select(x => transform.InverseTransformPoint(x)).ToArray(); - } - - private static List CreatePositions() - { - var lightProbeVolumes = FindObjectsOfType(); - - if (lightProbeVolumes.Length == 0) return new List(); - - List probes = new List(); - - for (int i = 0; i < lightProbeVolumes.Length; i++) - { - probes.AddRange(lightProbeVolumes[i].CreatePositions()); - } - - return probes; - } - - private static List CreateAroundPointLights(float range) - { - var lights = FindObjectsOfType().Where(x => x.type == LightType.Point).ToList(); - - if (lights.Count == 0) return new List(); - - List probes = new List(); - - for (int i = 0; i < lights.Count; i++) - { - probes.AddRange(CreatePositionsAround(lights[i].transform, range)); - } - - return probes; - } - - private static List MergeClosestPositions(List positions, float distance, out int mergedCount) - { - if (positions == null) - { - mergedCount = 0; - return new List(); - } - - int exist = positions.Count; - bool done = false; - - while (!done) - { - Dictionary> closest = new Dictionary>(); - - for (int i = 0; i < positions.Count; i++) - { - List points = positions.Where(x => (x - positions[i]).magnitude < distance).ToList(); - if (points.Count > 0 && !closest.ContainsKey(positions[i])) - { - closest.Add(positions[i], points); - } - } - - positions.Clear(); - List keys = closest.Keys.ToList(); - - for (int i = 0; i < keys.Count; i++) - { - var center = closest[keys[i]].Aggregate(Vector3.zero, (result, target) => result + target) / closest[keys[i]].Count; - if (!positions.Exists(x => x == center)) positions.Add(center); - } - - done = positions.Select(x => positions.Where(y => y != x && (y - x).magnitude < distance)).All(x => !x.Any()); - } - - mergedCount = exist - positions.Count; - return positions; - } - - public static List CreatePositionsAround(Transform transform, float range) - { - Vector3[] corners = - { - new Vector3(-0.5f, 0.5f, -0.5f), - new Vector3(-0.5f, 0.5f, 0.5f), - new Vector3(0.5f, 0.5f, 0.5f), - new Vector3(0.5f, 0.5f, -0.5f), - new Vector3(-0.5f, -0.5f, -0.5f), - new Vector3(-0.5f, -0.5f, 0.5f), - new Vector3(0.5f, -0.5f, 0.5f), - new Vector3(0.5f, -0.5f, -0.5f) - }; - - return corners.Select(x => transform.TransformPoint(x * range)).ToList(); - } - } -} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs.meta deleted file mode 100644 index db9a687..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9e58b2a5f02556c4897347a45818c57a -timeCreated: 1457269174 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 34a11416a6b53ee4795f603273b9a46d, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs deleted file mode 100644 index 9589b81..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs +++ /dev/null @@ -1,97 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; - -namespace SimpleLightProbePlacer -{ - public enum LightProbeVolumeType { Fixed, Float } - - [AddComponentMenu("Rendering/Light Probe Volume")] - public class LightProbeVolume : TransformVolume - { - [SerializeField] private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed; - [SerializeField] private Vector3 m_densityFixed = Vector3.one; - [SerializeField] private Vector3 m_densityFloat = Vector3.one; - - public LightProbeVolumeType Type { get { return m_type; } set { m_type = value; } } - public Vector3 Density - { - get { return m_type == LightProbeVolumeType.Fixed ? m_densityFixed : m_densityFloat; } - set - { - if (m_type == LightProbeVolumeType.Fixed) m_densityFixed = value; - else m_densityFloat = value; - } - } - - public static Color EditorColor { get { return new Color(1, 0.9f, 0.25f); } } - - public List CreatePositions() - { - return CreatePositions(m_type); - } - - public List CreatePositions(LightProbeVolumeType type) - { - return type == LightProbeVolumeType.Fixed - ? CreatePositionsFixed(transform, Origin, Size, Density) - : CreatePositionsFloat(transform, Origin, Size, Density); - } - - public static List CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) - { - List posList = new List(); - var offset = origin; - - var moveX = size.x / Mathf.FloorToInt(density.x); - var moveY = size.y / Mathf.FloorToInt(density.y); - var moveZ = size.z / Mathf.FloorToInt(density.z); - - offset -= size * 0.5f; - - for (int x = 0; x <= density.x; x++) - { - for (int y = 0; y <= density.y; y++) - { - for (int z = 0; z <= density.z; z++) - { - var probePos = offset + new Vector3(x * moveX, y * moveY, z * moveZ); - probePos = volumeTransform.TransformPoint(probePos); - posList.Add(probePos); - } - } - } - - return posList; - } - - public static List CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) - { - List posList = new List(); - var offset = origin; - - var stepX = Mathf.FloorToInt(size.x / density.x); - var stepY = Mathf.FloorToInt(size.y / density.y); - var stepZ = Mathf.FloorToInt(size.z / density.z); - - offset -= size * 0.5f; - offset.x += (size.x - stepX * density.x) * 0.5f; - offset.y += (size.y - stepY * density.y) * 0.5f; - offset.z += (size.z - stepZ * density.z) * 0.5f; - - for (int x = 0; x <= stepX; x++) - { - for (int y = 0; y <= stepY; y++) - { - for (int z = 0; z <= stepZ; z++) - { - var probePos = offset + new Vector3(x * density.x, y * density.y, z * density.z); - probePos = volumeTransform.TransformPoint(probePos); - posList.Add(probePos); - } - } - } - - return posList; - } - } -} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs.meta deleted file mode 100644 index 4e9d8c2..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6ce72b8e8fac84047a96f26f2b28d1d9 -timeCreated: 1457269185 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 152cd48aa35f97f45b3522bf745d7712, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs deleted file mode 100644 index b4e2d80..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs +++ /dev/null @@ -1,197 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - -#if UNITY_EDITOR -using UnityEditor; -#endif - -namespace SimpleLightProbePlacer -{ - [AddComponentMenu("")] - public class TransformVolume : MonoBehaviour - { - [SerializeField] private Volume m_volume = new Volume(Vector3.zero, Vector3.one); - - public Volume Volume { get { return m_volume; } set { m_volume = value; } } - public Vector3 Origin { get { return m_volume.Origin; } } - public Vector3 Size { get { return m_volume.Size; } } - - public bool IsInBounds(Vector3[] points) - { - return GetBounds().Intersects(GetBounds(points)); - } - - public bool IsOnBorder(Vector3[] points) - { - if (points.All(x => !IsInVolume(x))) return false; - - return !points.All(IsInVolume); - } - - public bool IsInVolume(Vector3[] points) - { - return points.All(IsInVolume); - } - - public bool IsInVolume(Vector3 position) - { - for (int i = 0; i < 6; i++) - { - var plane = new Plane(GetSideDirection(i), GetSidePosition(i)); - - if (plane.GetSide(position)) return false; - } - - return true; - } - - public Vector3[] GetCorners() - { - Vector3[] corners = - { - new Vector3(-0.5f, 0.5f, -0.5f), - new Vector3(-0.5f, 0.5f, 0.5f), - new Vector3(0.5f, 0.5f, 0.5f), - new Vector3(0.5f, 0.5f, -0.5f), - new Vector3(-0.5f, -0.5f, -0.5f), - new Vector3(-0.5f, -0.5f, 0.5f), - new Vector3(0.5f, -0.5f, 0.5f), - new Vector3(0.5f, -0.5f, -0.5f) - }; - - for (int i = 0; i < corners.Length; i++) - { - corners[i].x *= m_volume.Size.x; - corners[i].y *= m_volume.Size.y; - corners[i].z *= m_volume.Size.z; - - corners[i] = transform.TransformPoint(m_volume.Origin + corners[i]); - } - - return corners; - } - - public Bounds GetBounds() - { - return GetBounds(GetCorners()); - } - - public Bounds GetBounds(Vector3[] points) - { - var center = points.Aggregate(Vector3.zero, (result, point) => result + point) / points.Length; - var bounds = new Bounds(center, Vector3.zero); - - for (int i = 0; i < points.Length; i++) - { - bounds.Encapsulate(points[i]); - } - - return bounds; - } - - public GameObject[] GetGameObjectsInBounds(LayerMask layerMask) - { - MeshRenderer[] meshRenderers = FindObjectsOfType(); - - List list = new List(); - - Bounds bounds = GetBounds(); - - for (int i = 0; i < meshRenderers.Length; i++) - { - if (meshRenderers[i].gameObject == transform.gameObject) continue; - if (meshRenderers[i].GetComponent() != null) continue; - if ((1 << meshRenderers[i].gameObject.layer & layerMask.value) == 0) continue; - - if (bounds.Intersects(meshRenderers[i].bounds)) - { - list.Add(meshRenderers[i].gameObject); - } - } - - return list.ToArray(); - } - - public Vector3 GetSideDirection(int side) - { - Vector3[] sides = new Vector3[6]; - - var right = Vector3.right; - var up = Vector3.up; - var forward = Vector3.forward; - - sides[0] = right; - sides[1] = -right; - sides[2] = up; - sides[3] = -up; - sides[4] = forward; - sides[5] = -forward; - - return transform.TransformDirection(sides[side]); - } - - public Vector3 GetSidePosition(int side) - { - Vector3[] sides = new Vector3[6]; - - var right = Vector3.right; - var up = Vector3.up; - var forward = Vector3.forward; - - sides[0] = right; - sides[1] = -right; - sides[2] = up; - sides[3] = -up; - sides[4] = forward; - sides[5] = -forward; - - return transform.TransformPoint(sides[side] * GetSizeAxis(side) + m_volume.Origin); - } - - public float GetSizeAxis(int side) - { - switch (side) - { - case 0: - case 1: return m_volume.Size.x * 0.5f; - case 2: - case 3: return m_volume.Size.y * 0.5f; - default: return m_volume.Size.z * 0.5f; - } - } - -#if UNITY_EDITOR - public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color) - { - Vector3 origin, size; - Vector3[] controlHandles = new Vector3[6]; - var transform = transformVolume.transform; - - Handles.color = color; - - for (int i = 0; i < controlHandles.Length; i++) - { - controlHandles[i] = transformVolume.GetSidePosition(i); - } - - controlHandles[0] = Handles.Slider(controlHandles[0], transform.right, handleSize, Handles.DotHandleCap, 1); - controlHandles[1] = Handles.Slider(controlHandles[1], transform.right, handleSize, Handles.DotHandleCap, 1); - controlHandles[2] = Handles.Slider(controlHandles[2], transform.up, handleSize, Handles.DotHandleCap, 1); - controlHandles[3] = Handles.Slider(controlHandles[3], transform.up, handleSize, Handles.DotHandleCap, 1); - controlHandles[4] = Handles.Slider(controlHandles[4], transform.forward, handleSize, Handles.DotHandleCap, 1); - controlHandles[5] = Handles.Slider(controlHandles[5], transform.forward, handleSize, Handles.DotHandleCap, 1); - - origin.x = transform.InverseTransformPoint((controlHandles[0] + controlHandles[1]) * 0.5f).x; - origin.y = transform.InverseTransformPoint((controlHandles[2] + controlHandles[3]) * 0.5f).y; - origin.z = transform.InverseTransformPoint((controlHandles[4] + controlHandles[5]) * 0.5f).z; - - size.x = transform.InverseTransformPoint(controlHandles[0]).x - transform.InverseTransformPoint(controlHandles[1]).x; - size.y = transform.InverseTransformPoint(controlHandles[2]).y - transform.InverseTransformPoint(controlHandles[3]).y; - size.z = transform.InverseTransformPoint(controlHandles[4]).z - transform.InverseTransformPoint(controlHandles[5]).z; - - return new Volume(origin, size); - } -#endif - } -} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs.meta deleted file mode 100644 index 80bec4a..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d839bef4d4110b244bf82bcec581a66d -timeCreated: 1457258829 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs deleted file mode 100644 index e845b3b..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs +++ /dev/null @@ -1,54 +0,0 @@ -using UnityEngine; - -namespace SimpleLightProbePlacer -{ - [System.Serializable] - public struct Volume - { - [SerializeField] private Vector3 m_origin; - [SerializeField] private Vector3 m_size; - - public Vector3 Origin { get { return m_origin; } } - public Vector3 Size { get { return m_size; } } - - public Volume(Vector3 origin, Vector3 size) - { - m_origin = origin; - m_size = size; - } - - public static bool operator ==(Volume left, Volume right) - { - return left.Equals(right); - } - - public static bool operator !=(Volume left, Volume right) - { - return !left.Equals(right); - } - - public bool Equals(Volume other) - { - return Origin == other.Origin && Size == other.Size; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - return obj is Volume && Equals((Volume) obj); - } - - public override int GetHashCode() - { - unchecked - { - return (Origin.GetHashCode() * 397) ^ Size.GetHashCode(); - } - } - - public override string ToString() - { - return string.Format("Origin: {0}, Size: {1}", Origin, Size); - } - } -} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs.meta deleted file mode 100644 index 4b329d5..0000000 --- a/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f270f689c223be84f93d18074813ab7f -timeCreated: 1457259045 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/README.md b/Assets/README.md index 3207a36..82a8067 100644 --- a/Assets/README.md +++ b/Assets/README.md @@ -9,7 +9,7 @@ And... wait, which hold are you on again? * Health counter fade when aiming around it * Token, hold, and wave counter on radar hand * Player count for online leaderboards; see how you stack up! - * Won't work with [*TakeAndHoldTweaker*](https://h3vr.thunderstore.io/package/devyndamonster/TakeAndHoldTweaker/) installed + * Disabled if [*TakeAndHoldTweaker*](https://h3vr.thunderstore.io/package/devyndamonster/TakeAndHoldTweaker/) is installed * Numerical representation of tokens at item stations * Expiration indication for health crystals (configurable to multiple types) * ...and possibly more! diff --git a/Assets/README.md.meta b/Assets/README.md.meta index 77f4911..355a305 100644 --- a/Assets/README.md.meta +++ b/Assets/README.md.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: ab1d6dea017447a48ac348db588a6f35 -timeCreated: 1642657337 +guid: efa2d6091ed77bd4b879a74bd81d6cbc +timeCreated: 1690408694 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Settings.meta b/Assets/Settings.meta deleted file mode 100644 index 6ae2261..0000000 --- a/Assets/Settings.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 458207f7be969054a86c4182f7b24554 -folderAsset: yes -timeCreated: 1629140349 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Settings/BakeryProjectSettings.asset b/Assets/Settings/BakeryProjectSettings.asset deleted file mode 100644 index 2da2938..0000000 --- a/Assets/Settings/BakeryProjectSettings.asset +++ /dev/null @@ -1,23 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 05ce0574111032a418688d5d3961cb09, type: 3} - m_Name: BakeryProjectSettings - m_EditorClassIdentifier: - mipmapLightmaps: 0 - format8bit: 0 - texelPaddingForDefaultAtlasPacker: 3 - texelPaddingForXatlasAtlasPacker: 1 - alphaMetaPassResolutionMultiplier: 2 - volumeRenderMode: 1000 - deletePreviousLightmapsBeforeBake: 0 - logLevel: 3 - alternativeScaleInLightmap: 0 - generateSmoothPos: 1 diff --git a/Assets/_Prefabs/Store.asset b/Assets/Store.asset similarity index 100% rename from Assets/_Prefabs/Store.asset rename to Assets/Store.asset diff --git a/Assets/_Prefabs/Store.asset.meta b/Assets/Store.asset.meta similarity index 100% rename from Assets/_Prefabs/Store.asset.meta rename to Assets/Store.asset.meta diff --git a/Assets/_Fonts.meta b/Assets/_Fonts.meta index 3462f50..25bc8ac 100644 --- a/Assets/_Fonts.meta +++ b/Assets/_Fonts.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 623ce5e3a46127b4492d42d663741c3c +guid: 2c726b7409f68a3458da45710eada597 folderAsset: yes -timeCreated: 1643540751 +timeCreated: 1690407992 licenseType: Free DefaultImporter: userData: diff --git a/Assets/_Prefabs.meta b/Assets/_Prefabs.meta index f6d6ca2..81fc4bf 100644 --- a/Assets/_Prefabs.meta +++ b/Assets/_Prefabs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: c7b95c01c3e82834aadd369899319f0b +guid: f039a4ea814cffa46bbb3e9b1997c29c folderAsset: yes -timeCreated: 1642674489 +timeCreated: 1690407992 licenseType: Free DefaultImporter: userData: diff --git a/Assets/_Scripts.meta b/Assets/_Scripts.meta index 3d7bbdb..125558c 100644 --- a/Assets/_Scripts.meta +++ b/Assets/_Scripts.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 69c5c3c698a11cc449f00eaa9fc72b45 +guid: 06ed06262b5ec054698b97b88c8c3a3d folderAsset: yes -timeCreated: 1642658518 +timeCreated: 1690407992 licenseType: Free DefaultImporter: userData: diff --git a/Assets/_Textures.meta b/Assets/_Textures.meta index bff12f7..632b2d8 100644 --- a/Assets/_Textures.meta +++ b/Assets/_Textures.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 202273f3dee1d244dbfc63238c672310 +guid: 2aafceb42fd055b43b15b00f97bdb866 folderAsset: yes -timeCreated: 1643099086 +timeCreated: 1690407992 licenseType: Free DefaultImporter: userData: diff --git a/Assets/thumbnail better.png.meta b/Assets/thumbnail better.png.meta index f9391e4..27ec5f7 100644 --- a/Assets/thumbnail better.png.meta +++ b/Assets/thumbnail better.png.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 785b7946398f5314b95bf593d2d77d67 -timeCreated: 1642976088 +guid: af542f3f6d6914f4e96d0326e8b296cc +timeCreated: 1690411512 licenseType: Free TextureImporter: fileIDToRecycleName: {} diff --git a/Assets/thumbnail.png.meta b/Assets/thumbnail.png.meta index 84f4041..080c139 100644 --- a/Assets/thumbnail.png.meta +++ b/Assets/thumbnail.png.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: d11c6ee1f944fe443aa68a2d863f256d -timeCreated: 1642971887 +guid: fda85050abde8944f9775889b528bd35 +timeCreated: 1690408730 licenseType: Free TextureImporter: fileIDToRecycleName: {} @@ -19,7 +19,7 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 - isReadable: 1 + isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -53,7 +53,7 @@ TextureImporter: - buildTarget: DefaultTexturePlatform maxTextureSize: 2048 textureFormat: -1 - textureCompression: 0 + textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 diff --git a/MeatKit.sln.DotSettings b/MeatKit.sln.DotSettings index 8df2bc4..3d5a11e 100644 --- a/MeatKit.sln.DotSettings +++ b/MeatKit.sln.DotSettings @@ -1,6 +1,7 @@  True True + True True True True \ No newline at end of file diff --git a/Packages/AtlasPackage.unitypackage b/Packages/AtlasPackage.unitypackage deleted file mode 100644 index bd33b72..0000000 Binary files a/Packages/AtlasPackage.unitypackage and /dev/null differ diff --git a/Packages/OtherloaderPackage.unitypackage b/Packages/OtherloaderPackage.unitypackage deleted file mode 100644 index 564e0c2..0000000 Binary files a/Packages/OtherloaderPackage.unitypackage and /dev/null differ diff --git a/Packages/README.txt b/Packages/README.txt new file mode 100644 index 0000000..ba855d6 --- /dev/null +++ b/Packages/README.txt @@ -0,0 +1,5 @@ +Looking for the Atlas and OtherLoader unity packages? They've Moved! + +See here for where you can download them: +Atlas: https://github.com/H3VR-Modding/AtlasSampleScenes/releases/latest +OtherLoader: https://github.com/devyndamonster/MeatKit/releases/latest diff --git a/ProjectSettings/MeatKitVersion.txt b/ProjectSettings/MeatKitVersion.txt new file mode 100644 index 0000000..d9c62ed --- /dev/null +++ b/ProjectSettings/MeatKitVersion.txt @@ -0,0 +1 @@ +3.0.2 \ No newline at end of file diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset index 06b68d9..7990ebc 100644 --- a/ProjectSettings/NavMeshAreas.asset +++ b/ProjectSettings/NavMeshAreas.asset @@ -11,7 +11,19 @@ NavMeshProjectSettings: cost: 1 - name: Jump cost: 2 - - name: + - name: Obstructed + cost: 1 + - name: PanicOnly + cost: 1 + - name: Double Jump + cost: 1 + - name: Blast Jump + cost: 1 + - name: Exfil + cost: 1 + - name: TeleportRed + cost: 1 + - name: TeleportBlue cost: 1 - name: cost: 1 @@ -41,35 +53,23 @@ NavMeshProjectSettings: cost: 1 - name: cost: 1 - - name: + - name: KeyA07 cost: 1 - - name: + - name: KeyA281 cost: 1 - - name: + - name: KeyB15x cost: 1 - - name: + - name: KeyB521 cost: 1 - - name: + - name: KeyC001 cost: 1 - - name: + - name: KeyC97 cost: 1 - - name: + - name: KeyD84d cost: 1 - - name: + - name: KeyD0451 cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - m_LastAgentTypeID: -887442657 + m_LastAgentTypeID: -334000983 m_Settings: - serializedVersion: 2 agentTypeID: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 466645a..6da3715 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -70,6 +70,8 @@ PlayerSettings: captureSingleScreen: 0 muteOtherAudioSources: 0 Prepare IOS For Recording: 0 + deferSystemGesturesMode: 0 + hideHomeButton: 0 submitAnalytics: 1 usePlayerLog: 1 bakeCollisionMeshes: 0 @@ -99,6 +101,8 @@ PlayerSettings: n3dsEnableVSync: 0 ignoreAlphaClear: 0 xboxOneResolution: 0 + xboxOneSResolution: 0 + xboxOneXResolution: 3 xboxOneMonoLoggingLevel: 0 xboxOneLoggingLevel: 1 videoMemoryForVertexBuffers: 0 @@ -172,15 +176,21 @@ PlayerSettings: iPhone47inSplashScreen: {fileID: 0} iPhone55inPortraitSplashScreen: {fileID: 0} iPhone55inLandscapeSplashScreen: {fileID: 0} + iPhone58inPortraitSplashScreen: {fileID: 0} + iPhone58inLandscapeSplashScreen: {fileID: 0} iPadPortraitSplashScreen: {fileID: 0} iPadHighResPortraitSplashScreen: {fileID: 0} iPadLandscapeSplashScreen: {fileID: 0} iPadHighResLandscapeSplashScreen: {fileID: 0} appleTVSplashScreen: {fileID: 0} + appleTVSplashScreen2x: {fileID: 0} tvOSSmallIconLayers: [] + tvOSSmallIconLayers2x: [] tvOSLargeIconLayers: [] tvOSTopShelfImageLayers: [] + tvOSTopShelfImageLayers2x: [] tvOSTopShelfImageWideLayers: [] + tvOSTopShelfImageWideLayers2x: [] iOSLaunchScreenType: 0 iOSLaunchScreenPortrait: {fileID: 0} iOSLaunchScreenLandscape: {fileID: 0} @@ -282,6 +292,9 @@ PlayerSettings: switchTitleNames_9: switchTitleNames_10: switchTitleNames_11: + switchTitleNames_12: + switchTitleNames_13: + switchTitleNames_14: switchPublisherNames_0: switchPublisherNames_1: switchPublisherNames_2: @@ -294,6 +307,9 @@ PlayerSettings: switchPublisherNames_9: switchPublisherNames_10: switchPublisherNames_11: + switchPublisherNames_12: + switchPublisherNames_13: + switchPublisherNames_14: switchIcons_0: {fileID: 0} switchIcons_1: {fileID: 0} switchIcons_2: {fileID: 0} @@ -306,6 +322,9 @@ PlayerSettings: switchIcons_9: {fileID: 0} switchIcons_10: {fileID: 0} switchIcons_11: {fileID: 0} + switchIcons_12: {fileID: 0} + switchIcons_13: {fileID: 0} + switchIcons_14: {fileID: 0} switchSmallIcons_0: {fileID: 0} switchSmallIcons_1: {fileID: 0} switchSmallIcons_2: {fileID: 0} @@ -318,6 +337,9 @@ PlayerSettings: switchSmallIcons_9: {fileID: 0} switchSmallIcons_10: {fileID: 0} switchSmallIcons_11: {fileID: 0} + switchSmallIcons_12: {fileID: 0} + switchSmallIcons_13: {fileID: 0} + switchSmallIcons_14: {fileID: 0} switchManualHTML: switchAccessibleURLs: switchLegalInformation: @@ -359,6 +381,7 @@ PlayerSettings: switchLocalCommunicationIds_7: switchParentalControl: 0 switchAllowsScreenshot: 1 + switchAllowsVideoCapturing: 1 switchDataLossConfirmation: 0 switchSupportedNpadStyles: 3 switchSocketConfigEnabled: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index cec5751..7a59bc8 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 5.6.3p4 +m_EditorVersion: 5.6.7f1 diff --git a/preview/aimhide.png b/preview/aimhide.png deleted file mode 100644 index 540b31a..0000000 Binary files a/preview/aimhide.png and /dev/null differ diff --git a/preview/hp.png b/preview/hp.png deleted file mode 100644 index 5f37280..0000000 Binary files a/preview/hp.png and /dev/null differ diff --git a/preview/item station.png b/preview/item station.png deleted file mode 100644 index 3546e24..0000000 Binary files a/preview/item station.png and /dev/null differ diff --git a/preview/leaderboard.png b/preview/leaderboard.png deleted file mode 100644 index 8f5b1b8..0000000 Binary files a/preview/leaderboard.png and /dev/null differ diff --git a/preview/stats.png b/preview/stats.png deleted file mode 100644 index 496db0a..0000000 Binary files a/preview/stats.png and /dev/null differ diff --git a/preview/stats_new.png b/preview/stats_new.png deleted file mode 100644 index a3b4a99..0000000 Binary files a/preview/stats_new.png and /dev/null differ