mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-16 04:30:12 +00:00
Update samples
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using YooAsset.Editor;
|
||||
|
||||
public class CollectShaderVariants : IFilterRule
|
||||
{
|
||||
public bool IsCollectAsset(FilterRuleData data)
|
||||
{
|
||||
return Path.GetExtension(data.AssetPath) == ".shadervariants";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7382b7d45cb2b73469e37c334a1599d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Samples~/BasicSample/Script/Editor/CustomPackRule.cs
Normal file
10
Assets/Samples~/BasicSample/Script/Editor/CustomPackRule.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using YooAsset.Editor;
|
||||
|
||||
public class PackShaderVariants : IPackRule
|
||||
{
|
||||
public string GetBundleName(PackRuleData data)
|
||||
{
|
||||
return "myshaders";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77a44b35e325fd746b72741d7acf4106
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/Samples~/BasicSample/Script/Editor/GameServices.cs
Normal file
37
Assets/Samples~/BasicSample/Script/Editor/GameServices.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using YooAsset.Editor;
|
||||
|
||||
public class EncryptionNone : IEncryptionServices
|
||||
{
|
||||
bool IEncryptionServices.Check(string bundleName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
byte[] IEncryptionServices.Encrypt(byte[] fileData)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class GameEncryption : IEncryptionServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 检测资源包是否需要加密
|
||||
/// </summary>
|
||||
bool IEncryptionServices.Check(string bundleName)
|
||||
{
|
||||
// 对配置表进行加密
|
||||
return bundleName.Contains("assets/gameres/config/");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对数据进行加密,并返回加密后的数据
|
||||
/// </summary>
|
||||
byte[] IEncryptionServices.Encrypt(byte[] fileData)
|
||||
{
|
||||
int offset = 32;
|
||||
var temper = new byte[fileData.Length + offset];
|
||||
Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length);
|
||||
return temper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 339682333f36d014e942a790dea6b1f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user