private static void DrawRectange(MapMeshCell cell, Color color, int size = 1) { var meshCellSize = MapManager.MeshCellSize; var position = cell.Position; if (position.Z < -5000) { return; } for (var i = 0; i < size; i++) { var a = position + new Vector3(4 + i, 4 + i, 0); var b = a + new Vector3(0, meshCellSize - 8 - (i * 2), 0); var c = a + new Vector3(meshCellSize - 8 - (i * 2), 0, 0); var d = c + new Vector3(0, meshCellSize - 8 - (i * 2), 0); if (!a.IsOnScreen() || !b.IsOnScreen() || !c.IsOnScreen() || !d.IsOnScreen()) { return; } var a2 = RendererManager.WorldToScreen(a); var b2 = RendererManager.WorldToScreen(b); var c2 = RendererManager.WorldToScreen(c); var d2 = RendererManager.WorldToScreen(d); RendererManager.DrawLine(a2, b2, color); RendererManager.DrawLine(b2, d2, color); RendererManager.DrawLine(d2, c2, color); RendererManager.DrawLine(c2, a2, color); } }
protected override void Draw() { var keyPosition = new Vector2( (this.Position.X + this.Size.X) - this.MenuStyle.RightIndent - this.keyTextSize.X, this.Position.Y + ((this.Size.Y - this.MenuStyle.TextSize) / 3.3f)); //key background if (this.IsActive) { RendererManager.DrawLine( this.Position + new Vector2(this.Size.X - (this.keyTextSize.X + (this.MenuStyle.RightIndent * 2)), this.Size.Y / 2), this.Position + new Vector2(this.Size.X, this.Size.Y / 2), this.MenuStyle.BackgroundColor, this.Size.Y); } base.Draw(); //key RendererManager.DrawText( this.changingKey ? "?" : this.keyText, keyPosition, Color.White, this.MenuStyle.Font, this.MenuStyle.TextSize); }
public static void DrawTextWithBackground(string text, float size, Vector2 position) { var measureText = RendererManager.MeasureText(text, size); position -= new Vector2(measureText.X / 2, 0); var bgPosition = position + new Vector2(0, measureText.Y / 2); RendererManager.DrawLine( bgPosition - new Vector2(2, 0), bgPosition + new Vector2(measureText.X + 2, 0), new Color(5, 25, 25, 150), measureText.Y); RendererManager.DrawText(text, position, Color.White, size); }
public void DrawOnMinimap(IMinimap minimap) { const float MaxRadius = 22f; const float MinRadius = 15f; var remainingDuration = this.RemainingDuration; var position = minimap.WorldToMinimap(this.teleportPosition, 25 * Hud.Info.ScreenRatio); var radius = (((remainingDuration / this.duration) * (MaxRadius - MinRadius)) + MinRadius) * Hud.Info.ScreenRatio; var range = new Vector2((float)Math.Cos(-remainingDuration), (float)Math.Sin(-remainingDuration)) * radius; RendererManager.DrawCircle(position.Center, radius, this.color, 3); RendererManager.DrawLine(position.Center, position.Center + range, this.color, 2); RendererManager.DrawTexture(this.minimapTexture, position, TextureType.MiniUnit); }
protected override void Draw() { base.Draw(); //texture if (!string.IsNullOrEmpty(this.textureKey)) { RendererManager.DrawTexture( this.textureKey, new RectangleF( this.Position.X + this.MenuStyle.LeftIndent, this.Position.Y + ((this.Size.Y - this.textureSize.Y) / 2), this.textureSize.X, this.textureSize.Y), this.textureType); } //arrow RendererManager.DrawTexture( this.MenuStyle.TextureArrowKey, new RectangleF( (this.Position.X + this.Size.X) - this.MenuStyle.TextureArrowSize - this.MenuStyle.RightIndent, this.Position.Y + ((this.Size.Y - this.MenuStyle.TextureArrowSize) / 2.2f), this.MenuStyle.TextureArrowSize, this.MenuStyle.TextureArrowSize)); var position = this.Position + new Vector2(this.Size.X, 0); for (var i = 0; i < this.MenuItems.Count; i++) { var menuItem = this.MenuItems[i]; menuItem.OnDraw(position, this.ChildWidth); if (i > 0 && i < this.MenuItems.Count && menuItem.IsVisible) { // line RendererManager.DrawLine( position, position + new Vector2(this.ChildWidth, 0), this.MenuStyle.MenuSplitLineColor, this.MenuStyle.MenuSplitLineSize); } position += new Vector2(0, this.MenuStyle.Height); } }
public void DrawMenu() { this.Size = new Vector2(this.ChildWidth, this.MenuStyle.Height * 0.75f); RendererManager.DrawLine( this.MenuPosition + new Vector2(0, this.Size.Y / 2), this.MenuPosition + new Vector2(this.Size.X, this.Size.Y / 2), this.MenuStyle.HeaderBackgroundColor, this.Size.Y); var textPosition = new Vector2( (this.MenuPosition.X + this.ChildWidth) - this.DisplayNameSize.X - this.MenuStyle.RightIndent, this.MenuPosition.Y + ((this.Size.Y - this.MenuStyle.TextSize) / 4)); var iconSize = new Vector2(8, 14) * Hud.Info.ScreenRatio; var iconPosition = new Vector2( textPosition.X - (6 * Hud.Info.ScreenRatio), this.menuPosition.Y + ((this.Size.Y - iconSize.Y) / 2)); for (var i = 1; i <= this.MenuItems.Count; i++) { RendererManager.DrawTexture(this.MenuStyle.TextureIconKey, new RectangleF(iconPosition.X - iconSize.X * i, iconPosition.Y, iconSize.X, iconSize.Y)); } RendererManager.DrawText(this.DisplayName, textPosition, Color.White, this.MenuStyle.Font, this.MenuStyle.TextSize); var position = this.MenuPosition + new Vector2(0, this.Size.Y); for (var i = 0; i < this.MenuItems.Count; i++) { var menuItem = this.MenuItems[i]; menuItem.OnDraw(position, this.ChildWidth); // line if (i < this.MenuItems.Count) { RendererManager.DrawLine( position, position + new Vector2(this.ChildWidth, 0), this.MenuStyle.MenuSplitLineColor, this.MenuStyle.MenuSplitLineSize); } position += new Vector2(0, this.MenuStyle.Height); } }
protected virtual void Draw() { //background RendererManager.DrawLine( this.Position + new Vector2(0, this.Size.Y / 2), this.Position + new Vector2(this.Size.X, this.Size.Y / 2), this.MenuStyle.BackgroundColor, this.Size.Y); var pct = Math.Min(GameManager.RawGameTime - this.hooverTime, 0.3f) / 0.3f; int alpha; const int MinAlpha = 170; if (this.isHoovered || (this is Menu menu && !menu.IsCollapsed)) { alpha = (int)((pct * (255 - MinAlpha)) + MinAlpha); //tooltip if (!string.IsNullOrEmpty(this.Tooltip)) { var tooltipTextSize = RendererManager.MeasureText(this.Tooltip, this.MenuStyle.Font, this.MenuStyle.TooltipTextSize); RendererManager.DrawFilledRectangle( new RectangleF( this.Position.X + this.Size.X + this.MenuStyle.LeftIndent, this.Position.Y + (tooltipTextSize.Y / 4f), tooltipTextSize.X + this.MenuStyle.LeftIndent + this.MenuStyle.RightIndent, tooltipTextSize.Y), new Color(5, 5, 5, 200), new Color(50, 50, 50, 255), 1); RendererManager.DrawText( this.Tooltip, new RectangleF( this.Position.X + this.Size.X + (this.MenuStyle.LeftIndent * 2), this.Position.Y + (tooltipTextSize.Y / 4f), tooltipTextSize.X, this.Size.Y), Color.White, FontFlags.Left, this.MenuStyle.TooltipTextSize); } }
protected override void Draw() { //value fill var fillPct = ((float)this.Value - this.MinValue) / (this.MaxValue - this.MinValue); RendererManager.DrawLine( this.Position + new Vector2(0, this.Size.Y / 2), this.Position + new Vector2(this.Size.X * fillPct, this.Size.Y / 2), this.MenuStyle.BackgroundColor, this.Size.Y); base.Draw(); //value text var valuePosition = new Vector2( (this.Position.X + this.Size.X) - this.MenuStyle.RightIndent - this.valueTextSize.X, this.Position.Y + ((this.Size.Y - this.MenuStyle.TextSize) / 3.3f)); RendererManager.DrawText(this.Value.ToString(), valuePosition, Color.White, this.MenuStyle.Font, this.MenuStyle.TextSize); }
private void RendererManagerOnDraw() { if (ColorScreen) { var color = new Color( SpiritBreakerChargeMenu.RedItem.Value, SpiritBreakerChargeMenu.GreenItem.Value, SpiritBreakerChargeMenu.BlueItem.Value, SpiritBreakerChargeMenu.AlphaItem.Value); var screenSize = RendererManager.ScreenSize; RendererManager.DrawFilledRectangle(new RectangleF(0, 0, screenSize.X, screenSize.Y), Color.Zero, color, 0); } if (OnMinimap) { var startPos = startChargePosition.WorldToMinimap(); var endPos = endChargePosition.WorldToMinimap(); RendererManager.DrawLine(startPos, endPos, Color.WhiteSmoke, 1); RendererManager.DrawTexture(@"mini_heroes\npc_dota_hero_spirit_breaker.png", new RectangleF(startPos.X - 11, startPos.Y - 13, 24, 24)); } }
protected override void Draw() { base.Draw(); //drag ability if (this.drawDrag) { RendererManager.DrawTexture( this.dragItem, new RectangleF( this.dragAbilityPosition.X, this.dragAbilityPosition.Y, this.MenuStyle.TextureHeroSize.X, this.MenuStyle.TextureHeroSize.Y), TextureType.Unit); this.dragTargetAbility = null; } //heroes var startPosition = new Vector2( (this.Position.X + this.Size.X) - this.MenuStyle.TextureHeroSize.X - 4, this.Position.Y + ((this.Size.Y - this.MenuStyle.TextureHeroSize.Y) / 2.2f)); var priority = this.heroes.Count(x => x.Value); var count = 0; foreach (var ability in this.heroes.OrderByDescending(x => this.heroPriority[x.Key])) { count++; if (this.drawDrag) { var border = 3; if (ability.Key == this.dragItem) { border = 0; } if ((count == 1 && this.currentMousePosition.X > this.Position.X + this.Size.X) || (this.currentMousePosition.X >= startPosition.X - border && this.currentMousePosition.X <= startPosition.X + this.MenuStyle.TextureHeroSize.X + border)) { this.dragTargetAbility = ability.Key; startPosition -= new Vector2(this.MenuStyle.TextureHeroSize.X + 4, 0); this.increasePriority = false; } if (ability.Key == this.dragItem) { if (ability.Value) { priority--; } continue; } } RendererManager.DrawRectangle( new RectangleF( startPosition.X - 1.5f, startPosition.Y - 1.5f, this.MenuStyle.TextureHeroSize.X + 3, this.MenuStyle.TextureHeroSize.Y + 3), ability.Value ? Color.LightGreen : Color.Red, 1.5f); RendererManager.DrawTexture( ability.Key, new RectangleF(startPosition.X, startPosition.Y, this.MenuStyle.TextureHeroSize.X, this.MenuStyle.TextureHeroSize.Y), TextureType.Unit); if (ability.Value) { //priority RendererManager.DrawLine( startPosition + new Vector2(0, this.MenuStyle.TextureHeroSize.Y - 6), startPosition + new Vector2(6, this.MenuStyle.TextureHeroSize.Y - 6), Color.Black, 12); RendererManager.DrawText( priority--.ToString(), startPosition + new Vector2(0, this.MenuStyle.TextureHeroSize.Y - 12), Color.White, this.MenuStyle.Font, 12); } startPosition -= new Vector2(this.MenuStyle.TextureHeroSize.X + 4, 0); } if (this.drawDrag && this.dragTargetAbility == null) { this.dragTargetAbility = this.heroes.Select(x => x.Key).OrderBy(x => this.heroPriority[x]).FirstOrDefault(); this.increasePriority = true; } }
private void ShowEvadeResult() { try { var position = new Vector2(Hud.Info.ScreenSize.X, 23); for (var i = this.evadeResults.Count - 1; i >= 0; i--) { var result = this.evadeResults[i]; var text = string.Empty; if (result.State == EvadeResult.EvadeState.Failed) { text = result.Ally + " can't evade " + result.EnemyAbility + (result.IsModifier ? " (modifier)" : ""); } else { switch (result.Mode) { case EvadeMode.Dodge: { if (result.AllyAbility == null) { text = result.Ally + " dodging " + result.EnemyAbility; } else { text = result.Ally + " using " + result.AllyAbility + " to dodge " + result.EnemyAbility; } break; } case EvadeMode.Counter: { text = result.AbilityOwner + " using " + result.AllyAbility + " (" + (result.IsModifier ? "modifier " : "") + "counter) on " + result.Ally + " vs " + result.EnemyAbility; break; } case EvadeMode.Blink: { text = result.AbilityOwner + " using " + result.AllyAbility + " (" + (result.IsModifier ? "modifier " : "") + "blink) vs " + result.EnemyAbility; break; } case EvadeMode.Disable: { text = result.AbilityOwner + " using " + result.AllyAbility + " (" + (result.IsModifier ? "modifier " : "") + "disable) on " + result.Enemy + " vs " + result.EnemyAbility; break; } case EvadeMode.GoldSpend: { text = result.Ally + " trying to spend gold vs " + result.EnemyAbility; break; } } } var size = RendererManager.MeasureText(text, TextSize + 2); position += new Vector2(0, TextSize + 2); RendererManager.DrawLine( position - new Vector2(size.X + 20, ((TextSize + 2) / -2) - 3), position - new Vector2(0, ((TextSize + 2) / -2) - 3), new Color(0, 0, 0, 220), TextSize + 2); RendererManager.DrawText( text, position - new Vector2(size.X + 10, 0), result.State == EvadeResult.EvadeState.Failed ? Color.Red : Color.Green, TextSize + 2); } } catch { //ignore } }