public GraphComponent(Game game, Texture2D picture, DrawState state)
     : base(game)
 {
     _picture = picture;
     _state = new StateManager(game, state);
     PreviousBounds = game.GraphicsDevice.Viewport;
 }
 public Chess(Game game, Texture2D picture, DrawState state, int x, int y, Type chessType)
     : base(game, picture, state)
 {
     ChessType = chessType;
     X = x;
     Y = y;
     GoalArrived = false;
 }
 public FontComponent(Game game, SpriteFont font, DrawState state)
     : base(game)
 {
     _font = font;
     _state = new StateManager(game, state);
     PreviousBounds = game.GraphicsDevice.Viewport;
     Content = "";
 }
        public Board(Game game, Texture2D picture, DrawState state, Player[] players = null, BoardData boardData = null)
            : base(game, picture, state)
        {
            if (players != null) _players = players;
            if (boardData == null) boardData = new BoardData();

            InitParameters();
            InitAndLoadContent(game, boardData);
        }
 public StateManager(Game game, DrawState state)
     : base(game)
 {
     _stateChangeSecondQueue = new Queue<float>();
     _stateQueue = new Queue<DrawState>();
     CurrentState = state;
     _goalState = state;
     _currentColorAvoidSmallNumber = CurrentState.Color.ToVector4();
 }
 public Container(Game game, Texture2D background, DrawState state)
     : base(game, background,  state)
 {
     _contain = new List<BasicComponent>();
 }
 public ChessButton(Game game, Texture2D picture, DrawState state)
     : base(game, picture, state)
 {
     HaveChess = false;
     WantToGo = -1;
 }
 public Scene(Game game, Texture2D background, DrawState state)
     : base(game, background, state)
 {
 }
        public override void Update(GameTime gameTime)
        {
            if (_addframe > 0)
            {
                CurrentState.Bounds = new Vector4( CurrentState.Position.X + _addPosition.X,
                    CurrentState.Position.Y + _addPosition.Y,
                    CurrentState.Size.X + _addSize.X,
                    CurrentState.Size.Y + _addSize.Y );

                _currentColorAvoidSmallNumber = new Vector4(
                    _currentColorAvoidSmallNumber.X + _addColor.X,
                    _currentColorAvoidSmallNumber.Y + _addColor.Y,
                    _currentColorAvoidSmallNumber.Z + _addColor.Z,
                    _currentColorAvoidSmallNumber.W + _addColor.W);
                CurrentState.Color = new Color(_currentColorAvoidSmallNumber);

                --_addframe;
                if (_addframe <= 0) CurrentState = _goalState;
            }
            else if (_stateQueue.Count > 0)
            {
                _goalState = _stateQueue.Dequeue();
                SetNextState(_stateChangeSecondQueue.Dequeue(), _goalState);
            }

            base.Update(gameTime);
        }
 public void ClearAllAndAddState(float second, DrawState state)
 {
     _stateChangeSecondQueue.Clear();
     _stateQueue.Clear();
     SetNextState(second, state);
 }
 public void AddState(float second, DrawState state)
 {
     _stateChangeSecondQueue.Enqueue(second);
     _stateQueue.Enqueue(state);
 }
 private void SetNextState( float second, DrawState state )
 {
     _addPosition = new Vector2(((state.Position.X - CurrentState.Position.X) / second / FPS),
         ((state.Position.Y - CurrentState.Position.Y) / second / FPS));
     _addSize = new Vector2(((state.Size.X - CurrentState.Size.X) / second / FPS),
         ((state.Size.Y - CurrentState.Size.Y) / second / FPS));
     Vector4 color = state.Color.ToVector4(), currentColor = CurrentState.Color.ToVector4();
     _addColor = new Vector4(((color.X - currentColor.X) / second / FPS),
         ((color.Y - currentColor.Y) / second / FPS),
         ((color.Z - currentColor.Z) / second / FPS),
         ((color.W - currentColor.W) / second / FPS));
     _addframe = (int)(second * (float)FPS) + 1;
     _goalState = state;
 }
 public void ClearAllAndAddState(float second, DrawState drawState)
 {
     _state.ClearAllAndAddState(second, drawState);
 }
 public void AddState(float second, DrawState drawState)
 {
     _state.AddState(second, drawState);
 }