【m】临时加回local模式
This commit is contained in:
@@ -17,13 +17,15 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
private const string EditorSimulateMode = "Evo/Schema/ChangePlayer/EditorSimulateMode(编辑器调试模式)";
|
private const string EditorSimulateMode = "Evo/Schema/ChangePlayer/EditorSimulateMode(编辑器调试模式)";
|
||||||
private const string HostPlayMode = "Evo/Schema/ChangePlayer/HostPlayMode(联机运行模式)";
|
private const string HostPlayMode = "Evo/Schema/ChangePlayer/HostPlayMode(联机运行模式)";
|
||||||
|
private const string LocalPlayMode = "Evo/Schema/ChangePlayer/LocalPlayMode(本地运行模式)";
|
||||||
private const string WebPlayMode = "Evo/Schema/ChangePlayer/WebPlayMode(Web运行模式)";
|
private const string WebPlayMode = "Evo/Schema/ChangePlayer/WebPlayMode(Web运行模式)";
|
||||||
|
|
||||||
[MenuItem(EditorSimulateMode, false,3)]
|
[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(HostPlayMode, false,3)]
|
||||||
private static void SetHostMode() => SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
private static void SetHostMode() => SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
||||||
|
[MenuItem(LocalPlayMode, false,3)]
|
||||||
|
private static void SetLocalMode() => SetPlayerMode(PLayerMode.LOCAL_PLAYMODE);
|
||||||
// [MenuItem(WebPlayMode)]
|
// [MenuItem(WebPlayMode)]
|
||||||
// private static void SetWebMode() => SetPlayerMode(PLayerMode.WEB_PLAYMODE);
|
// private static void SetWebMode() => SetPlayerMode(PLayerMode.WEB_PLAYMODE);
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ namespace Stary.Evo.Editor
|
|||||||
string platform = CustomEditorPrefs.GetString("ChangePlayerSchema");
|
string platform = CustomEditorPrefs.GetString("ChangePlayerSchema");
|
||||||
Menu.SetChecked(EditorSimulateMode, platform == PLayerMode.EDITOR_SIMULATEMODE.ToString());
|
Menu.SetChecked(EditorSimulateMode, platform == PLayerMode.EDITOR_SIMULATEMODE.ToString());
|
||||||
Menu.SetChecked(HostPlayMode, platform == PLayerMode.HOST_PLAYMODE.ToString());
|
Menu.SetChecked(HostPlayMode, platform == PLayerMode.HOST_PLAYMODE.ToString());
|
||||||
|
Menu.SetChecked(LocalPlayMode, platform == PLayerMode.LOCAL_PLAYMODE.ToString());
|
||||||
//Menu.SetChecked(WebPlayMode, platform == PLayerMode.WEB_PLAYMODE.ToString());
|
//Menu.SetChecked(WebPlayMode, platform == PLayerMode.WEB_PLAYMODE.ToString());
|
||||||
Debug.LogError($"ChangePlayerSchema:{platform}");
|
Debug.LogError($"ChangePlayerSchema:{platform}");
|
||||||
return true;
|
return true;
|
||||||
@@ -60,7 +63,7 @@ namespace Stary.Evo.Editor
|
|||||||
// 添加解决方案文件重新生成逻辑
|
// 添加解决方案文件重新生成逻辑
|
||||||
EditorApplication.delayCall += () =>
|
EditorApplication.delayCall += () =>
|
||||||
{
|
{
|
||||||
EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
|
//EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
|
||||||
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
|
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
|
||||||
Debug.Log("已强制重新生成解决方案文件");
|
Debug.Log("已强制重新生成解决方案文件");
|
||||||
};
|
};
|
||||||
@@ -74,7 +77,8 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
//联机运行模式
|
//联机运行模式
|
||||||
HOST_PLAYMODE,
|
HOST_PLAYMODE,
|
||||||
|
//本地运行模式
|
||||||
|
LOCAL_PLAYMODE,
|
||||||
// //web运行模式
|
// //web运行模式
|
||||||
// WEB_PLAYMODE
|
// WEB_PLAYMODE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Stary.Evo.Editor
|
|||||||
var rawBuildResult = BuildRawFiles();
|
var rawBuildResult = BuildRawFiles();
|
||||||
if (!rawBuildResult.Success)
|
if (!rawBuildResult.Success)
|
||||||
{
|
{
|
||||||
Debug.LogError("视频文件打包失败!");
|
Debug.LogWarning("视频文件打包失败!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,29 +42,19 @@ namespace Stary.Evo
|
|||||||
Debug.LogWarning($"UnityEvo:资源包 {AppConfig.PackageDomainName}_RawFile 不存在,正在尝试创建...");
|
Debug.LogWarning($"UnityEvo:资源包 {AppConfig.PackageDomainName}_RawFile 不存在,正在尝试创建...");
|
||||||
packageRawFile = YooAssets.CreatePackage($"{AppConfig.PackageDomainName}_RawFile");
|
packageRawFile = YooAssets.CreatePackage($"{AppConfig.PackageDomainName}_RawFile");
|
||||||
}
|
}
|
||||||
|
bool isInitSuccess = false;
|
||||||
// 初始化资源包
|
// 初始化资源包
|
||||||
#if EDITOR_SIMULATEMODE
|
#if EDITOR_SIMULATEMODE
|
||||||
await EDITOR_SIMULATEMODE(package);
|
await EDITOR_SIMULATEMODE(package);
|
||||||
await FsmSystem.SetCurState(nameof(ResEditorSimulateState));
|
await FsmSystem.SetCurState(nameof(ResEditorSimulateState));
|
||||||
#elif HOST_PLAYMODE
|
#elif HOST_PLAYMODE
|
||||||
bool isInitSuccess = false;
|
|
||||||
//登录
|
//登录
|
||||||
if (((FsmLoadSystem)FsmSystem).IsLogin)
|
if (((FsmLoadSystem)FsmSystem).IsLogin)
|
||||||
{
|
{
|
||||||
bool isExit = await GetServerVersion();
|
await GetServerVersion();
|
||||||
if (isExit)
|
await HOST_PLAYMODE(package);
|
||||||
{
|
isInitSuccess = await HOST_PLAYMODE(packageRawFile);
|
||||||
await HOST_PLAYMODE(package);
|
|
||||||
isInitSuccess = await HOST_PLAYMODE(packageRawFile);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await OFFLINE_PLAYMODE(package);
|
|
||||||
await ChChe_PLAYMODE(package);
|
|
||||||
await OFFLINE_PLAYMODE(packageRawFile);
|
|
||||||
isInitSuccess = await ChChe_PLAYMODE(packageRawFile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -79,7 +69,14 @@ namespace Stary.Evo
|
|||||||
await UpdateLocalPackage(packageRawFile);
|
await UpdateLocalPackage(packageRawFile);
|
||||||
await LoadHotfixSettings();
|
await LoadHotfixSettings();
|
||||||
//await FsmSystem.SetCurState(nameof(ResUpdateLocalState));
|
//await FsmSystem.SetCurState(nameof(ResUpdateLocalState));
|
||||||
|
#elif LOCAL_PLAYMODE
|
||||||
|
await OFFLINE_PLAYMODE(package);
|
||||||
|
await UpdateLocalPackage(package);
|
||||||
|
|
||||||
|
await OFFLINE_PLAYMODE(packageRawFile);
|
||||||
|
if (isInitSuccess)
|
||||||
|
await UpdateLocalPackage(packageRawFile);
|
||||||
|
await LoadHotfixSettings();
|
||||||
#elif WEB_PLAYMODE
|
#elif WEB_PLAYMODE
|
||||||
// IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
// IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
||||||
// var webServerFileSystemParams = FileSystemParameters.CreateDefaultWebServerFileSystemParameters();
|
// var webServerFileSystemParams = FileSystemParameters.CreateDefaultWebServerFileSystemParameters();
|
||||||
@@ -165,10 +162,29 @@ namespace Stary.Evo
|
|||||||
|
|
||||||
private async UniTask OFFLINE_PLAYMODE(ResourcePackage package)
|
private async UniTask OFFLINE_PLAYMODE(ResourcePackage package)
|
||||||
{
|
{
|
||||||
Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
var initParams = YooAssetFileSystem.OfflineInitializeParameter();
|
||||||
CopyLocalFile(package.PackageName);
|
var initOperation = package.InitializeAsync(initParams);
|
||||||
|
await initOperation;
|
||||||
|
|
||||||
|
var operation = package.RequestPackageVersionAsync();
|
||||||
|
await operation;
|
||||||
|
if (operation.Status == EOperationStatus.Succeed)
|
||||||
|
{
|
||||||
|
CustomPlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION", operation.PackageVersion);
|
||||||
|
Debug.Log("UnityEvo:从本地加载资源包,初始化获取版本号成功!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"UnityEvo:从本地加载资源包,初始化获取版本号失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initOperation.Status == EOperationStatus.Succeed)
|
||||||
|
Debug.Log("UnityEvo:从本地加载资源包,初始化成功!");
|
||||||
|
else
|
||||||
|
Debug.LogError($"UnityEvo:从本地加载资源包,初始化失败:{initOperation.Error}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async UniTask<bool> ChChe_PLAYMODE(ResourcePackage package)
|
private async UniTask<bool> ChChe_PLAYMODE(ResourcePackage package)
|
||||||
{
|
{
|
||||||
//Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
//Debug.Log("UnityEvo:网络连接不通畅,切换缓存加载!");
|
||||||
@@ -260,7 +276,7 @@ namespace Stary.Evo
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private async UniTask<bool> GetServerVersion()
|
private async UniTask GetServerVersion()
|
||||||
{
|
{
|
||||||
// 新增平台判断代码
|
// 新增平台判断代码
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
@@ -299,12 +315,10 @@ namespace Stary.Evo
|
|||||||
Debug.LogWarning($"UnityEvo:当前版本{oldVersion}资源版本一致,自动跳过更新...");
|
Debug.LogWarning($"UnityEvo:当前版本{oldVersion}资源版本一致,自动跳过更新...");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"UnityEvo:获取资源版本失败: 【{resDmainMessageEntity.message}】");
|
Debug.LogWarning($"UnityEvo:获取资源版本失败: 【{resDmainMessageEntity.message}】");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.tools",
|
"name": "com.staryevo.tools",
|
||||||
"version": "1.3.14",
|
"version": "1.3.15",
|
||||||
"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