Merge branch 'master' of http://192.168.31.100:8088/framework/xosmopluginlibrary
This commit is contained in:
@@ -122,9 +122,7 @@ namespace Stary.Evo.Editor
|
||||
|
||||
#region BuildAsset
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
|
||||
[HideLabel]
|
||||
[BoxGroup("Build", showLabel: false)] [InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)] [HideLabel]
|
||||
public BuildAssetDataSetting BuildAssetDataSetting;
|
||||
|
||||
/// <summary>
|
||||
@@ -202,9 +200,7 @@ namespace Stary.Evo.Editor
|
||||
|
||||
#region Update
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[Title("打包本地资源", titleAlignment: TitleAlignments.Centered)]
|
||||
[HideLabel]
|
||||
[BoxGroup("Build", showLabel: false)] [Title("打包本地资源", titleAlignment: TitleAlignments.Centered)] [HideLabel]
|
||||
public BuildAssetEntity onBuildPipelineEntity;
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
@@ -257,15 +253,8 @@ namespace Stary.Evo.Editor
|
||||
//原yooAsset目录
|
||||
var outputPackageDirectory =
|
||||
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{setting.packageName}";
|
||||
|
||||
//RawFile目录路径
|
||||
var outputRawFileDirectory =
|
||||
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{setting.packageName}_RawFile";
|
||||
|
||||
//拷贝目录
|
||||
string outFilePath = $"{outputPackageDirectory}/{setting.packageVersion}";
|
||||
string outRawFilePath = $"{outputRawFileDirectory}/{setting.packageVersion}";
|
||||
|
||||
var copyPackageDirectory =
|
||||
$"{Application.streamingAssetsPath}/{YooAssetSettingsData.GetDefaultYooFolderName()}/{setting.packageName}";
|
||||
|
||||
@@ -273,10 +262,21 @@ namespace Stary.Evo.Editor
|
||||
CreateBuildinCatalogFile("BuildinCatalog.json", copyPackageDirectory, outFilePath);
|
||||
CreateBuildinCatalogFile("BuildinCatalog.bytes", copyPackageDirectory, outFilePath);
|
||||
|
||||
var copyRawFilePackageDirectory =
|
||||
|
||||
//RawFile目录路径
|
||||
string outputRawFileDirectory = "", outRawFilePath = "", copyRawFilePackageDirectory = "";
|
||||
outputRawFileDirectory =
|
||||
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{setting.packageName}_RawFile";
|
||||
if (Directory.Exists(outputRawFileDirectory))
|
||||
{
|
||||
outRawFilePath = $"{outputRawFileDirectory}/{setting.packageVersion}";
|
||||
copyRawFilePackageDirectory =
|
||||
$"{Application.streamingAssetsPath}/{YooAssetSettingsData.GetDefaultYooFolderName()}/{setting.packageName}_RawFile";
|
||||
CreateBuildinCatalogFile("BuildinCatalog.json", copyRawFilePackageDirectory, outRawFilePath);
|
||||
CreateBuildinCatalogFile("BuildinCatalog.bytes", copyRawFilePackageDirectory, outRawFilePath);
|
||||
}
|
||||
|
||||
|
||||
//输出目录
|
||||
string zipFilePath = Path.Combine(outputPackageDirectory, zipFileName);
|
||||
try
|
||||
@@ -302,12 +302,14 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
|
||||
// 打包RawFile文件
|
||||
if (Directory.Exists(outRawFilePath))
|
||||
if (Directory.Exists(outputRawFileDirectory) && Directory.Exists(outRawFilePath))
|
||||
{
|
||||
foreach (string filePath in Directory.GetFiles(outRawFilePath, "*.*", SearchOption.AllDirectories))
|
||||
foreach (string filePath in Directory.GetFiles(outRawFilePath, "*.*",
|
||||
SearchOption.AllDirectories))
|
||||
{
|
||||
// 获取文件在压缩包中的相对路径
|
||||
string entryName =$"{setting.packageName}_RawFile/{ Path.GetRelativePath(outRawFilePath, filePath)}";
|
||||
string entryName =
|
||||
$"{setting.packageName}_RawFile/{Path.GetRelativePath(outRawFilePath, filePath)}";
|
||||
|
||||
// 创建zip条目
|
||||
ZipArchiveEntry entry = archive.CreateEntry(entryName,
|
||||
@@ -355,8 +357,6 @@ namespace Stary.Evo.Editor
|
||||
|
||||
public static async Task UpdateFileDataResDomain(BuildAssetDataSetting setting, string zipFilePath)
|
||||
{
|
||||
|
||||
|
||||
string ip = CustomEditorPrefs.GetString("ip");
|
||||
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { zipFilePath });
|
||||
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(上传zip文件)", 0.5f);
|
||||
@@ -401,7 +401,6 @@ namespace Stary.Evo.Editor
|
||||
"确定");
|
||||
setting.GetBuildPackageVersion(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(更新数据库)", 1f);
|
||||
@@ -428,7 +427,8 @@ namespace Stary.Evo.Editor
|
||||
DomainName = selectedPackageNames,
|
||||
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
|
||||
};
|
||||
var resResultMessage = await WebRequestSystem.Post(CustomEditorPrefs.GetString("ip") + "/ResDomain/GetResDomainByDomain",
|
||||
var resResultMessage = await WebRequestSystem.Post(
|
||||
CustomEditorPrefs.GetString("ip") + "/ResDomain/GetResDomainByDomain",
|
||||
JsonConvert.SerializeObject(resDmainAddRequst));
|
||||
//如果低于服务器版本,更新版本号
|
||||
if (resResultMessage.code != 1011)
|
||||
@@ -493,7 +493,6 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool IsRelease()
|
||||
{
|
||||
return BuildAssetDataSetting.environmentType == EnvironmentType.Release;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
|
||||
// 2. 然后使用ScriptableBuildPipeline打包其余文件
|
||||
|
||||
Debug.Log("开始使用RawFileBuildPipeline打包视频文件...");
|
||||
var rawBuildResult = BuildRawFiles();
|
||||
if (!rawBuildResult.Success)
|
||||
@@ -34,6 +35,7 @@ namespace Stary.Evo.Editor
|
||||
Debug.LogError("视频文件打包失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("混合打包完成!");
|
||||
base.ExecuteBuild();
|
||||
}
|
||||
@@ -41,7 +43,19 @@ namespace Stary.Evo.Editor
|
||||
private BuildResult BuildRawFiles()
|
||||
{
|
||||
var rawPackageName = $"{packageName}_RawFile";
|
||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(packageName, selectedBuildPipelines);
|
||||
var package = AssetBundleCollectorSettingData.Setting.GetPackage(rawPackageName);
|
||||
int count = 0;
|
||||
foreach (var group in package.Groups)
|
||||
{
|
||||
foreach (var collector in group.Collectors)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count > 0)
|
||||
{
|
||||
var fileNameStyle =
|
||||
AssetBundleBuilderSetting.GetPackageFileNameStyle(packageName, selectedBuildPipelines);
|
||||
var buildinFileCopyOption =
|
||||
AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(packageName, selectedBuildPipelines);
|
||||
var buildinFileCopyParams =
|
||||
@@ -69,7 +83,14 @@ namespace Stary.Evo.Editor
|
||||
// SetVideoGroupActive(true);
|
||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
||||
return pipeline.Run(buildParameters, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return new BuildResult()
|
||||
{
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +106,8 @@ namespace Stary.Evo.Editor
|
||||
var useAssetDependencyDB =
|
||||
AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(packageName, selectedBuildPipelines);
|
||||
|
||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(packageName, selectedBuildPipelines);
|
||||
var clearBuildCache =
|
||||
AssetBundleBuilderSetting.GetPackageClearBuildCache(packageName, selectedBuildPipelines);
|
||||
var builtinShaderBundleName = GetBuiltinShaderBundleName();
|
||||
|
||||
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
||||
|
||||
@@ -165,24 +165,6 @@ namespace Stary.Evo.Editor
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddRawFileMark()
|
||||
{
|
||||
AssetBundleCollectorPackage assetBundleCollectorPackage = null;
|
||||
var packageRawFile = $"{BuildAssetWindow.GetBuildPackageName()}_RawFile";
|
||||
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
||||
{
|
||||
if (packageRawFile == BuildAssetWindow.GetBuildPackageName())
|
||||
{
|
||||
assetBundleCollectorPackage = package;
|
||||
}
|
||||
}
|
||||
|
||||
if (assetBundleCollectorPackage != null)
|
||||
{
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateRes(string domain, string resPath, string outputPath)
|
||||
{
|
||||
ResFileGet.CreateClass(addressDic, "Res", domain, outputPath,
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Stary.Evo
|
||||
public class AppConfig
|
||||
{
|
||||
public static OpenDomainType OpenDomainType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// package name
|
||||
/// </summary>
|
||||
@@ -26,6 +27,15 @@ namespace Stary.Evo
|
||||
private static GameObject _MainBaseModel;
|
||||
|
||||
|
||||
public static bool DeveloperMode
|
||||
{
|
||||
get { return HybridClREntrance.Global.stage == StageType.Developer || PackageDomainName == "Main"; }
|
||||
}
|
||||
|
||||
public static bool MainPackageMode
|
||||
{
|
||||
get { return PackageDomainName == "Main"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 赋值默认的实例
|
||||
@@ -48,6 +58,8 @@ namespace Stary.Evo
|
||||
{
|
||||
public const string RikidHandLeft = "LeftHandRender/RKHandVisual/Hand_L/left_wrist/left_palm";
|
||||
public const string RikidHandRight = "RightHandRender/RKHandVisual/Hand_R/right_wrist/right_palm";
|
||||
public const string RikidHandRightIndexTip = "RightHandRender/RKHandVisual/Hand_R/right_wrist/right_index_metacarpal/right_index_proximal/right_index_intermediate/right_index_distal/right_index_tip";
|
||||
|
||||
public const string RikidHandRightIndexTip =
|
||||
"RightHandRender/RKHandVisual/Hand_R/right_wrist/right_index_metacarpal/right_index_proximal/right_index_intermediate/right_index_distal/right_index_tip";
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,8 @@ namespace Stary.Evo
|
||||
{
|
||||
var initParams = YooAssetFileSystem.HostInitializeParameter(package.PackageName);
|
||||
// initParameters.CacheFileSystemParameters = cacheFileSystemParams;
|
||||
|
||||
try
|
||||
{
|
||||
var initOperation = package.InitializeAsync(initParams);
|
||||
|
||||
await initOperation;
|
||||
@@ -141,10 +142,16 @@ namespace Stary.Evo
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"UnityEvo:从远程加载资源包,初始化失败:{initOperation.Error}");
|
||||
return false;
|
||||
Debug.LogWarning($"UnityEvo:从远程加载资源包,初始化失败:{initOperation.Error}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"UnityEvo:从远程加载资源包,初始化失败:{e}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async UniTask OFFLINE_PLAYMODE(ResourcePackage package)
|
||||
{
|
||||
@@ -156,19 +163,26 @@ namespace Stary.Evo
|
||||
{
|
||||
//Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
||||
var initParams = YooAssetFileSystem.HostInitializeParameter(package.PackageName);
|
||||
try
|
||||
{
|
||||
var initOperation = package.InitializeAsync(initParams);
|
||||
await initOperation;
|
||||
if (initOperation.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.Log("UnityEvo:从本地缓存中资源包,初始化成功!");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"UnityEvo:从本地缓存中资源包,初始化失败:{initOperation.Error}");
|
||||
Debug.LogWarning($"UnityEvo:从本地缓存中资源包,初始化失败:{initOperation.Error}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"UnityEvo:从本地缓存中资源包,初始化失败:{e}");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
var operation = package.RequestPackageVersionAsync();
|
||||
await operation;
|
||||
@@ -380,12 +394,12 @@ namespace Stary.Evo
|
||||
//string loadPath = Path.Combine(Application.temporaryCachePath, "DownloadedContent", AppConfig.PackageDomainName);
|
||||
string loadPath = Path.Combine(Application.temporaryCachePath, "DownloadedContent");
|
||||
//string loadPath = $"{Application.persistentDataPath}/DownloadedContent/{AppConfig.PackageDomainName}";
|
||||
if (Directory.Exists(loadPath))
|
||||
{
|
||||
Directory.Delete(loadPath, true);
|
||||
// 等一帧,让系统真正释放句柄
|
||||
await UniTask.DelayFrame(1);
|
||||
}
|
||||
// if (Directory.Exists(loadPath))
|
||||
// {
|
||||
// Directory.Delete(loadPath, true);
|
||||
// // 等一帧,让系统真正释放句柄
|
||||
// await UniTask.DelayFrame(1);
|
||||
// }
|
||||
|
||||
FsmLoadSystem loadSystem = FsmSystem as FsmLoadSystem;
|
||||
if (loadSystem != null && loadSystem.ProgressBarPanel == null)
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Stary.Evo
|
||||
//4.下载补丁包
|
||||
await Download();
|
||||
|
||||
if (HybridClREntrance.Global.stage == StageType.Developer)
|
||||
if (AppConfig.DeveloperMode)
|
||||
{
|
||||
//加载热更配置文件
|
||||
var loadHotfixSettingsOp = package.LoadAssetAsync<DomainConfig>("Config_DomainConfig");
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Stary.Evo
|
||||
private DomainConfig.LoadResType loadResType;
|
||||
public GameObject mainPrefab;
|
||||
private DomainConfig domainConfig;
|
||||
|
||||
private string _packageName;
|
||||
private string _sceneName;
|
||||
|
||||
public ResStartState(IFsmSystemAsync system) : base(system)
|
||||
@@ -37,10 +37,11 @@ namespace Stary.Evo
|
||||
|
||||
public override async UniTask OnEnterAsync<T1, T2>(T1 param1, T2 param2)
|
||||
{
|
||||
if (domainConfig == null && HybridClREntrance.Global.stage == StageType.Originality)
|
||||
return;
|
||||
if (AppConfig.DeveloperMode)
|
||||
{
|
||||
domainConfig = param1 as DomainConfig;
|
||||
loadResType = domainConfig.loadResType;
|
||||
_packageName = domainConfig.domain;
|
||||
Type type = param2 as Type;
|
||||
var package = YooAssets.GetPackage(domainConfig.domain);
|
||||
switch (loadResType)
|
||||
@@ -54,7 +55,8 @@ namespace Stary.Evo
|
||||
|
||||
var sceneMode = domainConfig.loadSceneMode;
|
||||
var physicsMode = LocalPhysicsMode.None;
|
||||
SceneHandle handle = package.LoadSceneAsync(domainConfig.sceneIdentifier, sceneMode, physicsMode);
|
||||
SceneHandle handle =
|
||||
package.LoadSceneAsync(domainConfig.sceneIdentifier, sceneMode, physicsMode);
|
||||
await handle;
|
||||
|
||||
Scene targetScene = SceneManager.GetSceneByName(handle.SceneName);
|
||||
@@ -126,6 +128,11 @@ namespace Stary.Evo
|
||||
hotfixInstance.OnEnterAsync("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_packageName = AppConfig.PackageDomainName;
|
||||
}
|
||||
}
|
||||
|
||||
private async UniTask LoadDomainPrefab(ResourcePackage package)
|
||||
{
|
||||
@@ -156,10 +163,10 @@ namespace Stary.Evo
|
||||
|
||||
public override async UniTask OnExitAsync()
|
||||
{
|
||||
Debug.Log("UnityEvo:Domain退出...");
|
||||
if (_packageName=="Main")
|
||||
return;
|
||||
|
||||
if (HybridClREntrance.Global.stage == StageType.Developer)
|
||||
{
|
||||
if (domainConfig.domain != "Main")
|
||||
{
|
||||
DomainBase domainBase = mainPrefab.GetOrAddComponent<DomainBase>();
|
||||
if (domainBase == null)
|
||||
@@ -170,26 +177,25 @@ namespace Stary.Evo
|
||||
{
|
||||
domainBase.OnExit();
|
||||
await domainBase.OnExitAsync();
|
||||
}
|
||||
|
||||
if (domainBase != null)
|
||||
{
|
||||
GameObject.Destroy(domainBase.gameObject);
|
||||
|
||||
await ((FsmLoadSystem)FsmSystem).ForceUnloadAllAssets(domainBase.DomainName);
|
||||
await ((FsmLoadSystem)FsmSystem).ForceUnloadAllAssets(domainBase.DomainNameRaw);
|
||||
}
|
||||
|
||||
Debug.Log("UnityEvo:Domain退出...");
|
||||
|
||||
if (loadResType == DomainConfig.LoadResType.Scene)
|
||||
{
|
||||
await SceneManager.UnloadSceneAsync(_sceneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (HybridClREntrance.Global.stage == StageType.Originality)
|
||||
{
|
||||
await ((FsmLoadSystem)FsmSystem).ForceUnloadAllAssets(AppConfig.PackageDomainName);
|
||||
await ((FsmLoadSystem)FsmSystem).ForceUnloadAllAssets(_packageName);
|
||||
AppConfig.PackageDomainName = "";
|
||||
Debug.Log("UnityEvo:Domain退出...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.tools",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"displayName": "00.StaryEvo.Tools",
|
||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user