292 lines
8.2 KiB
C#
292 lines
8.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using AOT.Common;
|
|
using CriWare;
|
|
using Cysharp.Threading.Tasks;
|
|
using Framework;
|
|
using Framework.Wrapper;
|
|
using Gameplay;
|
|
using Gameplay.Area;
|
|
using Gameplay.Character;
|
|
using Gameplay.Common;
|
|
using Gameplay.Level;
|
|
using Gameplay.SubSystems;
|
|
using PhxhSDK;
|
|
using PhxhSDK.AOT.DeviceInfo;
|
|
using PhxhSDK.AOT.Net;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using CharacterInfo = Gameplay.Net.CharacterInfo;
|
|
using Constants = Framework.Constants;
|
|
using Object = UnityEngine.Object;
|
|
|
|
|
|
public partial class SROptions
|
|
{
|
|
#region DEVELOPMENT_BUILD测试
|
|
[Category("Test"), DisplayName("测试DEVELOPMENT_BUILD")]
|
|
public void DEVELOPMENT_BUILD_LOG()
|
|
{
|
|
#if DEVELOPMENT_BUILD || DEBUG
|
|
DebugUtil.Log("开启DEVELOPMENT_BUILD");
|
|
#else
|
|
DebugUtil.Log("关闭DEVELOPMENT_BUILD");
|
|
#endif
|
|
}
|
|
#endregion
|
|
|
|
#region CriAtom测试
|
|
/*[Category("Test"), DisplayName("异步流式加载CriAtom")]
|
|
public void TestCriAtomLoadAsync()
|
|
{
|
|
CriAtom.instance.LoadAsync(false);
|
|
}
|
|
|
|
[Category("Test"), DisplayName("异步非流式加载CriAtom")]
|
|
public void TestCriAtomLoadAsyncMemory()
|
|
{
|
|
CriAtom.instance.LoadAsync(true);
|
|
}
|
|
|
|
[Category("Test"), DisplayName("同步Streaming加载CriAtom")]
|
|
public void TestCriAtomLoad()
|
|
{
|
|
CriAtom.instance.Load();
|
|
}
|
|
|
|
[Category("Test"), DisplayName("输出Atom内存使用")]
|
|
public void TestLogAtom()
|
|
{
|
|
uint memory = Common.GetAtomMemoryUsage();
|
|
if (memory > 0)
|
|
DebugUtil.Log($"{memory / 1024 / 1024}M");
|
|
}*/
|
|
#endregion
|
|
|
|
[Category("Test"), DisplayName("测试内网检测")]
|
|
public async void TestIsInsideNet()
|
|
{
|
|
var isInsideNet = await NetChecker.CheckIsInsideNet();
|
|
Debug.Log($"是否是内网:{isInsideNet}");
|
|
}
|
|
|
|
[Category("Test"), DisplayName("测试编译模式")]
|
|
public void TestCompile()
|
|
{
|
|
#if DEBUG
|
|
Debug.Log($"Debug");
|
|
#else
|
|
Debug.Log($"Release");
|
|
#endif
|
|
}
|
|
|
|
[Category("Test"), DisplayName("检测剩余硬盘大小")]
|
|
public void TestDiskSpace()
|
|
{
|
|
var diskSpace = DeviceInfoEx.GetTotalDiskSpace();
|
|
Debug.Log($"剩余硬盘大小:{diskSpace}");
|
|
}
|
|
|
|
[Category("Test"), DisplayName("检测是否有足够的空间")]
|
|
public void CheckSpaceEnough()
|
|
{
|
|
var checkSize = 100 * 1024 * 1024; // 100M
|
|
var isEnough = DeviceInfoEx.CheckHaseEnoughSpace(checkSize);
|
|
Debug.Log($"检测是否有足够的空间:{isEnough}, size:{checkSize}");
|
|
}
|
|
|
|
[Category("Test"), DisplayName("是否启用OutlineDebug")]
|
|
public bool EnableOutlineDebug
|
|
{
|
|
get
|
|
{
|
|
return AOTCodeDefine.ENABLE_OUTLINE_DEBUG;
|
|
}
|
|
set
|
|
{
|
|
AOTCodeDefine.ENABLE_OUTLINE_DEBUG = value;
|
|
}
|
|
}
|
|
|
|
// private List<Sprite> _testSpriteList = new();
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestPureReferenceStart()
|
|
// {
|
|
// var path =
|
|
// "Assets/Art/UI/Texture/Poster/Poster_Default/Poster_A00001.png";
|
|
// var sprite = Addressables.LoadAssetAsync<Sprite>(path).WaitForCompletion();
|
|
// _testSpriteList.Add(sprite);
|
|
// Debug.LogError($"TestMonoScriptReferenceStart:{_testSpriteList[0].name}");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestPureReferenceEnd1()
|
|
// {
|
|
// Addressables.Release(_testSpriteList[0]);
|
|
// _testSpriteList.Clear();
|
|
// Resources.UnloadUnusedAssets();
|
|
// Debug.LogError($"TestMonoScriptReferenceEnd1");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestPureReferenceEnd2()
|
|
// {
|
|
// _testSpriteList.Clear();
|
|
// Addressables.Release(_testSpriteList[0]);
|
|
// Debug.LogError($"TestMonoScriptReferenceEnd2");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestPureReferenceEnd3()
|
|
// {
|
|
// Addressables.Release(_testSpriteList[0]);
|
|
// _testSpriteList.Clear();
|
|
// Debug.LogError($"TestMonoScriptReferenceEnd3");
|
|
// }
|
|
//
|
|
// private Texture2D _tex;
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleInABStart()
|
|
// {
|
|
// var path =
|
|
// "Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMaskTex.png";
|
|
// _tex = Addressables.LoadAssetAsync<Texture2D>(path).WaitForCompletion();
|
|
// Debug.LogError($"TestSingleInABStart");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleInABEnd1()
|
|
// {
|
|
// Addressables.Release(_tex);
|
|
// Debug.LogError($"TestSingleInABEnd1");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleInABEnd2()
|
|
// {
|
|
// _tex = null;
|
|
// Addressables.Release(_tex);
|
|
// Debug.LogError($"TestSingleInABEnd2");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleInABEnd3()
|
|
// {
|
|
// _tex = null;
|
|
// Addressables.Release(_tex);
|
|
// Resources.UnloadUnusedAssets();
|
|
// Debug.LogError($"TestSingleInABEnd3");
|
|
// }
|
|
//
|
|
// private TestUnityObjectReference TestUnityObjectReference
|
|
// {
|
|
// get
|
|
// {
|
|
// var result = Object.FindObjectOfType<TestUnityObjectReference>();
|
|
// if (result == null)
|
|
// {
|
|
// var go = new GameObject("test");
|
|
// result = go.AddComponent<TestUnityObjectReference>();
|
|
// }
|
|
//
|
|
// return result;
|
|
// }
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestUnityObjectReferenceStart()
|
|
// {
|
|
// TestUnityObjectReference.ImageTestStart();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestUnityObjectReferenceEnd()
|
|
// {
|
|
// TestUnityObjectReference.ImageTestEnd();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSpriteReferenceStart()
|
|
// {
|
|
// TestUnityObjectReference.SpriteTestStart();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSpriteReferenceEnd()
|
|
// {
|
|
// TestUnityObjectReference.SpriteTestEnd();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestRendererReferenceStart()
|
|
// {
|
|
// TestUnityObjectReference.RendererTestStart();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestRendererReferenceEnd()
|
|
// {
|
|
// TestUnityObjectReference.RenderTestEnd();
|
|
// }
|
|
|
|
// [Category("Test")]
|
|
// public void TestUnityObjectSerializableReferenceStart()
|
|
// {
|
|
// TestUnityObjectReference.TestSerializable();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestUnityObjectSerializableReferenceEnd()
|
|
// {
|
|
// TestUnityObjectReference.TestSerializableEnd();
|
|
// }
|
|
|
|
// [Category("Test")]
|
|
// public void TestSingleUnityObjectReferenceStart()
|
|
// {
|
|
// TestUnityObjectReference.TestSingleStart();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleUnityObjectReferenceEnd()
|
|
// {
|
|
// TestUnityObjectReference.TestSingleEnd();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleSerializableUnityObjectReferenceStart()
|
|
// {
|
|
// TestUnityObjectReference.TestSingleSerializableStart();
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestSingleSerializableUnityObjectReferenceEnd()
|
|
// {
|
|
// TestUnityObjectReference.TestSingleSerializableEnd();
|
|
// }
|
|
|
|
// private Image _image;
|
|
// private GameObject _instance;
|
|
// private GameObject _prefab;
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestPrefabReferenceStart()
|
|
// {
|
|
// var path = "Assets/Art/UI/TestPrefabReference.prefab";
|
|
// _prefab = Addressables.LoadAssetAsync<GameObject>(path).WaitForCompletion();
|
|
// _instance = Object.Instantiate(_prefab);
|
|
// _image = _instance.GetComponent<Image>();
|
|
// Debug.LogError($"TestPrefabReferenceStart {_image.sprite.name}");
|
|
// }
|
|
//
|
|
// [Category("Test")]
|
|
// public void TestPrefabReferenceEnd()
|
|
// {
|
|
// Object.Destroy(_instance);
|
|
// Addressables.Release(_prefab);
|
|
// Debug.LogError($"TestPrefabReferenceEnd {_image.sprite == null}");
|
|
// }
|
|
} |