Ejemplo n.º 1
0
        public override void Refresh(float a_fZoomScaler)
        {
            // Adjust the size of the Primary Sprite (the star icon) if necessary.
            if (MinimumSize.X > 0 && MinimumSize.Y > 0)
            {
                // calc size in pixels given current zoom factor:
                Vector2 v2CurrSize = RealSize * a_fZoomScaler;

                if (MinimumSize.X > v2CurrSize.X && MinimumSize.Y > v2CurrSize.Y)
                {
                    // then it is too small, make it display at a proper size:
                    PrimaryPrimitive.SetSize(MinimumSize / a_fZoomScaler);
                }
                else
                {
                    // we want to draw to scale:
                    PrimaryPrimitive.SetSize(RealSize);
                }
            }

            // Adjust the size of the text so it is always 10 point:
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;


            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }
        }
Ejemplo n.º 2
0
        public override void Refresh(float a_fZoomScaler)
        {
            // Adjust the size of the Primary Sprite (the planet icon) if necessary.
            if (MinimumSize.X > 0 && MinimumSize.Y > 0)
            {
                // calc size in pixels given current zoom factor:
                Vector2 v2CurrSize = RealSize * a_fZoomScaler;

                if (MinimumSize.X > v2CurrSize.X && MinimumSize.Y > v2CurrSize.Y)
                {
                    // then it is too small, make it display at a proper size:
                    PrimaryPrimitive.SetSize(MinimumSize / a_fZoomScaler);

                    // turn off moons if min orbit < icon size in world coords:
                    float test = (MinimumSize.X / a_fZoomScaler);
                    if (SmallestOrbit < test)
                    {
                        // we are overlapping, weill not draw children:
                        RenderChildren = false;
                    }
                    else
                    {
                        // we are not overlapping, will draw children:
                        RenderChildren = true;
                    }
                }
                else
                {
                    // we want to draw to scale:
                    PrimaryPrimitive.SetSize(RealSize);

                    // turn off moons if min orbit < icon size in world coords:
                    float test = (RealSize.X / a_fZoomScaler);
                    if (SmallestOrbit < test)
                    {
                        // we are overlapping, weill not draw children:
                        RenderChildren = false;
                    }
                    else
                    {
                        // we are not overlapping, will draw children:
                        RenderChildren = true;
                    }
                }
            }

            // Adjust the size of the text so it is always 10 point:
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;

            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }
        }
Ejemplo n.º 3
0
        public override void Refresh(float a_fZoomScaler)
        {
            // Adjust the size of the Primary Sprite (the star icon) if necessary.
            if (MinimumSize.X > 0 && MinimumSize.Y > 0)
            {
                // calc size in pixels given current zoom factor:
                Vector2 v2CurrSize = RealSize * a_fZoomScaler;

                if (MinimumSize.X > v2CurrSize.X && MinimumSize.Y > v2CurrSize.Y)
                {
                    // then it is too small, make it display at a proper size:
                    PrimaryPrimitive.SetSize(MinimumSize / a_fZoomScaler);
                }
                else
                {
                    // we want to draw to scale:
                    PrimaryPrimitive.SetSize(RealSize);
                }
            }

            // Adjust the size of the text so it is always 10 point:
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;

            /// <summary>
            /// Update the position of this element.
            /// </summary>
            Vector3 pos = new Vector3((float)m_oStar.Position.X, (float)m_oStar.Position.Y, 0.0f);

            PrimaryPrimitive.Position = pos;
            Lable.Position            = pos;

            if (m_oOrbitCircle != null)
            {
                /// <summary>
                /// Parent star is always at 0.0,0.0,0.0
                /// </summary>
                m_oOrbitCircle.CurrentPosition = Vector3.Zero;
                /// <summary>
                /// Putting this as a child means that it runs afoul of the "don't render children" check.
                /// </summary>
                m_oOrbitCircle.Refresh(a_fZoomScaler);
            }


            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }
        }
Ejemplo n.º 4
0
        public override void Refresh(float a_fZoomScaler)
        {
            // Adjust the size of the Primary Sprite (the star icon) if necessary.
            if (MinimumSize.X > 0 && MinimumSize.Y > 0)
            {
                // calc size in pixels given current zoom factor:
                Vector2 v2CurrSize = RealSize * a_fZoomScaler;

                if (MinimumSize.X > v2CurrSize.X && MinimumSize.Y > v2CurrSize.Y)
                {
                    // then it is too small, make it display at a proper size:
                    PrimaryPrimitive.SetSize(MinimumSize / a_fZoomScaler);
                }
                else
                {
                    // we want to draw to scale:
                    PrimaryPrimitive.SetSize(RealSize);
                }
            }

            // Adjust the size of the text so it is always 10 point:
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;

            /// <summary>
            /// Update the position of this element.
            /// </summary>
            Vector3 pos = new Vector3((float)m_oJumpPoint.Position.X, (float)m_oJumpPoint.Position.Y, 0.0f);

            PrimaryPrimitive.Position = pos;
            Lable.Position            = pos;

            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }

            Lable.Text = m_oJumpPoint.Name;
        }
Ejemplo n.º 5
0
        public override void Refresh(float a_fZoomScaler)
        {
            // Adjust the size of the Primary Sprite (the planet icon) if necessary.
            if (MinimumSize.X > 0 && MinimumSize.Y > 0)
            {
                // calc size in pixels given current zoom factor:
                Vector2 v2CurrSize = RealSize * a_fZoomScaler;

                if (MinimumSize.X > v2CurrSize.X && MinimumSize.Y > v2CurrSize.Y)
                {
                    // then it is too small, make it display at a proper size:
                    PrimaryPrimitive.SetSize(MinimumSize / a_fZoomScaler);

                    // turn off moons if min orbit < icon size in world coords:
                    float test = (MinimumSize.X / a_fZoomScaler);
                    if (SmallestOrbit < test)
                    {
                        // we are overlapping, weill not draw children:
                        RenderChildren = false;
                    }
                    else
                    {
                        // we are not overlapping, will draw children:
                        RenderChildren = true;
                    }
                }
                else
                {
                    // we want to draw to scale:
                    PrimaryPrimitive.SetSize(RealSize);

                    // turn off moons if min orbit < icon size in world coords:
                    float test = (RealSize.X / a_fZoomScaler);
                    if (SmallestOrbit < test)
                    {
                        // we are overlapping, weill not draw children:
                        RenderChildren = false;
                    }
                    else
                    {
                        // we are not overlapping, will draw children:
                        RenderChildren = true;
                    }
                }
            }

            // Adjust the size of the text so it is always 10 point:
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;

            /// <summary>
            /// Update the position of this element.
            /// </summary>
            Vector3 pos = new Vector3((float)(m_oPlanet.XSystem), (float)(m_oPlanet.YSystem), 0.0f);

            PrimaryPrimitive.Position = pos;
            Lable.Position            = pos;

            Vector3 pos2 = new Vector3((float)m_oPlanet.Parent.XSystem, (float)m_oPlanet.Parent.YSystem, 0.0f);

            m_oOrbitCircle.CurrentPosition = pos2;

            /// <summary>
            /// Putting this as a child means that it runs afoul of the "don't render children" check.
            /// </summary>
            m_oOrbitCircle.Refresh(a_fZoomScaler);

            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }
        }
Ejemplo n.º 6
0
        public override void Refresh(float a_fZoomScaler)
        {
            // Adjust the size of the Primary Sprite (the TG icon) if necessary.
            if (MinimumSize.X > 0 && MinimumSize.Y > 0)
            {
                // calc size in pixels given current zoom factor:
                Vector2 v2CurrSize = RealSize * a_fZoomScaler;

                if (MinimumSize.X > v2CurrSize.X && MinimumSize.Y > v2CurrSize.Y)
                {
                    // then it is too small, make it display at a proper size:
                    PrimaryPrimitive.SetSize(MinimumSize / a_fZoomScaler);
                }
                else
                {
                    // we want to draw to scale:
                    PrimaryPrimitive.SetSize(RealSize);
                }
            }

            /// <summary>
            /// update position of the selected contact and its travelline:
            /// </summary>
            Vector3 pos = Vector3.Zero, lastPos = Vector3.Zero;

            switch (m_oSystemContect.SSEntity)
            {
            case StarSystemEntityType.TaskGroup:
                pos     = new Vector3((float)m_oSystemContect.Position.X, (float)m_oSystemContect.Position.Y, 0.0f);
                lastPos = new Vector3((float)m_oSystemContect.LastPosition.X, (float)m_oSystemContect.LastPosition.Y, 0.0f);

                TaskGroupTN TaskGroup = m_oSystemContect.Entity as TaskGroupTN;

                if (TaskGroup.DrawTravelLine != 3)
                {
                    m_oTravelLine.StartPos = lastPos;
                    m_oTravelLine.EndPos   = pos;
                }
                else if (TaskGroup.DrawTravelLine == 3)
                {
                    m_oTravelLine.StartPos = pos;
                    m_oTravelLine.EndPos   = pos;
                }

                if (TaskGroup.DrawTravelLine == 2)
                {
                    TaskGroup.DrawTravelLine = 3;
                }
                break;

            case StarSystemEntityType.Population:
                break;

            case StarSystemEntityType.Missile:
                pos     = new Vector3((float)m_oSystemContect.Position.X, (float)m_oSystemContect.Position.Y, 0.0f);
                lastPos = new Vector3((float)m_oSystemContect.LastPosition.X, (float)m_oSystemContect.LastPosition.Y, 0.0f);

                OrdnanceGroupTN MissileGroup = m_oSystemContect.Entity as OrdnanceGroupTN;

                if (MissileGroup.DrawTravelLine != 3)
                {
                    m_oTravelLine.StartPos = lastPos;
                    m_oTravelLine.EndPos   = pos;
                }
                else if (MissileGroup.DrawTravelLine == 3)
                {
                    m_oTravelLine.StartPos = pos;
                    m_oTravelLine.EndPos   = pos;
                }

                if (MissileGroup.DrawTravelLine == 2)
                {
                    MissileGroup.DrawTravelLine = 3;
                }
                break;
            }



            PrimaryPrimitive.Position = pos;
            Lable.Position            = pos;

            // Adjust the size of the text so it is always 10 point:
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;

            switch (m_oSystemContect.SSEntity)
            {
            case StarSystemEntityType.TaskGroup:
                Lable.Text = m_oSystemContect.Entity.Name;
                break;
            }

            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }
        }