Init() public method

public Init ( ) : void
return void
Beispiel #1
0
        public static Map LoadMap(string filename)
        {
            Map map = InputOutput.ReadMap(filename);

            if (map != null)
            {
                map.Init();
            }
            return(map);
        }
Beispiel #2
0
        public Map CreateMap()
        {
            Map m = new Map();
            int l_count = (int)n_layers.Value;
            int l_w = (int)n_w.Value;
            int l_h = (int)n_h.Value;
            bool bNewvsp = rb_new.Checked;
            for(int i=0;i<l_count;i++)
            {
                MapLayer ml = new MapLayer(m);
                ml.size(l_w,l_h);
                ml.name = "Layer " + i;
                ml.type = LayerType.Tile;
                ml.parallaxInfo = new ParallaxInfo();
                m.Layers.Add(ml);
            }
            MapLayer zl = new MapLayer(m);
            zl.type = LayerType.Zone;
            zl.name = "Zones";
            zl.size(l_w,l_h);

            m.ZoneLayer=zl;

            MapLayer ol = new MapLayer(m);
            ol.type = LayerType.Obs;
            ol.name = "Obstructions";
            ol.size(l_w,l_h);
            m.ObsLayer = ol;

            MapLayer el = new MapLayer(m);
            el.type = LayerType.Entity;
            el.name = "Entities";
            MapLayerSpecial rl = new MapLayerSpecial(m);
            rl.type=LayerType.Special_Retrace;

            m.Layers.Add(rl);
            m.Layers.Add(el);
            m.Layers.Add(ol);
            m.Layers.Add(zl);

            m.EntLayer = el;
            if(bNewvsp)
            {
                Vsp24 v = new Vsp24();

                //v.AddTiles(100);
                v.Tiles.AddRange(v.GetTiles(100));
                m.vsp = v;

            }
            else
            {
                Vsp24 v = InputOutput.ReadVsp(t_vspfile.Text);
                if(v==null)
                {
                    Errors.Error("Warning", "An error occured when attempting to load the vsp file.  A blank VSP has been created.");
                    v = new Vsp24();

                    v.Tiles.Add(v.GetTiles(100));
                    m.vsp = v;
                }
                else
                    m.vsp = v;
            }

            MapZone mz = new MapZone();
            mz.ID = 0;
            mz.Name = "NULL_ZONE";
            m.Zones.Add(mz);

            m.Init();
            m.RenderString = "";
            return m;
        }
Beispiel #3
0
        public Map CreateMap()
        {
            Map  m       = new Map();
            int  l_count = (int)n_layers.Value;
            int  l_w     = (int)n_w.Value;
            int  l_h     = (int)n_h.Value;
            bool bNewvsp = rb_new.Checked;

            for (int i = 0; i < l_count; i++)
            {
                MapLayer ml = new MapLayer(m);
                ml.size(l_w, l_h);
                ml.name         = "Layer " + i;
                ml.type         = LayerType.Tile;
                ml.parallaxInfo = new ParallaxInfo();
                m.Layers.Add(ml);
            }
            MapLayer zl = new MapLayer(m);

            zl.type = LayerType.Zone;
            zl.name = "Zones";
            zl.size(l_w, l_h);

            m.ZoneLayer = zl;

            MapLayer ol = new MapLayer(m);

            ol.type = LayerType.Obs;
            ol.name = "Obstructions";
            ol.size(l_w, l_h);
            m.ObsLayer = ol;



            MapLayer el = new MapLayer(m);

            el.type = LayerType.Entity;
            el.name = "Entities";
            MapLayerSpecial rl = new MapLayerSpecial(m);

            rl.type = LayerType.Special_Retrace;


            m.Layers.Add(rl);
            m.Layers.Add(el);
            m.Layers.Add(ol);
            m.Layers.Add(zl);

            m.EntLayer = el;
            if (bNewvsp)
            {
                Vsp24 v = new Vsp24();

                //v.AddTiles(100);
                v.Tiles.AddRange(v.GetTiles(100));
                m.vsp = v;
            }
            else
            {
                Vsp24 v = InputOutput.ReadVsp(t_vspfile.Text);
                if (v == null)
                {
                    Errors.Error("Warning", "An error occured when attempting to load the vsp file.  A blank VSP has been created.");
                    v = new Vsp24();

                    v.Tiles.Add(v.GetTiles(100));
                    m.vsp = v;
                }
                else
                {
                    m.vsp = v;
                }
            }

            MapZone mz = new MapZone();

            mz.ID   = 0;
            mz.Name = "NULL_ZONE";
            m.Zones.Add(mz);


            m.Init();
            m.RenderString = "";
            return(m);
        }