Ejemplo n.º 1
0
        public BackgroundLayer2D(World2D world2D, IObject2DFactory factory, BackgroundLayer layer) :
            base(world2D, factory, layer)
        {
            this.Area = (factory as BackgroundLayer2DFactory).Area;

            this.nameToTiles = new Dictionary <string, TileBackgoundObject2D>();
        }
Ejemplo n.º 2
0
        private void TryApplyDefaultBackgroudLayer(bool isUseDefaultBackgroudLayer)
        {
            if (!isUseDefaultBackgroudLayer)
            {
                return;
            }
            string fname = AppDomain.CurrentDomain.BaseDirectory + @"数据引用\基础矢量\矢量模版\海陆模版.shp";

            if (!File.Exists(fname))
            {
                Console.WriteLine("文件\"" + fname + "\"未找到,无法应用默认背景。");
                return;
            }
            IBackgroundLayer lyr = null;

            if (_interestRegions == null || _interestRegions.Length == 0)
            {
                lyr = new BackgroundLayer(fname);
            }
            else
            {
                lyr = new BackgroundLayer(fname, _interestRegions);
            }
            (lyr as BackgroundLayer).LandColor = _landColor;
            (lyr as BackgroundLayer).SeaColor  = _seaColor;
            _canvasHost.Canvas.LayerContainer.Layers.Add(lyr);
        }
Ejemplo n.º 3
0
    private void InitBackground(BackgroundLayer layer)
    {
        GameObject gameObjRef = layer.gameObjRef;
        GameObject gameObject1, gameObject2;

        gameObject1 = Instantiate(gameObjRef, Vector3.up * layer.yPos, Quaternion.identity);
        gameObject1.transform.SetParent(this.transform);
        gameObject1.GetComponent <ScrollingObject>().scrollRatio = layer.scrollSpeedRatio;
        gameObject1.GetComponent <ScrollingObject>().row         = layer.row;

        //layer.width = gameObject1.GetComponent<BoxCollider2D>().size.x;
        //layer.height = gameObject1.GetComponent<BoxCollider2D>().size.y;
        if (layer.row == 0)
        {
            Utils.backgroundSize.x = layer.GetWidth();  // gameObject1.GetComponent<BoxCollider2D>().size.x;
            Utils.backgroundSize.y = layer.GetHeight(); // gameObject1.GetComponent<BoxCollider2D>().size.y;
        }

        Vector3 pos = Vector3.right * layer.GetWidth() + Vector3.up * layer.yPos;

        gameObject2 = Instantiate(gameObjRef, pos, Quaternion.identity);
        gameObject2.transform.SetParent(this.transform);
        gameObject2.transform.Rotate(Vector3.up * 180f);
        gameObject2.GetComponent <ScrollingObject>().scrollRatio = layer.scrollSpeedRatio;
        gameObject2.GetComponent <ScrollingObject>().row         = layer.row;
    }
            private static ICssValue CreateLayers(CssListValue image, CssListValue attachment, CssListValue clip, CssListValue positionX, CssListValue positionY, CssListValue origin, CssListValue repeatX, CssListValue repeatY, CssListValue size)
            {
                if (image != null)
                {
                    var layers = new ICssValue[image.Items.Length];

                    for (var i = 0; i < image.Items.Length; i++)
                    {
                        var px = GetValue(positionX, i);
                        var py = GetValue(positionY, i);
                        var rx = GetValue(repeatX, i);
                        var ry = GetValue(repeatY, i);
                        layers[i] = new BackgroundLayer
                        {
                            Attachment = GetValue(attachment, i),
                            Clip       = GetValue(clip, i),
                            Origin     = GetValue(origin, i),
                            Position   = px == null && py == null ? new Nullable <Point>() : new Point(px as Length? ?? Length.Zero, py as Length? ?? Length.Zero),
                            Repeat     = rx == null && ry == null ? new Nullable <ImageRepeats>() : new ImageRepeats(rx, ry),
                            Size       = GetValue(size, i),
                            Source     = image.Items[i],
                        };
                    }

                    return(new CssListValue(layers));
                }

                return(null);
            }
Ejemplo n.º 5
0
        public override void VisitStart(World world)
        {
            base.VisitStart(world);

            CJMenuLayer startPage = new CJMenuLayer();

            BackgroundLayer background = new BackgroundLayer();
            //EntityLayer entityLayer = new EntityLayer();
            BoardGameLayer boardGameLayer = new BoardGameLayer();

            boardGameLayer.ParentLayer = background;

            BoardPlayerLayer boardPlayerLayer   = new BoardPlayerLayer();
            BoardPlayerLayer boardOpponentLayer = new BoardPlayerLayer();

            BoardNotifLayer boardNotifLayer = new BoardNotifLayer();

            BoardBannerLayer bannerLayer = new BoardBannerLayer();

            world.InitializeWorld(new List <Tuple <string, ALayer> >()
            {
                new Tuple <string, ALayer>("startPage", startPage),

                new Tuple <string, ALayer>("VsO7nJK", background),
                new Tuple <string, ALayer>("gameLayer", boardGameLayer),
                new Tuple <string, ALayer>("playerLayer", boardPlayerLayer),
                new Tuple <string, ALayer>("opponentLayer", boardOpponentLayer),
                new Tuple <string, ALayer>("notifLayer", boardNotifLayer),
                new Tuple <string, ALayer>("bannerLayer", bannerLayer)
            });

            this.nextLevelNodeName = "StartPageLevel";
            this.UpdateCurrentLevelNode(world);
        }
Ejemplo n.º 6
0
		public ParallaxBackground(int numberOfLayers, string[] layerImageNames, float[] scrollFactors)
		{
			layers = new BackgroundLayer[numberOfLayers];
			for (int i = 0; i < numberOfLayers; i++)
				layers[i] = new BackgroundLayer(layerImageNames[i], scrollFactors[i]);
			RenderLayer = -(layerImageNames.Length + 1);
		}
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            LayerOverlay worldOverlay = new LayerOverlay();
            wpfMap1.Overlays.Add("WorldOverlay", worldOverlay);

            BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean));
            worldOverlay.Layers.Add(backgroundLayer);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldOverlay.Layers.Add("WorldLayer", worldLayer);

            // If you want to use file cache which saves images to the disk;
            // When loading back the same tile, we'll find from the disk first.
            // Turn the cache on enhance the performance a lot;
            // if your map image is static, we recommend to turn the cache on.
            // It's off by default.
            FileBitmapTileCache bitmapTileCache = new FileBitmapTileCache();
            bitmapTileCache.CacheDirectory = @"..\..\SampleData\Data\SampleCacheTiles";
            bitmapTileCache.CacheId = "World02CachedTiles";
            bitmapTileCache.TileAccessMode = TileAccessMode.ReadOnly;
            bitmapTileCache.ImageFormat = TileImageFormat.Png;
            worldOverlay.TileCache = bitmapTileCache;
            worldOverlay.TransitionEffect = TransitionEffect.None;

            wpfMap1.Refresh();
        }
Ejemplo n.º 8
0
        public override void Execute()
        {
            ICanvasViewer cv = _smartSession.SmartWindowManager.ActiveCanvasViewer;

            if (cv == null)
            {
                return;
            }
            ILayer layer = cv.Canvas.LayerContainer.GetByName("海陆背景");

            if (layer != null)
            {
                return;
            }
            string fname = AppDomain.CurrentDomain.BaseDirectory + @"数据引用\基础矢量\矢量模版\海陆模版.shp";

            if (!File.Exists(fname))
            {
                Console.WriteLine("文件\"" + fname + "\"未找到,无法应用默认背景。");
                return;
            }
            IBackgroundLayer lyr = new BackgroundLayer(fname);

            cv.Canvas.LayerContainer.Layers.Add(lyr);
            cv.Canvas.Refresh(enumRefreshType.All);
        }
Ejemplo n.º 9
0
        private void FrmSecondDMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (MsgBox.ShowQuestion("确定退出当前系统?") != DialogResult.Yes)
                {
                    e.Cancel = true; return;
                }
                string RemeberFilePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\SkinFile.txt";
                if (File.Exists(RemeberFilePath))
                {
                    File.Delete(RemeberFilePath);
                }
                File.AppendAllText(RemeberFilePath, UserLookAndFeel.Default.ActiveSkinName);

                string          path            = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\StorageColor.txt";
                BackgroundLayer layer           = m_canvas.Model.BackgroundLayer as BackgroundLayer;
                Color           BackGroundColor = layer.Color;
                Hashtable       hs = new Hashtable();
                hs["BackGroundColor"] = BackGroundColor.R + "," + BackGroundColor.G + "," + BackGroundColor.B;
                XMLClass.AppendXML(path, "StorageColor", hs);
            }
            catch (Exception ex)
            { MsgBox.ShowError(ex.Message); }
        }
Ejemplo n.º 10
0
 private void btnOption_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         BackgroundLayer layer                  = m_canvas.Model.BackgroundLayer as BackgroundLayer;
         GridLayer       Grid                   = m_canvas.Model.GridLayer as GridLayer;
         DrawingLayer    Drw                    = m_canvas.Model.ActiveLayer as DrawingLayer;
         Color           nullStorageColor       = m_canvas.Model.NullStorageColor;
         Color           emptyShelfStorageColor = m_canvas.Model.EmptyShelfStorageColor;
         Color           fullShelfStorageColor  = m_canvas.Model.FillShelfStorageColor;
         if (layer != null && Grid != null && Drw != null)
         {
             using (FrmOption frm = new FrmOption(Grid.Enabled, Grid.GridStyle, Grid.Color, layer.Color, Drw.Color, nullStorageColor, emptyShelfStorageColor, fullShelfStorageColor, Drw.Width))
             {
                 if (frm.ShowDialog() == DialogResult.OK)
                 {
                     Grid.Enabled   = frm.GridEnable;
                     Grid.GridStyle = frm.GridStyle;
                     Grid.Color     = frm.GridColor;
                     layer.Color    = frm.BackGroudColor;
                     Drw.Color      = frm.PenColor;
                     Drw.Width      = frm.PenWidth;
                     m_canvas.Model.NullStorageColor       = frm.NullStorageColor;
                     m_canvas.Model.EmptyShelfStorageColor = frm.EmptyShelfStorageColor;
                     m_canvas.Model.FillShelfStorageColor  = frm.FullShelfStorageColor;
                     m_canvas.DoInvalidate(true);
                 }
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Disposes the map object
        /// </summary>
        public void Dispose()
        {
            _disposing = true;
            AbortFetch();

            if (DisposeLayersOnDispose)
            {
                if (Layers != null)
                {
                    foreach (var disposable in Layers.OfType <IDisposable>())
                    {
                        disposable.Dispose();
                    }
                }
                if (BackgroundLayer != null)
                {
                    foreach (var disposable in BackgroundLayer.OfType <IDisposable>())
                    {
                        disposable.Dispose();
                    }
                }
            }
            Layers?.Clear();
            BackgroundLayer?.Clear();
        }
Ejemplo n.º 12
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-17336118, 20037508, 11623981, -16888303);

            LayerOverlay worldOverlay = new LayerOverlay();

            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean));

            worldOverlay.Layers.Add(backgroundLayer);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldOverlay.Layers.Add("WorldLayer", worldLayer);

            // If you want to use file cache which saves images to the disk;
            // When loading back the same tileView, we'll find from the disk first.
            // Turn the cache on enhance the performance a lot;
            // if your map image is static, we recommend to turn the cache on.
            // It's off by default.
            FileRasterTileCache bitmapTileCache = new FileRasterTileCache();

            bitmapTileCache.CacheDirectory = Path.Combine(Path.GetTempPath(), "ThinkGeo", "TileCaches", "UsingTileCache-Wpf");
            bitmapTileCache.CacheId        = "World02CachedTiles";
            bitmapTileCache.TileAccessMode = TileAccessMode.ReadOnly;
            bitmapTileCache.ImageFormat    = RasterTileFormat.Png;
            worldOverlay.TileCache         = bitmapTileCache;

            mapView.Refresh();
        }
Ejemplo n.º 13
0
 private void LoadDatas()
 {
     foreach (var bl in BackgroundLayer.ToList().OfType <Layer>())
     {
         if (bl.IsLayerVisible(this))
         {
             bl.LoadDatas(this);
         }
         else
         {
             bl.CleanupRendering();
         }
     }
     foreach (var l in Layers.ToList().OfType <Layer>())
     {
         if (l.IsLayerVisible(this))
         {
             l.LoadDatas(this);
         }
         else
         {
             l.CleanupRendering();
         }
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Returns a cloned copy of this map-object.
        /// Layers are not cloned. The same instances are referenced from the cloned copy as from the original.
        /// The property <see cref="DisposeLayersOnDispose"/> is however false on this object (which prevents layers beeing disposed and then not usable from the original map)
        /// </summary>
        /// <returns>Instance of <see cref="Map"/></returns>
        public Map Clone()
        {
            Map clone = null;

            lock (MapTransform)
            {
                clone = new Map()
                {
                    BackColor          = BackColor,
                    Disclaimer         = Disclaimer,
                    DisclaimerLocation = DisclaimerLocation,
                    MaximumZoom        = MaximumZoom,
                    MinimumZoom        = MinimumZoom,
                    PixelAspectRatio   = PixelAspectRatio,
                    Zoom = Zoom,
                    DisposeLayersOnDispose = false
                };

                if (DisclaimerFont != null)
                {
                    clone.DisclaimerFont = (Font)DisclaimerFont.Clone();
                }
                if (MapTransform != null)
                {
                    clone.MapTransform = MapTransform.Clone();
                }
                if (Size != null)
                {
                    clone.Size = new Size(Size.Width, Size.Height);
                }
                if (Center != null)
                {
                    clone.Center = Center.Clone();
                }
            }
            if (clone != null)
            {
                if (BackgroundLayer != null)
                {
                    clone.BackgroundLayer.AddCollection(BackgroundLayer.Clone());
                }

                for (int i = 0; i < Decorations.Count; i++)
                {
                    clone.Decorations.Add(Decorations[i]);
                }

                if (Layers != null)
                {
                    clone.Layers.AddCollection(Layers.Clone());
                }

                if (VariableLayers != null)
                {
                    clone.VariableLayers.AddCollection(VariableLayers.Clone());
                }
            }
            return(clone);
        }
Ejemplo n.º 15
0
        public BackgroundTester()
        {
            _background = new BackgroundLayer();
            AddChild(_background);

            DeclareTappable(this);
            Up += BackgroundTester_Up;
        }
Ejemplo n.º 16
0
 public ParallaxBackground(int numberOfLayers, string[] layerImageNames, float[] scrollFactors)
 {
     layers = new BackgroundLayer[numberOfLayers];
     for (int i = 0; i < numberOfLayers; i++)
     {
         layers[i] = new BackgroundLayer(layerImageNames[i], scrollFactors[i]);
     }
     RenderLayer = -(layerImageNames.Length + 1);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Adds a Background Layer to this background.
 /// </summary>
 /// <param name="layer"></param>
 public void AddLayer(BackgroundLayer layer)
 {
     if (_layers.Contains(layer))
     {
         return;
     }
     _layers.Add(layer);
     layer.Background = this;
 }
Ejemplo n.º 18
0
 public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (Visible)
     {
         BackgroundLayer.Draw(gameTime, spriteBatch);
         ForegroundLayer.Draw(gameTime, spriteBatch);
         UILayer.Draw(gameTime, spriteBatch);
     }
 }
Ejemplo n.º 19
0
        private void button27_Click(object sender, EventArgs e)
        {
            _canvas.CanvasSetting.RenderSetting.BackColor = Color.FromArgb(180, 198, 212);
            string          fname = @"F:\产品与项目\MAS-II\SMART0718\SMART\【控制】UI框架(通用)\demo\bin\Release\数据引用\基础矢量\矢量模版\海陆模版.shp";
            BackgroundLayer lyr   = new BackgroundLayer(fname);

            _canvas.LayerContainer.Layers.Add(lyr);
            _canvas.Refresh(enumRefreshType.All);
        }
Ejemplo n.º 20
0
        public LoadingScene(Action timeoutCallback = null, int timeout = 10) : base(AppDelegate.SharedWindow)
        {
            var bg = new BackgroundLayer(@"pic\1.png");

            AddChild(bg);
            var ui = new LoadingUiLayer(timeoutCallback, timeout);

            AddChild(ui);
        }
Ejemplo n.º 21
0
        public CampScene() : base(AppDelegate.SharedWindow)
        {
            var bg = new BackgroundLayer(@"pic\1.png");

            AddChild(bg);
            var ui = new CampUiLayer();

            AddChild(ui);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Adds a new layer to the LayeredLevelBackground.
        /// </summary>
        /// <param name="layer">The background</param>
        /// <param name="layerDepth">Defines the layer depth of the background layer. 0 is the foremost layer depth.</param>
        /// <param name="scrollSpeedModifier">0 for static background or no scrolling, 1 if you want the background to "follow camera"</param>
        public void AddLayer(LevelBackground layer, int layerDepth, Vector2 parallax)
        {
            BackgroundLayer bgLayer = new BackgroundLayer();
            bgLayer.background = layer;
            bgLayer.layerDepth = layerDepth;
            bgLayer.parallax = parallax;

            layers.Add(bgLayer);
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Draws all visible backgrounds in a given layer that are a part of this collection using the given palette information.
 /// </summary>
 /// <param name="layer">The layer of backgrounds to draw.</param>
 /// <param name="palettefx">The palette information used in drawing.</param>
 public void Draw(BackgroundLayer layer, Combat.PaletteFx palettefx)
 {
     foreach (var background in this)
     {
         if (background.Layer == layer && background.IsVisible)
         {
             background.Draw(palettefx);
         }
     }
 }
Ejemplo n.º 24
0
        public FollowerListScene() : base(AppDelegate.SharedWindow)
        {
            var bg = new BackgroundLayer(@"pic\1.png");

            AddChild(bg);

            var ui = new FollowerListUiLayer();

            AddChild(ui);
        }
Ejemplo n.º 25
0
        public void Draw(BackgroundLayer layer)
        {
            var shift = new Point(Mugen.ScreenSize.X / 2 - Engine.Camera.Location.X, 0 - Engine.Camera.Location.Y);

            Engine.GetSubSystem <Video.VideoSystem>().CameraShift += shift;

            Backgrounds.Draw(layer, PaletteFx);

            Engine.GetSubSystem <Video.VideoSystem>().CameraShift -= shift;
        }
Ejemplo n.º 26
0
        public IImage RenderImage(ILUT lut)
        {
            var img = BackgroundLayer.RenderImage(lut);

            if (_layers.Count > 1)
            {
                img.DrawGraphics(_layers.Skip(1));
            }
            return(img);
        }
        public override IObject2D CreateObject2D(World2D world2D, IObject obj)
        {
            if (obj is BackgroundLayer)
            {
                BackgroundLayer backgroundLayer = obj as BackgroundLayer;

                return(new BackgroundLayer2D(world2D, this, backgroundLayer));
            }

            return(null);
        }
Ejemplo n.º 28
0
        public virtual void Update(GameTime gameTime)
        {
            if (Visible)
            {
                BackgroundLayer.Update(gameTime);
                ForegroundLayer.Update(gameTime);
                UILayer.Update(gameTime);

                AnimationManager.Update(gameTime);
            }
        }
Ejemplo n.º 29
0
        private void CreateLayers()
        {
            backgroundLayer = new BackgroundLayer();
            AddLayer(backgroundLayer);

            gameplayLayer = new CCLayer();
            AddLayer(gameplayLayer);

            hudLayer = new CCLayer();
            AddLayer(hudLayer);
        }
Ejemplo n.º 30
0
        public void AddEntity(Entity entity, BackgroundLayer layer, bool isPointGravity = false)
        {
            entity.Level = this;
            this.entities.Add(entity);
            layer.AddSprite(entity);
            if (isPointGravity)
            {
                gravitycontroller.AddBody(entity.Body);
            }

            entity.Body.OnCollision += Body_OnCollision;
        }
Ejemplo n.º 31
0
        public GameScene(CCWindow window) : base(window)
        {
            var backgroundLayer = new BackgroundLayer();
            var hudLayer        = new HudLayer();
            var gameplayLayer   = new GameplayLayer(hudLayer.ScoreBox);
            var foregraundLayer = new ForegroundLayer();

            AddChild(backgroundLayer);
            AddChild(gameplayLayer);
            AddChild(foregraundLayer);
            AddChild(hudLayer);
        }
Ejemplo n.º 32
0
        private void TryApplyDefaultBackgroudLayer()
        {
            string fname = AppDomain.CurrentDomain.BaseDirectory + @"数据引用\基础矢量\矢量模版\海陆模版.shp";

            if (!File.Exists(fname))
            {
                Console.WriteLine("文件\"" + fname + "\"未找到,无法应用默认背景。");
                return;
            }
            IBackgroundLayer lyr = new BackgroundLayer(fname);

            this.canvasHost1.Canvas.LayerContainer.Layers.Add(lyr);
        }
Ejemplo n.º 33
0
        private void InitCanvas(string filename, bool IsNew)
        {
            if (!IsNew)
            {
                try
                {
                    AGVDAccess.AGVClientDAccess.GetPlanSet();
                    string tempFile = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\temSet.agv";
                    if (File.Exists(tempFile))
                    {
                        filename = tempFile;
                    }
                }
                catch (Exception ex)
                { MsgBox.ShowError(ex.Message); }
            }
            try
            {
                m_data = new DataModel();
                if (filename.Length > 0 && File.Exists(filename) && m_data.Load(filename, null))
                {
                    m_filename = filename;
                }
                m_canvas      = new CanvasCtrller(this, m_data);
                m_canvas.Dock = DockStyle.Fill;
                pclMain.Controls.Clear();
                pclMain.Controls.Add(m_canvas);
                m_canvas.SetCenter(new UnitPoint(0, 0));
                m_canvas.IsChooseSpecial = false;


                string storageColorPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\StorageColor.txt";
                //加载记忆画布背景颜色
                if (File.Exists(storageColorPath))
                {
                    Hashtable hs = XMLClass.GetXMLByParentNode(storageColorPath, "StorageColor");
                    if (hs["BackGroundColor"] != null && !string.IsNullOrEmpty(hs["BackGroundColor"].ToString()))
                    {
                        string[] bgColor         = hs["BackGroundColor"].ToString().Split(',');
                        Color    BackGroundColor = Color.FromArgb(Convert.ToInt16(bgColor[0]), Convert.ToInt16(bgColor[1]), Convert.ToInt16(bgColor[2]));
                        if (m_canvas != null)
                        {
                            BackgroundLayer layer = m_canvas.Model.BackgroundLayer as BackgroundLayer;
                            layer.Color = BackGroundColor;
                        }
                    }
                }
            }
            catch (Exception ex)
            { MsgBox.ShowError(ex.Message); }
        }
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean));

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();
            worldOverlay.Layers.Add(backgroundLayer);
            worldOverlay.Layers.Add(worldLayer);
            wpfMap1.Overlays.Add(worldOverlay);

            wpfMap1.Refresh();
        }
Ejemplo n.º 35
0
    public void CrossFade(string fadeLayer1, string fadeLayer2, float duration)
    {
        float startTime = Time.time;
        float endTime = startTime + duration;

        int x = 0;
        foreach (BackgroundLayer bl in audioLayers)
        {
            if (bl.name == fadeLayer1)
            {
                layer1 = bl;
                x++;
            }
            else if (bl.name == fadeLayer2)
            {
                layer2 = bl;
                x++;
            }
        }

        if (x == 2)
        {

            layer2.source.volume = 0;
            layer2.source.clip = layer2.clip;
            layer2.source.Play();

            float t = Time.time;
            while (t < endTime)
            {
                float i = (t - startTime) / duration;
                ////debug.log(i);
                layer1.source.volume = (1 - i);
                layer2.source.volume = i;
                t = t + Time.deltaTime;
            }

            layer1.source.Stop();
        }
        else
        {
            //debug.log("One of the layers was not found");
        }
    }
Ejemplo n.º 36
0
		public void Draw(BackgroundLayer layer)
		{
			Point shift = new Point(Mugen.ScreenSize.X / 2 - Engine.Camera.Location.X, 0 - Engine.Camera.Location.Y);

			Engine.GetSubSystem<Video.VideoSystem>().CameraShift += shift;

			Backgrounds.Draw(layer, PaletteFx);

			Engine.GetSubSystem<Video.VideoSystem>().CameraShift -= shift;
		}
Ejemplo n.º 37
0
        /// <summary>
        /// Initialize needs to be called after adding all the layers.
        /// </summary>
        public void Initialize()
        {
            layersInDrawingOrder = new BackgroundLayer[layers.Count];

            int layerDepthCounter = 0;
            int indexCounter = 0;

            while (layers.Count > 0)
            {
                for (int i = 0; i < layers.Count; i++)
                {
                    if (layers[i].layerDepth == layerDepthCounter)
                    {
                        layersInDrawingOrder[indexCounter] = layers[i];
                        indexCounter++;
                        layers.RemoveAt(i);
                    }
                }

                layerDepthCounter++;
            }

            BackgroundLayer[] tempArray = new BackgroundLayer[layersInDrawingOrder.Length];

            indexCounter = 0;

            for(int i = layersInDrawingOrder.Length - 1; i > -1; i--)
            {
                tempArray[indexCounter] = layersInDrawingOrder[i];
                tempArray[indexCounter].position = Vector2.Zero;
                indexCounter++;
            }

            layersInDrawingOrder = tempArray;
        }
Ejemplo n.º 38
0
 public void CopyToLayer(BackgroundLayer layer)
 {
     layer.Color = m_color;
 }
Ejemplo n.º 39
0
 public void CopyFromLayer(BackgroundLayer layer)
 {
     m_color = layer.Color;
 }
Ejemplo n.º 40
0
		/// <summary>
		/// Draws all visible backgrounds in a given layer that are a part of this collection using the given palette information.
		/// </summary>
		/// <param name="layer">The layer of backgrounds to draw.</param>
		/// <param name="palettefx">The palette information used in drawing.</param>
		public void Draw(BackgroundLayer layer, Combat.PaletteFx palettefx)
		{
			foreach (Backgrounds.Base background in this)
			{
				if (background.Layer == layer && background.IsVisible == true) background.Draw(palettefx);
			}
		}