当前位置: 首页>>代码示例>>C#>>正文


C# Sector.GetObjects方法代码示例

本文整理汇总了C#中Sector.GetObjects方法的典型用法代码示例。如果您正苦于以下问题:C# Sector.GetObjects方法的具体用法?C# Sector.GetObjects怎么用?C# Sector.GetObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sector的用法示例。


在下文中一共展示了Sector.GetObjects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SectorRenderer

    public SectorRenderer(Application application, Level level, Sector sector)
    {
        this.application = application;
        this.level = level;
        this.sector = sector;
        Layer layer = new Layer();

        foreach(IDrawableLayer IDrawableLayer in sector.GetObjects(typeof(IDrawableLayer))) {
            Node node = IDrawableLayer.GetSceneGraphNode();
            if (IDrawableLayer is Tilemap)	//Special handling for tilemaps
                node = new TilemapNode((Tilemap) IDrawableLayer, level.Tileset);
            ColorNode colorNode = new ColorNode(node, new Color(1f, 1f, 1f, 1f), true);
            layer.Add(IDrawableLayer.Layer, colorNode);
            colors[IDrawableLayer] = colorNode;
        }

        objectsNode = new NodeWithChilds();
        objectsColorNode = new ColorNode(objectsNode, new Color(1f, 1f, 1f, 1f));
        layer.Add(1, objectsColorNode);

        foreach(IObject Object in sector.GetObjects(typeof(IObject))) {
            Node node = Object.GetSceneGraphNode();
            if(node != null)
                objectsNode.AddChild(node);
        }

        // fill remaining place with one color
        sectorFill = new SceneGraph.Rectangle();
        sectorFill.Fill = true;
        ColorNode color = new ColorNode(sectorFill, new Drawing.Color(0.4f, 0.3f, 0.4f));
        layer.Add(-10000, color);

        // draw border around sector...
        sectorBBox = new SceneGraph.Rectangle();
        sectorBBox.Fill = false;
        color = new ColorNode(sectorBBox, new Drawing.Color(1, 0.3f, 1));
        layer.Add(1000, color);

        // draw border around selected layer...
        color = new ColorNode(new TilemapBorder(application), new Drawing.Color(1, 1, 0));
        layer.Add(1001, color);

        OnSizeChanged(sector);

        this.SceneGraphRoot = layer;

        sector.ObjectAdded += OnObjectAdded;
        sector.ObjectRemoved += OnObjectRemoved;
        sector.SizeChanged += OnSizeChanged;
        application.TilemapChanged += OnTilemapChanged;
        //TODO: It should be possible to iterate over all (currently present?) types that implements ILayer.. How?
        FieldOrProperty.AnyFieldChanged += OnFieldChanged;
    }
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:53,代码来源:SectorRenderer.cs

示例2: SectorRenderer

    public SectorRenderer(Level level, Sector sector)
    {
        this.level = level;
        Layer layer = new Layer();

        backgroundNode = new NodeWithChilds();
        backgroundColorNode = new ColorNode(backgroundNode, new Color(1f, 1f, 1f, 1f));
        layer.Add(-900, backgroundColorNode);
        foreach(Background background in sector.GetObjects(typeof(Background))) {
            Node node = background.GetSceneGraphNode();
            if(node == null) continue;
            backgroundNode.AddChild(node);
        }

        foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
            Node node = new TilemapNode(tilemap, level.Tileset);
            ColorNode colorNode = new ColorNode(node, new Color(1f, 1f, 1f, 1f));
            layer.Add(tilemap.ZPos, colorNode);
            colors[tilemap] = colorNode;
        }

        objectsNode = new NodeWithChilds();
        objectsColorNode = new ColorNode(objectsNode, new Color(1f, 1f, 1f, 1f));
        layer.Add(1, objectsColorNode);

        foreach(IObject Object in sector.GetObjects(typeof(IObject))) {
            Node node = Object.GetSceneGraphNode();
            if(node != null)
                objectsNode.AddChild(node);
        }

        // draw border around sector...
        sectorFill = new SceneGraph.Rectangle();
        sectorFill.Fill = true;
        ColorNode color = new ColorNode(sectorFill, new Drawing.Color(0.4f, 0.3f, 0.4f));
        layer.Add(-10000, color);

        sectorBBox = new SceneGraph.Rectangle();
        sectorBBox.Fill = false;
        color = new ColorNode(sectorBBox, new Drawing.Color(1, 0.3f, 1));
        layer.Add(1000, color);

        OnSizeChanged(sector);

        this.SceneGraphRoot = layer;

        sector.ObjectAdded += OnObjectAdded;
        sector.ObjectRemoved += OnObjectRemoved;
        sector.SizeChanged += OnSizeChanged;

        Drag.DestSet(this, DestDefaults.All, ObjectListWidget.DragTargetEntries, Gdk.DragAction.Default);
        DragMotion += OnDragMotion;
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:53,代码来源:SectorRenderer.cs

示例3: ResizeDialog

    public ResizeDialog(Sector sector, IEditorApplication app)
    {
        this.sector = sector;
        application = app;
        Glade.XML gxml = new Glade.XML("editor.glade", "resizeDialog");
        gxml.Autoconnect(this);

        if(resizeDialog == null || WidthEntry == null || HeightEntry == null)
            throw new Exception("Couldn't load resize Dialog");

        uint width = 0;
        uint height = 0;
        foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
            if(tilemap.Width > width)
                width = tilemap.Width;
            if(tilemap.Height > height)
                height = tilemap.Height;
        }
        WidthEntry.Text = width.ToString();
        HeightEntry.Text = height.ToString();

        resizeDialog.ShowAll();
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:23,代码来源:ResizeDialog.cs

示例4: CheckIds

    public static void CheckIds(Application application, Sector sector, bool AlertGood)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder("These tilemaps have bad ids in sector " + sector.Name + ":");
        List<int> invalidtiles;
        // Any bad found yet?
        bool bad = false;
        foreach (Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
            invalidtiles = CheckIds(tilemap, application.CurrentLevel.Tileset);
            if (invalidtiles.Count != 0) {
                bad = true;
                if (String.IsNullOrEmpty(tilemap.Name))
                    sb.Append(Environment.NewLine + "Tilemap (" + tilemap.Layer + ")");
                else
                    sb.Append(Environment.NewLine + tilemap.Name + " (" + tilemap.Layer + ")");
            }
        }

        MessageType msgtype;
        string message;
        if (! bad) {
            if (! AlertGood)
                return;
            msgtype = MessageType.Info;
            message = "No invalid tile ids in any tilemap in sector " + sector.Name + ".";
        } else {
            msgtype = MessageType.Warning;
            message = sb.ToString();
        }
        MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent,
                                             msgtype, ButtonsType.Close, message);
        md.Run();
        md.Destroy();
    }
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:33,代码来源:QACheck.cs

示例5: OnSizeChanged

    public void OnSizeChanged(Sector sector)
    {
        uint width = 0;
        uint height = 0;
        foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
            if(tilemap.Width > width)
                width = tilemap.Width;
            if(tilemap.Height > height)
                height = tilemap.Height;
        }

        sectorBBox.Rect = new RectangleF(-1, -1,
                                         width * Tileset.TILE_WIDTH + 1,
                                         height * Tileset.TILE_HEIGHT + 1);
        sectorFill.Rect = new RectangleF(-1, -1,
                                         width * Tileset.TILE_WIDTH + 1,
                                         height * Tileset.TILE_HEIGHT + 1);
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:18,代码来源:SectorRenderer.cs


注:本文中的Sector.GetObjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。