This commit is contained in:
王志勋 2025-11-04 18:11:20 +08:00
parent fa3a5df6fe
commit a0fc3b976d
3 changed files with 114 additions and 114 deletions

View File

@ -11,7 +11,7 @@ namespace UnityStandardAssets.Utility
public class WaypointCircuit : MonoBehaviour public class WaypointCircuit : MonoBehaviour
{ {
public WaypointList waypointList = new WaypointList(); public WaypointList waypointList = new WaypointList();
[SerializeField] private bool smoothRoute = true; [SerializeField] public bool smoothRoute = true;
private int numPoints; private int numPoints;
private Vector3[] points; private Vector3[] points;
private float[] distances; private float[] distances;

View File

@ -69,10 +69,10 @@ public class ScrollableInputField : MonoBehaviour
return; return;
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 初始化完成 - {gameObject.name}"); // Debug.Log($"ScrollableInputField: 初始化完成 - {gameObject.name}");
} //}
SetText("大量文本大量文本内容大量文本内容大量文本大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容内容..."); SetText("大量文本大量文本内容大量文本内容大量文本大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容大量文本内容内容...");
} }
@ -97,10 +97,10 @@ public class ScrollableInputField : MonoBehaviour
inputField.onValueChanged.AddListener(OnInputFieldTextChanged); inputField.onValueChanged.AddListener(OnInputFieldTextChanged);
inputField.onEndEdit.AddListener(OnInputFieldEndEdit); inputField.onEndEdit.AddListener(OnInputFieldEndEdit);
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: InputField设置完成 - 多行模式: {inputField.lineType}, 字符限制: {inputField.characterLimit}"); // Debug.Log($"ScrollableInputField: InputField设置完成 - 多行模式: {inputField.lineType}, 字符限制: {inputField.characterLimit}");
} //}
} }
/// <summary> /// <summary>
@ -112,10 +112,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
copyButton.onClick.AddListener(CopyTextToClipboard); copyButton.onClick.AddListener(CopyTextToClipboard);
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 复制按钮设置完成"); // Debug.Log($"ScrollableInputField: 复制按钮设置完成");
} //}
} }
} }
@ -134,10 +134,10 @@ public class ScrollableInputField : MonoBehaviour
ScrollToBottom(); ScrollToBottom();
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 文本变化 - 长度: {text.Length}"); // Debug.Log($"ScrollableInputField: 文本变化 - 长度: {text.Length}");
} //}
} }
/// <summary> /// <summary>
@ -146,10 +146,10 @@ public class ScrollableInputField : MonoBehaviour
/// <param name="text">最终文本内容</param> /// <param name="text">最终文本内容</param>
private void OnInputFieldEndEdit(string text) private void OnInputFieldEndEdit(string text)
{ {
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 编辑结束 - 最终长度: {text.Length}"); // Debug.Log($"ScrollableInputField: 编辑结束 - 最终长度: {text.Length}");
} //}
} }
/// <summary> /// <summary>
@ -197,10 +197,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
GUIUtility.systemCopyBuffer = textToCopy; GUIUtility.systemCopyBuffer = textToCopy;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 文本已复制到剪贴板 - 长度: {textToCopy.Length}"); // Debug.Log($"ScrollableInputField: 文本已复制到剪贴板 - 长度: {textToCopy.Length}");
} //}
// 触发复制成功事件 // 触发复制成功事件
OnCopySuccess?.Invoke(); OnCopySuccess?.Invoke();
@ -221,10 +221,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
inputField.text = text; inputField.text = text;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 设置文本 - 长度: {text?.Length ?? 0}"); // Debug.Log($"ScrollableInputField: 设置文本 - 长度: {text?.Length ?? 0}");
} //}
} }
} }
@ -255,10 +255,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
inputField.text += text; inputField.text += text;
if (enableDebugLog) // if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 追加文本 - 追加长度: {text?.Length ?? 0}, 总长度: {inputField.text.Length}"); // Debug.Log($"ScrollableInputField: 追加文本 - 追加长度: {text?.Length ?? 0}, 总长度: {inputField.text.Length}");
} // }
} }
} }
@ -274,10 +274,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
inputField.characterLimit = limit > 0 ? limit : 0; inputField.characterLimit = limit > 0 ? limit : 0;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 设置字符限制: {limit}"); // Debug.Log($"ScrollableInputField: 设置字符限制: {limit}");
} //}
} }
} }
@ -289,10 +289,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
autoScrollToBottom = autoScroll; autoScrollToBottom = autoScroll;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 设置自动滚动: {autoScroll}"); // Debug.Log($"ScrollableInputField: 设置自动滚动: {autoScroll}");
} //}
} }
/// <summary> /// <summary>
@ -324,10 +324,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
inputField.interactable = interactable; inputField.interactable = interactable;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"ScrollableInputField: 设置可交互状态: {interactable}"); // Debug.Log($"ScrollableInputField: 设置可交互状态: {interactable}");
} //}
} }
} }

View File

@ -145,17 +145,17 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
horizontalScrollbar = scrollRect.horizontalScrollbar; horizontalScrollbar = scrollRect.horizontalScrollbar;
} }
if (enableDebugLog)
{
Debug.Log($"TMPInputFieldAutoSetup: 组件检测完成 - {gameObject.name}\n" +
$"InputField: {(inputField != null ? "" : "")}\n" +
$"TextComponent: {(textComponent != null ? "" : "")}\n" +
$"ScrollRect: {(scrollRect != null ? "" : "")}\n" +
$"ContentSizeFitter: {(contentSizeFitter != null ? "" : "")}\n" +
$"LayoutGroup: {(layoutGroup != null ? "" : "")}\n" +
$"垂直滚动条: {(verticalScrollbar != null ? "" : "")}\n" +
$"水平滚动条: {(horizontalScrollbar != null ? "" : "")}");
}
} }
/// <summary> /// <summary>
@ -208,10 +208,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
StartCoroutine(DelayedScrollbarUpdate()); StartCoroutine(DelayedScrollbarUpdate());
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: 设置已应用 - 溢出模式: {overflowMode}, 换行: {enableWordWrapping}, 自动调整: {enableAutoSizing}"); // Debug.Log($"TMPInputFieldAutoSetup: 设置已应用 - 溢出模式: {overflowMode}, 换行: {enableWordWrapping}, 自动调整: {enableAutoSizing}");
} //}
} }
/// <summary> /// <summary>
@ -221,10 +221,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
{ {
if (scrollRect == null || scrollRect.content == null) if (scrollRect == null || scrollRect.content == null)
{ {
if (enableDebugLog)
{
Debug.Log("TMPInputFieldAutoSetup: 未找到ScrollRect或Content跳过Content设置");
}
return; return;
} }
@ -243,10 +243,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
if (contentSizeFitter == null) if (contentSizeFitter == null)
{ {
contentSizeFitter = scrollRect.content.gameObject.AddComponent<ContentSizeFitter>(); contentSizeFitter = scrollRect.content.gameObject.AddComponent<ContentSizeFitter>();
if (enableDebugLog)
{
Debug.Log("TMPInputFieldAutoSetup: 已添加ContentSizeFitter组件");
}
} }
} }
@ -273,10 +273,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
} }
} }
if (enableDebugLog)
{
Debug.Log($"TMPInputFieldAutoSetup: ScrollRect Content设置完成 - Content高度: {contentRect.sizeDelta.y}, 滚动功能已启用");
}
} }
/// <summary> /// <summary>
@ -420,10 +420,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
{ {
contentRect.sizeDelta = new Vector2(contentRect.sizeDelta.x, preferredHeight + 20f); // 额外20像素边距 contentRect.sizeDelta = new Vector2(contentRect.sizeDelta.x, preferredHeight + 20f); // 额外20像素边距
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: Content高度已调整 - 文本高度: {preferredHeight}, Content高度: {contentRect.sizeDelta.y}"); // Debug.Log($"TMPInputFieldAutoSetup: Content高度已调整 - 文本高度: {preferredHeight}, Content高度: {contentRect.sizeDelta.y}");
} //}
} }
} }
} }
@ -457,10 +457,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
// 6. 调整所有相关组件的大小 // 6. 调整所有相关组件的大小
AdjustAllSizes(); AdjustAllSizes();
if (enableDebugLog)
{
Debug.Log("TMPInputFieldAutoSetup: 已强制显示完整文本");
}
} }
/// <summary> /// <summary>
@ -491,10 +491,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
textRect.sizeDelta = new Vector2(textRect.sizeDelta.x, 50f); textRect.sizeDelta = new Vector2(textRect.sizeDelta.x, 50f);
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: 文本RectTransform已设置 - 大小: {textRect.sizeDelta}"); // Debug.Log($"TMPInputFieldAutoSetup: 文本RectTransform已设置 - 大小: {textRect.sizeDelta}");
} //}
} }
/// <summary> /// <summary>
@ -513,10 +513,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
// 临时禁用Layout Group // 临时禁用Layout Group
layoutGroup.enabled = false; layoutGroup.enabled = false;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: 已临时禁用Layout Group: {layoutGroup.GetType().Name}"); // Debug.Log($"TMPInputFieldAutoSetup: 已临时禁用Layout Group: {layoutGroup.GetType().Name}");
} //}
} }
// 检测并处理Content Size Fitter的限制 // 检测并处理Content Size Fitter的限制
@ -661,10 +661,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
layoutGroup.enabled = true; layoutGroup.enabled = true;
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log("TMPInputFieldAutoSetup: ScrollRect滚动功能已恢复"); // Debug.Log("TMPInputFieldAutoSetup: ScrollRect滚动功能已恢复");
} //}
} }
/// <summary> /// <summary>
@ -682,15 +682,15 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
bool hasContent = scrollRect.content != null; bool hasContent = scrollRect.content != null;
bool contentHasSize = hasContent && scrollRect.content.sizeDelta.y > 0; bool contentHasSize = hasContent && scrollRect.content.sizeDelta.y > 0;
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: ScrollRect状态检查\n" + // Debug.Log($"TMPInputFieldAutoSetup: ScrollRect状态检查\n" +
$"可滚动: {isScrollable}\n" + // $"可滚动: {isScrollable}\n" +
$"有Content: {hasContent}\n" + // $"有Content: {hasContent}\n" +
$"Content有大小: {contentHasSize}\n" + // $"Content有大小: {contentHasSize}\n" +
$"水平滚动: {scrollRect.horizontal}\n" + // $"水平滚动: {scrollRect.horizontal}\n" +
$"垂直滚动: {scrollRect.vertical}"); // $"垂直滚动: {scrollRect.vertical}");
} //}
return isScrollable && hasContent && contentHasSize; return isScrollable && hasContent && contentHasSize;
} }
@ -732,15 +732,15 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
UpdateScrollbarVisibility(horizontalScrollbar, needsHorizontalScrollbar); UpdateScrollbarVisibility(horizontalScrollbar, needsHorizontalScrollbar);
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条更新\n" + // Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条更新\n" +
$"文本高度: {textHeight}\n" + // $"文本高度: {textHeight}\n" +
$"Viewport高度: {viewportHeight}\n" + // $"Viewport高度: {viewportHeight}\n" +
$"Content高度: {contentHeight}\n" + // $"Content高度: {contentHeight}\n" +
$"需要垂直滚动条: {needsVerticalScrollbar}\n" + // $"需要垂直滚动条: {needsVerticalScrollbar}\n" +
$"需要水平滚动条: {needsHorizontalScrollbar}"); // $"需要水平滚动条: {needsHorizontalScrollbar}");
} //}
} }
/// <summary> /// <summary>
@ -830,10 +830,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
} }
} }
if (enableDebugLog) //if (enableDebugLog)
{ //{
Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条功能已{(enable ? "" : "")}"); // Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条功能已{(enable ? "启用" : "禁用")}");
} //}
} }
#if UNITY_EDITOR #if UNITY_EDITOR