Exemplo n.º 1
0
        /// <summary>
        /// Triggered when a token is removed from the board.
        /// </summary>
        public void OnTokenRemoved(
            object sender,
            TokenArgs args)
        {
            // Check to see if the token above is burning
            Token token = args.Token;

            if (args.IsBurnt)
            {
                // Show the burning state with a new sprite (which we
                // remove when it is done).
                BurntSprite bt = new BurntSprite(GetTokenSprite(token));
                sprites.Add(bt);
            }

            // Get the token sprite
            ContainerSprite ms = GetContainerSprite(token);

            // Remove the sprites from the list
            sprites.Remove(ms);

            // Redraw the entire screen
            QueueDraw();
            log.Debug("TokenRemoved: {0} count {1}", args.Token, sprites.Count);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Triggered when a token is added to the board.
        /// </summary>
        public void OnTokenAdded(
            object sender,
            TokenArgs args)
        {
            // Create a new token
            TokenSprite     ts = new TokenSprite(this, args.Token);
            ContainerSprite ms = new ContainerSprite(ts);

            sprites.Add(ms);

            // Move the sprite over
            ms.RateX = 100;
            ms.RateY = 100;
            ms.X     = ms.DesiredX = TileSize * args.Token.Column;
            ms.Y     = ms.DesiredY = TileSize * args.Token.Row;
            ms.Y    -= TileSize;

            // Check the state
            if (Game.State == GameState.InProgress &&
                args.Token.Type == TokenType.Flooded && args.Token.Value == ' ')
            {
                // Flooded tokens show up in place, but with a special
                // animation
                ms.Y = ms.DesiredY;
                ms.X = ms.DesiredX;
                ts.DrawableState.Frame = TokenSprite.FloodedStart;
            }

            // We need to sort the list again
            sortNext = true;
            QueueDraw();
            log.Debug(
                "TokenAdded: {0} sprits {1} state {2}", ts, sprites.Count, Game.State);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Triggered when a token is changed on the board.
        /// </summary>
        public void OnTokenChanged(
            object sender,
            TokenArgs args)
        {
            // Remove the old one
            TokenSprite ts = GetTokenSprite(args.Token);

            ts.UpdateDrawable();
        }
Exemplo n.º 4
0
        /// <summary>
        /// This is the default operation for when a token is removed.
        /// </summary>
        protected virtual void OnTokenRemoved(
            Token token,
            bool burnt)
        {
            // Build the arguments
            TokenArgs args = new TokenArgs(token);

            args.IsBurnt = burnt;

            // Call it
            if (TokenRemoved != null)
            {
                TokenRemoved(this, args);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Triggered when a token is removed from the board.
        /// </summary>
        public void OnTokenRemoved(
			object sender,
			TokenArgs args)
        {
            // Check to see if the token above is burning
            Token token = args.Token;

            if (args.IsBurnt)
            {
                // Show the burning state with a new sprite (which we
                // remove when it is done).
                BurntSprite bt = new BurntSprite(GetTokenSprite(token));
                sprites.Add(bt);
            }

            // Get the token sprite
            ContainerSprite ms = GetContainerSprite(token);

            // Remove the sprites from the list
            sprites.Remove(ms);

            // Redraw the entire screen
            QueueDraw();
            log.Debug("TokenRemoved: {0} count {1}", args.Token, sprites.Count);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Triggered when a token is changed on the board.
        /// </summary>
        public void OnTokenChanged(
			object sender,
			TokenArgs args)
        {
            // Remove the old one
            TokenSprite ts = GetTokenSprite(args.Token);
            ts.UpdateDrawable();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Triggered when a token is added to the board.
        /// </summary>
        public void OnTokenAdded(
			object sender,
			TokenArgs args)
        {
            // Create a new token
            TokenSprite ts = new TokenSprite(this, args.Token);
            ContainerSprite ms = new ContainerSprite(ts);
            sprites.Add(ms);

            // Move the sprite over
            ms.RateX = 100;
            ms.RateY = 100;
            ms.X = ms.DesiredX = TileSize * args.Token.Column;
            ms.Y = ms.DesiredY = TileSize * args.Token.Row;
            ms.Y -= TileSize;

            // Check the state
            if (Game.State == GameState.InProgress &&
                args.Token.Type == TokenType.Flooded && args.Token.Value == ' ')
            {
                // Flooded tokens show up in place, but with a special
                // animation
                ms.Y = ms.DesiredY;
                ms.X = ms.DesiredX;
                ts.DrawableState.Frame = TokenSprite.FloodedStart;
            }

            // We need to sort the list again
            sortNext = true;
            QueueDraw();
            log.Debug(
                "TokenAdded: {0} sprits {1} state {2}", ts, sprites.Count, Game.State);
        }
Exemplo n.º 8
0
        /// <summary>
        /// This is the default operation for when a token is removed.
        /// </summary>
        protected virtual void OnTokenRemoved(
			Token token,
			bool burnt)
        {
            // Build the arguments
            TokenArgs args = new TokenArgs(token);
            args.IsBurnt = burnt;

            // Call it
            if (TokenRemoved != null)
            {
                TokenRemoved(this, args);
            }
        }