• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IRenderContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RenderView

        public Response RenderView(ViewLocationResult viewLocationResult, dynamic model, IRenderContext renderContext)
        {
            var response = new HtmlResponse();

            var html = renderContext.ViewCache.GetOrAdd(viewLocationResult, result =>
                                                                                {
                                                                                    string markDown =
                                                                                        viewLocationResult.Contents()
                                                                                                          .ReadToEnd();


                                                                                    var parser = new Markdown();
                                                                                    return parser.Transform(markDown);
                                                                                });


            var serverHtml = ParagraphSubstitution.Replace(html, "$1");

            var renderHtml = this.engineWrapper.Render(serverHtml, model, new MarkdownViewEngineHost(new NancyViewEngineHost(renderContext), renderContext));

            response.Contents = stream =>
            {
                var writer = new StreamWriter(stream);
                writer.Write(renderHtml);
                writer.Flush();
            };

            return response;
        }
开发者ID:jchannon,项目名称:Nancy.ViewEngines.Markdown,代码行数:29,代码来源:MarkDownEngine.cs


示例2: RenderView

        /// <summary>
        /// Renders the view.
        /// </summary>
        /// <param name="viewLocationResult">A <see cref="ViewLocationResult"/> instance, containing information on how to get the view template.</param>
        /// <param name="model">The model that should be passed into the view</param>
        /// <param name="renderContext"></param>
        /// <returns>A delegate that can be invoked with the <see cref="Stream"/> that the view should be rendered to.</returns>
        public Action<Stream> RenderView(ViewLocationResult viewLocationResult, dynamic model, IRenderContext renderContext)
        {
            return stream =>{

                var templateManagerProvider =
                    new TemplateManagerProvider()
                        .WithLoader(new TemplateLoader(viewLocationResult.Contents.Invoke()));

                var templateManager =
                    templateManagerProvider.GetNewManager();

                var template = renderContext.ViewCache.GetOrAdd(
                    viewLocationResult,
                    x => templateManager.GetTemplate(string.Empty));

                var context = new Dictionary<string, object> { { "Model", model } };
                var reader = template.Walk(templateManager, context);

                var writer =
                    new StreamWriter(stream);

                writer.Write(reader.ReadToEnd());
                writer.Flush();
            };
        }
开发者ID:nuxleus,项目名称:Nancy,代码行数:32,代码来源:NDjangoViewEngine.cs


示例3: RazorViewEngineFixture

        public RazorViewEngineFixture()
        {
            this.configuration = A.Fake<IRazorConfiguration>();
            this.engine = new RazorViewEngine(this.configuration);

            var cache = A.Fake<IViewCache>();
            A.CallTo(() => cache.GetOrAdd(A<ViewLocationResult>.Ignored, A<Func<ViewLocationResult, Func<NancyRazorViewBase>>>.Ignored))
                .ReturnsLazily(x =>
                {
                    var result = x.GetArgument<ViewLocationResult>(0);
                    return x.GetArgument<Func<ViewLocationResult, Func<NancyRazorViewBase>>>(1).Invoke(result);
                });

            this.renderContext = A.Fake<IRenderContext>();
            A.CallTo(() => this.renderContext.ViewCache).Returns(cache);
            A.CallTo(() => this.renderContext.LocateView(A<string>.Ignored, A<object>.Ignored))
                .ReturnsLazily(x =>
                {
                    var viewName = x.GetArgument<string>(0);
                    return FindView(viewName); ;
                });

            this.rootPathProvider = A.Fake<IRootPathProvider>();
            A.CallTo(() => this.rootPathProvider.GetRootPath()).Returns(Path.Combine(Environment.CurrentDirectory, "TestViews"));

            this.fileSystemViewLocationProvider = new FileSystemViewLocationProvider(this.rootPathProvider, new DefaultFileSystemReader());
        }
开发者ID:GraemeF,项目名称:Nancy,代码行数:27,代码来源:RazorViewEngineFixture.cs


示例4: Render

        public override void Render(IGameContext gameContext, IRenderContext renderContext)
        {
            base.Render(gameContext, renderContext);

            // For each of the chunk AIs, process them.  It's not ideal to have this in
            // the Render() call, but some AIs need access to the render context so that
            // they can do bounding frustum checks to find out what's on screen.
            using (this.m_Profiler.Measure("tychaia-chunk_ai"))
            {
                foreach (var ai in this.m_ChunkAI)
                {
                    var result = ai.Process(this.m_World, this, gameContext, renderContext);
                    if (result != null)
                    {
                        this.m_ChunksToRenderNext = result;
                    }
                }
            }

            // Find the chunk that belongs at this position.
            using (this.m_Profiler.Measure("tychaia-chunk_render"))
            {
                foreach (var chunk in this.m_ChunksToRenderNext)
                {
                    if (chunk != null)
                    {
                        this.m_ChunkRenderer.Render(renderContext, chunk);
                    }
                }
            }
        }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:31,代码来源:ChunkManagerEntity.cs


示例5: Render

        /// <summary>
        /// Renders the ocean
        /// </summary>
        /// <param name="context">Rendering context</param>
        public override void Render( IRenderContext context )
        {
            if ( Planet == null || Planet.PlanetModel.OceanModel == null )
            {
                return;
            }

            GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.Begin( );

            float seaLevel = ( SpherePlanet.PlanetModel.Radius + Planet.PlanetModel.OceanModel.SeaLevel ).ToRenderUnits;
            seaLevel /= 10.0f;
            Graphics.Renderer.PushTransform( TransformType.LocalToWorld );
            Graphics.Renderer.Scale( TransformType.LocalToWorld, seaLevel, seaLevel, seaLevel );

            m_WaveAnimation.UpdateAnimation( context.RenderTime );
            m_Technique.Effect.Parameters[ "OceanTexture0" ].Set( m_WaveAnimation.SourceTexture );
            m_Technique.Effect.Parameters[ "OceanTexture1" ].Set( m_WaveAnimation.DestinationTexture );
            m_Technique.Effect.Parameters[ "OceanTextureT" ].Set( m_WaveAnimation.LocalT );

            context.ApplyTechnique( m_Technique, m_OceanGeometry );

            Graphics.Renderer.PopTransform( TransformType.LocalToWorld );

            GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.End( );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:29,代码来源:SpherePlanetOceanRenderer.cs


示例6: Render

        public override void Render(IGameContext gameContext, IRenderContext renderContext)
        {
            base.Render(gameContext, renderContext);

            if (renderContext.IsCurrentRenderPass<I2DDirectRenderPass>())
            {
                if (_analyzerEntity.TopLeftNormalized != null && _analyzerEntity.TopRightNormalized != null &&
                    _analyzerEntity.BottomLeftNormalized != null && _analyzerEntity.BottomRightNormalized != null)
                {
                    _cachedTopLeft = _analyzerEntity.TopLeftNormalized;
                    _cachedTopRight = _analyzerEntity.TopRightNormalized;
                    _cachedBottomLeft = _analyzerEntity.BottomLeftNormalized;
                    _cachedBottomRight = _analyzerEntity.BottomRightNormalized;
                }

                if (_cachedTopLeft != null && _cachedTopRight != null &&
                    _cachedBottomLeft != null && _cachedBottomRight != null)
                { 
                    _warpFromPolygonEffect.Effect.Parameters["TopLeft"].SetValue(_cachedTopLeft.Value);
                    _warpFromPolygonEffect.Effect.Parameters["TopRight"].SetValue(_cachedTopRight.Value);
                    _warpFromPolygonEffect.Effect.Parameters["BottomLeft"].SetValue(_cachedBottomLeft.Value);
                    _warpFromPolygonEffect.Effect.Parameters["BottomRight"].SetValue(_cachedBottomRight.Value);
                    _warpFromPolygonEffect.Effect.Parameters["Alpha"].SetValue(_alpha);

                    _graphicsBlit.Blit(
                        renderContext,
                        _webcamEntity.VideoCaptureFrame,
                        null,
                        _warpFromPolygonEffect.Effect,
                        BlendState.AlphaBlend);
                }
            }
        }
开发者ID:hach-que,项目名称:Augmented-Board-Game,代码行数:33,代码来源:BoardRendererEntity.cs


示例7: RenderRow

 public override void RenderRow (IRenderContext context, int rowIndex, StatusType statusType, int width, int height)
 {
     if (statusType == StatusType.Normal && rowIndex % 2 != 0) {
         context.Theme.RenderRule (context.Context, width, height);
     }
     base.RenderRow (context, rowIndex, statusType);
 }
开发者ID:lunchtimemama,项目名称:hyena.rendering,代码行数:7,代码来源:RuledRowRenderer.cs


示例8: Render

 /// <summary>
 /// Internally called by <see cref="SensorEngineHook"/> to update sensors
 /// during the render step.
 /// </summary>
 /// <param name="gameContext">The current game context.</param>
 /// <param name="renderContext">The current render context.</param>
 public void Render(IGameContext gameContext, IRenderContext renderContext)
 {
     foreach (var sensor in _sensors)
     {
         sensor.Render(gameContext, renderContext);
     }
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:13,代码来源:DefaultSensorEngine.cs


示例9: RenderWireframeCube

 public void RenderWireframeCube(
     IRenderContext renderContext,
     Microsoft.Xna.Framework.BoundingBox boundingBox,
     Color? color = null)
 {
     this.RenderWireframeCube(renderContext, boundingBox.ToProtogame(), color);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:7,代码来源:DefaultDebugCubeRenderer.cs


示例10: Render

        /// <summary>
        /// Renders the polygon annotation.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="model">The plot model.</param>
        public override void Render(IRenderContext rc, PlotModel model)
        {
            base.Render(rc, model);

            this.screenPosition = this.Transform(this.X, this.Y);

            // clip to the area defined by the axes
            var clippingRectangle = this.GetClippingRect();

            rc.DrawMarker(clippingRectangle, this.screenPosition, this.Shape, this.CustomOutline, this.Size, this.Fill, this.Stroke, this.StrokeThickness);

            if (!string.IsNullOrEmpty(this.Text))
            {
                var dx = -(int)this.TextHorizontalAlignment * (this.Size + this.TextMargin);
                var dy = -(int)this.TextVerticalAlignment * (this.Size + this.TextMargin);
                var textPosition = this.screenPosition + new ScreenVector(dx, dy);
                rc.DrawClippedText(
                    clippingRectangle,
                    textPosition,
                    this.Text,
                    this.ActualTextColor,
                    this.ActualFont,
                    this.ActualFontSize,
                    this.ActualFontWeight,
                    this.TextRotation,
                    this.TextHorizontalAlignment,
                    this.TextVerticalAlignment);
            }
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:34,代码来源:PointAnnotation.cs


示例11: Process

        public ClientChunk[] Process(
            TychaiaGameWorld world, 
            ChunkManagerEntity manager, 
            IGameContext gameContext, 
            IRenderContext renderContext)
        {
            foreach (
                var position in
                    this.m_PredeterminedChunkPositions.GetPurgableAbsolutePositions(
                        new Vector3(
                            world.IsometricCamera.Chunk.X,
                            world.IsometricCamera.Chunk.Y,
                            world.IsometricCamera.Chunk.Z)))
            {
                var chunk = world.ChunkOctree.Get((long)position.X, (long)position.Y, (long)position.Z);
                if (chunk != null)
                {
                    Console.WriteLine("FIXME: PURGING CHUNK");

                    // chunk.Purge();
                }
            }

            return null;
        }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:25,代码来源:PredeterminedChunkPurgerAI.cs


示例12: CurrentRequestSessions

        /// <summary>
        /// Generates some script tags that you insert into your view.
        /// You should probably call this from a helper depending on your view engine.
        /// </summary>
        /// <param name="renderContext">The current Nancy Render Context</param>
        /// <returns></returns>
        public static string CurrentRequestSessions(IRenderContext renderContext)
        {
            var rootUrl = renderContext.ParsePath("~" + ModulePath) + "/";
            var sessionIdList = GetCurrentSessionIdList(renderContext.Context);

            return CurrentRequestSessions(rootUrl, sessionIdList);
        }
开发者ID:thefringeninja,项目名称:randy,代码行数:13,代码来源:RavenProfiler.cs


示例13: RenderText

 public void RenderText(IRenderContext context, Vector2 position, string text, FontAsset font,
     HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left,
     VerticalAlignment verticalAlignment = VerticalAlignment.Top, Color? textColor = null, bool renderShadow = true,
     Color? shadowColor = null)
 {
     throw new NotSupportedException();
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:7,代码来源:Null2DRenderUtilities.cs


示例14: RenderBelow

 public void RenderBelow(IGameContext gameContext, IRenderContext renderContext)
 {
     using (this.m_Profiler.Measure("clear"))
     {
         gameContext.Graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
     }
 }
开发者ID:RedpointGames,项目名称:Protogame.Template.Platformer,代码行数:7,代码来源:PROJECT_SAFE_NAMEWorld.cs


示例15: RenderText

 public void RenderText(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix matrix,
     string text, FontAsset font, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left,
     VerticalAlignment verticalAlignment = VerticalAlignment.Top, Color? textColor = null, bool renderShadow = true,
     Color? shadowColor = null)
 {
     throw new NotSupportedException();
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:7,代码来源:Null3DRenderUtilities.cs


示例16: SvgRenderContext

 /// <summary>
 /// Initializes a new instance of the <see cref="SvgRenderContext"/> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="textMeasurer">The text measurer.</param>
 public SvgRenderContext(string path, double width, double height, IRenderContext textMeasurer)
 {
     this.w = new SvgWriter(path, width, height);
     this.Width = width;
     this.Height = height;
     this.TextMeasurer = textMeasurer;
 }
开发者ID:jgodinez,项目名称:OxyPlot.2DGraphLib.MonoTouch,代码行数:14,代码来源:SvgRenderContext.cs


示例17: SingleScreenSpaceShadow

 public SingleScreenSpaceShadow(IRenderContext context)
     : base(context)
 {
     lspsmLightCamera = new LspsmLightCamera();
     lightCameraFrustum = new BoundingFrustum(Matrix.Identity);
     shadowCasters = new List<Actor>();
 }
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:7,代码来源:SingleScreenSpaceShadow.cs


示例18: RenderDebug

        public void RenderDebug(IGameContext gameContext, IRenderContext renderContext, Agent agent, I2DRenderUtilities twoDRenderUtilities)
        {
            var wndPos = new Vector2(this.WanderDistance, 0);
            var wldPos = agent.Project(wndPos);

            for (var i = 0; i < 10; i++)
            {
                var r = MathHelper.ToRadians(36 * i);
                var r2 = MathHelper.ToRadians(36 * (i + 1));
                twoDRenderUtilities.RenderLine(
                    renderContext,
                    wldPos + (new Vector2((float)Math.Sin(r), (float)Math.Cos(r)) * this.WanderRadius),
                    wldPos + (new Vector2((float)Math.Sin(r2), (float)Math.Cos(r2)) * this.WanderRadius),
                    Color.Green);
            }

            wndPos = this.m_WanderTarget + new Vector2(this.WanderDistance, 0);
            wldPos = agent.Project(wndPos);

            for (var i = 0; i < 10; i++)
            {
                var r = MathHelper.ToRadians(36 * i);
                var r2 = MathHelper.ToRadians(36 * (i + 1));
                twoDRenderUtilities.RenderLine(
                    renderContext,
                    wldPos + (new Vector2((float)Math.Sin(r), (float)Math.Cos(r)) * 3),
                    wldPos + (new Vector2((float)Math.Sin(r2), (float)Math.Cos(r2)) * 3),
                    Color.Red);
            }
        }
开发者ID:johnsonc,项目名称:Protogame,代码行数:30,代码来源:WanderAI.cs


示例19: Render

        public void Render(IGameContext gameContext, IRenderContext renderContext, Rectangle rectangle)
        {
            if (!_networkEngine.GetRecentFrames().Any())
            {
                return;
            }

            var recent = _networkEngine.GetRecentFrames().Last();

            _sentSampler.Sample(
                recent.BytesSentByMessageType,
                recent.MessagesSentByMessageType,
                rectangle.Width);

            _receivedSampler.Sample(
                recent.BytesReceivedByMessageType,
                recent.MessagesReceivedByMessageType,
                rectangle.Width);
            
            _sentSampler.Render(
                renderContext,
                new Rectangle(
                    rectangle.X,
                    rectangle.Y,
                    rectangle.Width,
                    _sentSampler.Height));

            _receivedSampler.Render(
                renderContext,
                new Rectangle(
                    rectangle.X,
                    rectangle.Y + _sentSampler.Height,
                    rectangle.Width,
                    _receivedSampler.Height));
        }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:35,代码来源:NetworkTrafficProfilerVisualiser.cs


示例20: Render

        /// <summary>
        /// Renders the Series on the specified rendering context.
        /// </summary>
        /// <param name="rc">
        /// The rendering context.
        /// </param>
        /// <param name="model">
        /// The model.
        /// </param>
        public override void Render(IRenderContext rc, PlotModel model)
        {
            this.MovePointsToItems();

            // Let the base class draw the rectanges.
            base.Render(rc, model);
        }
开发者ID:hut104,项目名称:ApsimX,代码行数:16,代码来源:ColumnXYSeries.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IRenderable类代码示例发布时间:2022-05-24
下一篇:
C# IRemoteClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap