Пример #1
0
        private void b_layeradd_Click(object sender, System.EventArgs e)
        {
            NewLayerWindow nlw = new NewLayerWindow();
            MapLayer bl = null;
            foreach (MapLayer ml in Global.ActiveMap.Layers)
                if (ml.type == LayerType.Tile)
                {
                    bl = ml;
                    break;
                }
            if (bl == null)
                nlw.init(100, 100);
            else nlw.init(bl.Width, bl.Height);
            if (nlw.ShowDialog() != DialogResult.OK) return;

            MapLayer mlz = new MapLayer(Global.ActiveMap);
            mlz.type = LayerType.Tile;
            mlz.size(nlw.SelectedSize.Width, nlw.SelectedSize.Height);
            mlz.name = "Layer " + (Global.ActiveMap.Layers.Count - 3);
            mlz.parallaxInfo = new ParallaxInfo();

            //			lpAddLayer(mlz, true,false, );
            Global.ActiveMap.AddLayer(mlz);
            lpUpdate(Global.ActiveMap, mlz);
        }
Пример #2
0
        private void miNewLayer_Click(object sender, System.EventArgs e)
        {
            if (Global.ActiveMap != null)
            {
                NewLayerWindow nlw = new NewLayerWindow();

                DialogResult dr = nlw.ShowDialog();

                if (dr != DialogResult.OK)
                {
                    return;
                }

                // add the layer

                MapLayer ml = new MapLayer(Global.ActiveMap);

                int w = nlw.SelectedSize.Width;
                int h = nlw.SelectedSize.Height;

                //ml.Height = h;
                //ml.Width = w;
                ml.size(w, h);

                ml.parallaxInfo = new ParallaxInfo();

                ml.Translucency = 0;

                Global.ActiveMap.Layers.Add(ml);

                lpAddLayer(ml, true, false, (Global.ActiveMap.Layers.Count - 1));

                // create a render state for this layer
                Global.ActiveMap.UIState.AddLayer(ml);

                //				Global.ForceRedraws();
            }
            ui_update();
        }