internal void Export(XmlWriter writer) { writer.WriteStartElement("Alignment"); if (Vertical != VerticalAlignment.None) { writer.WriteAttributeString("ss", "Vertical", null, Vertical.ToString()); } if (Horizontal != HorizontalAlignment.None) { writer.WriteAttributeString("ss", "Horizontal", null, Horizontal.ToString()); } if (WrapText) { writer.WriteAttributeString("ss", "WrapText", null, "1"); } if (ShrinkToFit) { writer.WriteAttributeString("ss", "ShrinkToFit", null, "1"); } if (Indent > 0) { writer.WriteAttributeString("ss", "Indent", null, Indent.ToString(CultureInfo.InvariantCulture)); } if (Rotate > 0) { writer.WriteAttributeString("ss", "Rotate", null, Rotate.ToString(CultureInfo.InvariantCulture)); } writer.WriteEndElement(); }
private void SetAdditionalVerticalComments(Vertical vertical, VerticalObservation verticalObservation) { var stringBuilder = new StringBuilder(); if (!string.IsNullOrWhiteSpace(vertical.Comments)) { stringBuilder.AppendLine(vertical.Comments); } if (verticalObservation.LocationIndicators.Count == 1 && verticalObservation.LocationIndicators.First() == "W") { stringBuilder.AppendLine(CommonMapper.WallMeasurementMappedToPoint6); } if (verticalObservation.LocationIndicators.Contains("B")) { stringBuilder.AppendLine(CommonMapper.BottomMeasurementMappedToPoint6); } var cosVfValues = verticalObservation.ObservationPoints .Select(point => point.CosineVerticalFactor) .Where(vf => Math.Abs(vf - 1.0d) > 0.0000001) .ToList(); if (cosVfValues.Any()) { stringBuilder.AppendLine($"{CommonMapper.CosVfEquals}{string.Join(",", cosVfValues)}"); } vertical.Comments = stringBuilder.ToString().Trim(); }
private void MoveDirection(Vector3 direction, out Vertical vertical, out Horizontal horizontal) { if (direction.y < -0.5) { vertical = Vertical.Down; } else if (direction.y > 0.5) { vertical = Vertical.Top; } else { vertical = Vertical.None; } if (direction.x < -0.5) { horizontal = Horizontal.Left; } else if (direction.x > 0.5) { horizontal = Horizontal.Right; } else { horizontal = Horizontal.None; } }
public string ReturnResolution() { string resolution; resolution = $"{Diagonal.ToString()} inches; {Horizontal.ToString()}x{Vertical.ToString()} pixels; {CalculatePpi(Horizontal, Vertical, Diagonal)} ppi"; return(resolution); }
public Player(Vector2 position) : base(position) { this.Tag((int)GameTags.Player); this.Collider = new Hitbox((float)20.0f, (float)32.0f, -10.0f, -16.0f); this.Visible = true; player = new AnimationPlayer(); downTexture = Engine.Instance.Content.Load <Texture2D>("Player/DrifterDown"); upTexture = Engine.Instance.Content.Load <Texture2D>("Player/DrifterUp"); leftTexture = Engine.Instance.Content.Load <Texture2D>("Player/DrifterLeft"); rightTexture = Engine.Instance.Content.Load <Texture2D>("Player/DrifterRight"); downAnimationData = new AnimationData(downTexture, 60, 32, true); upAnimationData = new AnimationData(upTexture, 60, 32, true); leftAnimationData = new AnimationData(leftTexture, 60, 32, true); rightAnimationData = new AnimationData(rightTexture, 60, 32, true); vertical = Vertical.None; horizonal = Horizonal.None; player.PlayAnimation(downAnimationData); Camera.CameraTrap = new Rectangle((int)this.Right, (int)this.Bottom - 40, 40, 40); }
public void PaintPath(List <int> path) { if (path == null) { MessageBox.Show("No path availible"); } else { for (int y = 0; y < 64; y++) { for (int x = 0; x < 64; x++) { int nodeInt = path[x + y * 64]; if (nodeInt != -1) { m_map[x, y] = 4;//Path bit Horizontal.Start(); Vertical.Start(); } } } int endNodeFrom = path[m_endPosX + 64 * m_endPosY]; m_map[m_endPosX, m_endPosY] = 5; int newNodeFrom = path[endNodeFrom]; while (path[newNodeFrom] != (m_startPosX + 64 * m_startPosY)) { //Paint 2d map m_map[newNodeFrom % 64, newNodeFrom / 64] = 5; //Assign 1d array; newNodeFrom = path[newNodeFrom]; } } }
public override SKMatrix Transform(SKSize dimension) { var horz_map = Horizontal.CoordinateFromValue(dimension.Width); var vert_map = Vertical.CoordinateFromValue(dimension.Height); return(Map.CreateMatrix(horz_map, vert_map)); }
public void Move(int horizontal, int vertical) { Horizontal horizontalConverted = (Horizontal)Enum.Parse(typeof(Horizontal), (1 + horizontal).ToString()); Vertical verticalConverted = (Vertical)Enum.Parse(typeof(Vertical), (8 - vertical).ToString()); Field field = new Field(horizontalConverted, verticalConverted); _figure.Move(field); }
/// <summary> /// Deep clone, to avoid mess up the original data during offsetting the boundary. /// </summary> /// <returns>Cloned object</returns> public Trapezoid Clone() { return(new Trapezoid( Top.Clone() as Line, Vertical.Clone() as Line, Bottom.Clone() as Line, Slanted.Clone() as Line)); }
void IVerticalsRepository.CreateVertical(Vertical vertical) { using (var dc = CreateContext()) { dc.VerticalEntities.InsertOnSubmit(vertical.Map()); dc.SubmitChanges(); } }
public static ReadOnlyUrl GetAlternativeHostRedirectUrl(this Vertical vertical, ReadOnlyUrl url) { // If the url corresponds to a vertical's alternative hosts then redirect to the primary host. var redirectUrl = GetAlternativeHostRedirectUrl(vertical, url, v => v.SecondaryHost); return(redirectUrl ?? GetAlternativeHostRedirectUrl(vertical, url, v => v.TertiaryHost)); }
public static VerticalEntity Map(this Vertical vertical) { var entity = new VerticalEntity { id = vertical.Id }; vertical.MapTo(entity); return(entity); }
internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary<string, XmlElement> processed) { base.SetXML(xml, host, processed); if (mHorizontal != null) xml.AppendChild(Horizontal.GetXML(xml.OwnerDocument, "Horizontal", this, processed)); if (mVertical != null) xml.AppendChild(Vertical.GetXML(xml.OwnerDocument, "Vertical", this, processed)); setAttribute(xml, "Tag", Tag); }
public static void AddHtmlContent(this IContentEngine contentEngine, Vertical vertical, string name, string text) { contentEngine.CreateContentItem(new HtmlContentItem { Name = name, VerticalId = vertical == null ? (Guid?)null : vertical.Id, Text = text }); }
/// <summary> /// An image button /// </summary> /// <param name="normal">the image for the normal state</param> /// <param name="active">the image for the active state</param> /// <param name="verticalAlignment">vertical alignment of the button</param> /// <param name="horizontalAlignment">horizontal alignment of the button</param> /// <param name="position">absolute position on the screen</param> /// <param name="toggle">if button should be toggle able or not</param> public ImageButton(String normal, String active, Horizontal horizontalAlignment, Vertical verticalAlignment, Boolean toggle = false, Microsoft.Xna.Framework.Vector2 position = new Microsoft.Xna.Framework.Vector2()) : base(toggle) { this.normal = new Image(normal, horizontalAlignment, verticalAlignment, position); this.active = new Image(active, horizontalAlignment, verticalAlignment, position); this.ResetPosition(); FenrirGame.Instance.Properties.onResolutionChanged += new EventHandler(ResetPosition); }
protected Vertical CreateVertical(int index) { var vertical = new Vertical { Name = string.Format(VerticalNameFormat, index) }; _verticalsCommand.CreateVertical(vertical); return(vertical); }
/// <summary> /// Creates a label /// </summary> /// <param name="text">the text</param> /// <param name="font">the font</param> /// <param name="verticalAlignment">vertical alignment of the label</param> /// <param name="horizontalAlignment">horizontal alignment of the label</param> /// <param name="position">the absolute position on the screen</param> public Label(String text, String font, Horizontal horizontalAlignment, Vertical verticalAlignment, Vector2 position = new Vector2()) { this.text = text; this.font = FenrirGame.Instance.Properties.ContentManager.GetFont(font); this.position = position; this.horizontalAlignment = horizontalAlignment; this.verticalAlignment = verticalAlignment; this.ResetPosition(); }
/// <summary> /// Metodo que maneja los datos, para el cifrado vertical /// </summary> /// <param name="ArchivoCargado">Archivo cargado desde con los datos</param> /// <param name="N">tamaño de las filas</param> /// <param name="M">tamaño de las columnas</param> /// <param name="NuevoNombre">nuevo nombre del archivo</param> /// <param name="PathAEscribir">ruta para la escritura del archivo contenedor del resultado del metodo</param> public void CifradoVertical(IFormFile ArchivoCargado, int N, int M, string NuevoNombre, string PathAEscribir) { var ArchivoToString = EspaciosInnecesarios(ArchivoCargado); Vertical _Vertical = new Vertical(); var TextoCifradoVertical = _Vertical.CifradoVertical(ArchivoToString, N, M); var PathResultante = Path.Combine(PathAEscribir + NuevoNombre + ".txt"); File.WriteAllText(PathResultante, TextoCifradoVertical); }
private int CalculateRestrictedField(Horizontal horizontalRookLoc, Vertical verticalRookLoc) { Color currentPlayerColor = this.Game.CurrentPlayer.Color; int horizontalLocation = (int)horizontalRookLoc; int verticalLocation = (int)verticalRookLoc; int northWestField = (horizontalLocation - 1) * (8 - verticalLocation); int northEast = (8 - horizontalLocation) * (8 - verticalLocation); int southWest = (horizontalLocation - 1) * (verticalLocation - 1); int southEast = (8 - horizontalLocation) * (verticalLocation - 1); King king = (King)Game.Figures.First(f => f.Color != currentPlayerColor && f is King); if (king.Field.Vertical > verticalRookLoc) { if (king.Field.Horizontal > horizontalRookLoc) { return(northEast); } else if (king.Field.Horizontal == horizontalRookLoc) { return(northEast + northWestField); } else { return(northWestField); } } else if (king.Field.Vertical == verticalRookLoc) { if (king.Field.Horizontal > horizontalRookLoc) { return(northEast + southEast); } else { return(northWestField + southWest); } } else { if (king.Field.Horizontal > horizontalRookLoc) { return(southEast); } else if (king.Field.Horizontal == horizontalRookLoc) { return(southWest + southWest); } else { return(southWest); } } }
/// <summary> /// Creates a text button /// </summary> /// <param name="text">the text</param> /// <param name="font">the font</param> /// <param name="verticalAlignment">vertical alignment of the image</param> /// <param name="horizontalAlignment">horizontal alignment of the image</param> /// <param name="position">absolute position on the screen</param> /// <param name="toggle">toggleable?</param> public TextButton(String text, String font, Horizontal horizontalAlignment, Vertical verticalAlignment, Boolean toggle = false, Vector2 position = new Vector2()) : base(toggle) { this.label = new Label(text, font, horizontalAlignment, verticalAlignment, position); this.font = font; this.ResetPosition(); this.toggle = toggle; FenrirGame.Instance.Properties.onResolutionChanged += new EventHandler(ResetPosition); }
static public Vertical Opposite(this Vertical value) { switch (value) { case Vertical.Up: return(Vertical.Down); case Vertical.Down: return(Vertical.Up); default: throw new ArgumentException(); } }
static public Vector2 ToVector(this Vertical value) { switch (value) { case Vertical.Up: return(-Vector2.UnitY); case Vertical.Down: return(Vector2.UnitY); default: throw new ArgumentException(); } }
static public Verticals ToFlag(this Vertical value) { switch (value) { case Vertical.Up: return(Verticals.Up); case Vertical.Down: return(Verticals.Down); default: return(Verticals.None); } }
public override int GetHashCode() { // Implementation from Jon Skeet: http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode unchecked // Overflow is fine, just wrap { int hash = (int)2166136261; hash = hash * 16777619 ^ Horizontal.GetHashCode(); hash = hash * 16777619 ^ Vertical.GetHashCode(); return(hash); } }
public void SetData(ICharacterProperty characterProperty) { property = characterProperty; _health = property.MaxHealth; _vertical = Vertical.Down; _horizontal = Horizontal.None; _regenTimer = 0; _attackTimer = 0; _vertigoConter = 0; }
public override int GetHashCode() { unchecked { var hashCode = Horizontal.GetHashCode(); hashCode = (hashCode * 397) ^ Vertical.GetHashCode(); hashCode = (hashCode * 397) ^ KeepHorizontal.GetHashCode(); hashCode = (hashCode * 397) ^ KeepVertical.GetHashCode(); hashCode = (hashCode * 397) ^ KeepLeft.GetHashCode(); return(hashCode); } }
public override void Draw(SKCanvas canvas, SKSize dimension, SKSize view) { Wait(); Horizontal.Position = Padding.BottomPosition(dimension.Height); Vertical.Position = Padding.LeftPosition(dimension.Width); Horizontal.Draw(canvas, dimension, view); Vertical.Draw(canvas, dimension, view); Release(); }
private static string ToCSSLine(Thickness margin, Horizontal horizontal, Vertical vertical) { string result = "margin: " + string.Join(" ", ToCSSValue(margin.Top, true), ToCSSValue(margin.Right, false), ToCSSValue(margin.Bottom, true), ToCSSValue(margin.Left, false)) + ";"; return(result); }
void IVerticalsRepository.UpdateVertical(Vertical vertical) { using (var dc = CreateContext()) { var entity = GetVerticalEntity(dc, vertical.Id); if (entity != null) { vertical.MapTo(entity); dc.SubmitChanges(); } } }
public static void UpdateSectionContent(this IContentEngine contentEngine, Vertical vertical, bool enabled, string sectionName, string sectionTitle, string sectionContent) { var contentItem = contentEngine.GetContentItem <SectionContentItem>(sectionName, vertical == null ? (Guid?)null : vertical.Id, true); contentItem.IsEnabled = enabled; contentItem.SectionTitle = sectionTitle; contentItem.SectionContent = new HtmlContentItem { Text = sectionContent }; contentEngine.UpdateContentItem(contentItem); }
public IHttpActionResult Post([FromBody] Vertical vertical) { if (ModelState.IsValid) { VerticalRepository.AddVertical(vertical); return(Ok("Vertical saved successfully")); } else { return(BadRequest("Bad Request - Model State is not valid")); } }
/// <summary> /// Creates the SelectionList /// </summary> /// <param name="yPos"></param> /// <param name="font"></param> /// <param name="label"></param> /// <param name="data"></param> /// <param name="dataIndex"></param> public SelectionList(String text, String font, List<String> data, int defaultIndex, Horizontal horizontalAlignment, Vertical verticalAlignment, Vector2 position = new Vector2()) { this.data = data; this.entries = new List<TextButton>(); this.font = font; this.index = defaultIndex; this.position = position; this.buildList(); this.label = new Label(text, font, Horizontal.Left, Vertical.Top); this.ResetPosition(position); }
/// <summary> /// An image to be rendered /// </summary> /// <param name="imageName">the name of the texture</param> /// <param name="verticalAlignment">vertical alignment of the image</param> /// <param name="horizontalAlignment">horizontal alignment of the image</param> /// <param name="position">absolute position on the screen</param> public Image(String imageName, Horizontal horizontalAlignment, Vertical verticalAlignment, Vector2 position = new Vector2(), Vector2? size = null) { this.verticalAlignment = verticalAlignment; this.horizontalAlignment = horizontalAlignment; this.textureName = imageName; if (size.HasValue) this.size = size.Value; else this.size = size ?? new Microsoft.Xna.Framework.Vector2( FenrirGame.Instance.Properties.ContentManager.GetTexture(imageName).Width, FenrirGame.Instance.Properties.ContentManager.GetTexture(imageName).Height); this.position = position; this.renderPosition = new Microsoft.Xna.Framework.Vector2(); this.color = Color.White; this.ResetPosition(); }
/// <summary> /// /// </summary> /// <param name="size"></param> /// <param name="vertical"></param> /// <param name="horizontal"></param> /// <returns>A vector from topleft to the specified point</returns> internal static Vector Offset(this Size size, Vertical vertical, Horizontal horizontal) { var x = 0.0; var y = 0.0; switch (horizontal) { case Horizontal.Left: x = 0; break; case Horizontal.Center: x = size.Width / 2; break; case Horizontal.Right: x = size.Width; break; default: throw new ArgumentOutOfRangeException("horizontal"); } switch (vertical) { case Vertical.Top: y = 0; break; case Vertical.Mid: y = size.Height / 2; break; case Vertical.Bottom: y = size.Height; break; default: throw new ArgumentOutOfRangeException("vertical"); } return new Vector(-x, -y); }
void setRightFinger(Vertical v) { switch (v) { case Vertical.Up: rightFingerSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftFinger_Up : AssetManager.TextureName.RightFinger_Up); break; case Vertical.Down: rightFingerSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftFinger_Down : AssetManager.TextureName.RightFinger_Down); break; } }
/// <summary> /// Create an HUD element /// </summary> public Group(Horizontal horizontalAlignment, Vertical verticalAlignment) { this.elements = new List<Entry>(); this.horizontalAlignment = horizontalAlignment; this.verticalAlignment = verticalAlignment; }