2.002
This commit is contained in:
parent
141bd6df98
commit
7f0217d2d3
|
|
@ -112,14 +112,14 @@ namespace Coffee.UIEffects
|
|||
/// </summary>
|
||||
public void Stop(bool reset)
|
||||
{
|
||||
if (reset)
|
||||
{
|
||||
//if (reset)
|
||||
//{
|
||||
_time = 0;
|
||||
if (_callback != null)
|
||||
{
|
||||
_callback(_time);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
play = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,14 +178,14 @@ namespace RenderHeads.Media.AVProVideo
|
|||
#endif
|
||||
public static void LogInfo(string message, Object context = null)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
Debug.Log("[AVProVideo] " + message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[AVProVideo] " + message, context);
|
||||
}
|
||||
//if (context == null)
|
||||
//{
|
||||
// Debug.Log("[AVProVideo] " + message);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Debug.Log("[AVProVideo] " + message, context);
|
||||
//}
|
||||
}
|
||||
|
||||
public static int GetUnityAudioSampleRate()
|
||||
|
|
|
|||
|
|
@ -412,8 +412,8 @@ namespace Framework.Manager
|
|||
if (uiObjects.TryGetValue(currentStep.uiObjectName, out GameObject uiObject))
|
||||
{
|
||||
// 如果启用了UI状态检测,需要检查UI是否完全显示
|
||||
if (enableUIStateCheck)
|
||||
{
|
||||
//if (enableUIStateCheck)
|
||||
//{
|
||||
if (IsUIObjectFullyDisplayed(uiObject))
|
||||
{
|
||||
Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}");
|
||||
|
|
@ -428,14 +428,14 @@ namespace Framework.Manager
|
|||
bool delayedResult = await DelayedFindUIObjectAsync(currentStep);
|
||||
return delayedResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}");
|
||||
GuideMask.Instance.CreateRectangleMask(uiObject);
|
||||
// 如果UI对象是InputField,自动聚焦到该输入框
|
||||
FocusInputFieldIfApplicable(uiObject);
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}");
|
||||
// GuideMask.Instance.CreateRectangleMask(uiObject);
|
||||
// // 如果UI对象是InputField,自动聚焦到该输入框
|
||||
// FocusInputFieldIfApplicable(uiObject);
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
@ -551,8 +551,8 @@ namespace Framework.Manager
|
|||
if (foundObject != null)
|
||||
{
|
||||
// 如果启用了UI状态检测,需要等待UI完全显示
|
||||
if (enableUIStateCheck)
|
||||
{
|
||||
//if (enableUIStateCheck)
|
||||
//{
|
||||
if (IsUIObjectFullyDisplayed(foundObject))
|
||||
{
|
||||
Debug.Log($"延迟查找成功且UI完全显示,第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}");
|
||||
|
|
@ -566,15 +566,15 @@ namespace Framework.Manager
|
|||
Debug.Log($"第{attempts + 1}次尝试找到UI对象但未完全显示: {step.uiObjectName},继续等待...");
|
||||
foundObject = null; // 重置foundObject,继续等待
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"延迟查找成功,第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}");
|
||||
GuideMask.Instance.CreateRectangleMask(foundObject);
|
||||
// 如果UI对象是InputField,自动聚焦到该输入框
|
||||
FocusInputFieldIfApplicable(foundObject);
|
||||
return true; // 成功找到并显示UI对象
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Debug.Log($"延迟查找成功,第{attempts + 1}次尝试找到UI对象: {step.uiObjectName}");
|
||||
// GuideMask.Instance.CreateRectangleMask(foundObject);
|
||||
// // 如果UI对象是InputField,自动聚焦到该输入框
|
||||
// FocusInputFieldIfApplicable(foundObject);
|
||||
// return true; // 成功找到并显示UI对象
|
||||
//}
|
||||
}
|
||||
|
||||
// 等待一段时间再尝试
|
||||
|
|
@ -589,18 +589,18 @@ namespace Framework.Manager
|
|||
Debug.LogWarning($"多次尝试({maxAttempts}次)后仍未找到UI对象: {step.uiObjectName}");
|
||||
|
||||
// 判断是否自动跳过
|
||||
bool autoSkipMissingUI = false; // 可以添加配置选项控制此行为
|
||||
if (autoSkipMissingUI)
|
||||
{
|
||||
Debug.Log($"自动跳过未找到的UI对象: {step.uiObjectName}");
|
||||
TriggerNextGuide(); // 跳过当前步骤,继续下一个
|
||||
return true; // 虽然UI对象未找到,但已自动跳过,视为成功
|
||||
}
|
||||
else
|
||||
{
|
||||
//bool autoSkipMissingUI = false; // 可以添加配置选项控制此行为
|
||||
//if (autoSkipMissingUI)
|
||||
//{
|
||||
// Debug.Log($"自动跳过未找到的UI对象: {step.uiObjectName}");
|
||||
// TriggerNextGuide(); // 跳过当前步骤,继续下一个
|
||||
// return true; // 虽然UI对象未找到,但已自动跳过,视为成功
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
Debug.Log($"等待UI对象: {step.uiObjectName} 注册后继续引导");
|
||||
return false; // 延迟查找失败
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
return false; // 默认返回失败
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ namespace MotionFramework.Utility
|
|||
}
|
||||
else
|
||||
{
|
||||
if(checkError)
|
||||
throw new Exception($"class {type} must inherit from {parentType}.");
|
||||
//if(checkError)
|
||||
// throw new Exception($"class {type} must inherit from {parentType}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ namespace Cysharp.Threading.Tasks
|
|||
{
|
||||
if (ex != null)
|
||||
{
|
||||
if (!PropagateOperationCanceledException && ex is OperationCanceledException)
|
||||
if (ex is OperationCanceledException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ public class AdaptiveButton : MonoBehaviour
|
|||
// 查找文本组件
|
||||
FindTextComponent();
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 组件初始化完成 - 对象: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -67,10 +67,10 @@ public class AdaptiveButton : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 找到文本组件 - 对象: {textComponent.gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -101,10 +101,10 @@ public class AdaptiveButton : MonoBehaviour
|
|||
currentSize.x = targetWidth;
|
||||
buttonRectTransform.sizeDelta = currentSize;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 按钮宽度已调整 - 文本宽度: {textWidth:F1}, 目标宽度: {targetWidth:F1}, 对象: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -125,10 +125,10 @@ public class AdaptiveButton : MonoBehaviour
|
|||
// 调整按钮宽度
|
||||
AdjustButtonWidth();
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 文本已设置 - 内容: \"{text}\", 对象: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -179,10 +179,10 @@ public class AdaptiveButton : MonoBehaviour
|
|||
public void SetMinWidth(float width)
|
||||
{
|
||||
minWidth = width;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 最小宽度已设置为: {width}, 对象: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -192,10 +192,10 @@ public class AdaptiveButton : MonoBehaviour
|
|||
public void SetMaxWidth(float width)
|
||||
{
|
||||
maxWidth = width;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 最大宽度已设置为: {width}, 对象: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -205,9 +205,9 @@ public class AdaptiveButton : MonoBehaviour
|
|||
public void SetPadding(float paddingValue)
|
||||
{
|
||||
padding = paddingValue;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"[AdaptiveButton] 内边距已设置为: {paddingValue}, 对象: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ public class AutoHideScript : MonoBehaviour
|
|||
if (canvasGroup == null)
|
||||
{
|
||||
canvasGroup = gameObject.AddComponent<CanvasGroup>();
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 为物体 {gameObject.name} 添加了CanvasGroup组件");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SetCanvasGroupAlpha(hideAlpha);
|
||||
|
|
@ -83,10 +83,10 @@ public class AutoHideScript : MonoBehaviour
|
|||
/// </summary>
|
||||
public void ShowObject(string title)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 显示物体 {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
transform.Find("text").GetComponent<TMP_Text>().text = title;
|
||||
// 显示物体(使用CanvasGroup透明度)
|
||||
SetCanvasGroupAlpha(showAlpha);
|
||||
|
|
@ -94,10 +94,10 @@ public class AutoHideScript : MonoBehaviour
|
|||
// 如果已经在等待隐藏,取消之前的等待任务
|
||||
if (isWaitingToHide)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 取消之前的隐藏任务,重新开始计时");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CancelCurrentHideTask();
|
||||
}
|
||||
|
||||
|
|
@ -110,10 +110,10 @@ public class AutoHideScript : MonoBehaviour
|
|||
/// </summary>
|
||||
public void HideObject()
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 立即隐藏物体 {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 取消当前的隐藏任务
|
||||
CancelCurrentHideTask();
|
||||
|
|
@ -157,10 +157,10 @@ public class AutoHideScript : MonoBehaviour
|
|||
{
|
||||
try
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 开始等待 {hideDelay} 秒后隐藏物体 {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 等待指定时间
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(hideDelay), cancellationToken: cancellationToken);
|
||||
|
|
@ -168,20 +168,20 @@ public class AutoHideScript : MonoBehaviour
|
|||
// 等待完成后隐藏物体
|
||||
if (gameObject != null)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 等待完成,隐藏物体 {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SetCanvasGroupAlpha(hideAlpha);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// 任务被取消,这是正常情况
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 隐藏任务被取消 {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -202,10 +202,10 @@ public class AutoHideScript : MonoBehaviour
|
|||
public void SetHideDelay(float delay)
|
||||
{
|
||||
hideDelay = Mathf.Max(0f, delay);
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"AutoHideScript: 设置隐藏延迟时间为 {hideDelay} 秒");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ public class DropdownValidator : MonoBehaviour
|
|||
// 监听选择变化事件
|
||||
dropdown.onValueChanged.AddListener(OnDropdownValueChanged);
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 初始化完成 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -71,30 +71,30 @@ public class DropdownValidator : MonoBehaviour
|
|||
// 检查是否有有效选择
|
||||
if (selectedIndex < 0 || selectedIndex >= dropdown.options.Count)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 选择无效,不验证 - 下拉框: {gameObject.name}, 索引: {selectedIndex}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取选择的文本
|
||||
string selectedText = dropdown.options[selectedIndex].text;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 开始验证选择 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 使用新的严谨验证方法:验证选择是否匹配当前动作的正确答案,传递UI ID
|
||||
bool isSelectionCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(selectedText, gameObject.name);
|
||||
|
||||
if (isSelectionCorrect)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 选择正确自动跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (enableAutoJump)
|
||||
{
|
||||
|
|
@ -104,10 +104,10 @@ public class DropdownValidator : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 选择错误,不跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,10 +129,10 @@ public class DropdownValidator : MonoBehaviour
|
|||
public void SetAutoJumpEnabled(bool enabled)
|
||||
{
|
||||
enableAutoJump = enabled;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 自动跳转功能 {(enabled ? "启用" : "禁用")} - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -142,10 +142,10 @@ public class DropdownValidator : MonoBehaviour
|
|||
public void SetValidationDelay(float delay)
|
||||
{
|
||||
validationDelay = Mathf.Max(0f, delay);
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -194,10 +194,10 @@ public class DropdownValidator : MonoBehaviour
|
|||
dropdown.AddOptions(options);
|
||||
lastValidatedIndex = -1;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"DropdownValidator: 设置选项完成 - 下拉框: {gameObject.name}, 选项数量: {options.Count}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ public class NPUTFieldValidator : MonoBehaviour
|
|||
// 监听输入变化事件
|
||||
inputField.onValueChanged.AddListener(OnInputValueChanged);
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
// Debug.Log($"InputFieldValidator: 初始化完成 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,18 +69,18 @@ public class NPUTFieldValidator : MonoBehaviour
|
|||
{
|
||||
lastValidatedValue = value;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 开始验证输入 - 输入框: {gameObject.name}, 值: '{value}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 检查是否为空值
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 输入为空,不验证 - 输入框: {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -89,10 +89,10 @@ public class NPUTFieldValidator : MonoBehaviour
|
|||
|
||||
if (isInputCorrect)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 输入正确自动跳转 - 输入框: {gameObject.name}, 值: '{value}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (enableAutoJump)
|
||||
{
|
||||
|
|
@ -102,10 +102,10 @@ public class NPUTFieldValidator : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 输入错误,不跳转 - 输入框: {gameObject.name}, 值: '{value}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,10 +127,10 @@ public class NPUTFieldValidator : MonoBehaviour
|
|||
public void SetAutoJumpEnabled(bool enabled)
|
||||
{
|
||||
enableAutoJump = enabled;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 自动跳转功能 {(enabled ? "启用" : "禁用")} - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -140,10 +140,10 @@ public class NPUTFieldValidator : MonoBehaviour
|
|||
public void SetValidationDelay(float delay)
|
||||
{
|
||||
validationDelay = Mathf.Max(0f, delay);
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ public class ScrollableInputField : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
|
||||
//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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -112,10 +112,10 @@ public class ScrollableInputField : MonoBehaviour
|
|||
{
|
||||
copyButton.onClick.AddListener(CopyTextToClipboard);
|
||||
|
||||
//if (enableDebugLog)
|
||||
//{
|
||||
// Debug.Log($"ScrollableInputField: 复制按钮设置完成");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -134,10 +134,10 @@ public class ScrollableInputField : MonoBehaviour
|
|||
ScrollToBottom();
|
||||
}
|
||||
|
||||
//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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -197,10 +197,10 @@ public class ScrollableInputField : MonoBehaviour
|
|||
{
|
||||
GUIUtility.systemCopyBuffer = textToCopy;
|
||||
|
||||
//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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,10 +255,10 @@ public class ScrollableInputField : MonoBehaviour
|
|||
{
|
||||
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;
|
||||
|
||||
//if (enableDebugLog)
|
||||
//{
|
||||
// Debug.Log($"ScrollableInputField: 设置字符限制: {limit}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -289,10 +289,10 @@ public class ScrollableInputField : MonoBehaviour
|
|||
{
|
||||
autoScrollToBottom = 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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ public class TMPDropdownValidator : MonoBehaviour
|
|||
// 监听选择变化事件
|
||||
dropdown.onValueChanged.AddListener(OnDropdownValueChanged);
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 初始化完成 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -71,30 +71,30 @@ public class TMPDropdownValidator : MonoBehaviour
|
|||
// 检查是否有有效选择
|
||||
if (selectedIndex < 0 || selectedIndex >= dropdown.options.Count)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 选择无效,不验证 - 下拉框: {gameObject.name}, 索引: {selectedIndex}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取选择的文本
|
||||
string selectedText = dropdown.options[selectedIndex].text;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 开始验证选择 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 使用新的严谨验证方法:验证选择是否匹配当前动作的正确答案,传递UI ID
|
||||
bool isSelectionCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(selectedText, gameObject.name);
|
||||
|
||||
if (isSelectionCorrect)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 选择正确自动跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (enableAutoJump)
|
||||
{
|
||||
|
|
@ -104,10 +104,10 @@ public class TMPDropdownValidator : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 选择错误,不跳转 - 下拉框: {gameObject.name}, 索引: {selectedIndex}, 文本: '{selectedText}'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,10 +129,10 @@ public class TMPDropdownValidator : MonoBehaviour
|
|||
public void SetAutoJumpEnabled(bool enabled)
|
||||
{
|
||||
enableAutoJump = enabled;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 自动跳转功能 {(enabled ? "启用" : "禁用")} - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -142,10 +142,10 @@ public class TMPDropdownValidator : MonoBehaviour
|
|||
public void SetValidationDelay(float delay)
|
||||
{
|
||||
validationDelay = Mathf.Max(0f, delay);
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -194,10 +194,10 @@ public class TMPDropdownValidator : MonoBehaviour
|
|||
dropdown.AddOptions(options);
|
||||
lastValidatedIndex = -1;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"TMPDropdownValidator: 设置选项完成 - 下拉框: {gameObject.name}, 选项数量: {options.Count}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,10 +208,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
|
|||
StartCoroutine(DelayedScrollbarUpdate());
|
||||
}
|
||||
|
||||
//if (enableDebugLog)
|
||||
//{
|
||||
// Debug.Log($"TMPInputFieldAutoSetup: 设置已应用 - 溢出模式: {overflowMode}, 换行: {enableWordWrapping}, 自动调整: {enableAutoSizing}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -491,10 +491,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
|
|||
textRect.sizeDelta = new Vector2(textRect.sizeDelta.x, 50f);
|
||||
}
|
||||
|
||||
//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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 检测并处理Content Size Fitter的限制
|
||||
|
|
@ -661,10 +661,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
|
|||
layoutGroup.enabled = true;
|
||||
}
|
||||
|
||||
//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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -830,10 +830,10 @@ public class TMPInputFieldAutoSetup : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
//if (enableDebugLog)
|
||||
//{
|
||||
// Debug.Log($"TMPInputFieldAutoSetup: 自适应滚动条功能已{(enable ? "启用" : "禁用")}");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ public class TMPInputFieldValidator : MonoBehaviour
|
|||
// 监听输入变化事件
|
||||
inputField.onValueChanged.AddListener(OnInputValueChanged);
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 初始化完成 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -68,20 +68,20 @@ public class TMPInputFieldValidator : MonoBehaviour
|
|||
{
|
||||
lastValidatedValue = value;
|
||||
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 开始验证输入 - 输入框: {gameObject.name}, 值: {value}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 使用新的严谨验证方法:验证输入是否匹配当前动作的正确答案,传递UI ID
|
||||
bool isInputCorrect = MotionFramework.MotionEngine.GetModule<ProcessManager>().ValidateInputAgainstCurrentAction(value, gameObject.name);
|
||||
|
||||
if (isInputCorrect)
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 输入正确自动跳转 - 输入框: {gameObject.name}, 值: {value}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (enableAutoJump)
|
||||
{
|
||||
|
|
@ -91,10 +91,11 @@ public class TMPInputFieldValidator : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 输入错误,不跳转 - 输入框: {gameObject.name}, 值: {value}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -116,10 +117,11 @@ public class TMPInputFieldValidator : MonoBehaviour
|
|||
public void SetAutoJumpEnabled(bool enabled)
|
||||
{
|
||||
enableAutoJump = enabled;
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 自动跳转功能 {(enabled ? "启用" : "禁用")} - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -129,10 +131,10 @@ public class TMPInputFieldValidator : MonoBehaviour
|
|||
public void SetValidationDelay(float delay)
|
||||
{
|
||||
validationDelay = Mathf.Max(0f, delay);
|
||||
if (enableDebugLog)
|
||||
{
|
||||
Debug.Log($"InputFieldValidator: 验证延迟设置为 {validationDelay} 秒 - {gameObject.name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue