/// <summary> /// 跳过当前步骤(立即模式) /// </summary> private void SkipCurrentStepImmediateCoroutine() { _executing = true; CurrentTask = StepHelperTask.SkipImmediate; //UGUI按钮点击型步骤,自动执行按钮事件 if (_currentContent.Trigger == StepTrigger.ButtonClick) { if (_currentButton) { _currentButton.onClick.Invoke(); _currentButton.onClick.RemoveListener(ButtonClickCallback); } else { _currentButton = _currentTarget.GetComponent <Button>(); if (_currentButton) { _currentButton.onClick.Invoke(); } else { Log.Error(string.Format("步骤控制器:【步骤:{0}】【{1}】的目标丢失Button组件!", _currentStepIndex + 1, _currentContent.Name)); } } _currentButton = null; } //创建步骤助手 if (_currentHelper == null) { _currentHelper = CreateHelper(_currentContent, StepHelperTask.SkipImmediate); } _currentContent.SkipImmediate(); SkipStepImmediateEvent?.Invoke(_currentContent, _stepContentEnables.ContainsKey(_currentContent.GUID) ? _stepContentEnables[_currentContent.GUID] : false); //助手执行跳过,等待生命周期结束后销毁助手 if (_currentHelper != null) { _currentHelper.Task = StepHelperTask.SkipImmediate; _currentHelper.OnSkipImmediate(); _currentHelper.OnTermination(); _currentHelper = null; } ChangeNextStep(); }
/// <summary> /// 跳过当前步骤(立即模式) /// </summary> private void SkipCurrentStepImmediateCoroutine() { _executing = true; SkipStepImmediateEvent?.Invoke(_currentContent, _stepContentEnables.ContainsKey(_currentContent.GUID) ? _stepContentEnables[_currentContent.GUID] : false); //UGUI按钮点击型步骤,自动执行按钮事件 if (_currentContent.Trigger == StepTrigger.ButtonClick) { if (_currentButton) { _currentButton.onClick.Invoke(); _currentButton.onClick.RemoveListener(ButtonClickCallback); } else { _currentButton = _currentTarget.GetComponent <Button>(); if (_currentButton) { _currentButton.onClick.Invoke(); } else { Log.Error(string.Format("步骤控制器:【步骤:{0}】【{1}】的目标丢失Button组件!", _currentStepIndex + 1, _currentContent.Name)); } } _currentButton = null; } //创建步骤助手 if (_currentHelper == null && _currentContent.Helper != "<None>") { Type type = ReflectionToolkit.GetTypeInRunTimeAssemblies(_currentContent.Helper); if (type != null) { _currentHelper = Activator.CreateInstance(type) as StepHelper; _currentHelper.Parameters = _currentContent.Parameters; for (int i = 0; i < _currentHelper.Parameters.Count; i++) { if (_currentHelper.Parameters[i].Type == StepParameter.ParameterType.GameObject) { if (_targets.ContainsKey(_currentHelper.Parameters[i].GameObjectGUID)) { _currentHelper.Parameters[i].GameObjectValue = _targets[_currentHelper.Parameters[i].GameObjectGUID].gameObject; } } } _currentHelper.Content = _currentContent; _currentHelper.Target = _currentTarget; _currentHelper.Task = StepHelperTask.SkipImmediate; _currentHelper.OnInit(); } else { Log.Error(string.Format("步骤控制器:【步骤:{0}】【{1}】的助手 {2} 丢失!", _currentStepIndex + 1, _currentContent.Name, _currentContent.Helper)); } } _currentContent.SkipImmediate(); //助手执行跳过,等待生命周期结束后销毁助手 if (_currentHelper != null) { _currentHelper.Task = StepHelperTask.SkipImmediate; _currentHelper.OnSkipImmediate(); _currentHelper.OnTermination(); _currentHelper = null; } ChangeNextStep(); }