174 lines
5.5 KiB
C#
174 lines
5.5 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using Gameplay.Level;
|
||
|
||
public partial class SROptions
|
||
|
||
{
|
||
[Category("关卡"), DisplayName("关卡id")]
|
||
|
||
public int LevelId
|
||
{
|
||
get { return _levelId; }
|
||
|
||
set { _levelId = value; }
|
||
}
|
||
|
||
private int _levelId = 101;
|
||
|
||
|
||
[Category("关卡"), DisplayName("进入关卡(通过服务器)")]
|
||
public void EnterLevelByServer()
|
||
{
|
||
LevelManager.Instance.TryEnterLevel(LevelId);
|
||
}
|
||
|
||
[Category("关卡"), DisplayName("进入关卡(不通过服务器)")]
|
||
public void EnterLevel()
|
||
{
|
||
LevelManager.Instance.EnterLevelDirectly(LevelId);
|
||
}
|
||
|
||
[Category("关卡"), DisplayName("关卡阶段胜利")]
|
||
public void StageSuccess()
|
||
{
|
||
LevelManager.Instance.CurrentLevel?.EnterNextStage();
|
||
}
|
||
|
||
[Category("关卡"), DisplayName("关卡胜利(通过服务器)")]
|
||
public void LevelSuccess()
|
||
{
|
||
LevelManager.Instance.CurrentLevel?.TryExitLevel(true);
|
||
}
|
||
|
||
[Category("关卡"), DisplayName("关卡失败(通过服务器)")]
|
||
public void LevelFail()
|
||
{
|
||
LevelManager.Instance.CurrentLevel?.TryExitLevel(false);
|
||
}
|
||
|
||
[Category("关卡"), DisplayName("退出关卡(不通过服务器)")]
|
||
public void LevelExit()
|
||
{
|
||
LevelManager.Instance.ExitLevelDirectly();
|
||
}
|
||
|
||
[Category("关卡"), DisplayName("开启自动上阵")]
|
||
public bool AutoDeploy
|
||
{
|
||
get { return AutoDeploymentManager.Instance.IsAutoDeployEnabled; }
|
||
set { AutoDeploymentManager.Instance.SetAutoDeployEnabled(value); }
|
||
}
|
||
|
||
// private Material mat1;
|
||
// private Material mat2;
|
||
//
|
||
// //测试通过,material被销毁
|
||
// public async void TestAssetManager1()
|
||
// {
|
||
// var path =
|
||
// "Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
||
// mat1 = await AssetManager.Instance.LoadAssetAsync<Material>(path);
|
||
// mat2 = AssetManager.Instance.GetPreLoadResult<Material>(path);
|
||
// AssetManager.Instance.Unload(path);
|
||
// }
|
||
//
|
||
// //测试通过,material被销毁
|
||
// public async void TestAssetManager2()
|
||
// {
|
||
// var path =
|
||
// "Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
||
// var op1 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op1;
|
||
// mat1 = op1.Result;
|
||
//
|
||
// var op2 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op2;
|
||
// mat2 = op2.Result;
|
||
// Addressables.Release(mat1);
|
||
// Addressables.Release(mat1);
|
||
// }
|
||
//
|
||
// //测试通过,material被销毁
|
||
// public async void TestAssetManager3()
|
||
// {
|
||
// var path =
|
||
// "Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
||
// var op1 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op1;
|
||
// mat1 = op1.Result;
|
||
//
|
||
// var op2 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op2;
|
||
// mat2 = op2.Result;
|
||
// Addressables.Release(op1);
|
||
// Addressables.Release(op1);
|
||
// }
|
||
//
|
||
// //测试通过,material未被销毁
|
||
// public async void TestAssetManager4()
|
||
// {
|
||
// var path =
|
||
// "Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
||
// var op1 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op1;
|
||
// mat1 = op1.Result;
|
||
//
|
||
// var op2 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op2;
|
||
// mat2 = op2.Result;
|
||
// Addressables.Release(op1);
|
||
// }
|
||
//
|
||
// //测试通过,material未被销毁
|
||
// public async void TestAssetManager5()
|
||
// {
|
||
// var path =
|
||
// "Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
||
// var op1 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op1;
|
||
// mat1 = op1.Result;
|
||
//
|
||
// var op2 = Addressables.LoadAssetAsync<Material>(path);
|
||
// await op2;
|
||
// mat2 = op2.Result;
|
||
// Addressables.Release(mat1);
|
||
// }
|
||
//
|
||
// //测试通过,UI_ChooseRectW未被销毁
|
||
// public async void OnlyCloseUI()
|
||
// {
|
||
// UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
|
||
// }
|
||
//
|
||
// //测试通过,UI_ChooseRectW被销毁
|
||
// public async void TestUnloadUnusedResourceNoGC()
|
||
// {
|
||
// UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
|
||
// Resources.UnloadUnusedAssets();
|
||
// }
|
||
//
|
||
// //测试通过,UI_ChooseRectW被销毁
|
||
// public async void TestUnloadUnusedResource1()
|
||
// {
|
||
// UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
|
||
// Resources.UnloadUnusedAssets();
|
||
// GC.Collect();
|
||
// }
|
||
//
|
||
// //测试通过,UI_ChooseRectW被销毁
|
||
// public async void TestUnloadUnusedResource2()
|
||
// {
|
||
// UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
|
||
// GC.Collect();
|
||
// Resources.UnloadUnusedAssets();
|
||
// }
|
||
//
|
||
// //测试通过,UI_ChooseRectW被销毁
|
||
// public async void TestUnloadScene()
|
||
// {
|
||
// UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
|
||
// await GameSceneManager.Instance.LoadSceneAsync(Constants.MAIN_SCENE_PATH);
|
||
// }
|
||
} |