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 WaypointList waypointList = new WaypointList();
[SerializeField] private bool smoothRoute = true;
[SerializeField] public bool smoothRoute = true;
private int numPoints;
private Vector3[] points;
private float[] distances;

View File

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

View File

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