상속: OpenRA.Widgets.Widget
예제 #1
0
        protected SpriteWidget(SpriteWidget other)
            : base(other)
        {
            Palette    = other.Palette;
            GetPalette = other.GetPalette;
            GetSprite  = other.GetSprite;

            WorldRenderer = other.WorldRenderer;
        }
예제 #2
0
        public EditorResourceBrush(EditorViewportControllerWidget editorWidget, ResourceTypeInfo resource, WorldRenderer wr)
        {
            this.editorWidget = editorWidget;
            ResourceType = resource;
            worldRenderer = wr;
            world = wr.World;

            preview = editorWidget.Get<SpriteWidget>("DRAG_LAYER_PREVIEW");
            preview.Palette = resource.Palette;
            preview.GetScale = () => worldRenderer.Viewport.Zoom;
            preview.IsVisible = () => editorWidget.CurrentBrush == this;

            var variant = resource.Sequences.FirstOrDefault();
            var sequence = wr.World.Map.Rules.Sequences.GetSequence("resources", variant);
            var sprite = sequence.GetSprite(resource.MaxDensity - 1);
            preview.GetSprite = () => sprite;

            // The preview widget may be rendered by the higher-level code before it is ticked.
            // Force a manual tick to ensure the bounds are set correctly for this first draw.
            Tick();
        }
예제 #3
0
        public EditorResourceBrush(EditorViewportControllerWidget editorWidget, ResourceTypeInfo resource, WorldRenderer wr)
        {
            this.editorWidget = editorWidget;
            ResourceType      = resource;
            worldRenderer     = wr;
            world             = wr.World;

            preview           = editorWidget.Get <SpriteWidget>("DRAG_LAYER_PREVIEW");
            preview.Palette   = resource.Palette;
            preview.GetScale  = () => worldRenderer.Viewport.Zoom;
            preview.IsVisible = () => editorWidget.CurrentBrush == this;

            var variant  = resource.Variants.FirstOrDefault();
            var sequence = wr.World.Map.Rules.Sequences.GetSequence("resources", variant);
            var sprite   = sequence.GetSprite(resource.MaxDensity - 1);

            preview.GetSprite = () => sprite;

            // The preview widget may be rendered by the higher-level code before it is ticked.
            // Force a manual tick to ensure the bounds are set correctly for this first draw.
            Tick();
        }