コード例 #1
0
        /// <summary>
        /// This method can be called to redo the action.
        /// </summary>
        public void Redo()
        {
            EditorGizmoSystem gizmoSystem = EditorGizmoSystem.Instance;

            gizmoSystem.ActiveGizmoType = _newActiveGizmoType;
            ActiveGizmoTypeChangedMessage.SendToInterestedListeners(_oldActiveGizmoType, _newActiveGizmoType);
        }
コード例 #2
0
        /// <summary>
        /// This method can be called to undo the action.
        /// </summary>
        public void Undo()
        {
            EditorGizmoSystem gizmoSystem = EditorGizmoSystem.Instance;

            GizmoType oldActiveGizmoType = gizmoSystem.ActiveGizmoType;

            gizmoSystem.ActiveGizmoType = _activeGizmoType;
            ActiveGizmoTypeChangedMessage.SendToInterestedListeners(oldActiveGizmoType, _activeGizmoType);
        }
コード例 #3
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        public void Execute()
        {
            // If the gizmo types differ, execute the action
            EditorGizmoSystem gizmoSystem = EditorGizmoSystem.Instance;

            if (_oldActiveGizmoType != _newActiveGizmoType || gizmoSystem.AreGizmosTurnedOff)
            {
                gizmoSystem.ActiveGizmoType = _newActiveGizmoType;
                ActiveGizmoTypeChangedMessage.SendToInterestedListeners(_oldActiveGizmoType, _newActiveGizmoType);
                EditorUndoRedoSystem.Instance.RegisterAction(this);
            }
        }
コード例 #4
0
        /// <summary>
        /// Convenience function for sending an active gizmo type changed message to
        /// all interested listeners.
        /// </summary>
        /// <param name="oldActiveGizmoType">
        /// This is the old active gizmo type before it was changed.
        /// </param>
        /// <param name="newActiveGizmoType">
        /// This is the new active gizmo type.
        /// </param>
        public static void SendToInterestedListeners(GizmoType oldActiveGizmoType, GizmoType newActiveGizmoType)
        {
            var message = new ActiveGizmoTypeChangedMessage(oldActiveGizmoType, newActiveGizmoType);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }