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


C# Graphics.WorldRenderer类代码示例

本文整理汇总了C#中OpenRA.Graphics.WorldRenderer的典型用法代码示例。如果您正苦于以下问题:C# WorldRenderer类的具体用法?C# WorldRenderer怎么用?C# WorldRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WorldRenderer类属于OpenRA.Graphics命名空间,在下文中一共展示了WorldRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObserverProductionIconsWidget

 public ObserverProductionIconsWidget(World world, WorldRenderer worldRenderer)
     : base()
 {
     this.world = world;
     this.worldRenderer = worldRenderer;
     clocks = new Dictionary<ProductionQueue, Animation>();
 }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:7,代码来源:ObserverProductionIconsWidget.cs

示例2: RenderAfterWorld

        public void RenderAfterWorld(WorldRenderer wr, Actor self)
        {
            Color trailStart = TrailColor;
            Color trailEnd = Color.FromArgb(trailStart.A - 255 / TrailLength, trailStart.R,
                                            trailStart.G, trailStart.B);

            // LocalPlayer is null on shellmap
            ShroudRenderer shroud = null;
            if (self.World.LocalPlayer != null)
                shroud = self.World.LocalPlayer.Shroud;

            for (int i = positions.Count - 1; i >= 1; --i)
            {
                var conPos = positions[i];
                var nextPos = positions[i - 1];

                if (shroud == null ||
                    shroud.IsVisible(OpenRA.Traits.Util.CellContaining(conPos)) ||
                    shroud.IsVisible(OpenRA.Traits.Util.CellContaining(nextPos)))
                {
                    Game.Renderer.LineRenderer.DrawLine(conPos, nextPos, trailStart, trailEnd);

                    trailStart = trailEnd;
                    trailEnd = Color.FromArgb(trailStart.A - 255 / positions.Count, trailStart.R,
                                                trailStart.G, trailStart.B);
                }
            }
        }
开发者ID:geckosoft,项目名称:OpenRA,代码行数:28,代码来源:Contrail.cs

示例3: DrawInner

        public override void DrawInner( WorldRenderer wr )
        {
            if (video == null)
                return;

            if (!(stopped || paused))
            {
                var nextFrame = (int)float2.Lerp(0, video.Frames, Sound.VideoSeekPosition*invLength);
                if (nextFrame > video.Frames)
                {
                    Stop();
                    return;
                }

                while (nextFrame > video.CurrentFrame)
                {
                    video.AdvanceFrame();
                    if (nextFrame == video.CurrentFrame)
                        videoSprite.sheet.Texture.SetData(video.FrameData);
                }
            }

            Game.Renderer.RgbaSpriteRenderer.DrawSprite(videoSprite, videoOrigin, videoSize);

            if (DrawOverlay)
                Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize);
        }
开发者ID:patthoyts,项目名称:OpenRA,代码行数:27,代码来源:VqaPlayerWidget.cs

示例4: Draw

        public void Draw( WorldRenderer wr, Viewport viewport )
        {
            int verticesPerRow = map.Bounds.Width * 4;

            int visibleRows = (int)(viewport.Height * 1f / Game.CellSize / viewport.Zoom + 2);

            int firstRow = (int)(viewport.Location.Y * 1f / Game.CellSize - map.Bounds.Top);
            int lastRow = firstRow + visibleRows;

            if (lastRow < 0 || firstRow > map.Bounds.Height)
                return;

            if (firstRow < 0) firstRow = 0;
            if (lastRow > map.Bounds.Height) lastRow = map.Bounds.Height;

            if (world.RenderedPlayer != null && !world.RenderedShroud.Disabled && world.RenderedShroud.Bounds.HasValue)
            {
                var r = world.RenderedShroud.Bounds.Value;
                if (firstRow < r.Top - map.Bounds.Top)
                    firstRow = r.Top - map.Bounds.Top;

                if (firstRow > r.Bottom - map.Bounds.Top)
                    firstRow = r.Bottom - map.Bounds.Top;
            }

            if( lastRow < firstRow ) lastRow = firstRow;

            Game.Renderer.WorldSpriteRenderer.DrawVertexBuffer(
                vertexBuffer, verticesPerRow * firstRow, verticesPerRow * (lastRow - firstRow),
                PrimitiveType.QuadList, terrainSheet);

            foreach (var r in world.WorldActor.TraitsImplementing<IRenderOverlay>())
                r.Render( wr );
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:34,代码来源:TerrainRenderer.cs

示例5: Render

        public IEnumerable<IRenderable> Render(WorldRenderer wr)
        {
            if (!a.IsInWorld || a.World.FogObscures(a.Location))
                return SpriteRenderable.None;

            return anim.Render(a.CenterPosition, wr.Palette(palette));
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:7,代码来源:CrateEffect.cs

示例6: ObserverSupportPowerIconsWidget

		public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer)
		{
			this.world = world;
			this.worldRenderer = worldRenderer;
			clocks = new Dictionary<string, Animation>();
			icon = new Animation(world, "icon");
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:ObserverSupportPowerIconsWidget.cs

示例7: InitPalette

 public void InitPalette( WorldRenderer wr )
 {
     var info = Rules.Info["player"].Traits.WithInterface<PlayerColorPaletteInfo>()
         .First(p => p.BaseName == Info.PlayerPalette);
     format = info.PaletteFormat;
     wr.AddPalette("colorpicker", wr.GetPalette(info.BasePalette));
 }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:7,代码来源:ColorPickerPaletteModifier.cs

示例8: Render

		public void Render(WorldRenderer wr)
		{
			// Need at least 4 points to smooth the contrail over
			if (length - skip < 4)
				return;

			var wlr = Game.Renderer.WorldLineRenderer;
			var oldWidth = wlr.LineWidth;
			wlr.LineWidth = wr.Viewport.Zoom;

			// Start of the first line segment is the tail of the list - don't smooth it.
			var curPos = trail[Index(next - skip - 1)];
			var curColor = color;
			for (var i = 0; i < length - skip - 4; i++)
			{
				var j = next - skip - i - 2;
				var nextPos = Average(trail[Index(j)], trail[Index(j - 1)], trail[Index(j - 2)], trail[Index(j - 3)]);
				var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);

				if (!world.FogObscures(curPos) && !world.FogObscures(nextPos))
					wlr.DrawLine(wr.ScreenPosition(curPos), wr.ScreenPosition(nextPos), curColor, nextColor);

				curPos = nextPos;
				curColor = nextColor;
			}

			wlr.LineWidth = oldWidth;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:28,代码来源:ContrailRenderable.cs

示例9: IngameMenuLogic

        public IngameMenuLogic(Widget widget, World world, Action onExit, WorldRenderer worldRenderer)
        {
            widget.Get<ButtonWidget>("DISCONNECT").OnClick = () =>
            {
                onExit();
                LeaveGame(world);
            };

            widget.Get<ButtonWidget>("SETTINGS").OnClick = () =>
            {
                widget.Visible = false;
                Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
                {
                    { "onExit", () => widget.Visible = true },
                    { "worldRenderer", worldRenderer },
                });
            };

            widget.Get<ButtonWidget>("MUSIC").OnClick = () =>
            {
                widget.Visible = false;
                Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs { { "onExit", () => { widget.Visible = true; } } });
            };
            widget.Get<ButtonWidget>("RESUME").OnClick = () => onExit();

            widget.Get<ButtonWidget>("SURRENDER").OnClick = () =>
            {
                world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
                onExit();
            };
            widget.Get("SURRENDER").IsVisible = () => world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Undefined;
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:32,代码来源:IngameMenuLogic.cs

示例10: RenderAfterWorld

        public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
        {
            if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
                yield break;

            var jamsMissiles = self.Info.TraitInfoOrDefault<JamsMissilesInfo>();
            if (jamsMissiles != null)
            {
                yield return new RangeCircleRenderable(
                    self.CenterPosition,
                    jamsMissiles.Range,
                    0,
                    Color.FromArgb(128, Color.Red),
                    Color.FromArgb(96, Color.Black));
            }

            var jamsRadar = self.Info.TraitInfoOrDefault<JamsRadarInfo>();
            if (jamsRadar != null)
            {
                yield return new RangeCircleRenderable(
                    self.CenterPosition,
                    jamsRadar.Range,
                    0,
                    Color.FromArgb(128, Color.Blue),
                    Color.FromArgb(96, Color.Black));
            }
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:27,代码来源:RenderJammerCircle.cs

示例11: Render

        public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
        {
            var jamsMissiles = ai.TraitInfoOrDefault<JamsMissilesInfo>();
            if (jamsMissiles != null)
            {
                yield return new RangeCircleRenderable(
                    centerPosition,
                    jamsMissiles.Range,
                    0,
                    Color.FromArgb(128, Color.Red),
                    Color.FromArgb(96, Color.Black));
            }

            var jamsRadar = ai.TraitInfoOrDefault<JamsRadarInfo>();
            if (jamsRadar != null)
            {
                yield return new RangeCircleRenderable(
                    centerPosition,
                    jamsRadar.Range,
                    0,
                    Color.FromArgb(128, Color.Blue),
                    Color.FromArgb(96, Color.Black));
            }

            foreach (var a in w.ActorsWithTrait<RenderJammerCircle>())
                if (a.Actor.Owner.IsAlliedWith(w.RenderPlayer))
                    foreach (var r in a.Trait.RenderAfterWorld(wr))
                        yield return r;
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:29,代码来源:RenderJammerCircle.cs

示例12: DoControlGroup

        public void DoControlGroup(World world, WorldRenderer worldRenderer, int group, Modifiers mods, int MultiTapCount)
        {
            var addModifier = Platform.CurrentPlatform == PlatformType.OSX ? Modifiers.Meta : Modifiers.Ctrl;
            if (mods.HasModifier(addModifier))
            {
                if (actors.Count == 0)
                    return;

                if (!mods.HasModifier(Modifiers.Shift))
                    controlGroups[group].Clear();

                for (var i = 0; i < 10; i++)	/* all control groups */
                    controlGroups[i].RemoveAll(a => actors.Contains(a));

                controlGroups[group].AddRange(actors.Where(a => a.Owner == world.LocalPlayer));
                return;
            }

            var groupActors = controlGroups[group].Where(a => !a.IsDead() && !world.FogObscures(a));

            if (mods.HasModifier(Modifiers.Alt) || MultiTapCount >= 2)
            {
                worldRenderer.Viewport.Center(groupActors);
                return;
            }

            Combine(world, groupActors, mods.HasModifier(Modifiers.Shift), false);
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:28,代码来源:Selection.cs

示例13: TileSelectorLogic

		public TileSelectorLogic(Widget widget, WorldRenderer worldRenderer, Ruleset modRules)
		{
			var tileset = modRules.TileSets[worldRenderer.World.Map.Tileset];

			editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
			panel = widget.Get<ScrollPanelWidget>("TILETEMPLATE_LIST");
			itemTemplate = panel.Get<ScrollItemWidget>("TILEPREVIEW_TEMPLATE");
			panel.Layout = new GridLayout(panel);

			var tileCategorySelector = widget.Get<DropDownButtonWidget>("TILE_CATEGORY");
			var categories = tileset.EditorTemplateOrder;
			Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
			{
				var item = ScrollItemWidget.Setup(template,
					() => tileCategorySelector.Text == option,
					() => { tileCategorySelector.Text = option; IntializeTilePreview(widget, worldRenderer, tileset, option); });

				item.Get<LabelWidget>("LABEL").GetText = () => option;
				return item;
			};

			tileCategorySelector.OnClick = () =>
				tileCategorySelector.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, categories, setupItem);

			tileCategorySelector.Text = categories.First();
			IntializeTilePreview(widget, worldRenderer, tileset, categories.First());
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:27,代码来源:TileSelectorLogic.cs

示例14: MapEditorTabsLogic

        public MapEditorTabsLogic(Widget widget, WorldRenderer worldRenderer)
        {
            var tabContainer = widget.Get("MAP_EDITOR_TAB_CONTAINER");

            var tilesTab = tabContainer.Get<ButtonWidget>("TILES_TAB");
            tilesTab.IsHighlighted = () => menuType == MenuType.Tiles;
            tilesTab.OnClick = () => { menuType = MenuType.Tiles; };

            var overlaysTab = tabContainer.Get<ButtonWidget>("OVERLAYS_TAB");
            overlaysTab.IsHighlighted = () => menuType == MenuType.Layers;
            overlaysTab.OnClick = () => { menuType = MenuType.Layers; };

            var actorsTab = tabContainer.Get<ButtonWidget>("ACTORS_TAB");
            actorsTab.IsHighlighted = () => menuType == MenuType.Actors;
            actorsTab.OnClick = () => { menuType = MenuType.Actors; };

            var tileContainer = widget.Parent.Get<ContainerWidget>("TILE_WIDGETS");
            tileContainer.IsVisible = () => menuType == MenuType.Tiles;

            var layerContainer = widget.Parent.Get<ContainerWidget>("LAYER_WIDGETS");
            layerContainer.IsVisible = () => menuType == MenuType.Layers;

            var actorContainer = widget.Parent.Get<ContainerWidget>("ACTOR_WIDGETS");
            actorContainer.IsVisible = () => menuType == MenuType.Actors;
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:25,代码来源:MapEditorTabsLogic.cs

示例15: ObserverProductionIconsWidget

 public ObserverProductionIconsWidget(World world, WorldRenderer worldRenderer)
 {
     this.world = world;
     this.worldRenderer = worldRenderer;
     clocks = new Dictionary<ProductionQueue, Animation>();
     timestep = world.IsReplay ? world.WorldActor.Trait<MapOptions>().GameSpeed.Timestep : world.Timestep;
 }
开发者ID:OpenRA,项目名称:OpenRA,代码行数:7,代码来源:ObserverProductionIconsWidget.cs


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