コード例 #1
0
ファイル: StepMaster.cs プロジェクト: paradisewu/HTFramework
        public override void Refresh()
        {
            base.Refresh();

            if (_running)
            {
                if (!_executing)
                {
                    if (_currentHelper != null)
                    {
                        _currentHelper.OnUpdate();
                    }

                    _execute = false;
                    switch (_currentContent.Trigger)
                    {
                    case StepTrigger.MouseClick:
                        if (Main.m_Input.GetButtonDown("MouseLeft"))
                        {
                            if (Main.m_Controller.RayTarget)
                            {
                                if (Main.m_Controller.RayTargetObj == _currentContent.Target)
                                {
                                    _execute = true;
                                }
                                else
                                {
                                    if (Main.m_Controller.RayTarget.IsStepTarget)
                                    {
                                        if (_currentHelper != null)
                                        {
                                            if (!_currentHelper.AuxiliaryTarget.Contains(Main.m_Controller.RayTargetObj))
                                            {
                                                ClickWrongTargetEvent?.Invoke(_currentContent);
                                            }
                                        }
                                        else
                                        {
                                            ClickWrongTargetEvent?.Invoke(_currentContent);
                                        }
                                    }
                                }
                            }
                        }
                        break;

                    case StepTrigger.ButtonClick:
                        if (Main.m_Input.GetButtonDown("MouseLeft"))
                        {
                            if (Main.m_Controller.RayTarget && Main.m_Controller.RayTargetObj != _currentContent.Target && Main.m_Controller.RayTarget.IsStepTarget)
                            {
                                if (_currentHelper != null)
                                {
                                    if (!_currentHelper.AuxiliaryTarget.Contains(Main.m_Controller.RayTargetObj))
                                    {
                                        ClickWrongTargetEvent?.Invoke(_currentContent);
                                    }
                                }
                                else
                                {
                                    ClickWrongTargetEvent?.Invoke(_currentContent);
                                }
                            }
                        }
                        if (_isButtonClick)
                        {
                            _execute = true;
                        }
                        break;

                    case StepTrigger.StateChange:
                        if (Main.m_Input.GetButtonDown("MouseLeft"))
                        {
                            if (Main.m_Controller.RayTarget && Main.m_Controller.RayTargetObj != _currentContent.Target && Main.m_Controller.RayTarget.IsStepTarget)
                            {
                                if (_currentHelper != null)
                                {
                                    if (!_currentHelper.AuxiliaryTarget.Contains(Main.m_Controller.RayTargetObj))
                                    {
                                        ClickWrongTargetEvent?.Invoke(_currentContent);
                                    }
                                }
                                else
                                {
                                    ClickWrongTargetEvent?.Invoke(_currentContent);
                                }
                            }
                        }
                        if (_currentTarget.State == StepTargetState.Done)
                        {
                            _execute = true;
                        }
                        break;

                    case StepTrigger.AutoExecute:
                        _execute = true;
                        break;

                    default:
                        break;
                    }

                    if (_execute)
                    {
                        ExecuteCurrentStep();

                        if (_currentContent.Instant)
                        {
                            ChangeNextStep();
                        }
                        else
                        {
                            Main.Current.DelayExecute(() =>
                            {
                                ChangeNextStep();
                            }, _currentContent.ElapseTime);
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal override void OnRefresh()
        {
            base.OnRefresh();

            if (_running)
            {
                if (_pause)
                {
                    return;
                }

                if (!_executing)
                {
                    if (_currentHelper != null && _currentHelper.IsEnableUpdate)
                    {
                        _currentHelper.OnUpdate();
                    }

                    _execute = false;
                    switch (_currentContent.Trigger)
                    {
                    case StepTrigger.MouseClick:
                        if (Main.m_Input.GetButtonDown(InputButtonType.MouseLeft))
                        {
                            if (Main.m_Controller.RayTarget)
                            {
                                if (Main.m_Controller.RayTargetObj == _currentContent.Target)
                                {
                                    _execute = true;
                                }
                                else
                                {
                                    if (Main.m_Controller.RayTarget.IsStepTarget)
                                    {
                                        if (_currentHelper != null)
                                        {
                                            if (!_currentHelper.AuxiliaryTarget.Contains(Main.m_Controller.RayTargetObj))
                                            {
                                                ClickWrongTargetEvent?.Invoke(_currentContent);
                                            }
                                        }
                                        else
                                        {
                                            ClickWrongTargetEvent?.Invoke(_currentContent);
                                        }
                                    }
                                }
                            }
                        }
                        break;

                    case StepTrigger.ButtonClick:
                        if (Main.m_Input.GetButtonDown(InputButtonType.MouseLeft))
                        {
                            if (Main.m_Controller.RayTarget && Main.m_Controller.RayTargetObj != _currentContent.Target && Main.m_Controller.RayTarget.IsStepTarget)
                            {
                                if (_currentHelper != null)
                                {
                                    if (!_currentHelper.AuxiliaryTarget.Contains(Main.m_Controller.RayTargetObj))
                                    {
                                        ClickWrongTargetEvent?.Invoke(_currentContent);
                                    }
                                }
                                else
                                {
                                    ClickWrongTargetEvent?.Invoke(_currentContent);
                                }
                            }
                        }
                        if (_isButtonClick)
                        {
                            _execute = true;
                        }
                        break;

                    case StepTrigger.StateChange:
                        if (Main.m_Input.GetButtonDown(InputButtonType.MouseLeft))
                        {
                            if (Main.m_Controller.RayTarget && Main.m_Controller.RayTargetObj != _currentContent.Target && Main.m_Controller.RayTarget.IsStepTarget)
                            {
                                if (_currentHelper != null)
                                {
                                    if (!_currentHelper.AuxiliaryTarget.Contains(Main.m_Controller.RayTargetObj))
                                    {
                                        ClickWrongTargetEvent?.Invoke(_currentContent);
                                    }
                                }
                                else
                                {
                                    ClickWrongTargetEvent?.Invoke(_currentContent);
                                }
                            }
                        }
                        if (_currentTarget.State == StepTargetState.Done)
                        {
                            _execute = true;
                        }
                        break;

                    case StepTrigger.AutoExecute:
                        _execute = true;
                        break;

                    default:
                        break;
                    }

                    if (_execute)
                    {
                        ExecuteCurrentStep();

                        if (_currentContent.Instant)
                        {
                            _waitCoroutine = Main.Current.StartCoroutine(WaitCoroutine(ChangeNextStep, 0));
                        }
                        else
                        {
                            _waitCoroutine = Main.Current.StartCoroutine(WaitCoroutine(ChangeNextStep, _currentContent.ElapseTime));
                        }
                    }
                }
            }
        }