NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Debug/SROptions.Level.cs

1 line
8.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Cysharp.Threading.Tasks;
using Framework;
using Framework.Wrapper;
using Gameplay;
using Gameplay.Area;
using Gameplay.Character;
using Gameplay.Level;
using Gameplay.SubSystems;
using PhxhSDK;
using UnityEngine;
using CharacterInfo = Gameplay.Net.CharacterInfo;
using Constants = Framework.Constants;
public partial class SROptions
{
[Category("Level")]
public int LevelId
{
get { return _levelId; }
set { _levelId = value; }
}
private int _levelId = 101;
[Category("Level")]
public void EnterLevel()
{
LevelManager.Instance.TryEnterLevel(LevelId);
}
[Category("Level")]
public void EnterPVPLevel()
{
// var pvpData = new PVPDefenderData();
// List<PVPUnitInfo> unitInfos = new();
// unitInfos.Add(new()
// {
// unitID = 100001,
// cellIndex = 74,
// });
// // unitInfos.Add(new()
// // {
// // unitID = 100002,
// // cellIndex = 75,
// // });
// // unitInfos.Add(new()
// // {
// // unitID = 100003,
// // cellIndex = 76,
// // });
// unitInfos.Add(new()
// {
// unitID = 300001,
// cellIndex = 77,
// type = Unit.UnitType.Vehicle,
// });
// List<CharacterInfo> characterInfos = new();
// characterInfos.Add(new()
// {
// ID = 100001,
// AwakeLevel = 1,
// BreakLevel = 1,
// Level = 1,
// UltraSkillLevel = 1,
// });
// Gameplay.Net.VehicleInfo vehicleInfo = new()
// {
// nID = 300001,
// UpgradeCount = new ushort[5] { 0, 0, 0, 0, 0 },
// };
// pvpData.Init(unitInfos, characterInfos, vehicleInfo);
// LevelManager.Instance.TryEnterLevel(TableManager.Instance.Tables.GlobalConfig.PVPLevelID, null, pvpData);
UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_PVPMain);
}
[Category("Level")]
public void EnterPVPDefenderPrepare()
{
PVPManager.Instance.EnterDefendPrepare();
}
[Category("Level")]
public bool ShowCharacterID
{
get { return _showCharacterID; }
set
{
_showCharacterID = value;
if (_showCharacterID)
{
UIManager.Instance.CreateAndOpenWindow(UINameConst.UIDebugShowID);
}
else
{
UIManager.Instance.CloseWindow(UINameConst.UIDebugShowID);
}
}
}
private bool _showCharacterID = false;
[Category("Level")]
public bool ShowPrepareRegion
{
get { return _showPrepareRegion; }
set
{
_showPrepareRegion = value;
if (_showPrepareRegion)
{
AreaManager.instance.readyAreaManager.ShowReadyArea();
}
else
{
AreaManager.instance.readyAreaManager.HideReadyArea();
}
}
}
private bool _showPrepareRegion = false;
[Category("Level")]
public bool ShowMapDebugInfo
{
get { return _showMapDebugInfo; }
set
{
_showMapDebugInfo = value;
LevelManager.Instance?.CurrentLevel?.Map?.ShowInfo(_showMapDebugInfo ? -1 : 0);
}
}
private bool _showMapDebugInfo = false;
//
// [Category("Level")]
// public bool Pause {
// get { return _pause; }
// set
// {
// _pause = value;
// LevelManager.Instance.CurrentLevel.SetPause(_pause);
// }
// }
// private bool _pause = false;
//
// [Category("Level")]
// public float Speed {
// get { return _speed; }
// set
// {
// _speed = value;
// LevelManager.Instance.CurrentLevel.SetSpeed(_speed);
// }
// }
// private float _speed = ELevelSpeed.Normal;
[Category("Level")]
public void StageSuccess()
{
LevelManager.Instance.CurrentLevel?.EnterNextStage();
}
[Category("Level")]
public void LevelSuccess()
{
LevelManager.Instance.CurrentLevel?.TryExitLevel(true);
}
[Category("Level")]
public void LevelFail()
{
LevelManager.Instance.CurrentLevel?.TryExitLevel(false);
}
// 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);
// }
}