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


C# RenderingContext类代码示例

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


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

示例1: RenderPlaceholder

		public virtual void RenderPlaceholder(object model, string key, string index, RenderingContext context)
		{
			if (!string.IsNullOrEmpty(index))
				key = string.Join("_", key, index);

			ViewDefinition definition;
			if (!context.TryGetData("siteDefinition", out definition))
				throw new InvalidOperationException("The context must contain a siteDefinition to use the placeholder helper.");

			if (definition.Placeholder == null)
				return;

			ViewDefinition[] definitions;
			if (!definition.Placeholder.TryGetValue(key, out definitions))
				return;

			foreach (var placeholderConfig in definitions)
			{
				// TODO: Move to view definition
				var ctx = new RenderingContext(context.Writer, context);
				ctx.Data["siteDefinition"] = placeholderConfig;

				placeholderConfig.Render(this, model, ctx);
			}
		}
开发者ID:namics,项目名称:TerrificNet,代码行数:25,代码来源:DefaultTerrificTemplateHandler.cs

示例2: RenderScene

        public void RenderScene(RenderingContext context)
        {
            Ensure.That("context", context).IsNotNull();

            //// transforms from image space into camera space
            //var imageMatrix = Matrix.Scaling(1d / context.Target.Width, 1d / context.Target.Height, 1);

            foreach (var pixel in context.Target.GetPixels()) {
                var colorAccumulator = Color.Black;

                foreach (var pixelSpaceSample in _pixelSampleGenerator.GenerateSamples(context.SamplesPerPixel)) {

                    var imageSpaceSample = new Point(pixel.X + pixelSpaceSample.X, pixel.Y + pixelSpaceSample.Y, 1);

                    var projectionSpaceRay = new Ray(context.ImageMatrix * imageSpaceSample, Vector.UnitZ);
                    var cameraSpaceRay = context.ProjectionMatrix * projectionSpaceRay;

                    // TODO: transform camera space ray into world space

                    colorAccumulator += _algorithm.DetermineRayColor(cameraSpaceRay, context.World);
                }

                context.Target.SetPixelColor(pixel, colorAccumulator / context.SamplesPerPixel);
            }
        }
开发者ID:pritisutar,项目名称:kelly,代码行数:25,代码来源:TracingRenderer.cs

示例3: RenderModule

        public virtual void RenderModule(string moduleId, string skin, RenderingContext context, string dataVariation)
		{
			string variation;
			object variationObj;
            if (string.IsNullOrEmpty(dataVariation) && context.Data.TryGetValue("data_variation", out variationObj))
                variation = variationObj as string;
            else
                variation = dataVariation;

			var moduleDefinition = _moduleRepository.GetModuleDefinitionByIdAsync(moduleId).Result;
			if (moduleDefinition != null)
			{
				TemplateInfo templateInfo;
				if (string.IsNullOrEmpty(skin) || moduleDefinition.Skins == null ||
					!moduleDefinition.Skins.TryGetValue(skin, out templateInfo))
					templateInfo = moduleDefinition.DefaultTemplate;

				var view = _viewEngine.CreateViewAsync(templateInfo).Result;
				if (view != null)
				{
					var moduleModel = _modelProvider.GetModelForModuleAsync(moduleDefinition, variation).Result;
					if (context.Data.ContainsKey("siteDefinition") && context.Data.ContainsKey("short_module"))
						context.Data["siteDefinition"] = JsonConvert.DeserializeObject<ModuleViewDefinition>(JsonConvert.SerializeObject(moduleModel));

					view.Render(moduleModel, new RenderingContext(context.Writer, context));

					return;
				}
			}

			throw new ArgumentException("Problem loading template " + moduleId +
										(!string.IsNullOrEmpty(skin) ? "-" + skin : string.Empty));

		}
开发者ID:namics,项目名称:TerrificNet,代码行数:34,代码来源:DefaultTerrificTemplateHandler.cs

示例4: Render

 public override void Render(RenderingContext rc)
 {
     if (!this.poe.InGame || !Settings.GetBool("MinimapIcons"))
     {
         return;
     }
     this.playerPos = this.poe.Player.GetComponent<Positioned>().GridPos;
     Element smallMinimap = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap;
     float scale = 240f;
     Rect clientRect = smallMinimap.GetClientRect();
     Vec2 minimapCenter = new Vec2(clientRect.X + clientRect.W / 2, clientRect.Y + clientRect.H / 2);
     double diag = Math.Sqrt((double)(clientRect.W * clientRect.W + clientRect.H * clientRect.H)) / 2.0;
     List<MinimapIcon>[] array = this.icons;
     for (int i = 0; i < array.Length; i++)
     {
         List<MinimapIcon> list = array[i];
         list.RemoveAll((MinimapIcon x) => !x.Validate());
         foreach (MinimapIcon current in
             from x in list
             where x.WantsToRender()
             select x)
         {
             Vec2 point = this.WorldToMinimap(current.WorldPosition, minimapCenter, diag, scale);
             current.RenderAt(rc, point);
         }
     }
 }
开发者ID:sbradno,项目名称:PoeHud,代码行数:27,代码来源:MinimapRenderer.cs

示例5: Render

	    public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
		{
			Element root = this.GameController.Game.IngameState.UIRoot;


			int yPos = 80;
			int x = 320;
			int[] path = new int[12];
			//var tt = this.GameController.Game.IngameState.IngameUi;
			//for (path[0] = 0x0; path[0] <= 0x0 ; path[0] += 4 )
			//{

			//	var starting_it = tt;
			//	//	.ReadObjectAt<Element>(path[0]);
			//	var v2 = starting_it.GetParentPos();
			//	drawElt(rc, starting_it, new Vec2((int)(v2.X*.75), (int)(v2.Y*.75)), ref x, ref yPos, path, 1);
			//}


			for (path[0] = 0x40; path[0] <= 0x210; path[0] += 4)
			{

				//if (path[0] == 0x120 || path[0] == 0xd8 || path[0] == 0xa0 || path[0] == 0x154 || path[0] == 0x158)
				//	continue;

				Element starting_it = this.GameController.Game.IngameState.IngameUi.ReadObjectAt<Element>(path[0]);
				var v2 = starting_it.GetParentPos();
				drawElt(rc, starting_it, new Vec2((int)(v2.X * .75), (int)(v2.Y * .75)), ref x, ref yPos, path, 1);
			}
		}
开发者ID:TomTer,项目名称:PoeHud,代码行数:30,代码来源:ShowUiHierarchy.cs

示例6: RenderPlaceholder

		public override void RenderPlaceholder(object model, string key, string index, RenderingContext context)
        {
            var isPageEditor = context.GetData("pageEditor", () => false);
            var renderPath = context.GetData("renderPath", () => new List<string>());

            if (isPageEditor) 
            {
                renderPath.Add(key);
                context.Writer.Write("<div class='plh start' id='plh_" +
                                     GetRenderPath(context) +
                                     "'>Placeholder \"" + key +
                                     "\" before</div>");
            }

            base.RenderPlaceholder(model, key, index, context);

            if (isPageEditor)
            {
                context.Writer.Write("<div class='plh end' id='plh_" +
                                     GetRenderPath(context) +
                                     "'>Placeholder \"" + key +
                                     "\" after</div>");

                renderPath.Remove(key);
            }
        }
开发者ID:TerrificNet,项目名称:TerrificNet,代码行数:26,代码来源:PageEditDefaultTerrificTemplateHandler.cs

示例7: Render

        public Image Render()
        {
            var renderingContext = new RenderingContext( this );
            renderingContext.Render();

            return renderingContext.GetImage();
        }
开发者ID:bg0jr,项目名称:Maui,代码行数:7,代码来源:GenericStockChart.cs

示例8: RenderModule

        public override void RenderModule(string moduleId, string skin, RenderingContext context)
        {
            var renderPath = context.GetData("renderPath", () => new List<string>());
            var isPageEditor = context.GetData("pageEditor", () => false);

            var modId = new Regex("/[^/]+$").Match(moduleId).Value.Substring(1);
            var path = "";
            if (isPageEditor)
            {
                renderPath.Add(modId);
                path = GetRenderPath(context);
                context.Writer.Write("<div class='plh module start' data-module-id='" + moduleId +
                                     "' data-path='" +
                                     path +
                                     "' data-self='" +
                                     modId +
                                     "' data-index='" +
                                     Guid.NewGuid() + "'>Module \"" +
                                     moduleId +
                                     "\" before <span class='btn-delete' data-toggle='tooltip' data-placement='top' title='Delete module.'><i class='glyphicon glyphicon-remove'></i></span></div>");
            }

            base.RenderModule(moduleId, skin, context);

            if (isPageEditor)
            {
                context.Writer.Write("<div class='plh module end' data-path='" + path + "' data-self='" + modId +
                                     "'>Module \"" +
                                     moduleId + "\" after</div>");

                renderPath.Remove(modId);
            }
        }
开发者ID:TerrificNet,项目名称:TerrificNet,代码行数:33,代码来源:PageEditDefaultTerrificTemplateHandler.cs

示例9: RednerIconsOnLargeMap

        private void RednerIconsOnLargeMap(RenderingContext rc)
        {
            var camera = model.Internal.Game.IngameState.Camera;
            var cw = camera.Width;
            var ch = camera.Height;
            BigMinimap mapWindow = model.Internal.Game.IngameState.IngameUi.Minimap;
            Rect rcMap = mapWindow.GetClientRect();

            Vec2 playerPos = model.Player.GetComponent<Positioned>().GridPos;
            float pPosZ = model.Player.GetComponent<Render>().Z;
            Vec2 screenCenter = new Vec2(rcMap.W / 2, rcMap.H / 2) + new Vec2(rcMap.X, rcMap.Y) + new Vec2((int)mapWindow.ShiftX, (int)mapWindow.ShiftY);
            float diag = (float)Math.Sqrt(cw * cw + ch * ch);

            // const float scale = 1280f;
            var k = cw < 1024 ? 1120 : 1024;
            float scale = (float)k / ch * cw * 3 / 4;

            foreach (MapIcon icon in _getIcons())
            {
                if (ShouldSkipIcon(icon))
                    continue;

                float iZ = icon.Entity.GetComponent<Render>().Z;
                Vec2 point = screenCenter + MapIcon.deltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (int)((iZ - pPosZ) / 10));

                var texture = icon.LargeMapIcon ?? icon.MinimapIcon;
                int size = icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2);
                Rect rect = new Rect(point.X - size / 2, point.Y - size / 2, size, size);
                texture.DrawAt(rc, point, rect);
            }
        }
开发者ID:benjy3gg,项目名称:PoeHud,代码行数:31,代码来源:MapIconsRenderer.cs

示例10: RenderingContextWrapper

        public RenderingContextWrapper(RenderingContext renderingContext)
        {
            if (renderingContext == null)
                throw new ArgumentNullException("renderingContext");

            _renderingContext = renderingContext;
        }
开发者ID:herskinduk,项目名称:Usergroup.SocialConnectedMvc,代码行数:7,代码来源:RenderingContextWrapper.cs

示例11: Render

        public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
        {
            Vec2 pos = mountPoints[UiMountPoint.LeftOfMinimap];

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Player = {0:X8}\r\n", model.Player.Address);
            sb.AppendFormat("TheGame = {0:X8}\r\n", model.Internal.Address);
            sb.AppendFormat("IngameState = {0:X8}\r\n", model.Internal.IngameState.Address);
            sb.AppendFormat("IngameData = {0:X8}\r\n", model.Internal.IngameState.Data.Address);
            sb.AppendFormat("InventoryFrame = {0:X8}\r\n", model.Internal.IngameState.IngameUi.InventoryPanel.Address);

            var w1 = model.Internal.IngameState.IngameUi.InventoryPanel.MainWeaponSlot.GetItemAt();

            //var flasks = model.Internal.IngameState.IngameUi.InventoryPanel.FlasksFrame;
            //for (int i = 0; i < 5; i++)
            //{
            //	var f1 = flasks.GetItemAt(i);
            //	if (f1 != null)
            //		sb.AppendFormat("F{1} = {0}\r\n",String.Join("; ", f1.EnumComponents().Select(kv => String.Format("{0}: {1:X8}", kv.Key, kv.Value))), i + 1);
            //}

            var szText = rc.AddTextWithHeight(pos, sb.ToString(), Color.White, 11, DrawTextFormat.Right);
            Rect box = new Rect(pos.X - szText.X - 5, pos.Y - 5, szText.X + 10, szText.Y + 10);
            rc.AddBox(box, Color.FromArgb(160, 0, 0, 0));

            mountPoints[UiMountPoint.LeftOfMinimap]  = new Vec2(pos.X, pos.Y + szText.Y + 10 + 5);
        }
开发者ID:benjy3gg,项目名称:PoeHud,代码行数:27,代码来源:MainAddresses.cs

示例12: Render

 public override void Render(RenderingContext rc)
 {
     if (!Settings.GetBool("Tooltip") || !Settings.GetBool("Tooltip.ShowItemMods"))
         return;
     Element uiHover = this.poe.Internal.IngameState.UIHover;
     Entity poeEntity = uiHover.AsObject<InventoryItemIcon>().Item;
     if (poeEntity.address == 0 || !poeEntity.IsValid)
         return;
     Tooltip tooltip = uiHover.AsObject<InventoryItemIcon>().Tooltip;
     if (tooltip == null)
         return;
     Element childAtIndex1 = tooltip.GetChildAtIndex(0);
     if (childAtIndex1 == null)
         return;
     Element childAtIndex2 = childAtIndex1.GetChildAtIndex(1);
     if (childAtIndex2 == null)
         return;
     Rect clientRect = childAtIndex2.GetClientRect();
     Rect headerRect = childAtIndex1.GetChildAtIndex(0).GetClientRect();
     if (this.poeEntity == null || this.poeEntity.ID != poeEntity.ID) {
         this.mods = new List<MaxRolls_Current>();
         //List<Poe_ItemMod> impMods = poeEntity.GetComponent<Mods>().ImplicitMods;
         List<ItemMod> expMods = poeEntity.GetComponent<Mods>().ItemMods;
         int ilvl = poeEntity.GetComponent<Mods>().ItemLevel;
         foreach (ItemMod item in expMods)
         {
             this.mods.Add(new MaxRolls_Current(item.Name, item.Level, ilvl));
         }
         this.poeEntity = poeEntity;
     }
     int tooltipBotY=clientRect.Y + clientRect.H;
     int i = tooltipBotY;
     // Implicit mods
     //foreach (Poe_ItemMod item in impMods)
     //{
     //    rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.Name, Color.Yellow, 9, DrawTextFormat.Left);
     //    rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 10, i), item.Level.ToString(), Color.White, 6, DrawTextFormat.Left);
     //    i += 20;
     //}
     foreach (MaxRolls_Current item in this.mods)
     {
         rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.name, item.color, 8, DrawTextFormat.Left);
         i += 20;
         rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max, Color.White, 8, DrawTextFormat.Left);
         rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr, Color.White, 8, DrawTextFormat.Left);
         i += 20;
         if (item.curr2 != null && item.max2 != null)
         {
             rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max2, Color.White, 8, DrawTextFormat.Left);
             rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr2, Color.White, 8, DrawTextFormat.Left);
             i += 20;
         }
     }
     if (i > tooltipBotY)
     {
         Rect helpRect = new Rect(clientRect.X + 1, tooltipBotY, clientRect.W, i - tooltipBotY);
         rc.AddBox(helpRect, Color.FromArgb(220, Color.Black));
     }
 }
开发者ID:sbradno,项目名称:PoeHud,代码行数:59,代码来源:ItemRollsRenderer.cs

示例13: OnPreInit

    protected override void OnPreInit(EventArgs e)
    {
        _renderingContext = RenderingContext.InitializeFromHttpContext();

        InitializeCulture();

        base.OnPreInit(e);
    }
开发者ID:MaxPRafferty,项目名称:JS-E,代码行数:8,代码来源:Page.aspx.cs

示例14: Render

 public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
 {
     int alpha = this.menuVisible ? 255 : 100;
     rc.AddBox(this.bounds, Color.FromArgb(alpha, Color.Gray));
     rc.AddTextWithHeight(new Vec2(Settings.PositionWidth + Settings.AnchorWidth / 2, Settings.PositionHeight + Settings.AnchorHeight / 2), "Menu", Color.Gray, 10, DrawTextFormat.Center | DrawTextFormat.VerticalCenter);
     foreach (BooleanButton current in this.buttons)
         current.Render(rc);
 }
开发者ID:benjy3gg,项目名称:PoeHud,代码行数:8,代码来源:Menu.cs

示例15: RenderModule

		public void RenderModule(string moduleId, string skin, RenderingContext context)
		{
			var mvcContext = context as MvcRenderingContext;
			if (mvcContext == null)
				throw new InvalidOperationException("MvcTerrificTemplateHandler can only be used inside a Mvc application.");

			new HtmlHelper(mvcContext.ViewContext, mvcContext.ViewDataContainer).RenderAction("Index", moduleId);
		}
开发者ID:TerrificNet,项目名称:TerrificNet,代码行数:8,代码来源:MvcTerrificTemplateHandler.cs


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