Merge pull request #116 from tpxxn/main

const 变量名
This commit is contained in:
ALEX
2025-03-09 08:18:25 +08:00
committed by GitHub
26 changed files with 170 additions and 162 deletions

View File

@@ -18,10 +18,10 @@ namespace GameLogic
private readonly List<UIWindow> _uiStack = new List<UIWindow>(100);
public const int LayerDeep = 2000;
public const int WindowDeep = 100;
public const int WindowHideLayer = 2; // Ignore Raycast
public const int WindowShowLayer = 5; // UI
public const int LAYER_DEEP = 2000;
public const int WINDOW_DEEP = 100;
public const int WINDOW_HIDE_LAYER = 2; // Ignore Raycast
public const int WINDOW_SHOW_LAYER = 5; // UI
public static IUIResourceLoader Resource;
@@ -445,13 +445,13 @@ namespace GameLogic
private void OnSortWindowDepth(int layer)
{
int depth = layer * LayerDeep;
int depth = layer * LAYER_DEEP;
for (int i = 0; i < _uiStack.Count; i++)
{
if (_uiStack[i].WindowLayer == layer)
{
_uiStack[i].Depth = depth;
depth += WindowDeep;
depth += WINDOW_DEEP;
}
}
}

View File

@@ -265,7 +265,7 @@ namespace GameLogic
for (var index = 0; index < listCanvas.Length; index++)
{
var childCanvas = listCanvas[index];
childCanvas.sortingOrder = parentCanvas.sortingOrder + childCanvas.sortingOrder % UIModule.WindowDeep;
childCanvas.sortingOrder = parentCanvas.sortingOrder + childCanvas.sortingOrder % UIModule.WINDOW_DEEP;
}
}
}

View File

@@ -138,7 +138,7 @@ namespace GameLogic
{
if (_canvas != null)
{
return _canvas.gameObject.layer == UIModule.WindowShowLayer;
return _canvas.gameObject.layer == UIModule.WINDOW_SHOW_LAYER;
}
else
{
@@ -150,7 +150,7 @@ namespace GameLogic
{
if (_canvas != null)
{
int setLayer = value ? UIModule.WindowShowLayer : UIModule.WindowHideLayer;
int setLayer = value ? UIModule.WINDOW_SHOW_LAYER : UIModule.WINDOW_HIDE_LAYER;
if (_canvas.gameObject.layer == setLayer)
return;

View File

@@ -15,7 +15,7 @@ namespace Procedure
{
private int _curTryCount;
private const int MaxTryCount = 3;
private const int MAX_TRY_COUNT = 3;
public override bool UseNativeDialog { get; }

View File

@@ -18,7 +18,7 @@ namespace Launcher
public Text _label_package;
private Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>> loadConfig;
private const string ConfigPath = "RawBytes/UIStyle/Style.json";
private const string CONFIG_PATH = "RawBytes/UIStyle/Style.json";
public enum StyleEnum
{

View File

@@ -7,34 +7,34 @@ namespace TEngine.Editor
/// </summary>
public static class LogScriptingDefineSymbols
{
private const string EnableLogScriptingDefineSymbol = "ENABLE_LOG";
private const string EnableDebugAndAboveLogScriptingDefineSymbol = "ENABLE_DEBUG_AND_ABOVE_LOG";
private const string EnableInfoAndAboveLogScriptingDefineSymbol = "ENABLE_INFO_AND_ABOVE_LOG";
private const string EnableWarningAndAboveLogScriptingDefineSymbol = "ENABLE_WARNING_AND_ABOVE_LOG";
private const string EnableErrorAndAboveLogScriptingDefineSymbol = "ENABLE_ERROR_AND_ABOVE_LOG";
private const string EnableFatalAndAboveLogScriptingDefineSymbol = "ENABLE_FATAL_AND_ABOVE_LOG";
private const string EnableDebugLogScriptingDefineSymbol = "ENABLE_DEBUG_LOG";
private const string EnableInfoLogScriptingDefineSymbol = "ENABLE_INFO_LOG";
private const string EnableWarningLogScriptingDefineSymbol = "ENABLE_WARNING_LOG";
private const string EnableErrorLogScriptingDefineSymbol = "ENABLE_ERROR_LOG";
private const string EnableFatalLogScriptingDefineSymbol = "ENABLE_FATAL_LOG";
private const string ENABLE_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_LOG";
private const string ENABLE_DEBUG_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_DEBUG_AND_ABOVE_LOG";
private const string ENABLE_INFO_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_INFO_AND_ABOVE_LOG";
private const string ENABLE_WARNING_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_WARNING_AND_ABOVE_LOG";
private const string ENABLE_ERROR_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_ERROR_AND_ABOVE_LOG";
private const string ENABLE_FATAL_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_FATAL_AND_ABOVE_LOG";
private const string ENABLE_DEBUG_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_DEBUG_LOG";
private const string ENABLE_INFO_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_INFO_LOG";
private const string ENABLE_WARNING_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_WARNING_LOG";
private const string ENABLE_ERROR_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_ERROR_LOG";
private const string ENABLE_FATAL_LOG_SCRIPTING_DEFINE_SYMBOL = "ENABLE_FATAL_LOG";
private static readonly string[] AboveLogScriptingDefineSymbols = new string[]
{
EnableDebugAndAboveLogScriptingDefineSymbol,
EnableInfoAndAboveLogScriptingDefineSymbol,
EnableWarningAndAboveLogScriptingDefineSymbol,
EnableErrorAndAboveLogScriptingDefineSymbol,
EnableFatalAndAboveLogScriptingDefineSymbol
ENABLE_DEBUG_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_INFO_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_WARNING_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_ERROR_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_FATAL_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL
};
private static readonly string[] SpecifyLogScriptingDefineSymbols = new string[]
{
EnableDebugLogScriptingDefineSymbol,
EnableInfoLogScriptingDefineSymbol,
EnableWarningLogScriptingDefineSymbol,
EnableErrorLogScriptingDefineSymbol,
EnableFatalLogScriptingDefineSymbol
ENABLE_DEBUG_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_INFO_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_WARNING_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_ERROR_LOG_SCRIPTING_DEFINE_SYMBOL,
ENABLE_FATAL_LOG_SCRIPTING_DEFINE_SYMBOL
};
/// <summary>
@@ -43,7 +43,7 @@ namespace TEngine.Editor
[MenuItem("TEngine/Log Scripting Define Symbols/Disable All Logs", false, 30)]
public static void DisableAllLogs()
{
ScriptingDefineSymbols.RemoveScriptingDefineSymbol(EnableLogScriptingDefineSymbol);
ScriptingDefineSymbols.RemoveScriptingDefineSymbol(ENABLE_LOG_SCRIPTING_DEFINE_SYMBOL);
foreach (string specifyLogScriptingDefineSymbol in SpecifyLogScriptingDefineSymbols)
{
@@ -63,7 +63,7 @@ namespace TEngine.Editor
public static void EnableAllLogs()
{
DisableAllLogs();
ScriptingDefineSymbols.AddScriptingDefineSymbol(EnableLogScriptingDefineSymbol);
ScriptingDefineSymbols.AddScriptingDefineSymbol(ENABLE_LOG_SCRIPTING_DEFINE_SYMBOL);
}
/// <summary>
@@ -72,7 +72,7 @@ namespace TEngine.Editor
[MenuItem("TEngine/Log Scripting Define Symbols/Enable Debug And Above Logs", false, 32)]
public static void EnableDebugAndAboveLogs()
{
SetAboveLogScriptingDefineSymbol(EnableDebugAndAboveLogScriptingDefineSymbol);
SetAboveLogScriptingDefineSymbol(ENABLE_DEBUG_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL);
}
/// <summary>
@@ -81,7 +81,7 @@ namespace TEngine.Editor
[MenuItem("TEngine/Log Scripting Define Symbols/Enable Info And Above Logs", false, 33)]
public static void EnableInfoAndAboveLogs()
{
SetAboveLogScriptingDefineSymbol(EnableInfoAndAboveLogScriptingDefineSymbol);
SetAboveLogScriptingDefineSymbol(ENABLE_INFO_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL);
}
/// <summary>
@@ -90,7 +90,7 @@ namespace TEngine.Editor
[MenuItem("TEngine/Log Scripting Define Symbols/Enable Warning And Above Logs", false, 34)]
public static void EnableWarningAndAboveLogs()
{
SetAboveLogScriptingDefineSymbol(EnableWarningAndAboveLogScriptingDefineSymbol);
SetAboveLogScriptingDefineSymbol(ENABLE_WARNING_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL);
}
/// <summary>
@@ -99,7 +99,7 @@ namespace TEngine.Editor
[MenuItem("TEngine/Log Scripting Define Symbols/Enable Error And Above Logs", false, 35)]
public static void EnableErrorAndAboveLogs()
{
SetAboveLogScriptingDefineSymbol(EnableErrorAndAboveLogScriptingDefineSymbol);
SetAboveLogScriptingDefineSymbol(ENABLE_ERROR_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL);
}
/// <summary>
@@ -108,7 +108,7 @@ namespace TEngine.Editor
[MenuItem("TEngine/Log Scripting Define Symbols/Enable Fatal And Above Logs", false, 36)]
public static void EnableFatalAndAboveLogs()
{
SetAboveLogScriptingDefineSymbol(EnableFatalAndAboveLogScriptingDefineSymbol);
SetAboveLogScriptingDefineSymbol(ENABLE_FATAL_AND_ABOVE_LOG_SCRIPTING_DEFINE_SYMBOL);
}
/// <summary>

View File

@@ -7,13 +7,13 @@ namespace TEngine.Editor
/// </summary>
public class ProfilerDefineSymbols
{
private const string EnableFirstProfiler = "FIRST_PROFILER";
private const string EnableDinProFiler = "T_PROFILER";
private const string ENABLE_FIRST_PROFILER = "FIRST_PROFILER";
private const string ENABLE_DIN_PROFILER = "T_PROFILER";
private static readonly string[] AllProfilerDefineSymbols = new string[]
{
EnableFirstProfiler,
EnableDinProFiler,
ENABLE_FIRST_PROFILER,
ENABLE_DIN_PROFILER,
};
/// <summary>

View File

@@ -5,7 +5,7 @@ using System.IO;
[CanEditMultipleObjects, CustomEditor(typeof(DefaultAsset), false)]
public class DefaultAssetInspector : Editor
{
private const int MaxColum = 10240;
private const int MAX_COLUM = 10240;
private GUIStyle _textStyle;
@@ -34,9 +34,9 @@ public class DefaultAssetInspector : Editor
else
{
text = luaFile;
if (text.Length > MaxColum)
if (text.Length > MAX_COLUM)
{
text = text.Substring(0, MaxColum) + "...\n\n<...etc...>";
text = text.Substring(0, MAX_COLUM) + "...\n\n<...etc...>";
}
}

View File

@@ -5,7 +5,7 @@ using System.IO;
[CanEditMultipleObjects, CustomEditor(typeof(TextAsset))]
public class TextAssetInspector : Editor
{
private const int MaxColum = 10240;
private const int MAX_COLUM = 10240;
private GUIStyle _textStyle;
@@ -35,9 +35,9 @@ public class TextAssetInspector : Editor
else
{
text = luaFile;
if (text.Length > MaxColum)
if (text.Length > MAX_COLUM)
{
text = text.Substring(0, MaxColum) + "...\n\n<...etc...>";
text = text.Substring(0, MAX_COLUM) + "...\n\n<...etc...>";
}
}

View File

@@ -10,7 +10,7 @@ namespace TEngine.Editor
[CustomEditor(typeof(RootModule))]
internal sealed class RootModuleInspector : GameFrameworkInspector
{
private const string NoneOptionName = "<None>";
private const string NONE_OPTION_NAME = "<None>";
private static readonly float[] GameSpeed = new float[] { 0f, 0.01f, 0.1f, 0.25f, 0.5f, 1f, 1.5f, 2f, 4f, 8f };
private static readonly string[] GameSpeedForDisplay = new string[] { "0x", "0.01x", "0.1x", "0.25x", "0.5x", "1x", "1.5x", "2x", "4x", "8x" };
@@ -161,7 +161,7 @@ namespace TEngine.Editor
{
List<string> textHelperTypeNames = new List<string>
{
NoneOptionName
NONE_OPTION_NAME
};
textHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Text.ITextHelper)));
@@ -179,7 +179,7 @@ namespace TEngine.Editor
List<string> logHelperTypeNames = new List<string>
{
NoneOptionName
NONE_OPTION_NAME
};
logHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(GameFrameworkLog.ILogHelper)));
@@ -197,7 +197,7 @@ namespace TEngine.Editor
List<string> jsonHelperTypeNames = new List<string>
{
NoneOptionName
NONE_OPTION_NAME
};
jsonHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Json.IJsonHelper)));

View File

@@ -38,10 +38,10 @@ public class SpritePostprocessor : AssetPostprocessor
public static class EditorSpriteSaveInfo
{
private const string NormalAtlasDir = "Assets/AssetArt/Atlas";
private const string UISpritePath = "Assets/AssetRaw/UIRaw";
private const string UIAtlasPath = "Assets/AssetRaw/UIRaw/Atlas";
private const string UIRawPath = "Assets/AssetRaw/UIRaw/UIRaw";
private const string NORMAL_ATLAS_DIR = "Assets/AssetArt/Atlas";
private const string UI_SPRITE_PATH = "Assets/AssetRaw/UIRaw";
private const string UI_ATLAS_PATH = "Assets/AssetRaw/UIRaw/Atlas";
private const string UI_RAW_PATH = "Assets/AssetRaw/UIRaw/UIRaw";
private static readonly List<string> _dirtyAtlasList = new List<string>();
private static readonly Dictionary<string, List<string>> _allASprites = new Dictionary<string, List<string>>();
private static readonly Dictionary<string, string> _uiAtlasMap = new Dictionary<string, string>();
@@ -58,7 +58,7 @@ public static class EditorSpriteSaveInfo
EditorApplication.update += CheckDirty;
//读取所有图集信息
string[] findAssets = AssetDatabase.FindAssets("t:SpriteAtlas", new[] { NormalAtlasDir });
string[] findAssets = AssetDatabase.FindAssets("t:SpriteAtlas", new[] { NORMAL_ATLAS_DIR });
foreach (var findAsset in findAssets)
{
var path = AssetDatabase.GUIDToAssetPath(findAsset);
@@ -123,7 +123,7 @@ public static class EditorSpriteSaveInfo
public static void OnImportSprite(string assetPath)
{
if (!assetPath.StartsWith(UISpritePath))
if (!assetPath.StartsWith(UI_SPRITE_PATH))
{
return;
}
@@ -134,7 +134,7 @@ public static class EditorSpriteSaveInfo
{
var modify = false;
if (assetPath.StartsWith(UISpritePath))
if (assetPath.StartsWith(UI_SPRITE_PATH))
{
if (ti.textureType != TextureImporterType.Sprite)
{
@@ -314,7 +314,7 @@ public static class EditorSpriteSaveInfo
return;
}
if (!assetPath.StartsWith(UISpritePath))
if (!assetPath.StartsWith(UI_SPRITE_PATH))
{
return;
}
@@ -332,7 +332,7 @@ public static class EditorSpriteSaveInfo
return;
}
if (assetPath.StartsWith(UISpritePath))
if (assetPath.StartsWith(UI_SPRITE_PATH))
{
var spriteName = Path.GetFileNameWithoutExtension(assetPath);
if (_uiAtlasMap.ContainsKey(spriteName))
@@ -369,8 +369,8 @@ public static class EditorSpriteSaveInfo
}
}
var pathv2 = $"{NormalAtlasDir}/{atlasName}.spriteatlasv2";
var path = $"{NormalAtlasDir}/{atlasName}.asset";
var pathv2 = $"{NORMAL_ATLAS_DIR}/{atlasName}.spriteatlasv2";
var path = $"{NORMAL_ATLAS_DIR}/{atlasName}.asset";
if (spriteList.Count == 0)
{
@@ -449,7 +449,7 @@ public static class EditorSpriteSaveInfo
List<string> needSaveAtlas = new List<string>();
m_tempAllASprites.Clear();
_allASprites.Clear();
var findAssets = AssetDatabase.FindAssets("t:sprite", new[] { UIAtlasPath });
var findAssets = AssetDatabase.FindAssets("t:sprite", new[] { UI_ATLAS_PATH });
foreach (var findAsset in findAssets)
{
var path = AssetDatabase.GUIDToAssetPath(findAsset);

View File

@@ -26,14 +26,14 @@ namespace TEngine
fixedWidth = 60
};
ToolBarTextStyle = new GUIStyle(ButtonStyleName)
ToolBarTextStyle = new GUIStyle(BUTTON_STYLE_NAME)
{
padding = new RectOffset(2, 8, 2, 2),
alignment = TextAnchor.MiddleCenter,
fontStyle = FontStyle.Bold
};
ToolBarButtonGuiStyle = new GUIStyle(ButtonStyleName)
ToolBarButtonGuiStyle = new GUIStyle(BUTTON_STYLE_NAME)
{
padding = new RectOffset(2, 8, 2, 2),
alignment = TextAnchor.MiddleCenter,
@@ -48,7 +48,7 @@ namespace TEngine
_resourceModeIndex = EditorPrefs.GetInt("EditorPlayMode", 0);
}
private const string ButtonStyleName = "Tab middle";
private const string BUTTON_STYLE_NAME = "Tab middle";
static GUIStyle _buttonGuiStyle;
private static readonly string[] _resourceModeNames =

View File

@@ -12,12 +12,12 @@ namespace TEngine
/// 默认设计的模块数量。
/// <remarks>有增删可以自行修改减少内存分配与GCAlloc。</remarks>
/// </summary>
internal const int DesignModuleCount = 16;
internal const int DESIGN_MODULE_COUNT = 16;
private static readonly Dictionary<Type, Module> _moduleMaps = new Dictionary<Type, Module>(DesignModuleCount);
private static readonly Dictionary<Type, Module> _moduleMaps = new Dictionary<Type, Module>(DESIGN_MODULE_COUNT);
private static readonly LinkedList<Module> _modules = new LinkedList<Module>();
private static readonly LinkedList<Module> _updateModules = new LinkedList<Module>();
private static readonly List<IUpdateModule> _updateExecuteList = new List<IUpdateModule>(DesignModuleCount);
private static readonly List<IUpdateModule> _updateExecuteList = new List<IUpdateModule>(DESIGN_MODULE_COUNT);
private static bool _isExecuteListDirty;

View File

@@ -27,7 +27,7 @@ namespace TEngine
Exception,
}
private const ELogLevel FilterLevel = ELogLevel.Info;
private const ELogLevel FILTER_LEVEL = ELogLevel.Info;
private static readonly StringBuilder _stringBuilder = new StringBuilder(1024);
/// <summary>
@@ -126,7 +126,7 @@ namespace TEngine
private static void LogImp(ELogLevel type, string logString)
{
if (type < FilterLevel)
if (type < FILTER_LEVEL)
{
return;
}

View File

@@ -8,7 +8,7 @@ namespace TEngine
/// </summary>
public class DefaultTextHelper : Utility.Text.ITextHelper
{
private const int StringBuilderCapacity = 1024;
private const int STRING_BUILDER_CAPACITY = 1024;
[ThreadStatic]
private static StringBuilder s_CachedStringBuilder = null;
@@ -577,7 +577,7 @@ namespace TEngine
{
if (s_CachedStringBuilder == null)
{
s_CachedStringBuilder = new StringBuilder(StringBuilderCapacity);
s_CachedStringBuilder = new StringBuilder(STRING_BUILDER_CAPACITY);
}
}
}

View File

@@ -10,8 +10,8 @@ namespace TEngine
/// </summary>
public static class Converter
{
private const float InchesToCentimeters = 2.54f; // 1 inch = 2.54 cm
private const float CentimetersToInches = 1f / InchesToCentimeters; // 1 cm = 0.3937 inches
private const float INCHES_TO_CENTIMETERS = 2.54f; // 1 inch = 2.54 cm
private const float CENTIMETERS_TO_INCHES = 1f / INCHES_TO_CENTIMETERS; // 1 cm = 0.3937 inches
/// <summary>
/// 获取数据在此计算机结构中存储时的字节顺序。
@@ -39,7 +39,7 @@ namespace TEngine
throw new GameFrameworkException("You must set screen DPI first.");
}
return InchesToCentimeters * pixels / ScreenDpi;
return INCHES_TO_CENTIMETERS * pixels / ScreenDpi;
}
/// <summary>
@@ -54,7 +54,7 @@ namespace TEngine
throw new GameFrameworkException("You must set screen DPI first.");
}
return CentimetersToInches * centimeters * ScreenDpi;
return CENTIMETERS_TO_INCHES * centimeters * ScreenDpi;
}
/// <summary>

View File

@@ -10,7 +10,7 @@ namespace TEngine
/// <remarks>非托管内存相关的实用函数。</remarks>
public static class Marshal
{
private const int BlockSize = 1024 * 4;
private const int BLOCK_SIZE = 1024 * 4;
private static IntPtr _cachedHGlobalPtr = IntPtr.Zero;
private static int _cachedHGlobalSize = 0;
@@ -33,7 +33,7 @@ namespace TEngine
if (_cachedHGlobalPtr == IntPtr.Zero || _cachedHGlobalSize < ensureSize)
{
FreeCachedHGlobal();
int size = (ensureSize - 1 + BlockSize) / BlockSize * BlockSize;
int size = (ensureSize - 1 + BLOCK_SIZE) / BLOCK_SIZE * BLOCK_SIZE;
_cachedHGlobalPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(size);
_cachedHGlobalSize = size;
}

View File

@@ -18,7 +18,7 @@ namespace TEngine
private float _volume = 1.0f;
private float _duration;
private float _fadeoutTimer;
private const float FadeoutDuration = 0.2f;
private const float FADEOUT_DURATION = 0.2f;
private bool _inPool;
/// <summary>
@@ -273,7 +273,7 @@ namespace TEngine
{
if (fadeout)
{
_fadeoutTimer = FadeoutDuration;
_fadeoutTimer = FADEOUT_DURATION;
_audioAgentRuntimeState = AudioAgentRuntimeState.FadingOut;
}
else
@@ -379,7 +379,7 @@ namespace TEngine
if (_fadeoutTimer > 0f)
{
_fadeoutTimer -= elapseSeconds;
_source.volume = _volume * _fadeoutTimer / FadeoutDuration;
_source.volume = _volume * _fadeoutTimer / FADEOUT_DURATION;
}
else
{

View File

@@ -76,7 +76,7 @@ namespace TEngine
this.audioMixer = audioMixer;
_maxChannel = maxChannel;
_audioGroupConfig = audioGroupConfig;
AudioMixerGroup[] audioMixerGroups = audioMixer.FindMatchingGroups(Utility.Text.Format("Master/{0}", audioGroupConfig.audioType.ToString()));
AudioMixerGroup[] audioMixerGroups = audioMixer.FindMatchingGroups(Utility.Text.Format("Master/{0}", audioGroupConfig.AudioType.ToString()));
if (audioMixerGroups.Length > 0)
{
_audioMixerGroup = audioMixerGroups[0];

View File

@@ -22,7 +22,7 @@ namespace TEngine
/// 音效分类,可分别关闭/开启对应分类音效。
/// </summary>
/// <remarks>命名与AudioMixer中分类名保持一致。</remarks>
public AudioType audioType;
public AudioType AudioType;
/// <summary>
/// 音频源中3D声音的衰减模式。

View File

@@ -10,9 +10,9 @@ namespace TEngine
{
internal class AudioModule : Module, IAudioModule, IUpdateModule
{
public const string MusicVolumeName = "MusicVolume";
public const string UISoundVolumeName = "UISoundVolume";
public const string VoiceVolumeName = "VoiceVolume";
public const string MUSIC_VOLUME_NAME = "MusicVolume";
public const string UI_SOUND_VOLUME_NAME = "UISoundVolume";
public const string VOICE_VOLUME_NAME = "VoiceVolume";
private AudioMixer _audioMixer;
private Transform _instanceRoot = null;
@@ -113,7 +113,7 @@ namespace TEngine
float volume = Mathf.Clamp(value, 0.0001f, 1.0f);
_categoriesVolume[(int)AudioType.Music] = volume;
_audioMixer.SetFloat(MusicVolumeName, Mathf.Log10(volume) * 20f);
_audioMixer.SetFloat(MUSIC_VOLUME_NAME, Mathf.Log10(volume) * 20f);
}
}
@@ -167,7 +167,7 @@ namespace TEngine
float volume = Mathf.Clamp(value, 0.0001f, 1.0f);
_categoriesVolume[(int)AudioType.UISound] = volume;
_audioMixer.SetFloat(UISoundVolumeName, Mathf.Log10(volume) * 20f);
_audioMixer.SetFloat(UI_SOUND_VOLUME_NAME, Mathf.Log10(volume) * 20f);
}
}
@@ -194,7 +194,7 @@ namespace TEngine
float volume = Mathf.Clamp(value, 0.0001f, 1.0f);
_categoriesVolume[(int)AudioType.Voice] = volume;
_audioMixer.SetFloat(VoiceVolumeName, Mathf.Log10(volume) * 20f);
_audioMixer.SetFloat(VOICE_VOLUME_NAME, Mathf.Log10(volume) * 20f);
}
}
@@ -210,7 +210,7 @@ namespace TEngine
return false;
}
if (_audioMixer.GetFloat(MusicVolumeName, out var db))
if (_audioMixer.GetFloat(MUSIC_VOLUME_NAME, out var db))
{
return db > -80f;
}
@@ -231,11 +231,11 @@ namespace TEngine
// 音乐采用0音量方式避免恢复播放时的复杂逻辑
if (value)
{
_audioMixer.SetFloat(MusicVolumeName, Mathf.Log10(_categoriesVolume[(int)AudioType.Music]) * 20f);
_audioMixer.SetFloat(MUSIC_VOLUME_NAME, Mathf.Log10(_categoriesVolume[(int)AudioType.Music]) * 20f);
}
else
{
_audioMixer.SetFloat(MusicVolumeName, -80f);
_audioMixer.SetFloat(MUSIC_VOLUME_NAME, -80f);
}
}
}
@@ -389,7 +389,7 @@ namespace TEngine
for (int index = 0; index < (int)AudioType.Max; ++index)
{
AudioType audioType = (AudioType)index;
AudioGroupConfig audioGroupConfig = _audioGroupConfigs.First(t => t.audioType == audioType);
AudioGroupConfig audioGroupConfig = _audioGroupConfigs.First(t => t.AudioType == audioType);
_audioCategories[index] = new AudioCategory(audioGroupConfig.AgentHelperCount, _audioMixer, audioGroupConfig);
_categoriesVolume[index] = audioGroupConfig.Volume;
}

View File

@@ -11,7 +11,7 @@ namespace TEngine
{
private sealed partial class RuntimeMemoryInformationWindow<T> : ScrollableDebuggerWindowBase where T : UnityEngine.Object
{
private const int ShowSampleCount = 300;
private const int SHOW_SAMPLE_COUNT = 300;
private readonly List<Sample> _samples = new List<Sample>();
private readonly Comparison<Sample> _sampleComparer = SampleComparer;
@@ -69,7 +69,7 @@ namespace TEngine
GUILayout.EndHorizontal();
count++;
if (count >= ShowSampleCount)
if (count >= SHOW_SAMPLE_COUNT)
{
break;
}

View File

@@ -6,7 +6,7 @@ namespace TEngine
{
private abstract class ScrollableDebuggerWindowBase : IDebuggerWindow
{
private const float TitleWidth = 240f;
private const float TITLE_WIDTH = 240f;
private Vector2 _scrollPosition = Vector2.zero;
public virtual void Initialize(params object[] args)
@@ -44,7 +44,7 @@ namespace TEngine
{
GUILayout.BeginHorizontal();
{
GUILayout.Label(title, GUILayout.Width(TitleWidth));
GUILayout.Label(title, GUILayout.Width(TITLE_WIDTH));
if (GUILayout.Button(content, "label"))
{
CopyToClipboard(content);

View File

@@ -8,9 +8,9 @@ namespace TEngine
/// </summary>
internal sealed partial class ObjectPoolModule : Module, IObjectPoolModule, IUpdateModule
{
private const int DefaultCapacity = int.MaxValue;
private const float DefaultExpireTime = float.MaxValue;
private const int DefaultPriority = 0;
private const int DEFAULT_CAPACITY = int.MaxValue;
private const float DEFAULT_EXPIRE_TIME = float.MaxValue;
private const int DEFAULT_PRIORITY = 0;
private readonly Dictionary<TypeNamePair, ObjectPoolBase> _objectPools;
private readonly List<ObjectPoolBase> _cachedAllObjectPools;
@@ -370,7 +370,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>() where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, false, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -380,7 +380,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType)
{
return InternalCreateObjectPool(objectType, string.Empty, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, false, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -391,7 +391,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(string name) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, false, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -402,7 +402,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name)
{
return InternalCreateObjectPool(objectType, name, false, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, false, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -413,7 +413,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(int capacity) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -424,7 +424,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity)
{
return InternalCreateObjectPool(objectType, string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -435,7 +435,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, false, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, false, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -446,7 +446,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime)
{
return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -458,7 +458,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(string name, int capacity) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -470,7 +470,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity)
{
return InternalCreateObjectPool(objectType, name, false, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -482,7 +482,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(string name, float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, false, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, false, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -494,7 +494,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime)
{
return InternalCreateObjectPool(objectType, name, false, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, false, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -506,7 +506,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(int capacity, float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, false, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, false, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -518,7 +518,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, float expireTime)
{
return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -530,7 +530,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(int capacity, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool<T>(string.Empty, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -542,7 +542,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, int capacity, int priority)
{
return InternalCreateObjectPool(objectType, string.Empty, false, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool(objectType, string.Empty, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -554,7 +554,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(float expireTime, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, false, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool<T>(string.Empty, false, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -566,7 +566,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, float expireTime, int priority)
{
return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool(objectType, string.Empty, false, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -579,7 +579,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(string name, int capacity, float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, false, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, false, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -592,7 +592,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, float expireTime)
{
return InternalCreateObjectPool(objectType, name, false, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, false, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -605,7 +605,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(string name, int capacity, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, false, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool<T>(name, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -618,7 +618,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, int capacity, int priority)
{
return InternalCreateObjectPool(objectType, name, false, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool(objectType, name, false, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -631,7 +631,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public IObjectPool<T> CreateSingleSpawnObjectPool<T>(string name, float expireTime, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, false, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool<T>(name, false, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -644,7 +644,7 @@ namespace TEngine
/// <returns>要创建的允许单次获取的对象池。</returns>
public ObjectPoolBase CreateSingleSpawnObjectPool(Type objectType, string name, float expireTime, int priority)
{
return InternalCreateObjectPool(objectType, name, false, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool(objectType, name, false, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -739,7 +739,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>() where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, true, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -749,7 +749,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType)
{
return InternalCreateObjectPool(objectType, string.Empty, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, true, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -760,7 +760,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(string name) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, true, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -771,7 +771,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name)
{
return InternalCreateObjectPool(objectType, name, true, DefaultExpireTime, DefaultCapacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, true, DEFAULT_EXPIRE_TIME, DEFAULT_CAPACITY, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -782,7 +782,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(int capacity) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -793,7 +793,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity)
{
return InternalCreateObjectPool(objectType, string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -804,7 +804,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, true, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, true, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -815,7 +815,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime)
{
return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -827,7 +827,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(string name, int capacity) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -839,7 +839,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity)
{
return InternalCreateObjectPool(objectType, name, true, DefaultExpireTime, capacity, DefaultExpireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, DEFAULT_PRIORITY);
}
/// <summary>
@@ -851,7 +851,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(string name, float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, true, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, true, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -863,7 +863,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime)
{
return InternalCreateObjectPool(objectType, name, true, expireTime, DefaultCapacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, true, expireTime, DEFAULT_CAPACITY, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -875,7 +875,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(int capacity, float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, true, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(string.Empty, true, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -887,7 +887,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, float expireTime)
{
return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -899,7 +899,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(int capacity, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool<T>(string.Empty, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -911,7 +911,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, int capacity, int priority)
{
return InternalCreateObjectPool(objectType, string.Empty, true, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool(objectType, string.Empty, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -923,7 +923,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(float expireTime, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(string.Empty, true, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool<T>(string.Empty, true, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -935,7 +935,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, float expireTime, int priority)
{
return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool(objectType, string.Empty, true, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -948,7 +948,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(string name, int capacity, float expireTime) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, true, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool<T>(name, true, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -961,7 +961,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, float expireTime)
{
return InternalCreateObjectPool(objectType, name, true, expireTime, capacity, expireTime, DefaultPriority);
return InternalCreateObjectPool(objectType, name, true, expireTime, capacity, expireTime, DEFAULT_PRIORITY);
}
/// <summary>
@@ -974,7 +974,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(string name, int capacity, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, true, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool<T>(name, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -987,7 +987,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, int capacity, int priority)
{
return InternalCreateObjectPool(objectType, name, true, DefaultExpireTime, capacity, DefaultExpireTime, priority);
return InternalCreateObjectPool(objectType, name, true, DEFAULT_EXPIRE_TIME, capacity, DEFAULT_EXPIRE_TIME, priority);
}
/// <summary>
@@ -1000,7 +1000,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public IObjectPool<T> CreateMultiSpawnObjectPool<T>(string name, float expireTime, int priority) where T : ObjectBase
{
return InternalCreateObjectPool<T>(name, true, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool<T>(name, true, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>
@@ -1013,7 +1013,7 @@ namespace TEngine
/// <returns>要创建的允许多次获取的对象池。</returns>
public ObjectPoolBase CreateMultiSpawnObjectPool(Type objectType, string name, float expireTime, int priority)
{
return InternalCreateObjectPool(objectType, name, true, expireTime, DefaultCapacity, expireTime, priority);
return InternalCreateObjectPool(objectType, name, true, expireTime, DEFAULT_CAPACITY, expireTime, priority);
}
/// <summary>

View File

@@ -13,7 +13,7 @@ namespace TEngine
{
#region Propreties
private const int DefaultPriority = 0;
private const int DEFAULT_PRIORITY = 0;
private IResourceModule _resourceModule;

View File

@@ -9,25 +9,33 @@ namespace TEngine
[DisallowMultipleComponent]
public sealed class RootModule : MonoBehaviour
{
private const int DefaultDpi = 96; // default windows dpi
private const int DEFAULT_DPI = 96; // default windows dpi
private float _gameSpeedBeforePause = 1f;
[SerializeField] private Language editorLanguage = Language.Unspecified;
[SerializeField]
private Language editorLanguage = Language.Unspecified;
[SerializeField] private string textHelperTypeName = "TEngine.DefaultTextHelper";
[SerializeField]
private string textHelperTypeName = "TEngine.DefaultTextHelper";
[SerializeField] private string logHelperTypeName = "TEngine.DefaultLogHelper";
[SerializeField]
private string logHelperTypeName = "TEngine.DefaultLogHelper";
[SerializeField] private string jsonHelperTypeName = "TEngine.DefaultJsonHelper";
[SerializeField]
private string jsonHelperTypeName = "TEngine.DefaultJsonHelper";
[SerializeField] private int frameRate = 120;
[SerializeField]
private int frameRate = 120;
[SerializeField] private float gameSpeed = 1f;
[SerializeField]
private float gameSpeed = 1f;
[SerializeField] private bool runInBackground = true;
[SerializeField]
private bool runInBackground = true;
[SerializeField] private bool neverSleep = true;
[SerializeField]
private bool neverSleep = true;
/// <summary>
/// 获取或设置编辑器语言(仅编辑器内有效)。
@@ -102,7 +110,7 @@ namespace TEngine
Utility.Converter.ScreenDpi = Screen.dpi;
if (Utility.Converter.ScreenDpi <= 0)
{
Utility.Converter.ScreenDpi = DefaultDpi;
Utility.Converter.ScreenDpi = DEFAULT_DPI;
}
Application.targetFrameRate = frameRate;