示例#1
0
        private void do_paint(Graphics g)
        {
            Brush br_darkgray = new SolidBrush(Color.FromArgb(20, 20, 20));

            // Background img
            if (this.dropdownBGtype.SelectedIndex == 0 && map.Terrain != null)
            {
                g.DrawImage(map.Terrain, 0, 0, map.Width * this.zoom, map.Height * this.zoom);
            }
            else if (this.dropdownBGtype.SelectedIndex == 1 && map.Terrain != null)
            {
                g.DrawImage(map.Heightmap, 0, 0, map.Width * this.zoom, map.Height * this.zoom);
            }

            // Zones
            foreach (Entity ent in map.Entities)
            {
                if (!(ent is ZoneEntity))
                {
                    continue;
                }

                ZoneEntity entc = (ZoneEntity)ent;

                g.DrawRectangle((ent == currEntity ? Pens.Red : Pens.White), entc.X * this.zoom - entc.Width * this.zoom / 2, entc.Y * this.zoom - entc.Height * this.zoom / 2, entc.Width * this.zoom, entc.Height * this.zoom);
            }

            // Lights
            foreach (Entity ent in map.Entities)
            {
                if (!(ent is LightEntity))
                {
                    continue;
                }

                LightEntity entc = (LightEntity)ent;

                g.DrawEllipse((ent == currEntity ? Pens.Red : Pens.White), entc.X * this.zoom, entc.Y * this.zoom, 10, 10);
            }

            // Objects
            foreach (Entity ent in map.Entities)
            {
                if (!(ent is ObjectEntity))
                {
                    continue;
                }

                ObjectEntity entc = (ObjectEntity)ent;

                g.DrawRectangle((ent == currEntity ? Pens.Red : Pens.White), entc.X * this.zoom - 5, entc.Y * this.zoom - 5, 10, 10);
            }
        }
示例#2
0
        public override Entity loadConfig(ConfuseSection sect)
        {
            ZoneEntity ent = new ZoneEntity();
            ent.Type = types[0];

            ent.Width = sect.get_int("width", 20);
            ent.Height = sect.get_int("height", 20);
            ent.X = sect.get_int("x", 0);
            ent.Y = sect.get_int("y", 0);
            ent.Angle = sect.get_int("angle", 0);

            return ent;
        }
示例#3
0
        public override Entity loadConfig(ConfuseSection sect)
        {
            ZoneEntity ent = new ZoneEntity();

            ent.Type = types[0];

            ent.Width  = sect.get_int("width", 20);
            ent.Height = sect.get_int("height", 20);
            ent.X      = sect.get_int("x", 0);
            ent.Y      = sect.get_int("y", 0);
            ent.Angle  = sect.get_int("angle", 0);

            return(ent);
        }
示例#4
0
        public override string saveConfig(Entity ent)
        {
            string     o = "";
            ZoneEntity z = (ZoneEntity)ent;

            o += "zone {";
            o += "  width = " + z.Width;
            o += "  height = " + z.Height;
            o += "  x = " + z.X;
            o += "  y = " + z.Y;
            o += "  angle = " + z.Angle;
            o += "}";

            return(o);
        }