コード例 #1
0
ファイル: AnimationManager.cs プロジェクト: glwu/acat
        /// <summary>
        /// Disposes resources
        /// </summary>
        /// <param name="disposing">disposed yet?</param>
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!_disposed)
            {
                Log.Debug();

                if (disposing)
                {
                    unsubscribeToMouseClickEvents(_currentPanel);

                    // dispose all managed resources.
                    if (_player != null)
                    {
                        _player.Dispose();
                        _player = null;
                    }

                    if (_soundPlayer != null)
                    {
                        _soundPlayer.Dispose();
                    }

                    if (_animationsCollection != null)
                    {
                        _animationsCollection.Dispose();
                    }

                    unsubscribeFromActuatorEvents();
                }

                // Release unmanaged resources.
            }

            _disposed = true;
        }
コード例 #2
0
ファイル: AnimationManager.cs プロジェクト: glwu/acat
        /// <summary>
        /// Starts the animation sequence for the specified panel. It starts
        /// with the animation that has the 'start' attribute set to true in
        /// the xml file
        /// </summary>
        /// <param name="panelWidget">Which panel to start the animations for?</param>
        /// <param name="animationName">Name of the animation sequence</param>
        public void Start(Widget panelWidget, String animationName = null)
        {
            Log.Debug("Start animation for panel " + panelWidget.Name);

            if (_player != null)
            {
                _player.EvtPlayerStateChanged -= _player_EvtPlayerStateChanged;
                _player.Dispose();
            }

            resetSwitchEventStates();

            _currentPanel = panelWidget;

            subscribeToMouseClickEvents(panelWidget);

            _player = new AnimationPlayer(panelWidget, _interpreter, _variables);
            _player.EvtPlayerStateChanged += _player_EvtPlayerStateChanged;
            _variables.Set(Variables.SelectedWidget, panelWidget);
            _variables.Set(Variables.CurrentPanel, panelWidget);

            // get all the animations for the specified animation name.
            var animations = getAnimations(animationName);

            if (animations == null)
            {
                Log.Error("Could not find animations entry for panel " + panelWidget.Name);
                return;
            }

            // transition to the one that is marked as "first"
            var firstAnimation = animations.GetFirst();
            if (firstAnimation == null)
            {
                return;
            }

            foreach (var animation in animations.Values)
            {
                animation.EvtResolveWidgetChildren += animation_EvtResolveWidgetChildren;
            }

            _firstAnimation = firstAnimation;

            Transition(firstAnimation);
        }
コード例 #3
0
ファイル: AnimationManager.cs プロジェクト: andyleung521/acat
        /// <summary>
        /// Disposes resources
        /// </summary>
        /// <param name="disposing">disposed yet?</param>
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!_disposed)
            {
                Log.Debug();

                if (disposing)
                {
                    unsubscribeToMouseClickEvents(_currentScreen);

                    // dispose all managed resources.
                    if (_player != null)
                    {
                        _player.Dispose();
                        _player = null;
                    }

                    if (_soundPlayer != null)
                    {
                        _soundPlayer.Dispose();
                    }

                    if (_animationsCollection != null)
                    {
                        _animationsCollection.Dispose();
                    }

                    ActuatorManager.Instance.EvtSwitchActivated -= actuatorManager_EvtSwitchActivated;
                }

                // Release unmanaged resources.
            }

            _disposed = true;
        }
コード例 #4
0
ファイル: AnimationManager.cs プロジェクト: glwu/acat
 /// <summary>
 /// Initializes the AnimationManager class
 /// </summary>
 public AnimationManager()
 {
     _interpreter = new Interpret();
     _animationsCollection = new AnimationsCollection();
     _soundPlayer = null;
     _currentPanel = null;
     _player = null;
     IsSwitchActive = false;
     _variables = new Variables();
     resetSwitchEventStates();
 }
コード例 #5
0
ファイル: AnimationManager.cs プロジェクト: andyleung521/acat
 /// <summary>
 /// Initializes the AnimationManager class
 /// </summary>
 public AnimationManager()
 {
     _interpreter = new Interpret();
     _animationsCollection = new AnimationsCollection();
     _soundPlayer = null;
     _currentScreen = null;
     _player = null;
     _variables = new Variables();
 }