This commit is contained in:
lujiajian 2025-11-05 09:17:21 +08:00
parent 08ecf8d7dc
commit 3edd635583
3 changed files with 462 additions and 372 deletions

View File

@ -24,11 +24,6 @@ namespace Framework.Manager
[SerializeField]
private TutorialGuideConfig guideConfig;
[Space(5)]
[Tooltip("是否启用引导跳转功能")]
[SerializeField]
private bool enableSmartGuideJump = true;
[Space(10)]
[Header("状态信息")]
[SerializeField, ReadOnly]
@ -38,11 +33,6 @@ namespace Framework.Manager
// [SerializeField, ReadOnly] private bool isGuideDisabled = false;
[Space(5)]
[Tooltip("是否启用UI显示状态检测")]
[SerializeField]
private bool enableUIStateCheck = true;
// 运行时存储UI对象的字典
private Dictionary<string, GameObject> uiObjects = new Dictionary<string, GameObject>();
@ -52,15 +42,9 @@ namespace Framework.Manager
// ProcessManager引用用于获取当前流程步骤信息
// private ProcessManager processManager;
// 记录已匹配引导的步骤名称,避免同一步骤内重复匹配
private string lastMatchedStepName = string.Empty;
// 记录被隐藏但需要重新显示的步骤名称
private HashSet<string> hiddenStepsToRedisplay = new HashSet<string>();
// 记录当前步骤名称下已执行的引导数量,用于支持同一步骤下的多个引导按顺序执行
private Dictionary<string, int> stepExecutionCount = new Dictionary<string, int>();
// 安全帽点击特殊处理状态
private bool hasHelmetClicked = false; // 是否已点击安全帽
private string helmetClickedObjectName = string.Empty; // 点击的安全帽对象名称
@ -474,6 +458,107 @@ namespace Framework.Manager
}
}
/// <summary>
/// 验证UI名称匹配
/// </summary>
/// <returns>如果应该继续引导返回true如果应该停止返回false如果不需要验证返回null</returns>
private bool? ValidateUINameMatch(string uiName)
{
if (string.IsNullOrEmpty(uiName))
{
if (uiName == "")
{
Debug.Log("TutorialGuideManager: 传入空字符串,自动跳到下一步引导");
}
else
{
Debug.Log("TutorialGuideManager: 未传入uiName参数使用原有引导逻辑");
}
return null;
}
var currentStep = GetCurrentStep();
if (currentStep == null)
{
Debug.LogWarning("TutorialGuideManager: 无法获取当前引导步骤,跳过参数匹配检查");
return false;
}
// 处理特殊UI名称
if (uiName == "下一步")
{
return null; // 继续执行
}
if (IsSpecialUIName(uiName))
{
return HandleSpecialUIName(uiName, currentStep);
}
// 普通UI名称匹配
if (uiName != currentStep.uiObjectName)
{
Debug.Log($"TutorialGuideManager: 参数匹配失败 - 传入的uiName: '{uiName}' 与当前步骤的uiObjectName: '{currentStep.uiObjectName}' 不匹配,停止引导");
return false;
}
Debug.Log($"TutorialGuideManager: 参数匹配成功 - 传入的uiName: '{uiName}' 与当前步骤的uiObjectName: '{currentStep.uiObjectName}' 匹配,继续引导");
return null; // 继续执行
}
/// <summary>
/// 检查是否为特殊UI名称
/// </summary>
private bool IsSpecialUIName(string uiName)
{
return uiName == "大厅位置" || uiName == "地磅位置" || uiName == "电脑房" || uiName == "关闭" || uiName == "对话";
}
/// <summary>
/// 处理特殊UI名称
/// </summary>
private bool HandleSpecialUIName(string uiName, GuideStepConfig currentStep)
{
if (uiName != currentStep.uiObjectName)
{
return false;
}
if (uiName != "对话")
{
currentIndex++;
}
HideGuide();
return true;
}
/// <summary>
/// 执行引导步骤
/// </summary>
private async UniTask<bool> ExecuteGuideStep(GuideStepConfig currentStep)
{
if (uiObjects.TryGetValue(currentStep.uiObjectName, out GameObject uiObject))
{
if (IsUIObjectFullyDisplayed(uiObject))
{
Debug.Log($"执行引导步骤: {currentStep.stepName} 查询的对象:{uiObject.name}");
GuideMask.Instance.CreateRectangleMask(uiObject);
FocusInputFieldIfApplicable(uiObject);
return true;
}
else
{
Debug.Log($"UI对象 {uiObject.name} 存在但未完全显示,使用延迟查找");
return await DelayedFindUIObjectAsync(currentStep);
}
}
else
{
return await DelayedFindUIObjectAsync(currentStep);
}
}
//触发上一个引导步骤
public async UniTask<bool> TriggerPrevGuide()
{
@ -722,9 +807,7 @@ namespace Framework.Manager
{
isGuiding = false;
currentIndex = -1;
lastMatchedStepName = string.Empty; // 清除已匹配步骤记录
hiddenStepsToRedisplay.Clear(); // 清除待重新显示步骤记录
stepExecutionCount.Clear(); // 清除步骤执行计数记录
// 重置安全帽点击状态
hasHelmetClicked = false;
@ -882,18 +965,19 @@ namespace Framework.Manager
/// 触发当前UI对象的事件
/// 自动检测UI组件类型并触发相应的事件
/// </summary>
/// <returns>是否成功触发了事件</returns>
public void TriggerCurrentUIEvent()
{
var currentStep = GetCurrentStep();
if (currentStep == null)
{
Debug.LogWarning("TutorialGuideManager: 无法获取当前引导步骤无法触发UI事件");
return;
}
if (!uiObjects.TryGetValue(currentStep.uiObjectName, out GameObject uiObject))
{
Debug.LogWarning($"TutorialGuideManager: 当前UI对象 {currentStep.uiObjectName} 未注册,无法触发事件");
return;
}
Debug.Log($"TutorialGuideManager: 开始触发UI对象 {currentStep.uiObjectName} 的事件");
@ -1453,7 +1537,6 @@ namespace Framework.Manager
var orderedSteps = guideConfig.GetOrderedSteps();
int count = 0;
string lastNonEmptyStepName = string.Empty;
bool foundTargetStep = false;
// 遍历所有步骤,计算指定步骤名称下的引导数量
@ -1469,18 +1552,12 @@ namespace Framework.Manager
{
foundTargetStep = true;
count++;
lastNonEmptyStepName = step.stepName;
}
// 如果已经找到目标步骤,但遇到了新的步骤名称,停止计数
else if (foundTargetStep)
{
break;
}
// 更新lastNonEmptyStepName
else
{
lastNonEmptyStepName = step.stepName;
}
}
// 如果当前步骤的stepName为空
else
@ -1497,7 +1574,6 @@ namespace Framework.Manager
if (count == 0)
{
foundTargetStep = false;
lastNonEmptyStepName = string.Empty;
for (int i = 0; i < orderedSteps.Count; i++)
{
@ -1509,16 +1585,11 @@ namespace Framework.Manager
{
foundTargetStep = true;
count++;
lastNonEmptyStepName = step.stepName;
}
else if (foundTargetStep)
{
break;
}
else
{
lastNonEmptyStepName = step.stepName;
}
}
else if (foundTargetStep)
{
@ -1553,106 +1624,17 @@ namespace Framework.Manager
}
var orderedSteps = guideConfig.GetOrderedSteps();
// 收集所有匹配的引导步骤索引
List<int> matchedIndices = new List<int>();
string lastNonEmptyStepName = string.Empty;
bool foundTargetStep = false;
// 精确匹配(包括顺序延续逻辑)
for (int i = 0; i < orderedSteps.Count; i++)
{
var step = orderedSteps[i];
// 如果当前步骤的stepName不为空
if (!string.IsNullOrEmpty(step.stepName))
{
// 如果找到了目标步骤,开始收集
if (step.stepName == stepName)
{
foundTargetStep = true;
matchedIndices.Add(i);
lastNonEmptyStepName = step.stepName;
Debug.Log($"TutorialGuideManager: 精确匹配找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}'");
}
// 如果已经找到目标步骤,但遇到了新的步骤名称,停止收集
else if (foundTargetStep)
{
break;
}
// 更新lastNonEmptyStepName
else
{
lastNonEmptyStepName = step.stepName;
}
}
// 如果当前步骤的stepName为空
else
{
// 如果已经找到目标步骤,继续收集(顺序延续)
if (foundTargetStep)
{
matchedIndices.Add(i);
Debug.Log($"TutorialGuideManager: 顺序延续找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}', lastNonEmptyStepName='{lastNonEmptyStepName}'");
}
}
}
List<int> matchedIndices = FindExactMatchIndices(orderedSteps, stepName);
// 如果精确匹配没有结果,尝试包含匹配
if (matchedIndices.Count == 0)
{
foundTargetStep = false;
lastNonEmptyStepName = string.Empty;
for (int i = 0; i < orderedSteps.Count; i++)
{
var step = orderedSteps[i];
if (!string.IsNullOrEmpty(step.stepName))
{
if (step.stepName.Contains(stepName))
{
foundTargetStep = true;
matchedIndices.Add(i);
lastNonEmptyStepName = step.stepName;
Debug.Log($"TutorialGuideManager: 包含匹配找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}'");
}
else if (foundTargetStep)
{
break;
}
else
{
lastNonEmptyStepName = step.stepName;
}
}
else if (foundTargetStep)
{
matchedIndices.Add(i);
Debug.Log($"TutorialGuideManager: 包含匹配顺序延续找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}', lastNonEmptyStepName='{lastNonEmptyStepName}'");
}
}
matchedIndices = FindContainsMatchIndices(orderedSteps, stepName);
}
Debug.Log($"TutorialGuideManager: 步骤名称 '{stepName}' 总共找到 {matchedIndices.Count} 个匹配的引导步骤");
// 根据执行索引返回对应的引导步骤
if (executionIndex >= 0 && executionIndex < matchedIndices.Count)
{
int guideIndex = matchedIndices[executionIndex];
Debug.Log($"TutorialGuideManager: 找到匹配的引导步骤: {stepName} -> 执行索引: {executionIndex}, 引导索引: {guideIndex}, UI对象: {orderedSteps[guideIndex].uiObjectName}");
return guideIndex;
}
else if (matchedIndices.Count > 0)
{
// 如果执行索引超出范围,说明该步骤的所有引导都已执行完毕
// 返回-1让系统按顺序继续执行下一个引导而不是返回第一个匹配的
Debug.Log($"TutorialGuideManager: 执行索引超出范围,步骤 '{stepName}' 的所有引导步骤已执行完毕,将按顺序继续");
return -1;
}
Debug.Log($"TutorialGuideManager: 未找到匹配的引导步骤: {stepName}");
return -1;
return SelectGuideIndexByExecutionIndex(matchedIndices, orderedSteps, stepName, executionIndex);
}
catch (System.Exception ex)
{
@ -1661,6 +1643,109 @@ namespace Framework.Manager
}
}
/// <summary>
/// 查找精确匹配的引导步骤索引(包括顺序延续逻辑)
/// </summary>
private List<int> FindExactMatchIndices(List<GuideStepConfig> orderedSteps, string stepName)
{
List<int> matchedIndices = new List<int>();
bool foundTargetStep = false;
string lastNonEmptyStepName = string.Empty;
for (int i = 0; i < orderedSteps.Count; i++)
{
var step = orderedSteps[i];
if (!string.IsNullOrEmpty(step.stepName))
{
if (step.stepName == stepName)
{
foundTargetStep = true;
matchedIndices.Add(i);
lastNonEmptyStepName = step.stepName;
Debug.Log($"TutorialGuideManager: 精确匹配找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}'");
}
else if (foundTargetStep)
{
break;
}
else
{
lastNonEmptyStepName = step.stepName;
}
}
else if (foundTargetStep)
{
matchedIndices.Add(i);
Debug.Log($"TutorialGuideManager: 顺序延续找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}', lastNonEmptyStepName='{lastNonEmptyStepName}'");
}
}
return matchedIndices;
}
/// <summary>
/// 查找包含匹配的引导步骤索引(包括顺序延续逻辑)
/// </summary>
private List<int> FindContainsMatchIndices(List<GuideStepConfig> orderedSteps, string stepName)
{
List<int> matchedIndices = new List<int>();
bool foundTargetStep = false;
string lastNonEmptyStepName = string.Empty;
for (int i = 0; i < orderedSteps.Count; i++)
{
var step = orderedSteps[i];
if (!string.IsNullOrEmpty(step.stepName))
{
if (step.stepName.Contains(stepName))
{
foundTargetStep = true;
matchedIndices.Add(i);
lastNonEmptyStepName = step.stepName;
Debug.Log($"TutorialGuideManager: 包含匹配找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}'");
}
else if (foundTargetStep)
{
break;
}
else
{
lastNonEmptyStepName = step.stepName;
}
}
else if (foundTargetStep)
{
matchedIndices.Add(i);
Debug.Log($"TutorialGuideManager: 包含匹配顺序延续找到引导步骤: 索引={i}, stepName='{step.stepName}', uiObjectName='{step.uiObjectName}', lastNonEmptyStepName='{lastNonEmptyStepName}'");
}
}
return matchedIndices;
}
/// <summary>
/// 根据执行索引选择引导步骤索引
/// </summary>
private int SelectGuideIndexByExecutionIndex(List<int> matchedIndices, List<GuideStepConfig> orderedSteps, string stepName, int executionIndex)
{
if (executionIndex >= 0 && executionIndex < matchedIndices.Count)
{
int guideIndex = matchedIndices[executionIndex];
Debug.Log($"TutorialGuideManager: 找到匹配的引导步骤: {stepName} -> 执行索引: {executionIndex}, 引导索引: {guideIndex}, UI对象: {orderedSteps[guideIndex].uiObjectName}");
return guideIndex;
}
else if (matchedIndices.Count > 0)
{
Debug.Log($"TutorialGuideManager: 执行索引超出范围,步骤 '{stepName}' 的所有引导步骤已执行完毕,将按顺序继续");
return -1;
}
Debug.Log($"TutorialGuideManager: 未找到匹配的引导步骤: {stepName}");
return -1;
}
#endregion
}
}

View File

@ -6,262 +6,265 @@ using UnityEngine;
namespace MotionFramework
{
public static class MotionEngine
{
private class ModuleWrapper
{
public int Priority { private set; get; }
public IModule Module { private set; get; }
public static class MotionEngine
{
private class ModuleWrapper
{
public int Priority { private set; get; }
public IModule Module { private set; get; }
public ModuleWrapper(IModule module, int priority)
{
Module = module;
Priority = priority;
}
}
public ModuleWrapper(IModule module, int priority)
{
Module = module;
Priority = priority;
}
}
private static readonly List<ModuleWrapper> _coms = new List<ModuleWrapper>(100);
private static MonoBehaviour _behaviour;
private static bool _isDirty = false;
private static long _frame = 0;
private static readonly List<ModuleWrapper> _coms = new List<ModuleWrapper>(100);
private static MonoBehaviour _behaviour;
private static bool _isDirty = false;
private static long _frame = 0;
/// <summary>
/// 初始化框架
/// </summary>
public static void Initialize(MonoBehaviour behaviour, Action<ELogLevel, string> logCallback)
{
if (behaviour == null)
throw new Exception("MotionFramework behaviour is null.");
if (_behaviour != null)
throw new Exception($"{nameof(MotionEngine)} is already initialized.");
/// <summary>
/// 初始化框架
/// </summary>
public static void Initialize(MonoBehaviour behaviour, Action<ELogLevel, string> logCallback)
{
if (behaviour == null)
throw new ArgumentNullException(nameof(behaviour), "MotionFramework behaviour cannot be null");
if (_behaviour != null)
throw new InvalidOperationException($"{nameof(MotionEngine)} is already initialized");
UnityEngine.Object.DontDestroyOnLoad(behaviour.gameObject);
_behaviour = behaviour;
UnityEngine.Object.DontDestroyOnLoad(behaviour.gameObject);
_behaviour = behaviour;
// 注册日志回调
if (logCallback != null)
MotionLog.RegisterCallback(logCallback);
// 注册日志回调
if (logCallback != null)
MotionLog.RegisterCallback(logCallback);
behaviour.StartCoroutine(CheckFrame());
}
behaviour.StartCoroutine(CheckFrame());
}
/// <summary>
/// 检测MotionEngine更新方法
/// </summary>
private static IEnumerator CheckFrame()
{
var wait = new WaitForSeconds(1f);
yield return wait;
/// <summary>
/// 检测MotionEngine更新方法
/// </summary>
private static IEnumerator CheckFrame()
{
var wait = new WaitForSeconds(1f);
yield return wait;
// 说明初始化之后如果忘记更新MotionEngine这里会抛出异常
if (_frame == 0)
throw new Exception($"Please call update method : MotionEngine.Update");
}
// 说明初始化之后如果忘记更新MotionEngine这里会记录警告而不是抛出异常
// 避免在协程中抛出未处理的异常导致程序崩溃
if (_frame == 0)
{
MotionLog.Warning("MotionEngine.Update() has not been called. Please ensure Update() is called every frame.");
}
}
/// <summary>
/// 更新框架
/// </summary>
public static void Update()
{
_frame++;
/// <summary>
/// 更新框架
/// </summary>
public static void Update()
{
_frame++;
// 如果有新模块需要重新排序
if (_isDirty)
{
_isDirty = false;
_coms.Sort((left, right) =>
{
if (left.Priority > right.Priority)
return -1;
else if (left.Priority == right.Priority)
return 0;
else
return 1;
});
}
// 如果有新模块需要重新排序
if (_isDirty)
{
_isDirty = false;
_coms.Sort((left, right) =>
{
if (left.Priority > right.Priority)
return -1;
else if (left.Priority == right.Priority)
return 0;
else
return 1;
});
}
// 轮询所有模块
for (int i = 0; i < _coms.Count; i++)
{
_coms[i].Module.OnUpdate();
}
}
// 轮询所有模块
for (int i = 0; i < _coms.Count; i++)
{
_coms[i].Module.OnUpdate();
}
}
/// <summary>
/// 绘制所有模块的GUI内容
/// </summary>
internal static void DrawModulesGUIContent()
{
for (int i = 0; i < _coms.Count; i++)
{
_coms[i].Module.OnGUI();
}
}
/// <summary>
/// 绘制所有模块的GUI内容
/// </summary>
internal static void DrawModulesGUIContent()
{
for (int i = 0; i < _coms.Count; i++)
{
_coms[i].Module.OnGUI();
}
}
/// <summary>
/// 查询游戏模块是否存在
/// </summary>
public static bool Contains<T>() where T : class, IModule
{
System.Type type = typeof(T);
return Contains(type);
}
/// <summary>
/// 查询游戏模块是否存在
/// </summary>
public static bool Contains<T>() where T : class, IModule
{
System.Type type = typeof(T);
return Contains(type);
}
/// <summary>
/// 查询游戏模块是否存在
/// </summary>
public static bool Contains(System.Type moduleType)
{
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Module.GetType() == moduleType)
return true;
}
return false;
}
/// <summary>
/// 查询游戏模块是否存在
/// </summary>
public static bool Contains(System.Type moduleType)
{
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Module.GetType() == moduleType)
return true;
}
return false;
}
/// <summary>
/// 创建游戏模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
/// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param>
public static T CreateModule<T>(int priority = 0) where T : class, IModule
{
return CreateModule<T>(null, priority);
}
/// <summary>
/// 创建游戏模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
/// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param>
public static T CreateModule<T>(int priority = 0) where T : class, IModule
{
return CreateModule<T>(null, priority);
}
/// <summary>
/// 创建游戏模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
/// <param name="createParam">创建参数</param>
/// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param>
public static T CreateModule<T>(System.Object createParam, int priority = 0) where T : class, IModule
{
if (priority < 0)
throw new Exception("The priority can not be negative");
/// <summary>
/// 创建游戏模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
/// <param name="createParam">创建参数</param>
/// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param>
public static T CreateModule<T>(System.Object createParam, int priority = 0) where T : class, IModule
{
if (priority < 0)
throw new ArgumentOutOfRangeException(nameof(priority), priority, "Priority cannot be negative");
if (Contains(typeof(T)))
throw new Exception($"Game module {typeof(T)} is already existed");
if (Contains(typeof(T)))
throw new InvalidOperationException($"Game module {typeof(T)} already exists");
int minPriority = GetMinPriority();
priority = --minPriority;
// 如果没有设置优先级
if (priority == 0)
{
int minPriority = GetMinPriority();
priority = --minPriority;
}
MotionLog.Log($"Create game module : {typeof(T)}");
T module = Activator.CreateInstance<T>();
ModuleWrapper wrapper = new ModuleWrapper(module, priority);
wrapper.Module.OnCreate(createParam);
_coms.Add(wrapper);
_isDirty = true;
return module;
}
MotionLog.Log($"Create game module : {typeof(T)}");
T module = Activator.CreateInstance<T>();
ModuleWrapper wrapper = new ModuleWrapper(module, priority);
wrapper.Module.OnCreate(createParam);
_coms.Add(wrapper);
_isDirty = true;
return module;
}
/// <summary>
/// 销毁模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
public static bool DestroyModule<T>()
{
var moduleType = typeof(T);
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Module.GetType() == moduleType)
{
_coms[i].Module.OnDestroy();
_coms.RemoveAt(i);
return true;
}
}
return false;
}
/// <summary>
/// 销毁模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
public static bool DestroyModule<T>()
{
var moduleType = typeof(T);
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Module.GetType() == moduleType)
{
_coms[i].Module.OnDestroy();
_coms.RemoveAt(i);
return true;
}
}
return false;
}
/// <summary>
/// 获取游戏模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
public static T GetModule<T>() where T : class, IModule
{
System.Type type = typeof(T);
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Module.GetType() == type)
return _coms[i].Module as T;
}
/// <summary>
/// 获取游戏模块
/// </summary>
/// <typeparam name="T">模块类</typeparam>
public static T GetModule<T>() where T : class, IModule
{
System.Type type = typeof(T);
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Module.GetType() == type)
return _coms[i].Module as T;
}
MotionLog.Warning($"Not found game module {type}");
return null;
}
MotionLog.Warning($"Not found game module {type}");
return null;
}
/// <summary>
/// 获取当前模块里最小的优先级
/// </summary>
private static int GetMinPriority()
{
int minPriority = 0;
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Priority < minPriority)
minPriority = _coms[i].Priority;
}
return minPriority; //小于等于零
}
/// <summary>
/// 获取当前模块里最小的优先级
/// </summary>
private static int GetMinPriority()
{
int minPriority = 0;
for (int i = 0; i < _coms.Count; i++)
{
if (_coms[i].Priority < minPriority)
minPriority = _coms[i].Priority;
}
return minPriority; //小于等于零
}
#region
/// <summary>
/// 开启一个协程
/// </summary>
public static Coroutine StartCoroutine(IEnumerator coroutine)
{
if (_behaviour == null)
throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
return _behaviour.StartCoroutine(coroutine);
}
#region
/// <summary>
/// 开启一个协程
/// </summary>
public static Coroutine StartCoroutine(IEnumerator coroutine)
{
if (_behaviour == null)
throw new InvalidOperationException($"{nameof(MotionEngine)} is not initialized. Use MotionEngine.Initialize");
return _behaviour.StartCoroutine(coroutine);
}
/// <summary>
/// 停止一个协程
/// </summary>
public static void StopCoroutine(Coroutine coroutine)
{
if (_behaviour == null)
throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
_behaviour.StopCoroutine(coroutine);
}
/// <summary>
/// 停止一个协程
/// </summary>
public static void StopCoroutine(Coroutine coroutine)
{
if (_behaviour == null)
throw new InvalidOperationException($"{nameof(MotionEngine)} is not initialized. Use MotionEngine.Initialize");
_behaviour.StopCoroutine(coroutine);
}
/// <summary>
/// 开启一个协程
/// </summary>
public static void StartCoroutine(string methodName)
{
if (_behaviour == null)
throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
_behaviour.StartCoroutine(methodName);
}
/// <summary>
/// 开启一个协程
/// </summary>
public static void StartCoroutine(string methodName)
{
if (_behaviour == null)
throw new InvalidOperationException($"{nameof(MotionEngine)} is not initialized. Use MotionEngine.Initialize");
_behaviour.StartCoroutine(methodName);
}
/// <summary>
/// 停止一个协程
/// </summary>
public static void StopCoroutine(string methodName)
{
if (_behaviour == null)
throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
_behaviour.StopCoroutine(methodName);
}
/// <summary>
/// 停止一个协程
/// </summary>
public static void StopCoroutine(string methodName)
{
if (_behaviour == null)
throw new InvalidOperationException($"{nameof(MotionEngine)} is not initialized. Use MotionEngine.Initialize");
_behaviour.StopCoroutine(methodName);
}
/// <summary>
/// 停止所有协程
/// </summary>
public static void StopAllCoroutines()
{
if (_behaviour == null)
throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
_behaviour.StopAllCoroutines();
}
#endregion
}
/// <summary>
/// 停止所有协程
/// </summary>
public static void StopAllCoroutines()
{
if (_behaviour == null)
throw new InvalidOperationException($"{nameof(MotionEngine)} is not initialized. Use MotionEngine.Initialize");
_behaviour.StopAllCoroutines();
}
#endregion
}
}

View File

@ -244,73 +244,73 @@ public class DocumentManagement : MonoBehaviour
Debug.Log($"题目包含调拨入库,显示调拨入库相关单据");
return documentGoListDBRK;
}
if (examName.Contains("到货验收"))
{
Debug.Log($"题目包含到货验收,显示采购物资入库单据");
return purchaseDocumentCollections;
}
if (examName.Contains("代保管物资出库"))
{
Debug.Log($"题目包含代保管出库,显示代保管出库");
return documentGoListTC;
}
if (examName.Contains("退出退役资产代保管入库作业") ||
examName.Contains("代保管物资入库") ||
if (examName.Contains("退出退役资产代保管入库作业") ||
examName.Contains("代保管物资入库") ||
examName.Contains("退出退役代保管入库"))
{
Debug.Log($"题目包含代保管入库,显示退出退役资产代保管入库作业");
return documentGoListTCYUDBGRK;
}
if (examName.Contains("跨省调拨物资"))
{
Debug.Log($"题目包含跨省调拨物资,显示退出退役资产物资代保管出库作业");
return documentGoListKSDBWZ;
}
if (examName.Contains("借用物资出库"))
{
return documentGoListXSKBSJYWZ;
}
if (examName.Contains("库存物资报废"))
{
return documentGoListKCWZBF;
}
if (examName.Contains("领用出库"))
{
return documentGoListWZLYCK;
}
if (examName.Contains("退料物资入库"))
{
return documentGoListTLWZRK;
}
if (examName.Contains("电缆分支箱跨地市物资调配"))
{
return GetDocumentCollectionForCableBranchBox(examName);
}
if (examName.Contains("重点物资排产计划制定"))
{
return documentGoListDLZDWZPCJH;
}
if (examName.Contains("废旧物资入库") || examName.Contains("不可用办理实物退库"))
{
return documentGoListDLFJWZRK;
}
if (examName.Contains("借用物资系统归还系统操作") || examName.Contains("借用物资入库"))
{
return documentGoListJYWZRK;
}
return null;
}
@ -321,7 +321,7 @@ public class DocumentManagement : MonoBehaviour
{
inventoryReversalVoucherAnalyzer = (Framework.Dto.InventoryReversalVoucherAnalyzer)MotionEngine.GetModule<GlobalDataStorage>().materialTaskObj;
var doc = documentGoListDLFZXKSWZDP.ToList();
if (inventoryReversalVoucherAnalyzer.formselection == "需求数量缺失")
{
doc.RemoveAt(1);
@ -330,7 +330,7 @@ public class DocumentManagement : MonoBehaviour
{
doc.RemoveAt(0);
}
return doc.ToArray();
}
@ -370,10 +370,12 @@ public class DocumentManagement : MonoBehaviour
{
return;
}
for (int i = 0; i < documentCollections.Length; i++)
if (documentCollections != null)
{
GenerateDocument(documentCollections[i].name);
for (int i = 0; i < documentCollections.Length; i++)
{
GenerateDocument(documentCollections[i].name);
}
}
////保存按钮