Ejemplo n.º 1
0
        public static void DrawSprite(Graphics g, Rectangle destination, Sprite sprite, Color color)
        {
            SpriteImage image = sprite[0, 1];

            DrawImage(g, image?.Image, destination, color, false);
        }
Ejemplo n.º 2
0
        public void UpdateExtraObjects()
        {
            Info.RemoveSection("Levels");
            Info.RemoveSection("Paths");
            Info.RemoveSection("Icons");
            Info.RemoveSection("Specials");

            int levelID   = 0;
            int pathID    = 0;
            int specialID = 0;
            int iconID    = 0;
            int size      = Cells.Count;

            for (int i = 0; i < size; i++)
            {
                Cell  cell     = Cells[i];
                Point location = cell.GetLocation(Width, Height);

                for (int j = cell.Objects.Count - 1; j >= 0; j--)
                {
                    Item item = cell.Objects[j];
                    if (item is Level level)
                    {
                        Info["Levels", $"{levelID}name"]        = level.Name;
                        Info["Levels", $"{levelID}file"]        = level.File;
                        Info["Levels", $"{levelID}number"]      = level.Style == (byte)LevelStyle.Icon ? iconID.ToString() : level.Number.ToString();
                        Info["Levels", $"{levelID}style"]       = level.Style == (byte)LevelStyle.Icon ? "-1" : level.Style.ToString();
                        Info["Levels", $"{levelID}state"]       = level.State.ToString();
                        Info["Levels", $"{levelID}colour"]      = Reader.ShortToCoordinate(level.Color);
                        Info["Levels", $"{levelID}clearcolour"] = Reader.ShortToCoordinate(level.ActiveColor);
                        Info["Levels", $"{levelID}X"]           = location.X.ToString();
                        Info["Levels", $"{levelID}Y"]           = location.Y.ToString();
                        Info["Levels", $"{levelID}Z"]           = "0";
                        Info["Levels", $"{levelID}dir"]         = level.Direction.ToString();
                        if (level.Style == (byte)LevelStyle.Icon)
                        {
                            Sprite      sprite = Reader.Sprites[level.Sprite];
                            SpriteImage image  = sprite[level.SpriteNum, level.SpriteNumExtra];
                            Info["Icons", $"{iconID}file"] = image.Name;
                            Info["Icons", $"{iconID}root"] = sprite.IsRoot ? "1" : "0";
                            iconID++;
                        }
                        levelID++;
                    }
                    else if (item is LevelPath path)
                    {
                        Info["Paths", $"{pathID}object"]      = path.Object;
                        Info["Paths", $"{pathID}style"]       = path.Style.ToString();
                        Info["Paths", $"{pathID}gate"]        = path.Gate.ToString();
                        Info["Paths", $"{pathID}requirement"] = path.Requirement.ToString();
                        Info["Paths", $"{pathID}X"]           = location.X.ToString();
                        Info["Paths", $"{pathID}Y"]           = location.Y.ToString();
                        Info["Paths", $"{pathID}Z"]           = "0";
                        Info["Paths", $"{pathID}dir"]         = path.Direction.ToString();
                        pathID++;
                    }
                    else if (item is Special special)
                    {
                        Info["Specials", $"{specialID}data"] = special.Object;
                        Info["Specials", $"{specialID}X"]    = location.X.ToString();
                        Info["Specials", $"{specialID}Y"]    = location.Y.ToString();
                        Info["Specials", $"{specialID}Z"]    = "0";
                        specialID++;
                    }
                }
            }
        }