This commit is contained in:
王志勋 2025-11-04 19:51:25 +08:00
parent 141bd6df98
commit 7f0217d2d3
13 changed files with 309 additions and 307 deletions

View File

@ -112,14 +112,14 @@ namespace Coffee.UIEffects
/// </summary> /// </summary>
public void Stop(bool reset) public void Stop(bool reset)
{ {
if (reset) //if (reset)
{ //{
_time = 0; _time = 0;
if (_callback != null) if (_callback != null)
{ {
_callback(_time); _callback(_time);
} }
} // }
play = false; play = false;
} }

View File

@ -178,14 +178,14 @@ namespace RenderHeads.Media.AVProVideo
#endif #endif
public static void LogInfo(string message, Object context = null) public static void LogInfo(string message, Object context = null)
{ {
if (context == null) //if (context == null)
{ //{
Debug.Log("[AVProVideo] " + message); // Debug.Log("[AVProVideo] " + message);
} //}
else //else
{ //{
Debug.Log("[AVProVideo] " + message, context); // Debug.Log("[AVProVideo] " + message, context);
} //}
} }
public static int GetUnityAudioSampleRate() public static int GetUnityAudioSampleRate()

View File

@ -412,8 +412,8 @@ namespace Framework.Manager
if (uiObjects.TryGetValue(currentStep.uiObjectName, out GameObject uiObject)) if (uiObjects.TryGetValue(currentStep.uiObjectName, out GameObject uiObject))
{ {
// 如果启用了UI状态检测需要检查UI是否完全显示 // 如果启用了UI状态检测需要检查UI是否完全显示
if (enableUIStateCheck) //if (enableUIStateCheck)
{ //{
if (IsUIObjectFullyDisplayed(uiObject)) if (IsUIObjectFullyDisplayed(uiObject))
{ {
Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}"); Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}");
@ -428,14 +428,14 @@ namespace Framework.Manager
bool delayedResult = await DelayedFindUIObjectAsync(currentStep); bool delayedResult = await DelayedFindUIObjectAsync(currentStep);
return delayedResult; return delayedResult;
} }
} //}
else //else
{ //{
Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}"); // Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}");
GuideMask.Instance.CreateRectangleMask(uiObject); // GuideMask.Instance.CreateRectangleMask(uiObject);
// 如果UI对象是InputField自动聚焦到该输入框 // // 如果UI对象是InputField自动聚焦到该输入框
FocusInputFieldIfApplicable(uiObject); // FocusInputFieldIfApplicable(uiObject);
} //}
return true; return true;
} }
else else
@ -551,8 +551,8 @@ namespace Framework.Manager
if (foundObject != null) if (foundObject != null)
{ {
// 如果启用了UI状态检测需要等待UI完全显示 // 如果启用了UI状态检测需要等待UI完全显示
if (enableUIStateCheck) //if (enableUIStateCheck)
{ //{
if (IsUIObjectFullyDisplayed(foundObject)) if (IsUIObjectFullyDisplayed(foundObject))
{ {
Debug.Log($"延迟查找成功且UI完全显示第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}"); Debug.Log($"延迟查找成功且UI完全显示第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}");
@ -566,15 +566,15 @@ namespace Framework.Manager
Debug.Log($"第{attempts + 1}次尝试找到UI对象但未完全显示: {step.uiObjectName},继续等待..."); Debug.Log($"第{attempts + 1}次尝试找到UI对象但未完全显示: {step.uiObjectName},继续等待...");
foundObject = null; // 重置foundObject继续等待 foundObject = null; // 重置foundObject继续等待
} }
} //}
else //else
{ //{
Debug.Log($"延迟查找成功,第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}"); // Debug.Log($"延迟查找成功,第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}");
GuideMask.Instance.CreateRectangleMask(foundObject); // GuideMask.Instance.CreateRectangleMask(foundObject);
// 如果UI对象是InputField自动聚焦到该输入框 // // 如果UI对象是InputField自动聚焦到该输入框
FocusInputFieldIfApplicable(foundObject); // FocusInputFieldIfApplicable(foundObject);
return true; // 成功找到并显示UI对象 // return true; // 成功找到并显示UI对象
} //}
} }
// 等待一段时间再尝试 // 等待一段时间再尝试
@ -589,18 +589,18 @@ namespace Framework.Manager
Debug.LogWarning($"多次尝试({maxAttempts}次)后仍未找到UI对象: {step.uiObjectName}"); Debug.LogWarning($"多次尝试({maxAttempts}次)后仍未找到UI对象: {step.uiObjectName}");
// 判断是否自动跳过 // 判断是否自动跳过
bool autoSkipMissingUI = false; // 可以添加配置选项控制此行为 //bool autoSkipMissingUI = false; // 可以添加配置选项控制此行为
if (autoSkipMissingUI) //if (autoSkipMissingUI)
{ //{
Debug.Log($"自动跳过未找到的UI对象: {step.uiObjectName}"); // Debug.Log($"自动跳过未找到的UI对象: {step.uiObjectName}");
TriggerNextGuide(); // 跳过当前步骤,继续下一个 // TriggerNextGuide(); // 跳过当前步骤,继续下一个
return true; // 虽然UI对象未找到但已自动跳过视为成功 // return true; // 虽然UI对象未找到但已自动跳过视为成功
} //}
else //else
{ //{
Debug.Log($"等待UI对象: {step.uiObjectName} 注册后继续引导"); Debug.Log($"等待UI对象: {step.uiObjectName} 注册后继续引导");
return false; // 延迟查找失败 return false; // 延迟查找失败
} //}
} }
return false; // 默认返回失败 return false; // 默认返回失败

View File

@ -130,8 +130,8 @@ namespace MotionFramework.Utility
} }
else else
{ {
if(checkError) //if(checkError)
throw new Exception($"class {type} must inherit from {parentType}."); // throw new Exception($"class {type} must inherit from {parentType}.");
} }
} }
} }

View File

@ -102,7 +102,7 @@ namespace Cysharp.Threading.Tasks
{ {
if (ex != null) if (ex != null)
{ {
if (!PropagateOperationCanceledException && ex is OperationCanceledException) if (ex is OperationCanceledException)
{ {
return; return;
} }

View File

@ -47,10 +47,10 @@ public class AdaptiveButton : MonoBehaviour
// 查找文本组件 // 查找文本组件
FindTextComponent(); FindTextComponent();
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 组件初始化完成 - 对象: {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -67,10 +67,10 @@ public class AdaptiveButton : MonoBehaviour
return; return;
} }
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 找到文本组件 - 对象: {textComponent.gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -101,10 +101,10 @@ public class AdaptiveButton : MonoBehaviour
currentSize.x = targetWidth; currentSize.x = targetWidth;
buttonRectTransform.sizeDelta = currentSize; buttonRectTransform.sizeDelta = currentSize;
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 按钮宽度已调整 - 文本宽度: {textWidth:F1}, 目标宽度: {targetWidth:F1}, 对象: {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -125,10 +125,10 @@ public class AdaptiveButton : MonoBehaviour
// 调整按钮宽度 // 调整按钮宽度
AdjustButtonWidth(); AdjustButtonWidth();
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 文本已设置 - 内容: \"{text}\", 对象: {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -179,10 +179,10 @@ public class AdaptiveButton : MonoBehaviour
public void SetMinWidth(float width) public void SetMinWidth(float width)
{ {
minWidth = width; minWidth = width;
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 最小宽度已设置为: {width}, 对象: {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -192,10 +192,10 @@ public class AdaptiveButton : MonoBehaviour
public void SetMaxWidth(float width) public void SetMaxWidth(float width)
{ {
maxWidth = width; maxWidth = width;
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 最大宽度已设置为: {width}, 对象: {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -205,9 +205,9 @@ public class AdaptiveButton : MonoBehaviour
public void SetPadding(float paddingValue) public void SetPadding(float paddingValue)
{ {
padding = paddingValue; padding = paddingValue;
if (enableDebugLog)
{
Debug.Log($"[AdaptiveButton] 内边距已设置为: {paddingValue}, 对象: {gameObject.name}");
}
} }
} }

View File

@ -50,10 +50,10 @@ public class AutoHideScript : MonoBehaviour
if (canvasGroup == null) if (canvasGroup == null)
{ {
canvasGroup = gameObject.AddComponent<CanvasGroup>(); canvasGroup = gameObject.AddComponent<CanvasGroup>();
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 为物体 {gameObject.name} 添加了CanvasGroup组件");
}
} }
SetCanvasGroupAlpha(hideAlpha); SetCanvasGroupAlpha(hideAlpha);
@ -83,10 +83,10 @@ public class AutoHideScript : MonoBehaviour
/// </summary> /// </summary>
public void ShowObject(string title) public void ShowObject(string title)
{ {
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 显示物体 {gameObject.name}");
}
transform.Find("text").GetComponent<TMP_Text>().text = title; transform.Find("text").GetComponent<TMP_Text>().text = title;
// 显示物体使用CanvasGroup透明度 // 显示物体使用CanvasGroup透明度
SetCanvasGroupAlpha(showAlpha); SetCanvasGroupAlpha(showAlpha);
@ -94,10 +94,10 @@ public class AutoHideScript : MonoBehaviour
// 如果已经在等待隐藏,取消之前的等待任务 // 如果已经在等待隐藏,取消之前的等待任务
if (isWaitingToHide) if (isWaitingToHide)
{ {
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 取消之前的隐藏任务,重新开始计时");
}
CancelCurrentHideTask(); CancelCurrentHideTask();
} }
@ -110,10 +110,10 @@ public class AutoHideScript : MonoBehaviour
/// </summary> /// </summary>
public void HideObject() public void HideObject()
{ {
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 立即隐藏物体 {gameObject.name}");
}
// 取消当前的隐藏任务 // 取消当前的隐藏任务
CancelCurrentHideTask(); CancelCurrentHideTask();
@ -157,10 +157,10 @@ public class AutoHideScript : MonoBehaviour
{ {
try try
{ {
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 开始等待 {hideDelay} 秒后隐藏物体 {gameObject.name}");
}
// 等待指定时间 // 等待指定时间
await UniTask.Delay(TimeSpan.FromSeconds(hideDelay), cancellationToken: cancellationToken); await UniTask.Delay(TimeSpan.FromSeconds(hideDelay), cancellationToken: cancellationToken);
@ -168,20 +168,20 @@ public class AutoHideScript : MonoBehaviour
// 等待完成后隐藏物体 // 等待完成后隐藏物体
if (gameObject != null) if (gameObject != null)
{ {
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 等待完成,隐藏物体 {gameObject.name}");
}
SetCanvasGroupAlpha(hideAlpha); SetCanvasGroupAlpha(hideAlpha);
} }
} }
catch (OperationCanceledException) catch (OperationCanceledException)
{ {
// 任务被取消,这是正常情况 // 任务被取消,这是正常情况
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 隐藏任务被取消 {gameObject.name}");
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -202,10 +202,10 @@ public class AutoHideScript : MonoBehaviour
public void SetHideDelay(float delay) public void SetHideDelay(float delay)
{ {
hideDelay = Mathf.Max(0f, delay); hideDelay = Mathf.Max(0f, delay);
if (enableDebugLog)
{
Debug.Log($"AutoHideScript: 设置隐藏延迟时间为 {hideDelay} 秒");
}
} }
/// <summary> /// <summary>

View File

@ -38,10 +38,10 @@ public class DropdownValidator : MonoBehaviour
// 监听选择变化事件 // 监听选择变化事件
dropdown.onValueChanged.AddListener(OnDropdownValueChanged); dropdown.onValueChanged.AddListener(OnDropdownValueChanged);
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 初始化完成 - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -71,30 +71,30 @@ public class DropdownValidator : MonoBehaviour
// 检查是否有有效选择 // 检查是否有有效选择
if (selectedIndex < 0 || selectedIndex >= dropdown.options.Count) if (selectedIndex < 0 || selectedIndex >= dropdown.options.Count)
{ {
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 选择无效,不验证 - 下拉框: {gameObject.name}, 索引: {selectedIndex}");
}
return; return;
} }
// 获取选择的文本 // 获取选择的文本
string selectedText = dropdown.options[selectedIndex].text; string selectedText = dropdown.options[selectedIndex].text;
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 开始验证选择 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
}
// 使用新的严谨验证方法验证选择是否匹配当前动作的正确答案传递UI ID // 使用新的严谨验证方法验证选择是否匹配当前动作的正确答案传递UI ID
bool isSelectionCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(selectedText, gameObject.name); bool isSelectionCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(selectedText, gameObject.name);
if (isSelectionCorrect) if (isSelectionCorrect)
{ {
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 选择正确自动跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
}
if (enableAutoJump) if (enableAutoJump)
{ {
@ -104,10 +104,10 @@ public class DropdownValidator : MonoBehaviour
} }
else else
{ {
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 选择错误,不跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
}
} }
} }
@ -129,10 +129,10 @@ public class DropdownValidator : MonoBehaviour
public void SetAutoJumpEnabled(bool enabled) public void SetAutoJumpEnabled(bool enabled)
{ {
enableAutoJump = enabled; enableAutoJump = enabled;
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 自动跳转功能 {(enabled ? "" : "")} - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -142,10 +142,10 @@ public class DropdownValidator : MonoBehaviour
public void SetValidationDelay(float delay) public void SetValidationDelay(float delay)
{ {
validationDelay = Mathf.Max(0f, delay); validationDelay = Mathf.Max(0f, delay);
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -194,10 +194,10 @@ public class DropdownValidator : MonoBehaviour
dropdown.AddOptions(options); dropdown.AddOptions(options);
lastValidatedIndex = -1; lastValidatedIndex = -1;
if (enableDebugLog)
{
Debug.Log($"DropdownValidator: 设置选项完成 - 下拉框: {gameObject.name}, 选项数量: {options.Count}");
}
} }
} }
} }

View File

@ -39,10 +39,10 @@ public class NPUTFieldValidator : MonoBehaviour
// 监听输入变化事件 // 监听输入变化事件
inputField.onValueChanged.AddListener(OnInputValueChanged); inputField.onValueChanged.AddListener(OnInputValueChanged);
if (enableDebugLog)
{
// Debug.Log($"InputFieldValidator: 初始化完成 - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -69,18 +69,18 @@ public class NPUTFieldValidator : MonoBehaviour
{ {
lastValidatedValue = value; lastValidatedValue = value;
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 开始验证输入 - 输入框: {gameObject.name}, 值: '{value}'");
}
// 检查是否为空值 // 检查是否为空值
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
{ {
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 输入为空,不验证 - 输入框: {gameObject.name}");
}
return; return;
} }
@ -89,10 +89,10 @@ public class NPUTFieldValidator : MonoBehaviour
if (isInputCorrect) if (isInputCorrect)
{ {
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 输入正确自动跳转 - 输入框: {gameObject.name}, 值: '{value}'");
}
if (enableAutoJump) if (enableAutoJump)
{ {
@ -102,10 +102,10 @@ public class NPUTFieldValidator : MonoBehaviour
} }
else else
{ {
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 输入错误,不跳转 - 输入框: {gameObject.name}, 值: '{value}'");
}
} }
} }
@ -127,10 +127,10 @@ public class NPUTFieldValidator : MonoBehaviour
public void SetAutoJumpEnabled(bool enabled) public void SetAutoJumpEnabled(bool enabled)
{ {
enableAutoJump = enabled; enableAutoJump = enabled;
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 自动跳转功能 {(enabled ? "" : "")} - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -140,10 +140,10 @@ public class NPUTFieldValidator : MonoBehaviour
public void SetValidationDelay(float delay) public void SetValidationDelay(float delay)
{ {
validationDelay = Mathf.Max(0f, delay); validationDelay = Mathf.Max(0f, delay);
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
}
} }
/// <summary> /// <summary>

View File

@ -69,10 +69,10 @@ public class ScrollableInputField : MonoBehaviour
return; return;
} }
//if (enableDebugLog)
//{
// 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)
//{
// 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)
//{
// Debug.Log($"ScrollableInputField: 复制按钮设置完成");
//}
} }
} }
@ -134,10 +134,10 @@ public class ScrollableInputField : MonoBehaviour
ScrollToBottom(); ScrollToBottom();
} }
//if (enableDebugLog)
//{
// 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)
//{
// Debug.Log($"ScrollableInputField: 编辑结束 - 最终长度: {text.Length}");
//}
} }
/// <summary> /// <summary>
@ -197,10 +197,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
GUIUtility.systemCopyBuffer = textToCopy; GUIUtility.systemCopyBuffer = textToCopy;
//if (enableDebugLog)
//{
// 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)
//{
// Debug.Log($"ScrollableInputField: 设置文本 - 长度: {text?.Length ?? 0}");
//}
} }
} }
@ -255,10 +255,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
inputField.text += text; inputField.text += text;
// 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; inputField.characterLimit = limit > 0 ? limit : 0;
//if (enableDebugLog)
//{
// Debug.Log($"ScrollableInputField: 设置字符限制: {limit}");
//}
} }
} }
@ -289,10 +289,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
autoScrollToBottom = autoScroll; autoScrollToBottom = autoScroll;
//if (enableDebugLog)
//{
// Debug.Log($"ScrollableInputField: 设置自动滚动: {autoScroll}");
//}
} }
/// <summary> /// <summary>
@ -324,10 +324,10 @@ public class ScrollableInputField : MonoBehaviour
{ {
inputField.interactable = interactable; inputField.interactable = interactable;
//if (enableDebugLog)
//{
// Debug.Log($"ScrollableInputField: 设置可交互状态: {interactable}");
//}
} }
} }

View File

@ -38,10 +38,10 @@ public class TMPDropdownValidator : MonoBehaviour
// 监听选择变化事件 // 监听选择变化事件
dropdown.onValueChanged.AddListener(OnDropdownValueChanged); dropdown.onValueChanged.AddListener(OnDropdownValueChanged);
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 初始化完成 - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -71,30 +71,30 @@ public class TMPDropdownValidator : MonoBehaviour
// 检查是否有有效选择 // 检查是否有有效选择
if (selectedIndex < 0 || selectedIndex >= dropdown.options.Count) if (selectedIndex < 0 || selectedIndex >= dropdown.options.Count)
{ {
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 选择无效,不验证 - 下拉框: {gameObject.name}, 索引: {selectedIndex}");
}
return; return;
} }
// 获取选择的文本 // 获取选择的文本
string selectedText = dropdown.options[selectedIndex].text; string selectedText = dropdown.options[selectedIndex].text;
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 开始验证选择 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
}
// 使用新的严谨验证方法验证选择是否匹配当前动作的正确答案传递UI ID // 使用新的严谨验证方法验证选择是否匹配当前动作的正确答案传递UI ID
bool isSelectionCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(selectedText, gameObject.name); bool isSelectionCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(selectedText, gameObject.name);
if (isSelectionCorrect) if (isSelectionCorrect)
{ {
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 选择正确自动跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
}
if (enableAutoJump) if (enableAutoJump)
{ {
@ -104,10 +104,10 @@ public class TMPDropdownValidator : MonoBehaviour
} }
else else
{ {
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 选择错误,不跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
}
} }
} }
@ -129,10 +129,10 @@ public class TMPDropdownValidator : MonoBehaviour
public void SetAutoJumpEnabled(bool enabled) public void SetAutoJumpEnabled(bool enabled)
{ {
enableAutoJump = enabled; enableAutoJump = enabled;
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 自动跳转功能 {(enabled ? "" : "")} - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -142,10 +142,10 @@ public class TMPDropdownValidator : MonoBehaviour
public void SetValidationDelay(float delay) public void SetValidationDelay(float delay)
{ {
validationDelay = Mathf.Max(0f, delay); validationDelay = Mathf.Max(0f, delay);
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -194,10 +194,10 @@ public class TMPDropdownValidator : MonoBehaviour
dropdown.AddOptions(options); dropdown.AddOptions(options);
lastValidatedIndex = -1; lastValidatedIndex = -1;
if (enableDebugLog)
{
Debug.Log($"TMPDropdownValidator: 设置选项完成 - 下拉框: {gameObject.name}, 选项数量: {options.Count}");
}
} }
} }
} }

View File

@ -208,10 +208,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
StartCoroutine(DelayedScrollbarUpdate()); StartCoroutine(DelayedScrollbarUpdate());
} }
//if (enableDebugLog)
//{
// Debug.Log($"TMPInputFieldAutoSetup: 设置已应用 - 溢出模式: {overflowMode}, 换行: {enableWordWrapping}, 自动调整: {enableAutoSizing}");
//}
} }
/// <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)
//{
// Debug.Log($"TMPInputFieldAutoSetup: Content高度已调整 - 文本高度: {preferredHeight}, Content高度: {contentRect.sizeDelta.y}");
//}
} }
} }
} }
@ -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)
//{
// 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)
//{
// 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)
//{
// 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)
//{
// Debug.Log($"TMPInputFieldAutoSetup: ScrollRect状态检查\n" +
// $"可滚动: {isScrollable}\n" +
// $"有Content: {hasContent}\n" +
// $"Content有大小: {contentHasSize}\n" +
// $"水平滚动: {scrollRect.horizontal}\n" +
// $"垂直滚动: {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)
//{
// Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条更新\n" +
// $"文本高度: {textHeight}\n" +
// $"Viewport高度: {viewportHeight}\n" +
// $"Content高度: {contentHeight}\n" +
// $"需要垂直滚动条: {needsVerticalScrollbar}\n" +
// $"需要水平滚动条: {needsHorizontalScrollbar}");
//}
} }
/// <summary> /// <summary>
@ -830,10 +830,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
} }
} }
//if (enableDebugLog)
//{
// Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条功能已{(enable ? "启用" : "禁用")}");
//}
} }
#if UNITY_EDITOR #if UNITY_EDITOR

View File

@ -38,10 +38,10 @@ public class TMPInputFieldValidator : MonoBehaviour
// 监听输入变化事件 // 监听输入变化事件
inputField.onValueChanged.AddListener(OnInputValueChanged); inputField.onValueChanged.AddListener(OnInputValueChanged);
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 初始化完成 - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -68,20 +68,20 @@ public class TMPInputFieldValidator : MonoBehaviour
{ {
lastValidatedValue = value; lastValidatedValue = value;
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 开始验证输入 - 输入框: {gameObject.name}, 值: {value}");
}
// 使用新的严谨验证方法验证输入是否匹配当前动作的正确答案传递UI ID // 使用新的严谨验证方法验证输入是否匹配当前动作的正确答案传递UI ID
bool isInputCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(value, gameObject.name); bool isInputCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(value, gameObject.name);
if (isInputCorrect) if (isInputCorrect)
{ {
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 输入正确自动跳转 - 输入框: {gameObject.name}, 值: {value}");
}
if (enableAutoJump) if (enableAutoJump)
{ {
@ -91,10 +91,11 @@ public class TMPInputFieldValidator : MonoBehaviour
} }
else else
{ {
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 输入错误,不跳转 - 输入框: {gameObject.name}, 值: {value}");
}
} }
} }
@ -116,10 +117,11 @@ public class TMPInputFieldValidator : MonoBehaviour
public void SetAutoJumpEnabled(bool enabled) public void SetAutoJumpEnabled(bool enabled)
{ {
enableAutoJump = enabled; enableAutoJump = enabled;
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 自动跳转功能 {(enabled ? "" : "")} - {gameObject.name}");
}
} }
/// <summary> /// <summary>
@ -129,10 +131,10 @@ public class TMPInputFieldValidator : MonoBehaviour
public void SetValidationDelay(float delay) public void SetValidationDelay(float delay)
{ {
validationDelay = Mathf.Max(0f, delay); validationDelay = Mathf.Max(0f, delay);
if (enableDebugLog)
{
Debug.Log($"InputFieldValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
}
} }
/// <summary> /// <summary>