Пример #1
0
        private Horizontal WireRow(StringConcat stringConcat, DataFlowConnector <string> stringConcatConnector, Formula formula, Formula[] formulas)
        {
            // To understand this code, you need the wiring diagram of the two row calculator

            // first instantiate objects we need to give names to for wiring.  The rest can be anonymous.
            Text result = new Text();

            // Wire up a calculator row
            Horizontal row = new Horizontal()
                             .WireTo(new TextBox()
                                     .WireTo(new DataFlowConnector <string>()
                                             .WireFrom(stringConcat, "inputs")
                                             )
                                     )
                             .WireTo(new TextBox()
                                     .WireTo(new StringFormat <string, string>("({1})=>{0}")
                                             .WireTo(stringConcatConnector, "inputs")
                                             .WireTo(formula
                                                     .WireTo(new DataFlowConnector <double>()
                                                             .WireFrom(formulas[0], "operands")
                                                             .WireFrom(formulas[1], "operands")
                                                             .WireTo(new NumberToString <double?>()
                                                                     .WireTo(result)
                                                                     )
                                                             )
                                                     )
                                             )
                                     )
                             .WireTo(result)
                             .WireTo(new TextBox());

            return(row);
        }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Horizontal.GetHashCode() * 397) ^ Vertical);
     }
 }
Пример #3
0
        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));
        }
Пример #4
0
            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;
                }
            }
Пример #5
0
        private void beDelete_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            if (!Alert.Confirm("确认删除数据?"))
            {
                return;
            }
            switch (_typeFlag)
            {
            case FlagManangingMineName:
                // 矿井名称管理
                DeleteInfo <Mine>();
                gridControl1.DataSource = CollectionHelper.ConvertTo(Mine.FindAll());
                break;

            case FlagManangingHorizontal:
                // 水平名称管理
                DeleteInfo <Horizontal>();
                gridControl1.DataSource = CollectionHelper.ConvertTo(Horizontal.FindAll());
                break;

            case FlagManangingMiningArea:
                // 采区名称管理
                DeleteInfo <MiningArea>();
                gridControl1.DataSource = CollectionHelper.ConvertTo(MiningArea.FindAll());
                break;

            case FlagManangingWorkingFace:
                // 工作面名称管理
                DeleteInfo <Workingface>();
                gridControl1.DataSource = CollectionHelper.ConvertTo(Workingface.FindAll());
                break;
            }
        }
Пример #6
0
        public void BuildBars(Rectangle childArea)
        {
            Vertical.Both = Horizontal.Both = false;

            if (childArea.Width > Area.Width && childArea.Height > Area.Height)
            {
                BarDirection  = Direction.Both;
                Vertical.Both = Horizontal.Both = true;
            }
            else if (childArea.Width > Area.Width)
            {
                BarDirection = Direction.Horizontal;
            }
            else if (childArea.Height > Area.Height)
            {
                BarDirection = Direction.Vertical;
            }

            if (BarDirection == Direction.Horizontal || BarDirection == Direction.Both)
            {
                Horizontal.CalculateRatio(childArea);
            }
            if (BarDirection == Direction.Vertical || BarDirection == Direction.Both)
            {
                Vertical.CalculateRatio(childArea);
            }

            IsBuilt = true;
        }
Пример #7
0
        public string ReturnResolution()
        {
            string resolution;

            resolution = $"{Diagonal.ToString()} inches; {Horizontal.ToString()}x{Vertical.ToString()} pixels; {CalculatePpi(Horizontal, Vertical, Diagonal)} ppi";
            return(resolution);
        }
Пример #8
0
        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];
                }
            }
        }
Пример #9
0
 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();
 }
Пример #10
0
    private void Movement()
    {
        if (PlayerState.Instance.attack != Attack.passive)
        {
            player.velocity    = new Vector2(0, 0f);
            horizontalMovement = 0;
        }
        else
        {
            horizontalMovement = Input.GetAxisRaw("Horizontal");
            if (horizontalMovement != 0)
            {
                transform.localScale = new Vector3(horizontalMovement, 1, 1);
                PlayerState.Instance.DirectionFacing = (DirectionFacing)horizontalMovement;
            }
            if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Button A"))
            {
                isJumping = true;
            }
        }
        if (player.velocity.y == 0 && PlayerState.Instance.attack == Attack.passive)
        {
            PlayerState.Instance.Vertical = Vertical.Grounded;
        }

        Horizontal previousMotion = PlayerState.Instance.Horizontal;
        Horizontal currentMotion  = PlayerState.Instance.Horizontal = (Horizontal)horizontalMovement;

        if ((int)previousMotion * (int)currentMotion == -1)
        {
            PlayerState.Instance.Horizontal = Horizontal.Idle;
        }
        PlayerState.Instance.Horizontal = (Horizontal)horizontalMovement;
    }
Пример #11
0
    /// <summary>
    /// No Use of delta-time because FixedUpdate function -> called for working with rigidbody!
    /// FixedUpdate is called once per Frame!
    /// </summary>
    void FixedUpdate()
    {
        if (StanleyIsDead)
        {
            Win();
        }

        Walk();
        Jump();

        float move = Input.GetAxis("Horizontal");

        anim.SetFloat("Speed", Mathf.Abs(move));
        PlayerBody.velocity = new Vector2(move * maxSpeed, PlayerBody.velocity.y);

        if (_currentHealth <= 0)
        {
            _currentHealth = 0;
            Death();
        }

        //Debug.Log("Health: " + _currentHealth);
        //Debug.Log("Healthbar-Health: " + Healthbar.value);

        //Allow player movement only when not attacking
        if (PlayerState.Instance.Attack != Attack.Passive)
        {
            PlayerBody.velocity = new Vector2(0, 0.1f);
            HorizontalMotion    = 0;
        }
        else
        {
            HorizontalMotion = Input.GetAxisRaw("Horizontal");

            if (HorizontalMotion != 0)
            {
                transform.localScale = new Vector3(HorizontalMotion, 1, 1);
                PlayerState.Instance.DirectionFacing = (DirectionFacing)HorizontalMotion;
            }

            if (Input.GetButtonDown("Jump"))
            {
                JumpActive = true;
            }
        }

        if (PlayerBody.velocity.y == 0 && PlayerState.Instance.Attack == Attack.Passive)
        {
            PlayerState.Instance.Vertical = Vertical.Grounded;
        }

        Horizontal previousMotion = PlayerState.Instance.Horizontal;
        Horizontal currentMotion  = PlayerState.Instance.Horizontal = (Horizontal)HorizontalMotion;

        //Fixes an error with the camera following the player incorrectly if quickly changing direction while at the furthest possible positions at each side of the screen.
        if ((int)previousMotion * (int)currentMotion == -1)
        {
            PlayerState.Instance.Horizontal = Horizontal.Idle;
        }
    }
Пример #12
0
        private void player_mouseclick(object sender, MouseEventArgs e)
        {
            if (flag == 1)
            {
                string[]   separators = { ",", ".", "!", "?", ";", ":", " " };
                PictureBox pb         = (PictureBox)sender;
                int        x          = int.Parse(((string)pb.Tag).Split(separators, StringSplitOptions.RemoveEmptyEntries)[0]);
                int        y          = int.Parse(((string)pb.Tag).Split(separators, StringSplitOptions.RemoveEmptyEntries)[1]);
                Boolean    b          = Horizontal.SelectedIndex == 1 ? true : false;
                Horizontal.Refresh();
                Point[] a;

                Ships ship = null;

                switch (SelectShip.Text)
                {
                case "ship2":

                    a    = ship2.get_point(x, y, b);
                    ship = new ship2(b, a);
                    Console.WriteLine(ship.Name);
                    break;

                case "ship3":
                    a    = ship3.get_point(x, y, b);
                    ship = new ship3(b, a);
                    break;

                case "ship4":
                    a    = ship4.get_point(x, y, b);
                    ship = new ship4(b, a);

                    break;

                case "ship6":
                    a    = ship6.get_point(x, y, b);
                    ship = new ship6(b, a);
                    break;
                }

                if (player.set_ship(ship))
                {
                    player.Ships.Add(ship);

                    SelectShip.Items.RemoveAt(SelectShip.SelectedIndex);
                    SelectShip.SelectedIndex = 0;
                    SelectShip.Refresh();
                    if (SelectShip.Items.Count == 1)
                    {
                        StartButton.Visible = true;
                        SelectShip.Visible  = false;
                        Horizontal.Visible  = false;
                    }
                }


                pic_color_ship(player);
            }
        }
Пример #13
0
        protected override void LoadRenderers()
        {
            Horizontal.SetRenderManager(RenderManager);
            Vertical.SetRenderManager(RenderManager);

            Horizontal.Load();
            Vertical.Load();
        }
Пример #14
0
        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);
        }
Пример #15
0
        public override int GetHashCode()
        {
            var hashCode = 1238135884;

            hashCode = hashCode * -1521134295 + Horizontal.GetHashCode();
            hashCode = hashCode * -1521134295 + Vertical.GetHashCode();
            return(hashCode);
        }
Пример #16
0
		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);
		}
Пример #17
0
        /// <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);
        }
Пример #18
0
 /// <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();
 }
Пример #19
0
 /// <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();
 }
Пример #20
0
        public static void LoadHorizontalName(DataGridView dgv, int mineId)
        {
            var horizontals = Horizontal.FindAllByProperty("mine.id", mineId);

            if (horizontals != null)
            {
                DataBindListControl(dgv, horizontals);
            }
        }
Пример #21
0
        /// <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);
        }
Пример #22
0
        public override string ToString()
        {
            ///Shrnutí
            ///Metoda ToString() vrátí obě dvě čísla oddělená čárkou
            ///Tato metoda je důležitá při ukládání hry do souboru
            string toString = Horizontal.ToString() + ',' + Vertical.ToString();

            return(toString);
        }
Пример #23
0
        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);
                }
            }
        }
Пример #24
0
        /// <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);
        }
Пример #25
0
        public int CompareTo(Vector other)
        {
            var retval = Horizontal.CompareTo(other.Horizontal);

            if (retval == 0)
            {
                return(Vertical.CompareTo(other.Vertical));
            }
            return(retval);
        }
Пример #26
0
        /// <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);
        }
Пример #27
0
Файл: Dpi.cs Проект: ehmz11/aaa
 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);
     }
 }
Пример #28
0
        public static void LoadHorizontalName(ListControl lb, int mineId,
                                              String selectedText = "")
        {
            var horizontals = Horizontal.FindAllByProperty("mine.id", mineId);

            if (horizontals != null)
            {
                DataBindListControl(lb, horizontals, "name",
                                    "id", selectedText);
            }
        }
Пример #29
0
 public override void Draw()
 {
     if (BarDirection == Direction.Horizontal || BarDirection == Direction.Both)
     {
         Horizontal.Draw();
     }
     if (BarDirection == Direction.Vertical || BarDirection == Direction.Both)
     {
         Vertical.Draw();
     }
 }
Пример #30
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 void SetData(ICharacterProperty characterProperty)
        {
            property = characterProperty;

            _health        = property.MaxHealth;
            _vertical      = Vertical.Down;
            _horizontal    = Horizontal.None;
            _regenTimer    = 0;
            _attackTimer   = 0;
            _vertigoConter = 0;
        }
Пример #32
0
    private void Update()
    {
        PreUpdate();

        Horizontal.Update();
        Mouse.Update();
        Jump.Update();
        Interact.Update();

        PostUpdate();
    }
Пример #33
0
 // When serving, position in Z must be between correct boundaries
 public bool PositionInHorizontalArea(float posZ, Horizontal horiz)
 {
     if (horiz == Horizontal.Left)
     {
         return(posZ > _backLeftServingSquare.HorizontalStart && posZ < _backLeftServingSquare.HorizontalLimit);
     }
     else
     {
         return(posZ > _backRightServingSquare.HorizontalStart && posZ < _backRightServingSquare.HorizontalLimit);
     }
 }
Пример #34
0
        /// <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);
        }
Пример #35
0
        /// <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();
        }
Пример #36
0
        /// <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);
        }
Пример #37
0
        void setRightThumb(Horizontal h)
        {
            switch (h)
            {
                case Horizontal.Leftmost:
                    rightThumbSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftThumb_Rightmost : AssetManager.TextureName.RightThumb_Leftmost);
                    break;

                case Horizontal.Left:
                    rightThumbSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftThumb_Right : AssetManager.TextureName.RightThumb_Left);
                    break;

                case Horizontal.Mid:
                    rightThumbSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftThumb_Mid : AssetManager.TextureName.RightThumb_Mid);
                    break;

                case Horizontal.Right:
                    rightThumbSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftThumb_Left : AssetManager.TextureName.RightThumb_Right);
                    break;

                case Horizontal.Rightmost:
                    rightThumbSprite.Texture = AssetManager.getTexture(mirrored ? AssetManager.TextureName.LeftThumb_Leftmost : AssetManager.TextureName.RightThumb_Rightmost);
                    break;
            }
        }
Пример #38
0
 /// <summary>
 /// Create an HUD element
 /// </summary>
 public Group(Horizontal horizontalAlignment, Vertical verticalAlignment)
 {
     this.elements = new List<Entry>();
     this.horizontalAlignment = horizontalAlignment;
     this.verticalAlignment = verticalAlignment;
 }