【m】优化加载架构
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
public class ArtServerManageWindow : OdinEditorWindow
|
public class ArtServerManageWindow : OdinEditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("Evo/Art/服务器数据管理工具", false, 2)]
|
[MenuItem("Evo/Art/服务器数据管理工具", false, 1)]
|
||||||
static void Init()
|
static void Init()
|
||||||
{
|
{
|
||||||
// Get existing open window or if none, make a new one:
|
// Get existing open window or if none, make a new one:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.buildoriginality",
|
"name": "com.staryevo.buildoriginality",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"displayName": "00.StaryEvo.BuildOriginality",
|
"displayName": "00.StaryEvo.BuildOriginality",
|
||||||
"description": "美术打包工具",
|
"description": "美术打包工具",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
@@ -166,9 +166,10 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
buildAssetDataSetting.environmentType = EnvironmentType.Release;
|
buildAssetDataSetting.environmentType = EnvironmentType.Release;
|
||||||
buildAssetDataSetting.SetEnvironmentType();
|
buildAssetDataSetting.SetEnvironmentType();
|
||||||
buildAssetDataSetting.viewer = new BuiltinBuildPipelineViewer(buildAssetDataSetting.packageName,
|
buildAssetDataSetting.SetBuildPipelines();
|
||||||
buildAssetDataSetting.selectedBuildPipelines.ToString(),
|
// buildAssetDataSetting.viewer = new ScriptableBuildPipelineViewer(buildAssetDataSetting.packageName,
|
||||||
buildAssetDataSetting.packageVersion);
|
// buildAssetDataSetting.GetBuildPipelines().ToString(),
|
||||||
|
// buildAssetDataSetting.packageVersion);
|
||||||
buildAssetDataSetting.viewer.clearBuildCacheToggle = true;
|
buildAssetDataSetting.viewer.clearBuildCacheToggle = true;
|
||||||
buildAssetDataSetting.viewer.SetBuildCacheToggle();
|
buildAssetDataSetting.viewer.SetBuildCacheToggle();
|
||||||
EditorApplication.delayCall += buildAssetDataSetting.viewer.ExecuteBuild;
|
EditorApplication.delayCall += buildAssetDataSetting.viewer.ExecuteBuild;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
int id = EditorUtility.DisplayDialogComplex("提示",
|
int id = EditorUtility.DisplayDialogComplex("提示",
|
||||||
$"当前为[{PLayerMode.EDITOR_SIMULATEMODE}]模式,请选择切换得热更模式!",
|
$"当前为[{PLayerMode.EDITOR_SIMULATEMODE}]模式,请选择切换得热更模式!",
|
||||||
$"{PLayerMode.HOST_PLAYMODE}", $"{PLayerMode.OFFLINE_PLAYMODE}", "取消");
|
$"{PLayerMode.HOST_PLAYMODE}", $"{PLayerMode.HOST_PLAYMODE}", "取消");
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
@@ -30,8 +30,8 @@ namespace Stary.Evo.Editor
|
|||||||
Debug.Log("切换为[HOST_PLAYMODE]模式");
|
Debug.Log("切换为[HOST_PLAYMODE]模式");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ChangePlayerSchema.SetPlayerMode(PLayerMode.OFFLINE_PLAYMODE);
|
ChangePlayerSchema.SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
||||||
Debug.Log("切换为[OFFLINE_PLAYMODE]模式");
|
Debug.Log("切换为[HOST_PLAYMODE]模式");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
|
|||||||
@@ -9,20 +9,22 @@ using YooAsset.Editor;
|
|||||||
namespace Stary.Evo.Editor
|
namespace Stary.Evo.Editor
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(fileName = "BuildAssetDataSetting", menuName = "Evo/BuildAssetDataSetting")]
|
[CreateAssetMenu(fileName = "BuildAssetDataSetting", menuName = "Evo/BuildAssetDataSetting")]
|
||||||
public class BuildAssetDataSetting : SerializedScriptableObject
|
public class BuildAssetDataSetting : SerializedScriptableObject
|
||||||
{
|
{
|
||||||
public void OnEnable()
|
public void OnEnable()
|
||||||
{
|
{
|
||||||
BuildPipelineViewer();
|
viewer = new ScriptableBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(),
|
||||||
|
packageVersion);
|
||||||
oldVersionX = packageVersionX;
|
oldVersionX = packageVersionX;
|
||||||
oldVersionY = packageVersionY;
|
oldVersionY = packageVersionY;
|
||||||
oldVersionZ = packageVersionZ;
|
oldVersionZ = packageVersionZ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HideInInspector] public string packageName;
|
[HideInInspector] public string packageName;
|
||||||
[HideInInspector]public int packageVersionX = 1;
|
[HideInInspector] public int packageVersionX = 1;
|
||||||
[HideInInspector]public int packageVersionY;
|
[HideInInspector] public int packageVersionY;
|
||||||
[HideInInspector]public int packageVersionZ;
|
[HideInInspector] public int packageVersionZ;
|
||||||
private int oldVersionX = 1;
|
private int oldVersionX = 1;
|
||||||
private int oldVersionY;
|
private int oldVersionY;
|
||||||
private int oldVersionZ;
|
private int oldVersionZ;
|
||||||
@@ -32,10 +34,10 @@ namespace Stary.Evo.Editor
|
|||||||
[OnValueChanged("SetEnvironmentType")]
|
[OnValueChanged("SetEnvironmentType")]
|
||||||
public EnvironmentType environmentType;
|
public EnvironmentType environmentType;
|
||||||
|
|
||||||
[Title("构建列表", titleAlignment: TitleAlignments.Centered)]
|
// [Title("构建列表", titleAlignment: TitleAlignments.Centered)]
|
||||||
[HorizontalGroup("BuildSetting"), HideLabel]
|
// [HorizontalGroup("BuildSetting"), HideLabel]
|
||||||
[OnValueChanged("SetBuildPipelines")]
|
// [OnValueChanged("SetBuildPipelines")]
|
||||||
public EBuildPipeline selectedBuildPipelines;
|
private BuildPipelineType selectedBuildPipelines = BuildPipelineType.ScriptableBuildPipeline;
|
||||||
|
|
||||||
private const string VerSersionMessage = "(小版本由打包叠加,中版本、大版本更新会重置小版本,如误操作,点击重置按钮即可)";
|
private const string VerSersionMessage = "(小版本由打包叠加,中版本、大版本更新会重置小版本,如误操作,点击重置按钮即可)";
|
||||||
|
|
||||||
@@ -66,7 +68,8 @@ namespace Stary.Evo.Editor
|
|||||||
packageVersionY++;
|
packageVersionY++;
|
||||||
if (packageVersionZ > 0)
|
if (packageVersionZ > 0)
|
||||||
packageVersionZ = 0;
|
packageVersionZ = 0;
|
||||||
}else if (VersionType == VersionPosType.Z)
|
}
|
||||||
|
else if (VersionType == VersionPosType.Z)
|
||||||
{
|
{
|
||||||
packageVersionZ++;
|
packageVersionZ++;
|
||||||
}
|
}
|
||||||
@@ -90,7 +93,8 @@ namespace Stary.Evo.Editor
|
|||||||
packageVersionY--;
|
packageVersionY--;
|
||||||
if (packageVersionZ > 0)
|
if (packageVersionZ > 0)
|
||||||
packageVersionZ = 0;
|
packageVersionZ = 0;
|
||||||
}else if (VersionType == VersionPosType.Z)
|
}
|
||||||
|
else if (VersionType == VersionPosType.Z)
|
||||||
{
|
{
|
||||||
packageVersionZ--;
|
packageVersionZ--;
|
||||||
if (packageVersionZ < 0)
|
if (packageVersionZ < 0)
|
||||||
@@ -100,6 +104,7 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
GetPackageVersion();
|
GetPackageVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Title("重置版本", titleAlignment: TitleAlignments.Centered)]
|
[Title("重置版本", titleAlignment: TitleAlignments.Centered)]
|
||||||
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel, Button(Icon = SdfIconType.ArrowRepeat)]
|
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel, Button(Icon = SdfIconType.ArrowRepeat)]
|
||||||
[HideIf("environmentType", EnvironmentType.Debug)]
|
[HideIf("environmentType", EnvironmentType.Debug)]
|
||||||
@@ -111,11 +116,9 @@ namespace Stary.Evo.Editor
|
|||||||
GetPackageVersion();
|
GetPackageVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HideLabel] public AbstractBuildPipelineViewer viewer;
|
||||||
|
|
||||||
|
//[HideLabel] private Dictionary<BuildPipelineType, AbstractBuildPipelineViewer> _viewers;
|
||||||
[HideLabel] public AbstractBuildPipelineViewer viewer;
|
|
||||||
|
|
||||||
[HideLabel] private Dictionary<EBuildPipeline, AbstractBuildPipelineViewer> _viewers;
|
|
||||||
|
|
||||||
public void SetEnvironmentType()
|
public void SetEnvironmentType()
|
||||||
{
|
{
|
||||||
@@ -129,21 +132,21 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
EditorUtility.SetDirty(this);
|
EditorUtility.SetDirty(this);
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
version= "Simulate";
|
version = "Simulate";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environmentType == EnvironmentType.Release)
|
if (environmentType == EnvironmentType.Release)
|
||||||
{
|
{
|
||||||
version =
|
version =
|
||||||
$"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
|
$"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
|
||||||
|
|
||||||
if (isUpdate)
|
if (isUpdate)
|
||||||
packageVersionZ++;
|
packageVersionZ++;
|
||||||
|
|
||||||
packageVersion = $"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
|
packageVersion = $"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
|
||||||
|
|
||||||
}
|
}
|
||||||
BuildPipelineViewer();
|
|
||||||
|
//BuildPipelineViewer();
|
||||||
EditorUtility.SetDirty(this);
|
EditorUtility.SetDirty(this);
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
return version;
|
return version;
|
||||||
@@ -151,18 +154,16 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
public void GetPackageVersion()
|
public void GetPackageVersion()
|
||||||
{
|
{
|
||||||
SetBuildPipelines();
|
|
||||||
if (environmentType == EnvironmentType.Debug)
|
if (environmentType == EnvironmentType.Debug)
|
||||||
{
|
{
|
||||||
viewer.clearBuildCacheToggle = true;
|
viewer.clearBuildCacheToggle = true;
|
||||||
selectedBuildPipelines = EBuildPipeline.EditorSimulateBuildPipeline;
|
//selectedBuildPipelines = BuildPipelineType.EditorSimulateBuildPipeline;
|
||||||
packageVersion = "Simulate";
|
packageVersion = "Simulate";
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (environmentType == EnvironmentType.Release)
|
else if (environmentType == EnvironmentType.Release)
|
||||||
{
|
{
|
||||||
viewer.clearBuildCacheToggle = false;
|
viewer.clearBuildCacheToggle = false;
|
||||||
selectedBuildPipelines = EBuildPipeline.ScriptableBuildPipeline;
|
//selectedBuildPipelines = BuildPipelineType.ScriptableBuildPipeline;
|
||||||
|
|
||||||
packageVersionX = packageVersionX > 1 ? packageVersionX : 1;
|
packageVersionX = packageVersionX > 1 ? packageVersionX : 1;
|
||||||
packageVersionY =
|
packageVersionY =
|
||||||
@@ -183,44 +184,62 @@ namespace Stary.Evo.Editor
|
|||||||
/// 设置当前构建管线
|
/// 设置当前构建管线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private void SetBuildPipelines()
|
public void SetBuildPipelines()
|
||||||
{
|
{
|
||||||
BuildPipelineViewer();
|
if (packageName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
packageName = BuildAssetWindow.GetBuildPackageName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildPipelineViewer();
|
||||||
|
|
||||||
|
|
||||||
|
if (viewer != null)
|
||||||
|
viewer.SetBuildPackageData(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"UnityEvo:BuildPipelineViewer 为空!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成打包实例
|
/// 获取当前构建管线名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void BuildPipelineViewer()
|
/// <returns></returns>
|
||||||
|
public BuildPipelineType GetBuildPipelinesName()
|
||||||
{
|
{
|
||||||
if (_viewers == null)
|
return selectedBuildPipelines;
|
||||||
_viewers = new Dictionary<EBuildPipeline, AbstractBuildPipelineViewer>();
|
|
||||||
if (_viewers.ContainsKey(selectedBuildPipelines))
|
|
||||||
{
|
|
||||||
viewer = _viewers[selectedBuildPipelines];
|
|
||||||
viewer.SetBuildPackageData(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (selectedBuildPipelines)
|
|
||||||
{
|
|
||||||
case EBuildPipeline.EditorSimulateBuildPipeline:
|
|
||||||
viewer = new SimulateBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
|
||||||
break;
|
|
||||||
case EBuildPipeline.BuiltinBuildPipeline:
|
|
||||||
viewer = new BuiltinBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
|
||||||
break;
|
|
||||||
case EBuildPipeline.ScriptableBuildPipeline:
|
|
||||||
viewer = new ScriptableBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
|
||||||
break;
|
|
||||||
case EBuildPipeline.RawFileBuildPipeline:
|
|
||||||
viewer = new RawfileBuildpipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_viewers.Add(selectedBuildPipelines, viewer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// /// <summary>
|
||||||
|
// /// 生成打包实例
|
||||||
|
// /// </summary>
|
||||||
|
// public void BuildPipelineViewer()
|
||||||
|
// {
|
||||||
|
// if (_viewers == null)
|
||||||
|
// _viewers = new Dictionary<BuildPipelineType, AbstractBuildPipelineViewer>();
|
||||||
|
// if (_viewers.ContainsKey(selectedBuildPipelines))
|
||||||
|
// {
|
||||||
|
// viewer = _viewers[selectedBuildPipelines];
|
||||||
|
// viewer.SetBuildPackageData(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// switch (selectedBuildPipelines)
|
||||||
|
// {
|
||||||
|
// case BuildPipelineType.EditorSimulateBuildPipeline:
|
||||||
|
// viewer = new SimulateBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
||||||
|
// break;
|
||||||
|
// case BuildPipelineType.ScriptableBuildPipeline:
|
||||||
|
// viewer = new ScriptableBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
||||||
|
// break;
|
||||||
|
// case BuildPipelineType.RawFileBuildPipeline:
|
||||||
|
// viewer = new RawfileBuildpipelineViewer(packageName, selectedBuildPipelines.ToString(), packageVersion);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// _viewers.Add(selectedBuildPipelines, viewer);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum VersionPosType
|
public enum VersionPosType
|
||||||
|
|||||||
@@ -216,7 +216,8 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
private void OnBuildPipeline()
|
private void OnBuildPipeline()
|
||||||
{
|
{
|
||||||
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{selectedPackageNames}]!", "Yes", "No"))
|
if (EditorUtility.DisplayDialog("提示",
|
||||||
|
$"开始构建资源包[{selectedPackageNames}],版本号为[{BuildAssetDataSetting.packageVersion}]!", "Yes", "No"))
|
||||||
{
|
{
|
||||||
EditorTools.ClearUnityConsole();
|
EditorTools.ClearUnityConsole();
|
||||||
EditorApplication.delayCall += BuildAssetDataSetting.viewer.ExecuteBuild;
|
EditorApplication.delayCall += BuildAssetDataSetting.viewer.ExecuteBuild;
|
||||||
@@ -229,7 +230,8 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
private async void OnUpdateBuildPipeline()
|
private async void OnUpdateBuildPipeline()
|
||||||
{
|
{
|
||||||
if (EditorUtility.DisplayDialog("提示", $"开始上传至服务器[{selectedPackageNames}]!", "Yes", "No"))
|
if (EditorUtility.DisplayDialog("提示",
|
||||||
|
$"开始上传至服务器[{selectedPackageNames}],,版本号为[{BuildAssetDataSetting.packageVersion}", "Yes", "No"))
|
||||||
{
|
{
|
||||||
// 新增:打包为zip的逻辑
|
// 新增:打包为zip的逻辑
|
||||||
string zipFilePath = BuildZip(BuildAssetDataSetting);
|
string zipFilePath = BuildZip(BuildAssetDataSetting);
|
||||||
@@ -373,8 +375,14 @@ namespace Stary.Evo.Editor
|
|||||||
EditorUtility.DisplayDialog("提示",
|
EditorUtility.DisplayDialog("提示",
|
||||||
$"{resResultMessage.message + $"\n{resResultMessage.data.ToString()}"}", "确定");
|
$"{resResultMessage.message + $"\n{resResultMessage.data.ToString()}"}", "确定");
|
||||||
}
|
}
|
||||||
|
else if (resResultMessage.code == 200)
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("提示",
|
||||||
|
$"上传成功,已更新为{setting.packageVersion}",
|
||||||
|
"确定");
|
||||||
|
setting.GetBuildPackageVersion(true);
|
||||||
|
}
|
||||||
|
|
||||||
setting.GetBuildPackageVersion(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(更新数据库)", 1f);
|
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(更新数据库)", 1f);
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using YooAsset;
|
|
||||||
using YooAsset.Editor;
|
|
||||||
|
|
||||||
namespace Stary.Evo.Editor
|
|
||||||
{
|
|
||||||
[Serializable]
|
|
||||||
public class BuiltinBuildPipelineViewer : AbstractBuildPipelineViewer
|
|
||||||
{
|
|
||||||
public BuiltinBuildPipelineViewer(string packageName, string selectedBuildPipelines, string packageVersion) :
|
|
||||||
base(packageName, selectedBuildPipelines, packageVersion)
|
|
||||||
{
|
|
||||||
// isSimulate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ExecuteBuild()
|
|
||||||
{
|
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(packageName, selectedBuildPipelines);
|
|
||||||
var buildinFileCopyOption =
|
|
||||||
AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(packageName, selectedBuildPipelines);
|
|
||||||
var buildinFileCopyParams =
|
|
||||||
AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(packageName, selectedBuildPipelines);
|
|
||||||
var compressOption =
|
|
||||||
AssetBundleBuilderSetting.GetPackageCompressOption(packageName, selectedBuildPipelines);
|
|
||||||
var clearBuildCache =
|
|
||||||
AssetBundleBuilderSetting.GetPackageClearBuildCache(packageName, selectedBuildPipelines);
|
|
||||||
var useAssetDependencyDB =
|
|
||||||
AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(packageName, selectedBuildPipelines);
|
|
||||||
|
|
||||||
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
|
||||||
buildParameters.BuildPipeline = selectedBuildPipelines.ToString();
|
|
||||||
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
|
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
|
||||||
buildParameters.PackageName = packageName;
|
|
||||||
buildParameters.PackageVersion = packageVersion;
|
|
||||||
buildParameters.EnableSharePackRule = true;
|
|
||||||
buildParameters.VerifyBuildingResult = true;
|
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
|
||||||
buildParameters.CompressOption = compressOption;
|
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
|
||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
|
||||||
|
|
||||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
|
||||||
if (buildResult.Success)
|
|
||||||
{
|
|
||||||
Debug.Log($"Build Success! 【{buildResult.OutputPackageDirectory}】");
|
|
||||||
//EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
|
||||||
base.ExecuteBuild();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ac3d61d6f0744f02a2f038fdeed98b75
|
|
||||||
timeCreated: 1741830306
|
|
||||||
@@ -34,7 +34,7 @@ namespace Stary.Evo.Editor
|
|||||||
Menu.SetChecked(EditorNotUpdateMode, platform == HotUpdateMode.NotUpdate.ToString());
|
Menu.SetChecked(EditorNotUpdateMode, platform == HotUpdateMode.NotUpdate.ToString());
|
||||||
Menu.SetChecked(EditorHotUpdateMode, platform == HotUpdateMode.HotUpdate.ToString());
|
Menu.SetChecked(EditorHotUpdateMode, platform == HotUpdateMode.HotUpdate.ToString());
|
||||||
//Menu.SetChecked(WebPlayMode, platform == HotUpdateMode.WEB_PLAYMODE.ToString());
|
//Menu.SetChecked(WebPlayMode, platform == HotUpdateMode.WEB_PLAYMODE.ToString());
|
||||||
Debug.LogError("ChangeHotUpdateSchema");
|
Debug.LogError("ChangeHotUpdateSchema:"+platform);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,31 +16,25 @@ namespace Stary.Evo.Editor
|
|||||||
private static PLayerMode _pLayerMode;
|
private static PLayerMode _pLayerMode;
|
||||||
|
|
||||||
private const string EditorSimulateMode = "Evo/Schema/ChangePlayer/EditorSimulateMode(编辑器调试模式)";
|
private const string EditorSimulateMode = "Evo/Schema/ChangePlayer/EditorSimulateMode(编辑器调试模式)";
|
||||||
private const string OfflinePlayMode = "Evo/Schema/ChangePlayer/OfflinePlayMode(本地运行模式)";
|
private const string HostPlayMode = "Evo/Schema/ChangePlayer/HostPlayMode(联机运行模式)";
|
||||||
private const string HostPlayMode = "Evo/Schema/ChangePlayer/HostPlayMode(服务器运行模式)";
|
|
||||||
private const string WebPlayMode = "Evo/Schema/ChangePlayer/WebPlayMode(Web运行模式)";
|
private const string WebPlayMode = "Evo/Schema/ChangePlayer/WebPlayMode(Web运行模式)";
|
||||||
|
|
||||||
[MenuItem(EditorSimulateMode)]
|
[MenuItem(EditorSimulateMode, false,3)]
|
||||||
private static void SetEditorMode() => SetPlayerMode(PLayerMode.EDITOR_SIMULATEMODE);
|
private static void SetEditorMode() => SetPlayerMode(PLayerMode.EDITOR_SIMULATEMODE);
|
||||||
|
[MenuItem(HostPlayMode, false,3)]
|
||||||
[MenuItem(OfflinePlayMode)]
|
|
||||||
private static void SetOfflineMode() => SetPlayerMode(PLayerMode.OFFLINE_PLAYMODE);
|
|
||||||
|
|
||||||
[MenuItem(HostPlayMode)]
|
|
||||||
private static void SetHostMode() => SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
private static void SetHostMode() => SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
||||||
|
|
||||||
// [MenuItem(WebPlayMode)]
|
// [MenuItem(WebPlayMode)]
|
||||||
// private static void SetWebMode() => SetPlayerMode(PLayerMode.WEB_PLAYMODE);
|
// private static void SetWebMode() => SetPlayerMode(PLayerMode.WEB_PLAYMODE);
|
||||||
|
|
||||||
[MenuItem(EditorSimulateMode, true)]
|
[MenuItem(EditorSimulateMode, true,3)]
|
||||||
private static bool ValidateModeMenu()
|
private static bool ValidateModeMenu()
|
||||||
{
|
{
|
||||||
string platform = EditorPrefs.GetString("ChangePlayerSchema");
|
string platform = EditorPrefs.GetString("ChangePlayerSchema");
|
||||||
Menu.SetChecked(EditorSimulateMode, platform == PLayerMode.EDITOR_SIMULATEMODE.ToString());
|
Menu.SetChecked(EditorSimulateMode, platform == PLayerMode.EDITOR_SIMULATEMODE.ToString());
|
||||||
Menu.SetChecked(OfflinePlayMode, platform == PLayerMode.OFFLINE_PLAYMODE.ToString());
|
|
||||||
Menu.SetChecked(HostPlayMode, platform == PLayerMode.HOST_PLAYMODE.ToString());
|
Menu.SetChecked(HostPlayMode, platform == PLayerMode.HOST_PLAYMODE.ToString());
|
||||||
//Menu.SetChecked(WebPlayMode, platform == PLayerMode.WEB_PLAYMODE.ToString());
|
//Menu.SetChecked(WebPlayMode, platform == PLayerMode.WEB_PLAYMODE.ToString());
|
||||||
Debug.LogError("CheckPlatform");
|
Debug.LogError($"ChangePlayerSchema:{platform}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,9 +72,6 @@ namespace Stary.Evo.Editor
|
|||||||
//编辑仿真模式,
|
//编辑仿真模式,
|
||||||
EDITOR_SIMULATEMODE,
|
EDITOR_SIMULATEMODE,
|
||||||
|
|
||||||
//单机运行模式
|
|
||||||
OFFLINE_PLAYMODE,
|
|
||||||
|
|
||||||
//联机运行模式
|
//联机运行模式
|
||||||
HOST_PLAYMODE,
|
HOST_PLAYMODE,
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f9224eefce894279bc45f0e44c5eeb94
|
||||||
|
timeCreated: 1767593352
|
||||||
@@ -11,7 +11,7 @@ namespace Stary.Evo
|
|||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
public class LoginAssetWindow : OdinEditorWindow
|
public class LoginAssetWindow : OdinEditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("Evo/登录", false, 3)]
|
[MenuItem("Evo/登录", false, 0)]
|
||||||
static void Init()
|
static void Init()
|
||||||
{
|
{
|
||||||
var window = (LoginAssetWindow)EditorWindow.GetWindow(typeof(LoginAssetWindow));
|
var window = (LoginAssetWindow)EditorWindow.GetWindow(typeof(LoginAssetWindow));
|
||||||
|
|||||||
@@ -148,25 +148,6 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddArtMark(Action complete)
|
|
||||||
{
|
|
||||||
_packageName = BuildArtAssetWindow.GetBuildPackageName();
|
|
||||||
AssetBundleCollectorPackage assetBundleCollectorPackage = null;
|
|
||||||
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
|
||||||
{
|
|
||||||
if (package.PackageName ==_packageName)
|
|
||||||
{
|
|
||||||
assetBundleCollectorPackage = package;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (assetBundleCollectorPackage != null)
|
|
||||||
{
|
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
|
||||||
}
|
|
||||||
MarkArt();
|
|
||||||
CollectSVC(ArtRoot, _packageName,complete);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddDomainMark()
|
public static void AddDomainMark()
|
||||||
{
|
{
|
||||||
// //清空主包旧数据
|
// //清空主包旧数据
|
||||||
|
|||||||
@@ -5,4 +5,24 @@ namespace Stary.Evo
|
|||||||
Login,
|
Login,
|
||||||
Build,
|
Build,
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 构建管线类型
|
||||||
|
/// </summary>
|
||||||
|
public enum BuildPipelineType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑器下的模拟构建管线(ESBP)
|
||||||
|
/// </summary>
|
||||||
|
EditorSimulateBuildPipeline,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 可编程构建管线 (SBP)
|
||||||
|
/// </summary>
|
||||||
|
ScriptableBuildPipeline,
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// 原生文件构建管线 (RFBP)
|
||||||
|
// /// </summary>
|
||||||
|
// RawFileBuildPipeline,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,8 @@ namespace Stary.Evo
|
|||||||
private TransformCtor transformCtor;
|
private TransformCtor transformCtor;
|
||||||
|
|
||||||
public ProgressBarPanel ProgressBarPanel { get; set; }
|
public ProgressBarPanel ProgressBarPanel { get; set; }
|
||||||
|
|
||||||
|
public bool IsLogin = false;
|
||||||
public void SetOpenDomainType(OpenDomainType type)
|
public void SetOpenDomainType(OpenDomainType type)
|
||||||
{
|
{
|
||||||
this.OpenDomainType = type;
|
this.OpenDomainType = type;
|
||||||
|
|||||||
@@ -23,18 +23,6 @@ namespace Stary.Evo
|
|||||||
Debug.Log("UnityEvo:启动开始资源初始化...");
|
Debug.Log("UnityEvo:启动开始资源初始化...");
|
||||||
|
|
||||||
|
|
||||||
//初始化读取资源配置表
|
|
||||||
HotfixMainResDomain hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
|
|
||||||
if (hotfixMainResDomain != null)
|
|
||||||
{
|
|
||||||
AppConfig.IpConfig = hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig;
|
|
||||||
AppConfig.UserName = hotfixMainResDomain.hotfixMainResDomainEntity.username;
|
|
||||||
AppConfig.PassWord = hotfixMainResDomain.hotfixMainResDomainEntity.password;
|
|
||||||
AppConfig.ProductName =Application.identifier;
|
|
||||||
AppConfig.MainDomainVersion = hotfixMainResDomain.hotfixMainResDomainEntity.mainDomainVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"UnityEvo:读取资源配置表成功...{AppConfig.IpConfig}{AppConfig.UserName}{AppConfig.PassWord}");
|
|
||||||
// 初始化资源系统
|
// 初始化资源系统
|
||||||
YooAssets.Initialize();
|
YooAssets.Initialize();
|
||||||
//初始化资源加载模块
|
//初始化资源加载模块
|
||||||
@@ -53,20 +41,20 @@ namespace Stary.Evo
|
|||||||
await EDITOR_SIMULATEMODE(package);
|
await EDITOR_SIMULATEMODE(package);
|
||||||
await FsmSystem.SetCurState(nameof(ResEditorSimulateState));
|
await FsmSystem.SetCurState(nameof(ResEditorSimulateState));
|
||||||
#elif OFFLINE_PLAYMODE
|
#elif OFFLINE_PLAYMODE
|
||||||
await OFFLINE_PLAYMODE(package);
|
await OFFLINE_PLAYMODE(package);
|
||||||
await FsmSystem.SetCurState(nameof(ResUpdateLocalState));
|
await FsmSystem.SetCurState(nameof(ResUpdateLocalState));
|
||||||
#elif HOST_PLAYMODE
|
#elif HOST_PLAYMODE
|
||||||
|
//登录
|
||||||
//登录
|
if (((FsmLoadSystem)FsmSystem).IsLogin)
|
||||||
string url = AppConfig.IpConfig + "/Authentication/login";
|
await HOST_PLAYMODE(package);
|
||||||
bool isLogin = await WebRequestSystem.Login(url, AppConfig.UserName, AppConfig.PassWord);
|
else
|
||||||
if (isLogin)
|
{
|
||||||
await HOST_PLAYMODE(package);
|
await OFFLINE_PLAYMODE(package);
|
||||||
else
|
await ChChe_PLAYMODE(package);
|
||||||
await ChChe_PLAYMODE(package);
|
}
|
||||||
|
|
||||||
|
|
||||||
await FsmSystem.SetCurState(nameof(ResUpdateLocalState));
|
await FsmSystem.SetCurState(nameof(ResUpdateLocalState));
|
||||||
|
|
||||||
#elif WEB_PLAYMODE
|
#elif WEB_PLAYMODE
|
||||||
// IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
// IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
||||||
@@ -113,8 +101,7 @@ namespace Stary.Evo
|
|||||||
|
|
||||||
private async UniTask EDITOR_SIMULATEMODE(ResourcePackage package)
|
private async UniTask EDITOR_SIMULATEMODE(ResourcePackage package)
|
||||||
{
|
{
|
||||||
|
var initParams = YooAssetFileSystem.EditorSimulateInitializeParameter(package.PackageName);
|
||||||
var initParams=YooAssetFileSystem.EditorSimulateInitializeParameter(package.PackageName);
|
|
||||||
var initialization = package.InitializeAsync(initParams);
|
var initialization = package.InitializeAsync(initParams);
|
||||||
await initialization;
|
await initialization;
|
||||||
if (initialization.Status == EOperationStatus.Succeed)
|
if (initialization.Status == EOperationStatus.Succeed)
|
||||||
@@ -127,12 +114,20 @@ namespace Stary.Evo
|
|||||||
Debug.LogError($"UnityEvo:资源包初始化失败:{initialization.Error}");
|
Debug.LogError($"UnityEvo:资源包初始化失败:{initialization.Error}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async UniTask ChChe_PLAYMODE(ResourcePackage package)
|
private async UniTask ChChe_PLAYMODE(ResourcePackage package)
|
||||||
{
|
{
|
||||||
Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
//Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
||||||
var initParams=YooAssetFileSystem.HostInitializeParameter();
|
var initParams = YooAssetFileSystem.HostInitializeParameter();
|
||||||
var initOperation = package.InitializeAsync(initParams);
|
var initOperation = package.InitializeAsync(initParams);
|
||||||
await initOperation;
|
await initOperation;
|
||||||
|
if (initOperation.Status == EOperationStatus.Succeed)
|
||||||
|
Debug.Log("UnityEvo:从本地缓存中资源包,初始化成功!");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"UnityEvo:从本地缓存中资源包,初始化失败:{initOperation.Error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var operation = package.RequestPackageVersionAsync();
|
var operation = package.RequestPackageVersionAsync();
|
||||||
await operation;
|
await operation;
|
||||||
@@ -140,37 +135,87 @@ namespace Stary.Evo
|
|||||||
{
|
{
|
||||||
PlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION", operation.PackageVersion);
|
PlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION", operation.PackageVersion);
|
||||||
Debug.Log("UnityEvo:从本地缓存中加载资源包,初始化获取版本号成功!");
|
Debug.Log("UnityEvo:从本地缓存中加载资源包,初始化获取版本号成功!");
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError($"UnityEvo:从本地缓存中加载资源包,初始化获取版本号失败!");
|
Debug.LogError($"UnityEvo:从本地缓存中加载资源包,初始化获取版本号失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initOperation.Status == EOperationStatus.Succeed)
|
|
||||||
Debug.Log("UnityEvo:从本地缓存中资源包,初始化成功!");
|
|
||||||
else
|
|
||||||
Debug.LogError($"UnityEvo:从本地缓存中资源包,初始化失败:{initOperation.Error}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async UniTask OFFLINE_PLAYMODE(ResourcePackage package)
|
private async UniTask OFFLINE_PLAYMODE(ResourcePackage package)
|
||||||
{
|
{
|
||||||
var initParams=YooAssetFileSystem.OfflineInitializeParameter();
|
Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
||||||
var initOperation = package.InitializeAsync(initParams);
|
CopyLocalFile();
|
||||||
await initOperation;
|
// var initParams = YooAssetFileSystem.OfflineInitializeParameter();
|
||||||
|
// var initOperation = package.InitializeAsync(initParams);
|
||||||
|
// await initOperation;
|
||||||
|
//
|
||||||
|
// var operation = package.RequestPackageVersionAsync();
|
||||||
|
// await operation;
|
||||||
|
// if (operation.Status == EOperationStatus.Succeed)
|
||||||
|
// {
|
||||||
|
// PlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION", operation.PackageVersion);
|
||||||
|
// Debug.Log("UnityEvo:从本地StreamingAssets加载资源包,初始化获取版本号成功!");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Debug.LogError($"UnityEvo:从本地StreamingAssets加载资源包,初始化获取版本号失败!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (initOperation.Status == EOperationStatus.Succeed)
|
||||||
|
// Debug.Log("UnityEvo:从本地StreamingAssets加载资源包,初始化成功!");
|
||||||
|
// else
|
||||||
|
// Debug.LogError($"UnityEvo:从本地StreamingAssets加载资源包,初始化失败:{initOperation.Error}");
|
||||||
|
}
|
||||||
|
|
||||||
var operation = package.RequestPackageVersionAsync();
|
private void CopyLocalFile()
|
||||||
await operation;
|
{
|
||||||
if (operation.Status == EOperationStatus.Succeed)
|
#if UNITY_ANDROID
|
||||||
|
// 将StreamingAssets下指定的package拷贝到目标路径
|
||||||
|
string sourcePath = Path.Combine(Application.streamingAssetsPath,
|
||||||
|
YooAssetSettingsData.GetDefaultYooFolderName(), AppConfig.PackageDomainName);
|
||||||
|
string loadPath = Path.Combine(Application.temporaryCachePath, "DownloadedContent",
|
||||||
|
AppConfig.PackageDomainName);
|
||||||
|
|
||||||
|
// 创建目标目录(如果不存在)
|
||||||
|
if (!Directory.Exists(loadPath))
|
||||||
{
|
{
|
||||||
PlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION", operation.PackageVersion);
|
Directory.CreateDirectory(loadPath);
|
||||||
Debug.Log("UnityEvo:从本地加载资源包,初始化获取版本号成功!");
|
}
|
||||||
}else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError($"UnityEvo:从本地加载资源包,初始化获取版本号失败!");
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initOperation.Status == EOperationStatus.Succeed)
|
// 检查源路径是否存在
|
||||||
Debug.Log("UnityEvo:从本地加载资源包,初始化成功!");
|
if (Directory.Exists(sourcePath))
|
||||||
|
{
|
||||||
|
// 拷贝所有文件
|
||||||
|
string[] files = Directory.GetFiles(sourcePath, "*", SearchOption.AllDirectories);
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
// 计算目标文件路径
|
||||||
|
string relativePath = Path.GetRelativePath(sourcePath, file);
|
||||||
|
string destFile = Path.Combine(loadPath, relativePath);
|
||||||
|
|
||||||
|
// 创建目标子目录(如果不存在)
|
||||||
|
string destDir = Path.GetDirectoryName(destFile);
|
||||||
|
if (!Directory.Exists(destDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拷贝文件
|
||||||
|
File.Copy(file, destFile, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log($"UnityEvo:成功将StreamingAssets下的{AppConfig.PackageDomainName}包拷贝到{loadPath}");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Debug.LogError($"UnityEvo:从本地加载资源包,初始化失败:{initOperation.Error}");
|
{
|
||||||
|
Debug.LogError($"UnityEvo:StreamingAssets下的{AppConfig.PackageDomainName}包不存在");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask HOST_PLAYMODE(ResourcePackage package)
|
public async UniTask HOST_PLAYMODE(ResourcePackage package)
|
||||||
@@ -217,7 +262,7 @@ namespace Stary.Evo
|
|||||||
Debug.LogError($"UnityEvo:获取资源版本失败: 【{resDmainMessageEntity.message}】");
|
Debug.LogError($"UnityEvo:获取资源版本失败: 【{resDmainMessageEntity.message}】");
|
||||||
}
|
}
|
||||||
|
|
||||||
var initParams=YooAssetFileSystem.HostInitializeParameter();
|
var initParams = YooAssetFileSystem.HostInitializeParameter();
|
||||||
// initParameters.CacheFileSystemParameters = cacheFileSystemParams;
|
// initParameters.CacheFileSystemParameters = cacheFileSystemParams;
|
||||||
|
|
||||||
var initOperation = package.InitializeAsync(initParams);
|
var initOperation = package.InitializeAsync(initParams);
|
||||||
@@ -242,26 +287,28 @@ namespace Stary.Evo
|
|||||||
// 等一帧,让系统真正释放句柄
|
// 等一帧,让系统真正释放句柄
|
||||||
await UniTask.DelayFrame(1);
|
await UniTask.DelayFrame(1);
|
||||||
}
|
}
|
||||||
FsmLoadSystem loadSystem =FsmSystem as FsmLoadSystem;
|
|
||||||
|
FsmLoadSystem loadSystem = FsmSystem as FsmLoadSystem;
|
||||||
if (loadSystem.ProgressBarPanel == null)
|
if (loadSystem.ProgressBarPanel == null)
|
||||||
{
|
{
|
||||||
loadSystem.ProgressBarPanel =Object.Instantiate(Resources.Load<GameObject>("ProgressBarPanel"),
|
loadSystem.ProgressBarPanel = Object.Instantiate(Resources.Load<GameObject>("ProgressBarPanel"),
|
||||||
Camera.main.transform).GetOrAddComponent<ProgressBarPanel>();
|
Camera.main.transform).GetOrAddComponent<ProgressBarPanel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
await ZipTool.DownloadAndUnzipAsync(fileId, loadPath, DownLoadProgress, UnzipProgress);
|
await ZipTool.DownloadAndUnzipAsync(fileId, loadPath, DownLoadProgress, UnzipProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DownLoadProgress(float progress)
|
private void DownLoadProgress(float progress)
|
||||||
{
|
{
|
||||||
Debug.Log($"下载进度:{progress:P0}");
|
Debug.Log($"下载进度:{progress:P0}");
|
||||||
FsmLoadSystem loadSystem =FsmSystem as FsmLoadSystem;
|
FsmLoadSystem loadSystem = FsmSystem as FsmLoadSystem;
|
||||||
loadSystem.ProgressBarPanel.SetProgressBarValue("下载中", progress);
|
loadSystem.ProgressBarPanel.SetProgressBarValue("下载中", progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnzipProgress(float progress)
|
private void UnzipProgress(float progress)
|
||||||
{
|
{
|
||||||
Debug.Log($"解压进度:{progress:P0}");
|
Debug.Log($"解压进度:{progress:P0}");
|
||||||
FsmLoadSystem loadSystem =FsmSystem as FsmLoadSystem;
|
FsmLoadSystem loadSystem = FsmSystem as FsmLoadSystem;
|
||||||
loadSystem.ProgressBarPanel.SetProgressBarValue("解压中", progress);
|
loadSystem.ProgressBarPanel.SetProgressBarValue("解压中", progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,38 +20,17 @@ namespace Stary.Evo
|
|||||||
|
|
||||||
//更新失败
|
//更新失败
|
||||||
|
|
||||||
Debug.Log($"UnityEvo:切换为加载本地缓存资源...");
|
Debug.Log($"UnityEvo:开始加载本地缓存资源...");
|
||||||
string packageVersion = "";
|
|
||||||
// if (package.PackageName.Equals("Main"))
|
// 获取上次成功记录的版本
|
||||||
// {
|
string packageVersion = PlayerPrefs.GetString($"{AppConfig.PackageDomainName}_GAME_VERSION", string.Empty);
|
||||||
// var operation = package.RequestPackageVersionAsync();
|
if (string.IsNullOrEmpty(packageVersion))
|
||||||
// await operation;
|
|
||||||
// if (operation.Status == EOperationStatus.Succeed)
|
|
||||||
// {
|
|
||||||
// //更新成功
|
|
||||||
// packageVersion = operation.PackageVersion;
|
|
||||||
// Debug.Log($"Unity:【Main】Request package Version : {packageVersion}");
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //更新失败
|
|
||||||
// Debug.LogError("Unity:【Main】" + operation.Error);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
{
|
{
|
||||||
// 获取上次成功记录的版本
|
Debug.Log($"UnityEvo:没有找到本地版本记录,需要更新资源!");
|
||||||
packageVersion = PlayerPrefs.GetString($"{AppConfig.PackageDomainName}_GAME_VERSION", string.Empty);
|
return;
|
||||||
if (string.IsNullOrEmpty(packageVersion))
|
|
||||||
{
|
|
||||||
Debug.Log($"UnityEvo:没有找到本地版本记录,需要更新资源!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Debug.Log($"UnityEvo:获取资源版本 Version : 【{packageVersion}】");
|
Debug.Log($"UnityEvo:获取资源版本 Version : 【{packageVersion}】");
|
||||||
Debug.Log($"UnityEvo:开始加载本地资源...");
|
|
||||||
// Assert.AreEqual(EOperationStatus.Succeed, requetVersionOp.Status);
|
// Assert.AreEqual(EOperationStatus.Succeed, requetVersionOp.Status);
|
||||||
|
|
||||||
|
|
||||||
@@ -74,7 +53,7 @@ namespace Stary.Evo
|
|||||||
|
|
||||||
|
|
||||||
//4.下载补丁包
|
//4.下载补丁包
|
||||||
await Download();
|
//await Download();
|
||||||
|
|
||||||
|
|
||||||
//加载热更配置文件
|
//加载热更配置文件
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Stary.Evo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string loadDomain;
|
public string loadDomain;
|
||||||
|
|
||||||
private void Awake()
|
private async void Awake()
|
||||||
{
|
{
|
||||||
if (Global == null)
|
if (Global == null)
|
||||||
{
|
{
|
||||||
@@ -39,6 +39,22 @@ namespace Stary.Evo
|
|||||||
_devLoadSystem.AddState(new HotFixState(_devLoadSystem));
|
_devLoadSystem.AddState(new HotFixState(_devLoadSystem));
|
||||||
_devLoadSystem.AddState(new LoadResState(_devLoadSystem));
|
_devLoadSystem.AddState(new LoadResState(_devLoadSystem));
|
||||||
//_fsmSystem.AddState(new LoadResMainState(_fsmSystem));
|
//_fsmSystem.AddState(new LoadResMainState(_fsmSystem));
|
||||||
|
|
||||||
|
//初始化读取资源配置表
|
||||||
|
HotfixMainResDomain hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
|
||||||
|
if (hotfixMainResDomain != null)
|
||||||
|
{
|
||||||
|
AppConfig.IpConfig = hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig;
|
||||||
|
AppConfig.UserName = hotfixMainResDomain.hotfixMainResDomainEntity.username;
|
||||||
|
AppConfig.PassWord = hotfixMainResDomain.hotfixMainResDomainEntity.password;
|
||||||
|
AppConfig.ProductName = Application.identifier;
|
||||||
|
AppConfig.MainDomainVersion = hotfixMainResDomain.hotfixMainResDomainEntity.mainDomainVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log($"UnityEvo:读取资源配置表成功...{AppConfig.IpConfig}{AppConfig.UserName}{AppConfig.PassWord}");
|
||||||
|
//登录
|
||||||
|
string url = AppConfig.IpConfig + "/Authentication/login";
|
||||||
|
_devLoadSystem.IsLogin = await WebRequestSystem.Login(url, AppConfig.UserName, AppConfig.PassWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
namespace Stary.Evo
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using YooAsset;
|
||||||
|
|
||||||
|
public class CopyLocalFileServices : ICopyLocalFileServices
|
||||||
|
{
|
||||||
|
private class AndroidWrapper
|
||||||
|
{
|
||||||
|
public static void CopyAssetFile(string assetPath, string destPath)
|
||||||
|
{
|
||||||
|
// 注意:请实现安卓平台拷贝内置文件的原生接口
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyFile(LocalFileInfo sourceFileInfo, string destFilePath)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
// 安卓平台包体内文件的拷贝走安卓原生方法
|
||||||
|
if (IsBuildinSourceFile(sourceFileInfo.SourceFileURL))
|
||||||
|
{
|
||||||
|
// SourceFileURL示例 jar:file:///apk_path!/assets/yoo/DefaultPackage/xxxxxx.bundle
|
||||||
|
AndroidWrapper.CopyAssetFile(sourceFileInfo.SourceFileURL, destFilePath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string sourceFilePath = ConvertFileUriToPath(sourceFileInfo.SourceFileURL);
|
||||||
|
File.Copy(sourceFilePath, destFilePath);
|
||||||
|
}
|
||||||
|
#elif UNITY_OPENHARMONY
|
||||||
|
// 鸿蒙平台处理方式
|
||||||
|
......
|
||||||
|
#else
|
||||||
|
// 其它平台本地文件拷贝走正常方法
|
||||||
|
string sourceFilePath = ConvertFileUriToPath(sourceFileInfo.SourceFileURL);
|
||||||
|
File.Copy(sourceFilePath, destFilePath);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测本地文件URL地址是否为安卓内包体文件
|
||||||
|
private bool IsBuildinSourceFile(string fileURL)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(fileURL))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 判断是否包含APK路径特征
|
||||||
|
return fileURL.StartsWith("jar:file://", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
fileURL.Contains("!/assets/");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 本地文件URL地址转换为标准文件路径
|
||||||
|
public static string ConvertFileUriToPath(string uri)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(uri))
|
||||||
|
return uri;
|
||||||
|
|
||||||
|
// 处理标准 file:// URL
|
||||||
|
if (uri.StartsWith("file://", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
// 去除 file:// 前缀
|
||||||
|
string path = uri.Substring(7);
|
||||||
|
|
||||||
|
// 处理 Android 特殊格式 (file:/// 后跟绝对路径)
|
||||||
|
if (path.StartsWith("//"))
|
||||||
|
return path.Substring(1);
|
||||||
|
else
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 03c2e33161bb453aa60dcb3de5868c77
|
||||||
|
timeCreated: 1767602860
|
||||||
@@ -8,15 +8,19 @@ namespace Stary.Evo
|
|||||||
public static InitializeParameters OfflineInitializeParameter()
|
public static InitializeParameters OfflineInitializeParameter()
|
||||||
{
|
{
|
||||||
var buildinFileSystemParams = FileSystemParameters.CreateDefaultBuildinFileSystemParameters();
|
var buildinFileSystemParams = FileSystemParameters.CreateDefaultBuildinFileSystemParameters();
|
||||||
|
// ICopyLocalFileServices copyLocalFileServices = new CopyLocalFileServices();
|
||||||
|
// buildinFileSystemParams.AddParameter(FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES, copyLocalFileServices);
|
||||||
var initParameters = new OfflinePlayModeParameters();
|
var initParameters = new OfflinePlayModeParameters();
|
||||||
initParameters.BuildinFileSystemParameters = buildinFileSystemParams;
|
initParameters.BuildinFileSystemParameters = buildinFileSystemParams;
|
||||||
return initParameters;
|
return initParameters;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static InitializeParameters HostInitializeParameter()
|
public static InitializeParameters HostInitializeParameter()
|
||||||
{
|
{
|
||||||
var initParameters = new OfflinePlayModeParameters();
|
var initParameters = new OfflinePlayModeParameters();
|
||||||
var buildinFileSystemParams = FileSystemParameters.CreateDefaultBuildinFileSystemParameters(null,
|
var buildinFileSystemParams = FileSystemParameters.CreateDefaultBuildinFileSystemParameters(null,
|
||||||
$"{Application.temporaryCachePath}/DownloadedContent/{AppConfig.PackageDomainName}");
|
$"{Application.temporaryCachePath}/DownloadedContent/{AppConfig.PackageDomainName}");
|
||||||
|
Debug.Log($"UnityEvo:Host InitializeParameterPath: 【{Application.temporaryCachePath}/DownloadedContent/{AppConfig.PackageDomainName}】");
|
||||||
buildinFileSystemParams.AddParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, true);
|
buildinFileSystemParams.AddParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, true);
|
||||||
buildinFileSystemParams.AddParameter(FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST, true);
|
buildinFileSystemParams.AddParameter(FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST, true);
|
||||||
initParameters.BuildinFileSystemParameters = buildinFileSystemParams;
|
initParameters.BuildinFileSystemParameters = buildinFileSystemParams;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.tools",
|
"name": "com.staryevo.tools",
|
||||||
"version": "1.2.17",
|
"version": "1.3.0",
|
||||||
"displayName": "00.StaryEvo.Tools",
|
"displayName": "00.StaryEvo.Tools",
|
||||||
"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