Пример #1
0
 /// <summary>
 /// Enables the editing of the pressed timedEffect / saves it when pressed again
 /// </summary>
 /// <param name="effectorEvent">The pressed timedEvent</param>
 public void onTimedEffectorEventButtonPressed(TimedEffectorEvent effectorEvent)
 {
     exitEditing();
     if (_currentEffectorEvent != effectorEvent)
     {
         _currentEffectorEvent = effectorEvent;
         TimedEffectorEventPopupUIController.Instance.showTimedEffectorEvent(effectorEvent);
         if (effectorEvent.IsActive)
         {
             effectorEvent.IsActive = false;
             Timeline.Instance.effectorTimeChanged();
         }
         EventTimelineUIController.Instance.setTimePickerMode(newTime => {
             if (_timePickerBlocked)
             {
                 return;
             }
             effectorEvent.ExecutionTime = newTime;
             onEffectorEventTimeChanged?.Invoke(newTime);
             _checkEventManager.checkEvent("ChangedEventTime");
             _checkEventManager.checkEvent($"ChangedEventTimeTo{newTime:N1}");
         }, effectorEvent);
         ReplayManager.Instance.disableActive();
         ReplayTimeManager.Instance.setCurrentTime(effectorEvent.ExecutionTime);
         ReplayUIController.Instance.setActiveChangeButtonState(false);
         EventlineUIController.Instance.highlightEvent(effectorEvent);
         _checkEventManager.checkEvent("EditOpened");
     }
     else
     {
         _currentEffectorEvent = null;
         EventlineUIController.Instance.disHighlightAll();
     }
 }
Пример #2
0
 public void setup(TimedEffectorEvent effectorEvent)
 {
     openEffectorEventPopup.image.sprite = effectorEvent.getIcon();
     openEffectorEventPopup.onClick.AddListener(() => {
         TimedEffectorEventEditManager.Instance.onTimedEffectorEventButtonPressed(effectorEvent);
     });
 }
Пример #3
0
 public void highlightEvent(TimedEffectorEvent effectorEvent)
 {
     disHighlightAll();
     if (!_eventUIControllers.TryGetValue(effectorEvent, out var controller))
     {
         throw new Exception($"Could not find a UIController for {effectorEvent}");
     }
     controller.setHighlight(true);
 }
 /// <summary>
 /// Displays the meta data of a timedEvent
 /// </summary>
 /// <param name="effectorEvent"></param>
 public void showTimedEffectorEvent(TimedEffectorEvent effectorEvent)
 {
     _canvas.enabled        = true;
     effectorEventTime.text = $"{effectorEvent.ExecutionTime:N2}";
     removeButton.onClick.RemoveAllListeners();
     removeButton.onClick.AddListener(() => {
         TimedEffectorEventEditManager.Instance.removeTimedEffectorEvent(effectorEvent);
         _canvas.enabled = false;
     });
     reSimulateButton.onClick.AddListener(() => {
         SimulationManager.Instance.calculateSimulation(true);
         _checkEventManager.checkEvent("ResimulatePressed");
     });
 }
Пример #5
0
        /// <summary>
        /// Activates the timePickerMode
        /// </summary>
        /// <param name="callback">The to call callback</param>
        /// <param name="effectorEvent">The to change effector</param>
        public void setTimePickerMode(OnNewPickedTime callback, TimedEffectorEvent effectorEvent)
        {
            _activeEdit      = true;
            _newTimeCallback = callback;

            if (!_eventPointers.TryGetValue(effectorEvent, out _activePointer))
            {
                throw new Exception("Could not find a listed EffectorEvent!");
            }

            _activePointer.GetComponent <Image>().sprite = activeEventPointer;

            setPointerPosition(effectorEvent.ExecutionTime, _activePointer);
        }
Пример #6
0
 public void removeTimedEffectorEvent(TimedEffectorEvent effectorEvent)
 {
     Timeline.Instance.removeEffectorEvent(effectorEvent);
     onTimedEffectorEventButtonPressed(effectorEvent);
 }
Пример #7
0
 public void removeEffectorEvent(TimedEffectorEvent effectorEvent)
 {
     _effectors.Remove(effectorEvent);
     _effectors.Sort((x, y) => Math.Sign(x.ExecutionTime - y.ExecutionTime));
     onEffectorEventChanged?.Invoke(_effectors);
 }