コード例 #1
0
ファイル: Display.cs プロジェクト: dmoonfire/wordplay
        /// <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);
        }
コード例 #2
0
ファイル: ContainerSprite.cs プロジェクト: dmoonfire/wordplay
 /// <summary>
 /// Constructs the container sprite.
 /// </summary>
 public ContainerSprite(TokenSprite sprite)
     : base(sprite)
 {
 }