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); } }
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); } } }
public RenderingContextWrapper(RenderingContext renderingContext) { if (renderingContext == null) throw new ArgumentNullException("renderingContext"); _renderingContext = renderingContext; }
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); } }
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); } }
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); }
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); } }
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)); }
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); } }
public Image Render() { var renderingContext = new RenderingContext( this ); renderingContext.Render(); return renderingContext.GetImage(); }
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); } }
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)); } }
protected override void OnPreInit(EventArgs e) { _renderingContext = RenderingContext.InitializeFromHttpContext(); InitializeCulture(); base.OnPreInit(e); }
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); }
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); }
public override void PrepareToDraw(RenderingContext context) { CameraMatrix = context.camMatrix; Color = Target.Color; Effect.GetTechniqueByIndex(0).GetPassByIndex(0).Apply(Mat3DView.GraphicsDevice.ImmediateContext); Mat3DView.GraphicsDevice.ImmediateContext.InputAssembler.InputLayout = VertexLayout; }
protected internal override void Render(ITerrificTemplateHandler templateHandler, object model, RenderingContext context) { if (context.Data.ContainsKey("data_variation")) context.Data["data_variation"] = DataVariation; else context.Data.Add("data_variation", DataVariation); templateHandler.RenderModule(Module, Skin, context); }
public void Evaluate(object model, RenderingContext context, IDictionary<string, string> parameters) { var templateName = parameters["template"].Trim('"'); var skin = string.Empty; if (parameters.ContainsKey("skin")) skin = parameters["skin"].Trim('"'); _handler.RenderModule(templateName, skin, context); }
public override void PrepareToDraw(RenderingContext context) { if (!textureSent && Target.Texture != null) DiffuseTexture = Target.Texture; CameraMatrix = context.camMatrix; Effect.GetTechniqueByIndex(0).GetPassByIndex(0).Apply(Mat3DView.GraphicsDevice.ImmediateContext); Mat3DView.GraphicsDevice.ImmediateContext.InputAssembler.InputLayout = VertexLayout; }
public void ShouldReturnNullIfNotSearchResult(Item item) { var context = new RenderingContext(); context.Rendering = new Rendering(); context.Rendering.Item = item; ContextService.Get().Push(context); var repository = new SearchSettingsRepository(); var searchSettings = repository.Get(); searchSettings.Should().BeNull(); }
public void Evaluate(object model, RenderingContext context, IDictionary<string, string> parameters) { var gridStack = GridStack.FromContext(context); double ratio = GetValue(parameters, "ratio", 1); double margin = GetValue(parameters, "margin", 0); double padding = GetValue(parameters, "padding", 0); double? componentPadding = GetValueNullable(parameters, "component-padding"); double width = GetValue(parameters, "width", gridStack.Current.Width); gridStack.Push((int)(((width - margin) * ratio) - padding), componentPadding); }
public override void PrepareToDraw(RenderingContext context) { if (!textureSent && Target.Texture != null) DiffuseTexture = Target.Texture; CameraMatrix = context.camMatrix; World = Matrix.Translation((float)Target.PositionX, (float)Target.PositionY, (float)Target.PositionZ); Color = Target.Color; Effect.GetTechniqueByIndex(0).GetPassByIndex(0).Apply(Mat3DView.GraphicsDevice.ImmediateContext); Mat3DView.GraphicsDevice.ImmediateContext.InputAssembler.InputLayout = VertexLayout; }
public void ShouldInitObjectProperties() { var context = new RenderingContext(); var rendering = new Rendering(); var properties = new RenderingProperties(rendering); properties["Parameters"] = "property1=5&property2=10"; context.Rendering = new Rendering() {Properties = properties}; var repository = new RenderingPropertiesRepository(); ContextService.Get().Push(context); var resultObject = repository.Get<Model>(); resultObject.Property1.ShouldBeEquivalentTo(5); resultObject.Property2.ShouldBeEquivalentTo(10); }
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints) { if (!model.InGame) return; var mapRoot = model.Internal.IngameState.IngameUi.Minimap; if( Settings.ShowOn.MiniMap && mapRoot.SmallMinimap.IsVisible ) RenderIconsOnMiniMap(rc, mapRoot.SmallMinimap); if ( Settings.ShowOn.LargeMap && mapRoot.OrangeWords.IsVisible) RednerIconsOnLargeMap(rc); }
private int CalculateWidth(RenderingContext context, IDictionary<string, string> parameters) { double ratio = 1.0; string ratioValue; if (parameters.TryGetValue("ratio", out ratioValue)) { if (!double.TryParse(ratioValue, out ratio)) ratio = 1.0; } var gridStack = GridStack.FromContext(context); return (int)(GetWidth(gridStack) * ratio); }
public void Get_NoHttpContextQuery_ShouldReturnNull() { var context = new RenderingContext { Rendering = new Rendering { Item = null } }; ContextService.Get().Push(context); var repository = new SearchContextRepository(); var searchContext = repository.Get(); searchContext.Should().BeNull(); }
public override void Render(RenderingContext rc) { if (!Settings.GetBool("XphDisplay") || (this.poe.Player != null && this.poe.Player.GetComponent<Player>().Level >= 100)) { return; } if (!this.hasStarted) { this.startXp = this.poe.Player.GetComponent<Player>().XP; this.startTime = DateTime.Now; this.lastCalcTime = DateTime.Now; this.hasStarted = true; return; } DateTime dtNow = DateTime.Now; TimeSpan delta = dtNow - this.lastCalcTime; if (delta.TotalSeconds > 1.0) { this.poe.Area.CurrentArea.AddTimeSpent(delta); calculateRemainingExp(dtNow); this.lastCalcTime = dtNow; } int fontSize = Settings.GetInt("XphDisplay.FontSize"); int bgAlpha = Settings.GetInt("XphDisplay.BgAlpha"); Rect clientRect = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect(); Vec2 mapWithOffset = new Vec2(clientRect.X - 10, clientRect.Y + 5); int yCursor = 0; Vec2 rateTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y), this.curDisplayString, Color.White, fontSize, DrawTextFormat.Right); yCursor += rateTextSize.Y; Vec2 remainingTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + yCursor), this.curTimeLeftString, Color.White, fontSize, DrawTextFormat.Right); yCursor += remainingTextSize.Y; int thirdLine = mapWithOffset.Y + yCursor; Vec2 areaLevelNote = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, thirdLine), this.poe.Area.CurrentArea.DisplayName, Color.White, fontSize, DrawTextFormat.Right); string strTimer = this.poe.Area.CurrentArea.TimeString; Vec2 timerSize = rc.MeasureString(strTimer, fontSize, DrawTextFormat.Left); yCursor += areaLevelNote.Y; int textWidth = Math.Max( Math.Max(rateTextSize.X, remainingTextSize.X), areaLevelNote.X + timerSize.X + 20 ) + 10; int width = Math.Max(textWidth, Math.Max(clientRect.W, this.overlay.PreloadAlert.Bounds.W)); Rect rect = new Rect(mapWithOffset.X - width + 5, mapWithOffset.Y - 5, width, yCursor + 10); this.Bounds = rect; rc.AddTextWithHeight(new Vec2(rect.X + 5, mapWithOffset.Y), dtNow.ToShortTimeString(), Color.White, fontSize, DrawTextFormat.Left); rc.AddTextWithHeight(new Vec2(rect.X + 5, thirdLine), strTimer, Color.White, fontSize, DrawTextFormat.Left); rc.AddBox(rect, Color.FromArgb(bgAlpha, 1, 1, 1)); }
public override void Render(RenderingContext rc) { if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText")) { return; } Rect clientRect = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect(); Vec2 rightTopAnchor = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H + 5); int y = rightTopAnchor.Y; int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize"); foreach (KeyValuePair<ExileBot.Entity, AlertDrawStyle> kv in this.currentAlerts) { if (!kv.Key.IsValid) continue; string text = GetItemName(kv); if( null == text ) continue; AlertDrawStyle drawStyle = kv.Value; int frameWidth = drawStyle.FrameWidth; Vec2 vPadding = new Vec2(frameWidth + 5, frameWidth); int frameMargin = frameWidth + 2; Vec2 textPos = new Vec2(rightTopAnchor.X - vPadding.X, y + vPadding.Y); var vTextFrame = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right); int iconSize = vTextFrame.Y; bool hasIcon = drawStyle.IconIndex >= 0; int maxHeight = vTextFrame.Y + 2*vPadding.Y + frameMargin; int maxWidth = vTextFrame.X + 2 * vPadding.X + (hasIcon ? iconSize : 0); rc.AddBox(new Rect(rightTopAnchor.X - maxWidth, y, maxWidth, maxHeight), Color.FromArgb(180, 0, 0, 0)); if (hasIcon) { const float iconsInSprite = 4; Rect iconPos = new Rect(textPos.X - iconSize - vTextFrame.X, textPos.Y, iconSize, iconSize); RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1); rc.AddSprite("item_icons.png", iconPos, uv); } if( frameWidth > 0) { Rect frame = new Rect(rightTopAnchor.X - vTextFrame.X - 2*vPadding.X, y, vTextFrame.X + 2*vPadding.X, vTextFrame.Y + 2*vPadding.Y); rc.AddFrame(frame, kv.Value.color, frameWidth); } y += vTextFrame.Y + 2 * vPadding.Y + frameMargin; } }
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints) { Element uiHover = this.model.Internal.IngameState.ElementUnderCursor; 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(); Entity poeEntity = uiHover.AsObject<InventoryItemIcon>().Item; if (poeEntity.Address == 0 || !poeEntity.IsValid) return; if (this._lastHovered == null || this._lastHovered.ID != poeEntity.ID) { this._lastHovered = poeEntity; this._explicitMods = new List<RollValue>(); this._implicitMods = new List<RollValue>(); int ilvl = poeEntity.GetComponent<Mods>().ItemLevel; foreach (ItemMod item in poeEntity.GetComponent<Mods>().ItemMods) this._explicitMods.Add(new RollValue(item, model.Files, ilvl)); foreach (ItemMod item in poeEntity.GetComponent<Mods>().ImplicitMods) this._implicitMods.Add(new RollValue(item, model.Files, ilvl, true)); _quality = poeEntity.GetComponent<Quality>().ItemQuality; Weapon weap = poeEntity.GetComponent<Weapon>(); if (weap.Address != 0) { var attack = weap.Attack; _weaponAttack = new WeaponAttack() { AttackDelay = attack.AttackTime, CritChancePer10K = attack.CritChance, MinDamage = attack.DamageMin, MaxDamage = attack.DamageMax }; } else _weaponAttack = null; } RenderRolls(rc, clientRect); if( _weaponAttack != null && Settings.ShowDps) RenderWeaponStats(rc, clientRect); if (Settings.ShowItemLevel) RenderItemLevel(rc, clientRect); }
public void DemoContent_RenderingContextItemInitialized_ShouldReturnDemoContentView(Db db,IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { //arrange var itemID = ID.NewID; db.Add(new DbItem("ctx",itemID, Templates.DemoContent.ID)); var controller = new DemoController(contact, profile); var context = new RenderingContext(); context.ContextItem = db.GetItem(itemID); ContextService.Get().Push(context); using (new TrackerSwitcher(tracker)) { controller.DemoContent().As<ViewResult>().Model.Should().BeOfType<DemoContent>(); } }
public NodeTag(string filePath, RenderingContext rendering) { FilePath = filePath; Renderings = new List <RenderingContext>(); Renderings.Add(rendering); }
/// <summary> /// Render the Points to OpenGL /// </summary> /// <param name="context"></param> public virtual void Render(ref RenderingContext context) { if (Dirty) { Update(); } if (useGLArray) { int len = Count; Vector3d[] pos = new Vector3d[len]; Vector3d[] nor = new Vector3d[context.UseNormal ? len : 0]; int[] col = new int[context.UseObjectColor ? len : 0]; for (int i = 0; i < Count; i++) { Point3D v = this[i]; pos[i].X = v.Position.X; pos[i].Y = v.Position.Y; pos[i].Z = v.Position.Z; if (context.UseNormal) { nor[i] = v.Normal; } if (context.UseObjectColor) { col[i] = v.Color.ToGLRgba32(); } } int posH = -1;; int pos_Size = Vector3d.SizeInBytes; int norH = -1; int nor_Size = Vector3d.SizeInBytes; int colH = -1; int col_Size = sizeof(int); GL.GenBuffers(1, out posH); GL.BindBuffer(BufferTarget.ArrayBuffer, posH); GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(len * pos_Size), pos, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, posH); GL.VertexPointer(3, VertexPointerType.Double, pos_Size, IntPtr.Zero); GL.EnableClientState(ArrayCap.VertexArray); if (context.UseNormal) { GL.GenBuffers(1, out norH); GL.BindBuffer(BufferTarget.ArrayBuffer, norH); GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(len * nor_Size), nor, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, norH); GL.NormalPointer(NormalPointerType.Double, pos_Size, IntPtr.Zero); GL.EnableClientState(ArrayCap.NormalArray); } if (context.UseObjectColor) { GL.GenBuffers(1, out colH); GL.BindBuffer(BufferTarget.ArrayBuffer, colH); GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(len * col_Size), col, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, colH); GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(int), IntPtr.Zero); GL.EnableClientState(ArrayCap.ColorArray); } GL.DrawArrays(DrawAs, 0, len); GL.DisableClientState(ArrayCap.VertexArray); if (context.UseNormal) { GL.DisableClientState(ArrayCap.NormalArray); } if (context.UseObjectColor) { GL.DisableClientState(ArrayCap.ColorArray); } if (posH != -1) { GL.DeleteBuffers(1, ref posH); } if (context.UseNormal && norH != -1) { GL.DeleteBuffers(1, ref norH); } if (context.UseObjectColor && colH != -1) { GL.DeleteBuffers(1, ref colH); } } else { GL.Begin(this.DrawAs); if (this.DrawAs == PrimitiveType.TriangleStrip) { for (int i = 0; i < Count; i++) { Point3D p = this[i]; if (context.UseNormal && i < Count - 2) { GL.Normal3(p.Normal); } p.ToGL(ref context); } } else { for (int i = 0; i < Count; i++) { this[i].ToGL(ref context); } } GL.End(); #if false Vector4d currentColor = new Vector4d(); GL.Getdouble(GetPName.CurrentColor, out currentColor); GL.Begin(PrimitiveType.Lines); GL.Color3(Color.Red); for (int i = 0; i < Count; i++) { Point3D p = this[i]; GL.Vertex3(p.Position); GL.Vertex3(p.Position + p.Normal); } GL.End(); GL.Color4(currentColor); #endif } }
public abstract void Render(RenderingContext rc);
public RelatedEventsProvider() { this.renderingContext = RenderingContext.Current; }
protected override void AddAdditionalAttributes(RenderingContext <IBocDateTimeValue> renderingContext) { base.AddAdditionalAttributes(renderingContext); renderingContext.Writer.AddStyleAttribute("display", "inline"); }
public static void Draw(SceneManager scene, RenderingContext rc) { Runtime.Scene(scene, rc); }
public void ProcessRequest(HttpContext context) { OutputCacheHelper.InitializeFullPageCaching(context); using (var renderingContext = RenderingContext.InitializeFromHttpContext()) { bool cachingEnabled = false; string cacheKey = null; DonutCacheEntry cacheEntry = null; bool consoleUserLoggedIn = Composite.C1Console.Security.UserValidationFacade.IsLoggedIn(); // "Donut caching" is enabled for logged in users, only if profiling is enabled as well. if (!renderingContext.CachingDisabled && (!consoleUserLoggedIn || renderingContext.ProfilingEnabled)) { cachingEnabled = OutputCacheHelper.TryGetCacheKey(context, out cacheKey); if (cachingEnabled) { using (Profiler.Measure("Cache lookup")) { cacheEntry = OutputCacheHelper.GetFromCache(context, cacheKey); } } } XDocument document; var functionContext = PageRenderer.GetPageRenderFunctionContextContainer(); bool allFunctionsExecuted = false; bool preventResponseCaching = false; if (cacheEntry != null) { document = cacheEntry.Document; foreach (var header in cacheEntry.OutputHeaders) { context.Response.Headers[header.Name] = header.Value; } // Making sure this response will not go to the output cache preventResponseCaching = true; } else { if (renderingContext.RunResponseHandlers()) { return; } var renderer = PageTemplateFacade.BuildPageRenderer(renderingContext.Page.TemplateId); var slimRenderer = (ISlimPageRenderer)renderer; using (Profiler.Measure($"{nameof(ISlimPageRenderer)}.Render")) { document = slimRenderer.Render(renderingContext.PageContentToRender, functionContext); } allFunctionsExecuted = PageRenderer.ExecuteCacheableFunctions(document.Root, functionContext); if (cachingEnabled && !allFunctionsExecuted && OutputCacheHelper.ResponseCacheable(context)) { preventResponseCaching = true; if (!functionContext.ExceptionsSuppressed) { using (Profiler.Measure("Adding to cache")) { OutputCacheHelper.AddToCache(context, cacheKey, new DonutCacheEntry(context, document)); } } } } if (!allFunctionsExecuted) { using (Profiler.Measure("Executing embedded functions")) { PageRenderer.ExecuteEmbeddedFunctions(document.Root, functionContext); } } using (Profiler.Measure("Resolving page fields")) { PageRenderer.ResolvePageFields(document, renderingContext.Page); } string xhtml; if (document.Root.Name == RenderingElementNames.Html) { var xhtmlDocument = new XhtmlDocument(document); PageRenderer.ProcessXhtmlDocument(xhtmlDocument, renderingContext.Page); PageRenderer.ProcessDocumentHead(xhtmlDocument); xhtml = xhtmlDocument.ToString(); } else { xhtml = document.ToString(); } if (renderingContext.PreRenderRedirectCheck()) { return; } xhtml = renderingContext.ConvertInternalLinks(xhtml); if (GlobalSettingsFacade.PrettifyPublicMarkup) { xhtml = renderingContext.FormatXhtml(xhtml); } var response = context.Response; // Disabling ASP.NET cache if there's a logged-in user if (consoleUserLoggedIn || preventResponseCaching) { using (preventResponseCaching ? Profiler.Measure("CmsPageHttpHandler: Disabling HTTP caching as at least one of the functions is not cacheable") : EmptyDisposable.Instance) { context.Response.Cache.SetCacheability(HttpCacheability.NoCache); } } // Inserting performance profiling information if (renderingContext.ProfilingEnabled) { xhtml = renderingContext.BuildProfilerReport(); response.ContentType = "text/xml"; } response.Write(xhtml); } }
public override object Evaluate(RenderingContext context) { return(context.Get(_global)); }
public Models.GenericJumbotron GetGenericJumbotron(RenderingContext renderingContext, Item contextItem) { var model = new Models.GenericJumbotron(GetDatasource(renderingContext, contextItem, Generic_Jumbotron_Constants.TemplateId)); return(model); }
protected internal override void Render(ITerrificTemplateHandler templateHandler, object model, RenderingContext context) { if (context.Data.ContainsKey("data_variation")) { context.Data["data_variation"] = DataVariation; } else { context.Data.Add("data_variation", DataVariation); } templateHandler.RenderModule(Module, Skin, DataVariation, model, context); }
public RegisteringDisplayRenderer(RenderingContext context, ContentRegistration registration) : base(context.PropertyName, registration) { this.Context = context; }
public void SetContext(RenderingContext context) { //TODO }
public Task RenderLabelAsync(string key, RenderingContext context) { throw new NotImplementedException(); }
public void RenderLabel(string key, RenderingContext context) { throw new NotImplementedException(); }
internal void Render(RenderingContext context, TextWriter writer) { string text = context.Content[context.PropertyName] as string; if (text == null) { return; } var tokens = context.Content.GetDetailCollection(context.PropertyName + CollectionSuffix, false); if (tokens != null) { int lastFragmentEnd = 0; foreach (var detail in tokens.Details) { var token = detail.ExtractToken(); if (lastFragmentEnd < token.Index) { writer.Write(text.Substring(lastFragmentEnd, token.Index - lastFragmentEnd)); } ViewEngineResult vr = null; if (context.Html.ViewContext.HttpContext.IsCustomErrorEnabled) { try { vr = ViewEngines.Engines.FindPartialView(context.Html.ViewContext, "TokenTemplates/" + token.Name); } catch (System.Exception ex) { logger.Error(ex); } } else { vr = ViewEngines.Engines.FindPartialView(context.Html.ViewContext, "TokenTemplates/" + token.Name); // duplicated to preserve stack trace } if (vr != null && vr.View != null) { var viewData = new ViewDataDictionary(token.Value) { { "ParentViewContext", context.Html.ViewContext } }; viewData[RenderingExtensions.ContextKey] = context; viewData[RenderingExtensions.TokenKey] = token; var vc = new ViewContext(context.Html.ViewContext, vr.View, viewData, context.Html.ViewContext.TempData, writer); vr.View.Render(vc, writer); } else { writer.Write(detail.StringValue); } lastFragmentEnd = token.Index + detail.StringValue.Length; } if (lastFragmentEnd < text.Length) { writer.Write(text.Substring(lastFragmentEnd, text.Length - lastFragmentEnd)); } } else { writer.Write(text); } }
public void SetRenderingParameterMappingMapping <TModel>(TModel model, IPropertyMeta propertyMeta, RenderingContext renderingContext) { var stringProperty = propertyMeta as StringPropertyMeta <TModel>; if (stringProperty == null) { return; } stringProperty.AssignValueToModelProperty(model, renderingContext.Rendering.GetParameter(propertyMeta.MappingName)); }
public override void Execute(RenderingContext context) { var store = FetchStore(); context.Set(_key, store); }
public override void SetupRenderingData(RenderingContext context, WindowServer server, Window window) { var dc = GetDC(((WindowData?)window.NativeData ?? throw new InvalidOperationException()).Handle); if (dc == IntPtr.Zero) { throw new InvalidOperationException(Resources.GetMessage(Resources.Key.DeviceContextRetrievalFailed)); } var data = GetData(window); data.DeviceContext = dc; var settings = context.Settings ?? throw new InvalidOperationException(); var shareContext = settings.ShareContext; var shareContextHandle = (shareContext != null) ? GetData(shareContext).DeviceContext : IntPtr.Zero; data.Handle = CreateRenderingContext(dc, shareContextHandle, settings); if (swapInterval == null) { wglMakeCurrent(dc, data.Handle); var extensionsEXT = string.Empty; var extensionsARB = string.Empty; var proc = wglGetProcAddress("wglGetExtensionsStringEXT"); if (proc != IntPtr.Zero) { var getExtensions = Marshal.GetDelegateForFunctionPointer <PFNWGLGETEXTENSIONSSTRINGEXTPROC>(proc); extensionsEXT = Marshal.PtrToStringAnsi(getExtensions()) ?? string.Empty; } proc = wglGetProcAddress("wglGetExtensionsStringARB"); if (proc != IntPtr.Zero) { var getExtensions = Marshal.GetDelegateForFunctionPointer <PFNWGLGETEXTENSIONSSTRINGARBPROC>(proc); extensionsARB = Marshal.PtrToStringAnsi(getExtensions(dc)) ?? string.Empty; } if (HasExtension(extensionsEXT, extensionsARB, "WGL_EXT_swap_control")) { var swapIntervalEXT = LoadEntryPoint <PFNWGLSWAPINTERVALEXTPROC>("wglSwapIntervalEXT"); swapInterval = (sync) => swapIntervalEXT(sync ? 1 : 0); } else { swapInterval = (sync) => { }; } if (HasExtension(extensionsEXT, extensionsARB, "WGL_ARB_create_context")) { createContextAttribs = LoadEntryPoint <PFNWGLCREATECONTEXTATTRIBSARBPROC>("wglCreateContextAttribsARB"); } if (HasExtension(extensionsEXT, extensionsARB, "WGL_ARB_pixel_format")) { choosePixelFormat = LoadEntryPoint <PFNWGLCHOOSEPIXELFORMATARBPROC>("wglChoosePixelFormatARB"); } multisample = HasExtension(extensionsEXT, extensionsARB, "WGL_ARB_multisample"); wglMakeCurrent(IntPtr.Zero, IntPtr.Zero); if (CurrentWindow != null) { var currentData = (RenderingData?)CurrentWindow.RenderingData; if (currentData != null) { wglMakeCurrent(currentData.DeviceContext, currentData.Handle); } } if (choosePixelFormat != null && multisample && settings.Samples > 0) { wglDeleteContext(data.Handle); server.RecreateWindow(window); SetupRenderingData(context, server, window); } } }
public void Draw(RenderingContext rc) { Draw(this, rc); }
private void DrawEntityHealthbar(Color color, Color outline, Rect bg, float hpWidth, float esWidth, RenderingContext rc) { if (outline.ToArgb() != 0) { Rect rect = new Rect(bg.X - 2, bg.Y - 2, bg.W + 4, bg.H + 4); rc.AddBox(rect, outline); } if (Settings.GetBool("Healthbars.ShowIncrements")) { rc.AddTexture("healthbar_increment.png", bg, color); } else { rc.AddTexture("healthbar.png", bg, color); } if ((int)hpWidth < bg.W) { Rect rect2 = new Rect(bg.X + (int)hpWidth, bg.Y, bg.W - (int)hpWidth, bg.H); rc.AddTexture("healthbar_bg.png", rect2, color); } if (Settings.GetBool("Healthbars.ShowES")) { bg.W = (int)esWidth; rc.AddTexture("esbar.png", bg, Color.White); } }
public void Evaluate(object model, RenderingContext context, IDictionary <string, string> parameters) { var key = parameters.Keys.First().Trim('"'); _handler.RenderLabel(key, context); }
public HomeController() { _renderingContext = RenderingContext.Current; }
public RenderReportOdpInitial(ProcessingContext pc, RenderingContext rc, DateTime executionTimeStamp, IConfiguration configuration) : base(pc, rc, configuration) { this.m_executionTimeStamp = executionTimeStamp; }
public RenderReportDefinitionOnly(ProcessingContext pc, RenderingContext rc, DateTime executionTimeStamp, IConfiguration configuration) : base(pc, rc, executionTimeStamp, configuration) { }
public void Evaluate(object model, RenderingContext context, IDictionary <string, string> parameters) { var template = parameters["name"].Trim('"', '\''); _handler.RenderPartial(template, model, context); }
public Task RenderPlaceholderAsync(object model, string key, string index, RenderingContext context) { return(context.Writer.WriteAsync("Placeholder for:" + key)); }
protected virtual void EnterContext(Rendering rendering, RenderRenderingArgs args) { IDisposable item = RenderingContext.EnterContext(rendering); args.Disposables.Add(item); }
public override void AttachRenderingData(RenderingContext context, WindowServer server, Window window) { window.RenderingData = new RenderingData(); }
public Task RenderPartialAsync(string template, object model, RenderingContext context) { throw new NotImplementedException(); }
public void RenderPlaceholder(object model, string key, string index, RenderingContext context) { context.Writer.Write("Placeholder for:" + key); }