更改文件架构

This commit is contained in:
CortexCore
2023-06-07 18:38:07 +08:00
parent 93292b1a59
commit ed84166723
720 changed files with 297 additions and 65 deletions

View File

@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BITKit;
using UnityEditor;
using Sirenix.OdinInspector;
using System;
using System.Linq;
using System.Text;
using System.IO;
using Newtonsoft.Json;
namespace BITKit.IO
{
public class AssetBundleHelper : SerializedMonoBehaviour
{
[Sirenix.OdinInspector.FilePath]
public string path;
public string header = "Header";
public List<string> strings = new();
[ContextMenu(nameof(Write))]
public void Write()
{
Dictionary<string, string> dictionary = new();
foreach (var _str in strings)
{
dictionary.Add(_str, Guid.NewGuid().ToString());
}
var value = strings.Select(x => new BITAsset()
{
Name = x,
Buffer = Encoding.UTF8.GetBytes(x)
}).ToList();
value.Add(new()
{
Name = nameof(header),
Buffer = Encoding.UTF8.GetBytes(header),
});
value.Add(new()
{
Name = nameof(dictionary),
Buffer = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(dictionary)),
});
BITAssets.Build(path, value.ToArray());
}
[ContextMenu(nameof(Read))]
public async void Read()
{
Debug.Log(await BITAssets.ReadTextAsync(path, nameof(header)));
}
}
}

View File

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

View File

@@ -0,0 +1,18 @@
{
"name": "BITKit.AssetBundle",
"rootNamespace": "",
"references": [
"GUID:a209c53514018594f9f482516f2a6781",
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:9400d40641bab5b4a9702f65bf5c6eb5"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 09142b71c256ed34a9c6cb6b06d26607
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
namespace BITKit
{
public class Base64Parser : MonoBehaviour
{
public string path;
public string outputPath;
public string json;
[ContextMenu(nameof(Decompress))]
public void Decompress()
{
var base64 = File.ReadAllText(path);
var json = GZipHelper.GZipDecompressString(base64);
File.WriteAllText(outputPath, json);
}
}
}

View File

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