Пример #1
0
        public override void OnInitialization()
        {
            ImageSource       overlay = new ImageSource(this.Parent.TileSize);
            int               b       = 0;
            Action <int, int> paint   = (x, y) => overlay[x, y] = (new Bunch <Color>(Color.Black, Color.White))[b++ % 2];

            for (int x = 0; x < this.Parent.TileSize.X - 1; x++)
            {
                paint(x, 0);
            }
            for (int y = 0; y < this.Parent.TileSize.Y - 1; y++)
            {
                paint(this.Parent.TileSize.X - 1, y);
            }
            for (int x = this.Parent.TileSize.X - 1; x > 0; x--)
            {
                paint(x, this.Parent.TileSize.Y - 1);
            }
            for (int y = this.Parent.TileSize.Y - 1; y > 0; y--)
            {
                paint(0, y);
            }



            foreach (Areaset a in this.Areasets.Select(item => item.Value))
            {
                CollapseGroup c = new CollapseGroup(FontBase.Consolas, a.Name, new TileGroup(overlay, a, this.Editor.TileEditor, new Point(a.Size.X, a.Size.Y)))
                {
                    Width = this.Size.X * this.Parent.TileSize.X * 2, InnerHeight = a.Size.Y * this.Parent.TileSize.Y * 2
                };
                this.Groups.Add(c);
                this.Children.Add(c);
            }
        }
Пример #2
0
        public override void OnInitialization()
        {
            this.Children.Add(this.EntityEditor);

            Dictionary <string, Bunch <EntityTile> > groups = new Dictionary <string, Bunch <EntityTile> >();

            foreach (EntityType t in this.Entities.Where(item => item.Name != "Decoration"))
            {
                if (!groups.ContainsKey(t.Group))
                {
                    groups[t.Group] = new Bunch <EntityTile>();
                }
                groups[t.Group].Add(new EntityTileNormal(t)
                {
                    Types = this.Entities
                });
            }

            foreach (Areaset a in this.Parent.Areasets.Select(item => item.Value).Where(item => item.Decorations.Count > 0))
            {
                groups["Decoration " + a.Name] = new Bunch <EntityTile>();
                foreach (KeyValuePair <string, ImageSource> decoration in a.Decorations)
                {
                    groups["Decoration " + a.Name].Add(new EntityTileDecoration(a, decoration.Key)
                    {
                        Types = this.Entities
                    });
                }
            }

            foreach (KeyValuePair <string, Bunch <EntityTile> > g in groups.OrderBy(item => item.Key.GetAlphabetIndex()))
            {
                int           height = Meth.Up(g.Value.Count / (double)this.Size.X);
                CollapseGroup c      = new CollapseGroup(FontBase.Consolas, g.Key, new EntityGroup(g.Value, this.Editor.TileEditor, this.EntityEditor, new Point(this.Size.X, height)))
                {
                    InnerHeight = height * this.Parent.TileSize.Y * 2, Width = this.Size.X * this.Parent.TileSize.X * 2
                };
                this.Groups.Add(c);
                this.Children.Add(c);
            }
        }