refactor: Update Unity to 2022.3.62

This commit is contained in:
2025-06-21 01:22:02 +08:00
parent d71bf7d4a5
commit 283783954f
112 changed files with 778 additions and 907 deletions

View File

@@ -342,7 +342,7 @@ namespace TMPro.EditorUtilities
//#if UNITY_2022_1_OR_NEWER
//Vector3 newLeft = Handles.FreeMoveHandle(oldLeft, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#else
Vector3 newLeft = Handles.FreeMoveHandle(oldLeft, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
var fmh_345_63_638860614827494399 = Quaternion.identity; Vector3 newLeft = Handles.FreeMoveHandle(oldLeft, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#endif
bool hasChanged = false;
if (oldLeft != newLeft)
@@ -361,7 +361,7 @@ namespace TMPro.EditorUtilities
//#if UNITY_2022_1_OR_NEWER
//Vector3 newTop = Handles.FreeMoveHandle(oldTop, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#else
Vector3 newTop = Handles.FreeMoveHandle(oldTop, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
var fmh_364_61_638860614827520141 = Quaternion.identity; Vector3 newTop = Handles.FreeMoveHandle(oldTop, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#endif
if (oldTop != newTop)
{
@@ -379,7 +379,7 @@ namespace TMPro.EditorUtilities
//#if UNITY_2022_1_OR_NEWER
//Vector3 newRight = Handles.FreeMoveHandle(oldRight, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#else
Vector3 newRight = Handles.FreeMoveHandle(oldRight, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
var fmh_382_65_638860614827523042 = Quaternion.identity; Vector3 newRight = Handles.FreeMoveHandle(oldRight, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#endif
if (oldRight != newRight)
{
@@ -397,7 +397,7 @@ namespace TMPro.EditorUtilities
//#if UNITY_2022_1_OR_NEWER
//Vector3 newBottom = Handles.FreeMoveHandle(oldBottom, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#else
Vector3 newBottom = Handles.FreeMoveHandle(oldBottom, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
var fmh_400_67_638860614827525664 = Quaternion.identity; Vector3 newBottom = Handles.FreeMoveHandle(oldBottom, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
//#endif
if (oldBottom != newBottom)
{

View File

@@ -104,13 +104,13 @@ namespace TMPro
/// <summary>
/// The character that will be used as a replacement for missing glyphs in a font asset.
/// </summary>
public static int missingGlyphCharacter
public static uint missingGlyphCharacter
{
get { return instance.m_missingGlyphCharacter; }
set { instance.m_missingGlyphCharacter = value; }
}
[SerializeField]
private int m_missingGlyphCharacter;
private uint m_missingGlyphCharacter;
/// <summary>
/// Determines if the "Clear Dynamic Data on Build" property will be set to true or false on newly created dynamic font assets.

View File

@@ -1303,7 +1303,7 @@ namespace TMPro
/// <param name="text">The source text that contains the missing character.</param>
/// <param name="fontAsset">The font asset that is missing the requested characters.</param>
/// <param name="textComponent">The text component where the requested character is missing.</param>
public delegate void MissingCharacterEventCallback(int unicode, int stringIndex, string text, FontAsset fontAsset, TMP_Text textComponent);
public delegate void MissingCharacterEventCallback(uint unicode, int stringIndex, string text, FontAsset fontAsset, TMP_Text textComponent);
/// <summary>
/// Event delegate to be called when the requested Unicode character is missing from the font asset.
@@ -1512,7 +1512,7 @@ namespace TMPro
[System.Diagnostics.DebuggerDisplay("Unicode ({unicode}) '{(char)unicode}'")]
internal struct UnicodeChar
{
public int unicode;
public uint unicode;
public int stringIndex;
public int length;
}
@@ -2120,11 +2120,11 @@ namespace TMPro
if (writeIndex + 2 > m_TextProcessingArray.Length) ResizeInternalArray(ref m_TextProcessingArray);
m_TextProcessingArray[writeIndex].unicode = (int)m_TextBackingArray[readIndex + 1];
m_TextProcessingArray[writeIndex].unicode = m_TextBackingArray[readIndex + 1];
m_TextProcessingArray[writeIndex].stringIndex = readIndex;
m_TextProcessingArray[writeIndex].length = 1;
m_TextProcessingArray[writeIndex + 1].unicode = (int)m_TextBackingArray[readIndex + 2];
m_TextProcessingArray[writeIndex + 1].unicode = m_TextBackingArray[readIndex + 2];
m_TextProcessingArray[writeIndex + 1].stringIndex = readIndex;
m_TextProcessingArray[writeIndex + 1].length = 1;
@@ -2215,7 +2215,7 @@ namespace TMPro
{
if (writeIndex == m_TextProcessingArray.Length) ResizeInternalArray(ref m_TextProcessingArray);
m_TextProcessingArray[writeIndex].unicode = (int)TMP_TextParsingUtilities.ConvertToUTF32(c, m_TextBackingArray[readIndex + 1]);
m_TextProcessingArray[writeIndex].unicode = TMP_TextParsingUtilities.ConvertToUTF32(c, m_TextBackingArray[readIndex + 1]);
m_TextProcessingArray[writeIndex].stringIndex = readIndex;
m_TextProcessingArray[writeIndex].length = 2;
@@ -2305,7 +2305,7 @@ namespace TMPro
if (writeIndex == m_TextProcessingArray.Length) ResizeInternalArray(ref m_TextProcessingArray);
m_TextProcessingArray[writeIndex].unicode = (int)c;
m_TextProcessingArray[writeIndex].unicode = c;
m_TextProcessingArray[writeIndex].stringIndex = readIndex;
m_TextProcessingArray[writeIndex].length = 1;
@@ -2811,11 +2811,11 @@ namespace TMPro
int styleLength = style.styleOpeningTagArray.Length;
// Replace <style> tag with opening definition
int[] tagDefinition = style.styleOpeningTagArray;
uint[] tagDefinition = style.styleOpeningTagArray;
for (int i = 0; i < styleLength; i++)
{
int c = tagDefinition[i];
uint c = tagDefinition[i];
if (c == '\\' && i + 1 < styleLength)
{
@@ -2922,7 +2922,7 @@ namespace TMPro
/// <param name="charBuffer"></param>
/// <param name="writeIndex"></param>
/// <returns></returns>
bool ReplaceOpeningStyleTag(ref int[] sourceText, int srcIndex, out int srcOffset, ref UnicodeChar[] charBuffer, ref int writeIndex)
bool ReplaceOpeningStyleTag(ref uint[] sourceText, int srcIndex, out int srcOffset, ref UnicodeChar[] charBuffer, ref int writeIndex)
{
// Validate <style> tag.
int styleHashCode = GetStyleHashCode(ref sourceText, srcIndex + 7, out srcOffset);
@@ -2940,11 +2940,11 @@ namespace TMPro
int styleLength = style.styleOpeningTagArray.Length;
// Replace <style> tag with opening definition
int[] tagDefinition = style.styleOpeningTagArray;
uint[] tagDefinition = style.styleOpeningTagArray;
for (int i = 0; i < styleLength; i++)
{
int c = tagDefinition[i];
uint c = tagDefinition[i];
if (c == '\\' && i + 1 < styleLength)
{
@@ -3066,11 +3066,11 @@ namespace TMPro
int styleLength = style.styleClosingTagArray.Length;
// Replace <style> tag with opening definition
int[] tagDefinition = style.styleClosingTagArray;
uint[] tagDefinition = style.styleClosingTagArray;
for (int i = 0; i < styleLength; i++)
{
int c = tagDefinition[i];
uint c = tagDefinition[i];
if (c == '\\' && i + 1 < styleLength)
{
@@ -3174,7 +3174,7 @@ namespace TMPro
/// <param name="charBuffer"></param>
/// <param name="writeIndex"></param>
/// <returns></returns>
void ReplaceClosingStyleTag(ref int[] sourceText, int srcIndex, ref UnicodeChar[] charBuffer, ref int writeIndex)
void ReplaceClosingStyleTag(ref uint[] sourceText, int srcIndex, ref UnicodeChar[] charBuffer, ref int writeIndex)
{
// Get style from the Style Stack
int styleHashCode = m_TextStyleStacks[m_TextStyleStackDepth + 1].Pop();
@@ -3189,11 +3189,11 @@ namespace TMPro
int styleLength = style.styleClosingTagArray.Length;
// Replace <style> tag with opening definition
int[] tagDefinition = style.styleClosingTagArray;
uint[] tagDefinition = style.styleClosingTagArray;
for (int i = 0; i < styleLength; i++)
{
int c = tagDefinition[i];
uint c = tagDefinition[i];
if (c == '\\' && i + 1 < styleLength)
{
@@ -3308,11 +3308,11 @@ namespace TMPro
int styleLength = style.styleOpeningTagArray.Length;
// Replace <style> tag with opening definition
int[] tagDefinition = style.styleOpeningTagArray;
uint[] tagDefinition = style.styleOpeningTagArray;
for (int i = 0; i < styleLength; i++)
{
int c = tagDefinition[i];
uint c = tagDefinition[i];
if (c == '\\' && i + 1 < styleLength)
{
@@ -3424,11 +3424,11 @@ namespace TMPro
int styleLength = style.styleClosingTagArray.Length;
// Replace <style> tag with opening definition
int[] tagDefinition = style.styleClosingTagArray;
uint[] tagDefinition = style.styleClosingTagArray;
for (int i = 0; i < styleLength; i++)
{
int c = tagDefinition[i];
uint c = tagDefinition[i];
if (c == '\\' && i + 1 < styleLength)
{
@@ -3531,7 +3531,7 @@ namespace TMPro
/// <param name="tagDefinition"></param>
/// <param name="readIndex"></param>
/// <returns></returns>
int GetMarkupTagHashCode(int[] tagDefinition, int readIndex)
int GetMarkupTagHashCode(uint[] tagDefinition, int readIndex)
{
int hashCode = 0;
int maxReadIndex = readIndex + 16;
@@ -3539,7 +3539,7 @@ namespace TMPro
for (; readIndex < maxReadIndex && readIndex < tagDefinitionLength; readIndex++)
{
int c = tagDefinition[readIndex];
uint c = tagDefinition[readIndex];
if (c == '>' || c == '=' || c == ' ')
return hashCode;
@@ -3584,7 +3584,7 @@ namespace TMPro
/// <param name="index"></param>
/// <param name="closeIndex"></param>
/// <returns></returns>
int GetStyleHashCode(ref int[] text, int index, out int closeIndex)
int GetStyleHashCode(ref uint[] text, int index, out int closeIndex)
{
int hashCode = 0;
closeIndex = 0;
@@ -4184,7 +4184,7 @@ namespace TMPro
// Parse through Character buffer to read HTML tags and begin creating mesh.
for (int i = 0; i < m_TextProcessingArray.Length && m_TextProcessingArray[i].unicode != 0; i++)
{
int charCode = m_TextProcessingArray[i].unicode;
uint charCode = m_TextProcessingArray[i].unicode;
// Parse Rich Text Tag
#region Parse Rich Text Tag
@@ -4223,7 +4223,7 @@ namespace TMPro
if (characterToSubstitute.index == m_characterCount)
{
charCode = (int)characterToSubstitute.unicode;
charCode = characterToSubstitute.unicode;
m_textElementType = TMP_TextElementType.Character;
isInjectingCharacter = true;
@@ -4316,7 +4316,7 @@ namespace TMPro
// Sprites are assigned in the E000 Private Area + sprite Index
if (charCode == 60)
charCode = 57344 + m_spriteIndex;
charCode = 57344 + (uint)m_spriteIndex;
// The sprite scale calculations are based on the font asset assigned to the text object.
if (m_currentSpriteAsset.faceInfo.pointSize > 0)
@@ -6523,7 +6523,7 @@ namespace TMPro
targetTextComponent.parentLinkedComponent = null;
}
protected void DoMissingGlyphCallback(int unicode, int stringIndex, FontAsset fontAsset)
protected void DoMissingGlyphCallback(uint unicode, int stringIndex, FontAsset fontAsset)
{
// Event to allow users to modify the content of the text info before the text is rendered.
OnMissingCharacter?.Invoke(unicode, stringIndex, m_text, fontAsset, this);
@@ -6630,7 +6630,7 @@ namespace TMPro
/// </summary>
/// <param name="hex"></param>
/// <returns></returns>
protected int HexToInt(char hex)
protected uint HexToInt(char hex)
{
switch (hex)
{
@@ -6677,9 +6677,9 @@ namespace TMPro
/// </summary>
/// <returns>The Unicode hex.</returns>
/// <param name="i">The index.</param>
protected int GetUTF16(string text, int i)
protected uint GetUTF16(string text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt(text[i]) << 12;
unicode += HexToInt(text[i + 1]) << 8;
unicode += HexToInt(text[i + 2]) << 4;
@@ -6687,9 +6687,9 @@ namespace TMPro
return unicode;
}
protected int GetUTF16(int[] text, int i)
protected uint GetUTF16(int[] text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt((char)text[i]) << 12;
unicode += HexToInt((char)text[i + 1]) << 8;
unicode += HexToInt((char)text[i + 2]) << 4;
@@ -6697,9 +6697,9 @@ namespace TMPro
return unicode;
}
internal int GetUTF16(uint[] text, int i)
internal uint GetUTF16(uint[] text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt((char)text[i]) << 12;
unicode += HexToInt((char)text[i + 1]) << 8;
unicode += HexToInt((char)text[i + 2]) << 4;
@@ -6712,9 +6712,9 @@ namespace TMPro
/// </summary>
/// <returns>The Unicode hex.</returns>
/// <param name="i">The index.</param>
protected int GetUTF16(StringBuilder text, int i)
protected uint GetUTF16(StringBuilder text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt(text[i]) << 12;
unicode += HexToInt(text[i + 1]) << 8;
unicode += HexToInt(text[i + 2]) << 4;
@@ -6722,9 +6722,9 @@ namespace TMPro
return unicode;
}
private int GetUTF16(TextBackingContainer text, int i)
private uint GetUTF16(TextBackingContainer text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt((char)text[i]) << 12;
unicode += HexToInt((char)text[i + 1]) << 8;
unicode += HexToInt((char)text[i + 2]) << 4;
@@ -6749,9 +6749,9 @@ namespace TMPro
/// </summary>
/// <returns>The Unicode hex.</returns>
/// <param name="i">The index.</param>
protected int GetUTF32(string text, int i)
protected uint GetUTF32(string text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt(text[i]) << 28;
unicode += HexToInt(text[i + 1]) << 24;
unicode += HexToInt(text[i + 2]) << 20;
@@ -6763,9 +6763,9 @@ namespace TMPro
return unicode;
}
protected int GetUTF32(int[] text, int i)
protected uint GetUTF32(int[] text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt((char)text[i]) << 28;
unicode += HexToInt((char)text[i + 1]) << 24;
unicode += HexToInt((char)text[i + 2]) << 20;
@@ -6777,9 +6777,9 @@ namespace TMPro
return unicode;
}
internal int GetUTF32(uint[] text, int i)
internal uint GetUTF32(uint[] text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt((char)text[i]) << 28;
unicode += HexToInt((char)text[i + 1]) << 24;
unicode += HexToInt((char)text[i + 2]) << 20;
@@ -6796,9 +6796,9 @@ namespace TMPro
/// </summary>
/// <returns>The Unicode hex.</returns>
/// <param name="i">The index.</param>
protected int GetUTF32(StringBuilder text, int i)
protected uint GetUTF32(StringBuilder text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt(text[i]) << 28;
unicode += HexToInt(text[i + 1]) << 24;
unicode += HexToInt(text[i + 2]) << 20;
@@ -6810,9 +6810,9 @@ namespace TMPro
return unicode;
}
int GetUTF32(TextBackingContainer text, int i)
uint GetUTF32(TextBackingContainer text, int i)
{
int unicode = 0;
uint unicode = 0;
unicode += HexToInt((char)text[i]) << 28;
unicode += HexToInt((char)text[i + 1]) << 24;
unicode += HexToInt((char)text[i + 2]) << 20;
@@ -7093,7 +7093,7 @@ namespace TMPro
for (int i = startIndex; i < chars.Length && chars[i].unicode != 0 && tagCharCount < m_htmlTag.Length && chars[i].unicode != '<'; i++)
{
int unicode = chars[i].unicode;
uint unicode = chars[i].unicode;
if (unicode == '>') // ASCII Code of End HTML tag '>'
{

View File

@@ -1039,7 +1039,7 @@ namespace TMPro
if (m_textInfo.characterInfo == null || m_totalCharacterCount >= m_textInfo.characterInfo.Length)
TMP_TextInfo.Resize(ref m_textInfo.characterInfo, m_totalCharacterCount + 1, true);
int unicode = textProcessingArray[i].unicode;
uint unicode = textProcessingArray[i].unicode;
// PARSE XML TAGS
#region PARSE XML TAGS
@@ -1142,7 +1142,7 @@ namespace TMPro
DoMissingGlyphCallback(unicode, textProcessingArray[i].stringIndex, m_currentFontAsset);
// Save the original unicode character
int srcGlyph = unicode;
uint srcGlyph = unicode;
// Try replacing the missing glyph character by TMP Settings Missing Glyph or Square (9633) character.
unicode = textProcessingArray[i].unicode = TMP_Settings.missingGlyphCharacter == 0 ? 9633 : TMP_Settings.missingGlyphCharacter;
@@ -1569,7 +1569,7 @@ namespace TMPro
// Reparse the text as input may have changed or been truncated.
ParseInputText();
FontAsset.UpdateFontAssetInUpdateQueue();
FontAsset.UpdateFontAssetsInUpdateQueue();
// Reset Font min / max used with Auto-sizing
if (m_enableAutoSizing)
@@ -1665,7 +1665,7 @@ namespace TMPro
m_sizeStack.SetDefault(m_currentFontSize);
float fontSizeDelta = 0;
int charCode = 0; // Holds the character code of the currently being processed character.
uint charCode = 0; // Holds the character code of the currently being processed character.
m_FontStyleInternal = m_fontStyle; // Set the default style.
m_FontWeightInternal = (m_FontStyleInternal & FontStyles.Bold) == FontStyles.Bold ? FontWeight.Bold : m_fontWeight;
@@ -1863,7 +1863,7 @@ namespace TMPro
if (characterToSubstitute.index == m_characterCount)
{
charCode = (int)characterToSubstitute.unicode;
charCode = characterToSubstitute.unicode;
m_textElementType = TMP_TextElementType.Character;
isInjectingCharacter = true;
@@ -1962,7 +1962,7 @@ namespace TMPro
// Sprites are assigned in the E000 Private Area + sprite Index
if (charCode == '<')
charCode = 57344 + m_spriteIndex;
charCode = 57344 + (uint)m_spriteIndex;
else
m_spriteColor = s_colorWhite;

View File

@@ -1114,7 +1114,7 @@ namespace TMPro
if (m_textInfo.characterInfo == null || m_totalCharacterCount >= m_textInfo.characterInfo.Length)
TMP_TextInfo.Resize(ref m_textInfo.characterInfo, m_totalCharacterCount + 1, true);
int unicode = textProcessingArray[i].unicode;
uint unicode = textProcessingArray[i].unicode;
// PARSE XML TAGS
#region PARSE XML TAGS
@@ -1217,7 +1217,7 @@ namespace TMPro
DoMissingGlyphCallback(unicode, textProcessingArray[i].stringIndex, m_currentFontAsset);
// Save the original unicode character
int srcGlyph = unicode;
uint srcGlyph = unicode;
// Try replacing the missing glyph character by TMP Settings Missing Glyph or Square (9633) character.
unicode = textProcessingArray[i].unicode = TMP_Settings.missingGlyphCharacter == 0 ? 9633 : TMP_Settings.missingGlyphCharacter;
@@ -1685,7 +1685,7 @@ namespace TMPro
// Reparse the text as input may have changed or been truncated.
ParseInputText();
FontAsset.UpdateFontAssetInUpdateQueue();
FontAsset.UpdateFontAssetsInUpdateQueue();
// Reset Font min / max used with Auto-sizing
if (m_enableAutoSizing)
@@ -1778,7 +1778,7 @@ namespace TMPro
m_sizeStack.SetDefault(m_currentFontSize);
float fontSizeDelta = 0;
int charCode = 0; // Holds the character code of the currently being processed character.
uint charCode = 0; // Holds the character code of the currently being processed character.
m_FontStyleInternal = m_fontStyle; // Set the default style.
m_FontWeightInternal = (m_FontStyleInternal & FontStyles.Bold) == FontStyles.Bold ? FontWeight.Bold : m_fontWeight;
@@ -1976,7 +1976,7 @@ namespace TMPro
if (characterToSubstitute.index == m_characterCount)
{
charCode = (int)characterToSubstitute.unicode;
charCode = characterToSubstitute.unicode;
m_textElementType = TMP_TextElementType.Character;
isInjectingCharacter = true;
@@ -2075,7 +2075,7 @@ namespace TMPro
// Sprites are assigned in the E000 Private Area + sprite Index
if (charCode == '<')
charCode = 57344 + m_spriteIndex;
charCode = 57344 + (uint)m_spriteIndex;
else
m_spriteColor = s_colorWhite;