예제 #1
0
 public Maze(int mazeId)
 {
     id         = mazeId;
     MazeConfig = ConfigData.GetMazeConfig(mazeId);
     items      = new List <MazeItem>();
     foreach (int mazeItemId in MazeBook.GetMazeItemIds(mazeId))
     {
         items.Add(new MazeItem(mazeItemId, MazeConfig.Level));
     }
 }
예제 #2
0
        public void DrawIcon(Graphics g, Rectangle dest, int frame)
        {
            string moveicon = "";

            switch (type)
            {
            case "mon": moveicon = ConfigData.GetPeopleConfig(infos[0]).Figue; break;

            case "resource": moveicon = string.Format("res{0}", infos[0]); break;

            case "gold": moveicon = "res1"; break;

            case "task": moveicon = "trap1"; break;
            }

            if (moveicon != "")
            {
                Image moveImage = MazeBook.GetMoveImage(moveicon);
                if (moveImage != null)
                {
                    int       wid        = moveImage.Width / 4;
                    Rectangle targetRect = new Rectangle(dest.X + (38 - wid) / 2, dest.Y, wid, moveImage.Height);
                    g.DrawImage(moveImage, targetRect, wid * frame, 0, wid, moveImage.Height, GraphicsUnit.Pixel);
                    if (type == "mon")
                    {
                        int  lv   = mlevel + infos[1];
                        Font font = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                        g.DrawString("lv" + lv, font, Brushes.Maroon, targetRect.X + 6, targetRect.Y + 28);
                        g.DrawString("lv" + lv, font, Brushes.White, targetRect.X + 5, targetRect.Y + 27);
                        font.Dispose();
                    }
                }
            }
            else
            {
                Rectangle smallDest = new Rectangle(dest.X + 7, dest.Y + 7, dest.Width - 14, dest.Height - 14);
                if (type == "block")
                {
                    Image block = PicLoader.Read("Map", "block.PNG");
                    g.DrawImage(block, smallDest);
                    block.Dispose();
                }
                else if (type == "item")
                {
                    g.DrawImage(HItemBook.GetHItemImage(infos[0]), smallDest, 4, 4, 56, 56, GraphicsUnit.Pixel);
                }
                else
                {
                    g.DrawImage(HSIcons.GetIconsByEName("res1"), smallDest, 0, 0, 32, 32, GraphicsUnit.Pixel);
                }
            }
        }