【m】修改一键打包
This commit is contained in:
@@ -281,103 +281,9 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
if (EditorUtility.DisplayDialog("提示", $"开始上传至服务器[{selectedPackageNames}]!", "Yes", "No"))
|
if (EditorUtility.DisplayDialog("提示", $"开始上传至服务器[{selectedPackageNames}]!", "Yes", "No"))
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayProgressBar("提示", "开始上传(打包zip)", 0.0f);
|
|
||||||
// 新增:打包为zip的逻辑
|
// 新增:打包为zip的逻辑
|
||||||
string zipFileName =
|
string zipFilePath = BuildZip(BuildAssetDataSetting);
|
||||||
$"{BuildAssetDataSetting.packageName}_{BuildAssetDataSetting.packageVersion}.zip";
|
await UpdateFileDataResDomain(BuildAssetDataSetting, zipFilePath);
|
||||||
var outputPackageDirectory =
|
|
||||||
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{BuildAssetDataSetting.packageName}";
|
|
||||||
//拷贝目录
|
|
||||||
string outFilePath = $"{outputPackageDirectory}/{BuildAssetDataSetting.packageVersion}";
|
|
||||||
//输出目录
|
|
||||||
string zipFilePath = Path.Combine(outputPackageDirectory, zipFileName);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (FileStream zipStream = new FileStream(zipFilePath, FileMode.Create))
|
|
||||||
using (ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Create))
|
|
||||||
{
|
|
||||||
// 指定需要压缩的后缀(例如:只压缩.json和.dll文件)
|
|
||||||
//string[] targetExtensions = { ".bundle" };
|
|
||||||
|
|
||||||
// 遍历目录下所有文件
|
|
||||||
// foreach (string filePath in Directory.GetFiles(outFilePath, "*.*", SearchOption.AllDirectories)
|
|
||||||
// .Where(f => targetExtensions.Contains(Path.GetExtension(f),
|
|
||||||
// StringComparer.OrdinalIgnoreCase)))
|
|
||||||
foreach (string filePath in Directory.GetFiles(outFilePath, "*.*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
// 获取文件在压缩包中的相对路径
|
|
||||||
string entryName = Path.GetRelativePath(outFilePath, filePath);
|
|
||||||
|
|
||||||
// 创建zip条目
|
|
||||||
ZipArchiveEntry entry = archive.CreateEntry(entryName,
|
|
||||||
System.IO.Compression.CompressionLevel.Optimal);
|
|
||||||
|
|
||||||
// 写入文件内容
|
|
||||||
using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
|
||||||
using (Stream entryStream = entry.Open())
|
|
||||||
{
|
|
||||||
fileStream.CopyTo(entryStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"成功打包为zip:{zipFilePath}");
|
|
||||||
EditorUtility.DisplayProgressBar("提示", "开始上传(打包zip)", 0.25f);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Debug.LogError($"打包zip失败:{ex.Message}");
|
|
||||||
EditorUtility.ClearProgressBar();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { zipFilePath });
|
|
||||||
EditorUtility.DisplayProgressBar("提示", "开始上传(上传zip文件)", 0.5f);
|
|
||||||
if (messageEntity.code == 200)
|
|
||||||
{
|
|
||||||
List<ResultMessageEntity> resultMessageEntities =
|
|
||||||
JsonConvert.DeserializeObject<List<ResultMessageEntity>>(messageEntity.data.ToString());
|
|
||||||
if (resultMessageEntities.Count > 0)
|
|
||||||
{
|
|
||||||
EditorUtility.DisplayProgressBar("提示", "开始上传(更新数据库)", 0.75f);
|
|
||||||
foreach (var resultMessageEntity in resultMessageEntities)
|
|
||||||
{
|
|
||||||
var data = JsonConvert.DeserializeObject(resultMessageEntity.data.ToString()) as JObject;
|
|
||||||
string fileId = data["id"].ToString();
|
|
||||||
ResDmainAddRequst resDmainAddRequst = new ResDmainAddRequst()
|
|
||||||
{
|
|
||||||
ProductName = Application.productName,
|
|
||||||
DomainName = BuildAssetDataSetting.packageName,
|
|
||||||
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
|
|
||||||
PackageVersion = BuildAssetDataSetting.packageVersion,
|
|
||||||
DocumentFileId = fileId
|
|
||||||
};
|
|
||||||
var resResultMessage = await WebRequestSystem.Post(ip + "/ResDomain/AddResDomain",
|
|
||||||
JsonConvert.SerializeObject(resDmainAddRequst));
|
|
||||||
//如果低于服务器版本,更新版本号
|
|
||||||
if (resResultMessage.code == 1009)
|
|
||||||
{
|
|
||||||
ResDmainVersionResponse dmainVersionResponse =
|
|
||||||
JsonConvert.DeserializeObject<ResDmainVersionResponse>(resResultMessage.data
|
|
||||||
.ToString());
|
|
||||||
string[] versions = dmainVersionResponse.PackageVersion.Split('.');
|
|
||||||
BuildAssetDataSetting.packageVersionX = int.Parse(versions[0]);
|
|
||||||
BuildAssetDataSetting.packageVersionY = int.Parse(versions[1]);
|
|
||||||
BuildAssetDataSetting.packageVersionZ = int.Parse(versions[2]);
|
|
||||||
}
|
|
||||||
EditorUtility.DisplayDialog("提示",
|
|
||||||
$"{resResultMessage.message + $"\n{resResultMessage.data.ToString()}"}", "确定");
|
|
||||||
BuildAssetDataSetting.GetBuildPackageVersion(true);
|
|
||||||
}
|
|
||||||
EditorUtility.DisplayProgressBar("提示", "开始上传(更新数据库)", 1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EditorUtility.DisplayProgressBar("提示", $"{messageEntity.message}", 1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
EditorUtility.ClearProgressBar();
|
EditorUtility.ClearProgressBar();
|
||||||
}
|
}
|
||||||
@@ -389,6 +295,117 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string BuildZip(BuildAssetDataSetting setting)
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(打包zip)", 0.0f);
|
||||||
|
// 新增:打包为zip的逻辑
|
||||||
|
string zipFileName =
|
||||||
|
$"{setting.packageName}_{setting.packageVersion}.zip";
|
||||||
|
var outputPackageDirectory =
|
||||||
|
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{setting.packageName}";
|
||||||
|
//拷贝目录
|
||||||
|
string outFilePath = $"{outputPackageDirectory}/{setting.packageVersion}";
|
||||||
|
//输出目录
|
||||||
|
string zipFilePath = Path.Combine(outputPackageDirectory, zipFileName);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (FileStream zipStream = new FileStream(zipFilePath, FileMode.Create))
|
||||||
|
using (ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Create))
|
||||||
|
{
|
||||||
|
// 指定需要压缩的后缀(例如:只压缩.json和.dll文件)
|
||||||
|
//string[] targetExtensions = { ".bundle" };
|
||||||
|
|
||||||
|
// 遍历目录下所有文件
|
||||||
|
// foreach (string filePath in Directory.GetFiles(outFilePath, "*.*", SearchOption.AllDirectories)
|
||||||
|
// .Where(f => targetExtensions.Contains(Path.GetExtension(f),
|
||||||
|
// StringComparer.OrdinalIgnoreCase)))
|
||||||
|
foreach (string filePath in Directory.GetFiles(outFilePath, "*.*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
// 获取文件在压缩包中的相对路径
|
||||||
|
string entryName = Path.GetRelativePath(outFilePath, filePath);
|
||||||
|
|
||||||
|
// 创建zip条目
|
||||||
|
ZipArchiveEntry entry = archive.CreateEntry(entryName,
|
||||||
|
System.IO.Compression.CompressionLevel.Optimal);
|
||||||
|
|
||||||
|
// 写入文件内容
|
||||||
|
using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
||||||
|
using (Stream entryStream = entry.Open())
|
||||||
|
{
|
||||||
|
fileStream.CopyTo(entryStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log($"成功打包为zip:{zipFilePath}");
|
||||||
|
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(打包zip)", 0.25f);
|
||||||
|
return zipFilePath;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.LogError($"打包zip失败:{ex.Message}");
|
||||||
|
EditorUtility.ClearProgressBar();
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task UpdateFileDataResDomain(BuildAssetDataSetting setting, string zipFilePath)
|
||||||
|
{
|
||||||
|
string ip = PlayerPrefs.GetString("LoginIp");
|
||||||
|
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { zipFilePath });
|
||||||
|
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(上传zip文件)", 0.5f);
|
||||||
|
if (messageEntity.code == 200)
|
||||||
|
{
|
||||||
|
List<ResultMessageEntity> resultMessageEntities =
|
||||||
|
JsonConvert.DeserializeObject<List<ResultMessageEntity>>(messageEntity.data.ToString());
|
||||||
|
if (resultMessageEntities.Count > 0)
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayProgressBar("提示", "开始上传(更新数据库)", 0.75f);
|
||||||
|
foreach (var resultMessageEntity in resultMessageEntities)
|
||||||
|
{
|
||||||
|
var data = JsonConvert.DeserializeObject(resultMessageEntity.data.ToString()) as JObject;
|
||||||
|
string fileId = data["id"].ToString();
|
||||||
|
ResDmainAddRequst resDmainAddRequst = new ResDmainAddRequst()
|
||||||
|
{
|
||||||
|
ProductName = Application.productName,
|
||||||
|
DomainName = setting.packageName,
|
||||||
|
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
|
||||||
|
PackageVersion = setting.packageVersion,
|
||||||
|
DocumentFileId = fileId
|
||||||
|
};
|
||||||
|
var resResultMessage = await WebRequestSystem.Post(ip + "/ResDomain/AddResDomain",
|
||||||
|
JsonConvert.SerializeObject(resDmainAddRequst));
|
||||||
|
//如果低于服务器版本,更新版本号
|
||||||
|
if (resResultMessage.code == 1009)
|
||||||
|
{
|
||||||
|
ResDmainVersionResponse dmainVersionResponse =
|
||||||
|
JsonConvert.DeserializeObject<ResDmainVersionResponse>(resResultMessage.data
|
||||||
|
.ToString());
|
||||||
|
string[] versions = dmainVersionResponse.PackageVersion.Split('.');
|
||||||
|
setting.packageVersionX = int.Parse(versions[0]);
|
||||||
|
setting.packageVersionY = int.Parse(versions[1]);
|
||||||
|
setting.packageVersionZ = int.Parse(versions[2]);
|
||||||
|
EditorUtility.DisplayDialog("提示",
|
||||||
|
$"{resResultMessage.message + $"\n{resResultMessage.data.ToString()}"}", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
|
setting.GetBuildPackageVersion(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(更新数据库)", 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayProgressBar("提示", $"{messageEntity.message}", 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Delay(1000);
|
||||||
|
EditorUtility.ClearProgressBar();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected void Init()
|
protected void Init()
|
||||||
@@ -398,7 +415,8 @@ namespace Stary.Evo.Editor
|
|||||||
onBuildPipelineEntity =
|
onBuildPipelineEntity =
|
||||||
new BuildAssetEntity("打包", $"打包资源包【版本:{BuildAssetDataSetting.packageVersion}】", OnBuildPipeline);
|
new BuildAssetEntity("打包", $"打包资源包【版本:{BuildAssetDataSetting.packageVersion}】", OnBuildPipeline);
|
||||||
onUpdateBuildPipelineEntity =
|
onUpdateBuildPipelineEntity =
|
||||||
new BuildAssetEntity("更新", $"更新至服务器【版本:{BuildAssetDataSetting.packageVersion}】", OnUpdateBuildPipeline);
|
new BuildAssetEntity("更新", $"更新至服务器【版本:{BuildAssetDataSetting.packageVersion}】",
|
||||||
|
OnUpdateBuildPipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 scroll;
|
private Vector2 scroll;
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using HybridCLR.Editor;
|
using HybridCLR.Editor;
|
||||||
using HybridCLR.Editor.Commands;
|
using HybridCLR.Editor.Commands;
|
||||||
using HybridCLR.Editor.Settings;
|
using HybridCLR.Editor.Settings;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using Sirenix.OdinInspector.Editor;
|
using Sirenix.OdinInspector.Editor;
|
||||||
using Stary.Evo.InformationSave;
|
using Stary.Evo.InformationSave;
|
||||||
|
using Unity.Plastic.Newtonsoft.Json;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditorInternal;
|
using UnityEditorInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -24,47 +26,98 @@ namespace Stary.Evo.Editor
|
|||||||
window.Show();
|
window.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Title("全选"), OnValueChanged("OneKeyBuildEvent"), HideLabel]
|
||||||
|
public bool isOneKeyBuild;
|
||||||
|
|
||||||
[ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false,
|
[ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false,
|
||||||
HideRemoveButton = true)]
|
HideRemoveButton = true)]
|
||||||
public List<OneKeyBUildEntity> OneKeyBUildEntities = new List<OneKeyBUildEntity>();
|
public List<OneKeyBuildEntity> OneKeyBuildEntities = new List<OneKeyBuildEntity>();
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
OneKeyBuildEntities.Clear();
|
||||||
var creatDomainAll = CreatAssetWindow.GetCreatDomainAll();
|
var creatDomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||||
foreach (var domainEntity in creatDomainAll)
|
foreach (var domainEntity in creatDomainAll)
|
||||||
{
|
{
|
||||||
OneKeyBUildEntities.Add(new OneKeyBUildEntity()
|
OneKeyBuildEntities.Add(new OneKeyBuildEntity()
|
||||||
{
|
{
|
||||||
DomainName = domainEntity.DomainName
|
DomainName = domainEntity.DomainName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Button("(一键)标记选择资源",ButtonSizes.Large)]
|
[Button("(一键)标记选择资源", ButtonSizes.Large)]
|
||||||
public void OneClickMark()
|
public void OneClickMark()
|
||||||
{
|
{
|
||||||
//打dll
|
//打dll
|
||||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||||
//拷贝dll
|
//拷贝dll
|
||||||
MarkAdressable.AddHotfixAddressableDllAll(OneKeyBUildEntities);
|
MarkAdressable.AddHotfixAddressableDllAll(OneKeyBuildEntities);
|
||||||
//标记全部资源
|
//标记全部资源
|
||||||
MarkAdressable.AddMarkAll(OneKeyBUildEntities);
|
MarkAdressable.AddMarkAll(OneKeyBuildEntities);
|
||||||
EditorUtility.DisplayDialog("提示", $"标记所有资源完成!", "确定");
|
EditorUtility.DisplayDialog("提示", $"标记所有资源完成!", "确定");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Button("(一键)打包选择资源",ButtonSizes.Large)]
|
[Button("(一键)获取服务器版本", ButtonSizes.Large)]
|
||||||
public void OneClickBuild()
|
public async void OneUpdatePackageVersion()
|
||||||
|
{
|
||||||
|
//打包
|
||||||
|
EditorTools.ClearUnityConsole();
|
||||||
|
foreach (var oneKeyBUildEntity in OneKeyBuildEntities)
|
||||||
|
{
|
||||||
|
if (oneKeyBUildEntity.isRaw)
|
||||||
|
{
|
||||||
|
BuildAssetDataSetting buildAssetDataSetting =
|
||||||
|
AssetDatabase.LoadAssetAtPath<BuildAssetDataSetting>(
|
||||||
|
$"Assets/Domain/{oneKeyBUildEntity.DomainName}/Conf/BuildAssetDataSetting.asset");
|
||||||
|
if (buildAssetDataSetting != null)
|
||||||
|
{
|
||||||
|
string ip = PlayerPrefs.GetString("LoginIp");
|
||||||
|
string url = $"{ip}/ResDomain/GetResDomainByDomain";
|
||||||
|
var resDmainRequst = new ResDmainRequst()
|
||||||
|
{
|
||||||
|
ProductName = Application.productName,
|
||||||
|
DomainName = oneKeyBUildEntity.DomainName,
|
||||||
|
Platform = UnityEditor.EditorUserBuildSettings.activeBuildTarget.ToString(),
|
||||||
|
};
|
||||||
|
//获取服务器版本
|
||||||
|
var resDmainMessageEntity =
|
||||||
|
await WebRequestSystem.Post(url, JsonConvert.SerializeObject(resDmainRequst));
|
||||||
|
if (resDmainMessageEntity.code == 200)
|
||||||
|
{
|
||||||
|
ResDmainResponse resDmainResponse =
|
||||||
|
JsonConvert.DeserializeObject<ResDmainResponse>(resDmainMessageEntity.data.ToString());
|
||||||
|
string[] versions = resDmainResponse.PackageVersion.Split('.');
|
||||||
|
buildAssetDataSetting.packageVersionX = int.Parse(versions[0]);
|
||||||
|
buildAssetDataSetting.packageVersionY = int.Parse(versions[1]);
|
||||||
|
buildAssetDataSetting.packageVersionZ = int.Parse(versions[2]);
|
||||||
|
buildAssetDataSetting.packageVersionZ++;
|
||||||
|
EditorUtility.SetDirty(buildAssetDataSetting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("BuildAssetDataSetting 不存在:" + oneKeyBUildEntity.DomainName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
EditorUtility.DisplayDialog("提示", $"获取服务器版本完成", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Button("(一键)打包选择资源", ButtonSizes.Large)]
|
||||||
|
public void OneClickBuild()
|
||||||
{
|
{
|
||||||
//打包
|
//打包
|
||||||
EditorTools.ClearUnityConsole();
|
EditorTools.ClearUnityConsole();
|
||||||
|
|
||||||
foreach (var oneKeyBUildEntity in OneKeyBUildEntities)
|
foreach (var oneKeyBUildEntity in OneKeyBuildEntities)
|
||||||
{
|
{
|
||||||
if (oneKeyBUildEntity.isRaw)
|
if (oneKeyBUildEntity.isRaw)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
BuildAssetDataSetting buildAssetDataSetting =
|
BuildAssetDataSetting buildAssetDataSetting =
|
||||||
AssetDatabase.LoadAssetAtPath<BuildAssetDataSetting>(
|
AssetDatabase.LoadAssetAtPath<BuildAssetDataSetting>(
|
||||||
$"Assets/Domain/{oneKeyBUildEntity.DomainName}/Conf/BuildAssetDataSetting.asset");
|
$"Assets/Domain/{oneKeyBUildEntity.DomainName}/Conf/BuildAssetDataSetting.asset");
|
||||||
@@ -86,9 +139,46 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
EditorUtility.DisplayDialog("提示", $"开始打包资源!", "确定");
|
EditorUtility.DisplayDialog("提示", $"开始打包资源!", "确定");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Button("(一键)上传服务器版本", ButtonSizes.Large)]
|
||||||
|
public async void OneUpdatePackage()
|
||||||
|
{
|
||||||
|
//打包
|
||||||
|
EditorTools.ClearUnityConsole();
|
||||||
|
foreach (var oneKeyBUildEntity in OneKeyBuildEntities)
|
||||||
|
{
|
||||||
|
if (oneKeyBUildEntity.isRaw)
|
||||||
|
{
|
||||||
|
BuildAssetDataSetting buildAssetDataSetting =
|
||||||
|
AssetDatabase.LoadAssetAtPath<BuildAssetDataSetting>(
|
||||||
|
$"Assets/Domain/{oneKeyBUildEntity.DomainName}/Conf/BuildAssetDataSetting.asset");
|
||||||
|
if (buildAssetDataSetting != null)
|
||||||
|
{
|
||||||
|
string zipFilePath = BuildAssetWindow.BuildZip(buildAssetDataSetting);
|
||||||
|
await BuildAssetWindow.UpdateFileDataResDomain(buildAssetDataSetting, zipFilePath);
|
||||||
|
await Task.Delay(1000);
|
||||||
|
EditorUtility.ClearProgressBar();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("BuildAssetDataSetting 不存在:" + oneKeyBUildEntity.DomainName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EditorUtility.DisplayDialog("提示", $"服务器上传完成", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OneKeyBuildEvent()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < OneKeyBuildEntities.Count; i++)
|
||||||
|
{
|
||||||
|
OneKeyBuildEntities[i].isRaw = isOneKeyBuild;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct OneKeyBUildEntity
|
[Serializable]
|
||||||
|
public class OneKeyBuildEntity
|
||||||
{
|
{
|
||||||
[Title("是否打包", titleAlignment: TitleAlignments.Centered)] [HideLabel, HorizontalGroup("OneKeyBUildEntity")]
|
[Title("是否打包", titleAlignment: TitleAlignments.Centered)] [HideLabel, HorizontalGroup("OneKeyBUildEntity")]
|
||||||
public bool isRaw;
|
public bool isRaw;
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
private static AssetBundleCollectorPackage package;
|
private static AssetBundleCollectorPackage package;
|
||||||
private static string packageName;
|
private static string packageName;
|
||||||
|
|
||||||
private static string[] configNames = new[] { "DomainConfig" };
|
|
||||||
|
|
||||||
|
|
||||||
public static string DomainRoot
|
public static string DomainRoot
|
||||||
@@ -58,7 +57,7 @@ namespace Stary.Evo.Editor
|
|||||||
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddHotfixAddressableDllAll(List<OneKeyBUildEntity> oneKeyBUildEntities)
|
public static void AddHotfixAddressableDllAll(List<OneKeyBuildEntity> oneKeyBUildEntities)
|
||||||
{
|
{
|
||||||
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddMarkAll(List<OneKeyBUildEntity> oneKeyBUildEntities)
|
public static void AddMarkAll(List<OneKeyBuildEntity> oneKeyBUildEntities)
|
||||||
{
|
{
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.ClearAll();
|
YooAsset.Editor.AssetBundleCollectorSettingData.ClearAll();
|
||||||
foreach (var oneKeyBUildEntity in oneKeyBUildEntities)
|
foreach (var oneKeyBUildEntity in oneKeyBUildEntities)
|
||||||
@@ -283,48 +282,6 @@ namespace Stary.Evo.Editor
|
|||||||
fileNewInfos.Add(file);
|
fileNewInfos.Add(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//不存在的配置对象名称
|
|
||||||
List<string> configNonentity = new List<string>();
|
|
||||||
//查找不存在的配置文件
|
|
||||||
for (int i = 0; i < configNames.Length; i++)
|
|
||||||
{
|
|
||||||
bool exists = false;
|
|
||||||
foreach (var filePath in fileNewInfos)
|
|
||||||
{
|
|
||||||
// 使用Path获取文件名
|
|
||||||
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
|
||||||
if (fileName == configNames[i])
|
|
||||||
{
|
|
||||||
exists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!exists)
|
|
||||||
{
|
|
||||||
configNonentity.Add(configNames[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string remotedRoot = Application.dataPath + "/Main/Config";
|
|
||||||
List<string> mainConfigInfos = new List<string>();
|
|
||||||
FilesUtils.GetFiles(remotedRoot, ref mainConfigInfos);
|
|
||||||
//从main文件里拿取指定配置文件
|
|
||||||
foreach (var config in configNonentity)
|
|
||||||
{
|
|
||||||
foreach (var mainConfigInfo in mainConfigInfos)
|
|
||||||
{
|
|
||||||
// 使用Path获取文件名
|
|
||||||
string fileName = Path.GetFileNameWithoutExtension(mainConfigInfo);
|
|
||||||
if (Path.GetExtension(mainConfigInfo) != ".meta" && fileName.Equals(config))
|
|
||||||
{
|
|
||||||
fileInfos.Add(mainConfigInfo);
|
|
||||||
Debug.LogWarning($"用户资源目录不存在【{config}】文件,从Main目录下复制,此操作可能导致配置文件不完成,请在用户目录配置");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileInfos != null && fileInfos.Count > 0)
|
if (fileInfos != null && fileInfos.Count > 0)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Stary.Evo.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class LeakDetectionMode
|
public class LeakDetectionMode
|
||||||
{
|
{
|
||||||
[MenuItem("Jobs/内存泄漏检测/显示当前模式")]
|
[MenuItem("Evo/内存泄漏检测/显示当前模式")]
|
||||||
static void ShowLeakDetection()
|
static void ShowLeakDetection()
|
||||||
{
|
{
|
||||||
string message = string.Format("当前模式: {0}", NativeLeakDetection.Mode.ToString());
|
string message = string.Format("当前模式: {0}", NativeLeakDetection.Mode.ToString());
|
||||||
@@ -16,40 +16,40 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MenuItem("Jobs/内存泄漏检测/禁用")]
|
[MenuItem("Evo/内存泄漏检测/禁用")]
|
||||||
static void LeakDetectionDisable()
|
static void LeakDetectionDisable()
|
||||||
{
|
{
|
||||||
NativeLeakDetection.Mode = NativeLeakDetectionMode.Disabled;
|
NativeLeakDetection.Mode = NativeLeakDetectionMode.Disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证方法会在正式方法前执行,通不过就会置灰
|
// 验证方法会在正式方法前执行,通不过就会置灰
|
||||||
[MenuItem("Jobs/内存泄漏检测/禁用", true)]
|
[MenuItem("Evo/内存泄漏检测/禁用", true)]
|
||||||
static bool ValidateLeakDetectionDisable()
|
static bool ValidateLeakDetectionDisable()
|
||||||
{
|
{
|
||||||
return NativeLeakDetection.Mode != NativeLeakDetectionMode.Disabled;
|
return NativeLeakDetection.Mode != NativeLeakDetectionMode.Disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MenuItem("Jobs/内存泄漏检测/启用")]
|
[MenuItem("Evo/内存泄漏检测/启用")]
|
||||||
static void LeakDetectionEnabled()
|
static void LeakDetectionEnabled()
|
||||||
{
|
{
|
||||||
NativeLeakDetection.Mode = NativeLeakDetectionMode.Enabled;
|
NativeLeakDetection.Mode = NativeLeakDetectionMode.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("Jobs/内存泄漏检测/启用", true)]
|
[MenuItem("Evo/内存泄漏检测/启用", true)]
|
||||||
static bool ValidateLeakDetectionEnabled()
|
static bool ValidateLeakDetectionEnabled()
|
||||||
{
|
{
|
||||||
return NativeLeakDetection.Mode != NativeLeakDetectionMode.Enabled;
|
return NativeLeakDetection.Mode != NativeLeakDetectionMode.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MenuItem("Jobs/内存泄漏检测/启用堆栈跟踪")]
|
[MenuItem("Evo/内存泄漏检测/启用堆栈跟踪")]
|
||||||
static void LeakDetectionEnabledWithStackTrace()
|
static void LeakDetectionEnabledWithStackTrace()
|
||||||
{
|
{
|
||||||
NativeLeakDetection.Mode = NativeLeakDetectionMode.EnabledWithStackTrace;
|
NativeLeakDetection.Mode = NativeLeakDetectionMode.EnabledWithStackTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("Jobs/内存泄漏检测/启用堆栈跟踪", true)]
|
[MenuItem("Evo/内存泄漏检测/启用堆栈跟踪", true)]
|
||||||
static bool ValidateLeakDetectionEnabledWithStackTrace()
|
static bool ValidateLeakDetectionEnabledWithStackTrace()
|
||||||
{
|
{
|
||||||
return NativeLeakDetection.Mode != NativeLeakDetectionMode.EnabledWithStackTrace;
|
return NativeLeakDetection.Mode != NativeLeakDetectionMode.EnabledWithStackTrace;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.main",
|
"name": "com.staryevo.main",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"displayName": "00.StaryEvo",
|
"displayName": "00.StaryEvo",
|
||||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user