예제 #1
0
        // Draws map using a SpriteDrawer
        public void Draw(SpriteDrawer sd)
        {
            for(int i = 0; i < map.GetLength(0); i++) {
                for(int j = 0; j < map.GetLength(1); j++) {
                    if(map[i, j] == -1) {
                        continue;
                    }

                    // All coordinates are scaled to WinRT resolutions and rendered correctly through SpriteDrawer
                    int x = Constants.BUFFER_SPRITE_DIM * j + Constants.BUFFER_SPRITE_DIM / 2;
                    int y = Constants.BUFFER_SPRITE_DIM * i + Constants.BUFFER_SPRITE_DIM / 2 - Constants.BUFFER_OFFSET + offset;
                    int spriteNum = map[i, j];

                    sd.Draw(mapTextures, new Vector2(x, y), spriteNum, cache: true, align: true);
                }
            }
        }
        protected void DrawLaunchpad(SpriteDrawer sd, Vector2 coord, int color)
        {
            int dim = Constants.BUFFER_SPRITE_DIM;
            // Draw the square
            for(int i = 0; i < 5; i++) {
                for(int j = 0; j < 5; j++) {
                    if(i == 0) {
                        sd.Draw(textureList["jetpack"], coord + new Vector2(dim / 2, dim * (j + 0.5f)), (int)TextureData.jetpackTextures.cautionLeft, cache: true, align: true);
                        if(j == 0) {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim / 2), (int)TextureData.jetpackTextures.orangeL + color * 5, SpriteEffects.FlipVertically, cache: true, align: true);
                        } else if(j == 4) {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim / 2, dim * 4.5f), (int)TextureData.jetpackTextures.orangeL + color * 5, cache: true, align: true);
                        } else {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim / 2, dim * (j + 0.5f)), (int)TextureData.jetpackTextures.orange_ + color * 5, spriteRotation: Constants.ROTATE_90, cache: true, align: true);
                        }
                    } else if(i == 4) {
                        sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 4.5f, dim * (j + 0.5f)), (int)TextureData.jetpackTextures.cautionRight, cache: true, align: true);
                        if(j == 0) {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 4.5f, dim / 2), (int)TextureData.jetpackTextures.orangeL + color * 5, SpriteEffects.FlipVertically | SpriteEffects.FlipHorizontally, cache: true, align: true);
                        } else if(j == 4) {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 4.5f), (int)TextureData.jetpackTextures.orangeL + color * 5, SpriteEffects.FlipHorizontally, cache: true, align: true);
                        } else {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 4.5f, dim * (j + 0.5f)), (int)TextureData.jetpackTextures.orange_ + color * 5, spriteRotation: Constants.ROTATE_90 * 3, cache: true, align: true);
                        }
                    }
                    if(j == 0) {
                        sd.Draw(textureList["jetpack"], coord + new Vector2(dim * (i + 0.5f), dim / 2), (int)TextureData.jetpackTextures.cautionTop, cache: true, align: true);
                        if(i != 0 && i != 4) {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * (i + 0.5f), dim / 2), (int)TextureData.jetpackTextures.orange_ + color * 5, spriteRotation: Constants.ROTATE_90 * 2, cache: true, align: true);
                        }
                    } else if(j == 4) {
                        sd.Draw(textureList["jetpack"], coord + new Vector2(dim * (i + 0.5f), dim * 4.5f), (int)TextureData.jetpackTextures.cautionBottom, cache: true, align: true);
                        if(i != 0 && i != 4) {
                            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * (i + 0.5f), dim * 4.5f), (int)TextureData.jetpackTextures.orange_ + color * 5, cache: true, align: true);
                        }
                    }
                }
            }

            // Draw the circle
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 1.5f, dim * 1.5f), (int)TextureData.jetpackTextures.orangeLCurve + color * 5, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 2.5f, dim * 1.5f), (int)TextureData.jetpackTextures.orangeTCurve + color * 5, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 3.5f, dim * 1.5f), (int)TextureData.jetpackTextures.orangeLCurve + color * 5, SpriteEffects.FlipHorizontally, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 1.5f, dim * 2.5f), (int)TextureData.jetpackTextures.orangeTCurve + color * 5, spriteRotation: Constants.ROTATE_90 * 3, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 2.5f, dim * 2.5f), (int)TextureData.jetpackTextures.orangeCross + color * 5, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 3.5f, dim * 2.5f), (int)TextureData.jetpackTextures.orangeTCurve + color * 5, spriteRotation: Constants.ROTATE_90, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 1.5f, dim * 3.5f), (int)TextureData.jetpackTextures.orangeLCurve + color * 5, SpriteEffects.FlipVertically, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 2.5f, dim * 3.5f), (int)TextureData.jetpackTextures.orangeTCurve + color * 5, spriteRotation: Constants.ROTATE_90 * 2, cache: true, align: true);
            sd.Draw(textureList["jetpack"], coord + new Vector2(dim * 3.5f, dim * 3.5f), (int)TextureData.jetpackTextures.orangeLCurve + color * 5, SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically, cache: true, align: true);
        }
 public void DrawBuckets(SpriteDrawer sd)
 {
     int i = 0;
     foreach(string user in scores.Keys) {
         float scale = 0.5f;
         if(scores[user] > displayScore[user]) {
             scale += (float)(Math.Sqrt(scores[user] - displayScore[user])) / 40f;
             displayScore[user] += 2;
         }
         sd.Draw(textureList["fishing"], new Vector2((float)Constants.BUFFER_SPRITE_DIM * (6f + i), BUCKET_Y + waveOffset), (int)TextureData.fishingTextures.bucket);
         sd.Draw(textureList["fishing"], new Vector2((float)Constants.BUFFER_SPRITE_DIM * (7f + i), BUCKET_Y + waveOffset), (int)TextureData.fishingTextures.bucket, SpriteEffects.FlipHorizontally);
         sd.DrawString(ScreenManager.Fonts["museoslab"], displayScore[user].ToString(), new Vector2((float)Constants.BUFFER_SPRITE_DIM * (6.5f + i), (float)Constants.BUFFER_SPRITE_DIM * 2.5f + waveOffset - 35), spriteScale: scale);
         if(i == 2)
             i++;
         i += 2;
     }
 }