예제 #1
0
        private void CheckLastActionAfter(TimeSpan newTimeSpan)
        {
            if (newTimeSpan < _lastTimestamp)
            {
                ResetCache();
            }

            int passedIndex = -1;

            if (_actions == null)
            {
                return;
            }

            for (int i = _lastIndex + 1; i < _actions.Count; i++)
            {
                if (GetTimestamp(i) > newTimeSpan)
                {
                    break;
                }

                if (GetTimestamp(i) <= newTimeSpan)
                {
                    passedIndex = i;
                }
            }

            if (passedIndex >= 0)
            {
                _lastIndex     = passedIndex;
                _lastTimestamp = GetTimestamp(passedIndex);

                ScriptActionEventArgs args = new ScriptActionEventArgs(_actions[passedIndex]);

                if (passedIndex + 1 < _actions.Count)
                {
                    args.RawNextAction = _actions[passedIndex + 1];
                }

                if (passedIndex > 0)
                {
                    args.RawPreviousAction = _actions[passedIndex - 1];
                }

                OnScriptActionRaised(args);
            }
        }
예제 #2
0
 protected virtual void OnScriptActionRaised(ScriptActionEventArgs e)
 {
     ScriptActionRaised?.Invoke(this, e);
 }