Beispiel #1
0
        // Hopefully no typos in here.
        public static void SaveProgramSettings()
        {
            XmlDocument config   = new XmlDocument();
            XmlElement  rootNode = config.CreateElement("Root");

            config.AppendChild(rootNode);

            // TODO: There is a lot of code repetition in rounding doubles. Fix.
            rootNode.SetAttribute("InnerDiskImagePath", InnerDiskImagePath == null ? "" : InnerDiskImagePath);
            rootNode.SetAttribute("InnerRadius", InnerRadius.ToString("0"));
            rootNode.SetAttribute("InnerDiskNormalOpacity", InnerDiskNormalOpacity.ToString("0.##"));
            rootNode.SetAttribute("InnerDiskMouseDownOpacity", InnerDiskMouseDownOpacity.ToString("0.##"));

            rootNode.SetAttribute("OuterDiskImagePath", OuterDiskImagePath == null ? "" : OuterDiskImagePath);
            rootNode.SetAttribute("OuterRadius", OuterRadius.ToString("0"));
            rootNode.SetAttribute("OuterDiskNormalOpacity", OuterDiskNormalOpacity.ToString("0.##"));
            rootNode.SetAttribute("OuterDiskMouseDownOpacity", OuterDiskMouseDownOpacity.ToString("0.##"));

            rootNode.SetAttribute("FileNotFoundIcon", FileNotFoundIcon.ImagePath == null ? "" : FileNotFoundIcon.ImagePath);
            rootNode.SetAttribute("FolderDefaultIcon", FolderDefaultIcon.ImagePath == null ? "" : FolderDefaultIcon.ImagePath);
            rootNode.SetAttribute("PieItemSize", PieItemSize.ToString("0"));
            rootNode.SetAttribute("PieItemNormalOpacity", PieItemNormalOpacity.ToString("0.##"));
            rootNode.SetAttribute("PieItemMouseDownOpacity", PieItemMouseDownOpacity.ToString("0.##"));
            rootNode.SetAttribute("PieItemRadiusFromCenter", PieItemRadiusFromCenter.ToString("0"));

            config.Save(ProgramSaveLocation);
        }
Beispiel #2
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            writer.WriteAttributeString("type", Type.ToString());

            if (X.HasValue)
            {
                writer.WriteAttributeString("x", X.ToString());
            }
            if (Y.HasValue)
            {
                writer.WriteAttributeString("y", Y.ToString());
            }
            if (Color.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("Color", Color);
            }
            if (Alpha.HasValue)
            {
                writer.WriteAttributeString("Alpha", Alpha.ToString());
            }
            if (Thickness.HasValue)
            {
                writer.WriteAttributeString("Thickness", Thickness.ToString());
            }

            if (XScale.HasValue)
            {
                writer.WriteAttributeString("XScale", XScale.ToString());
            }
            if (YScale.HasValue)
            {
                writer.WriteAttributeString("YScale", YScale.ToString());
            }
            if (Radius.HasValue)
            {
                writer.WriteAttributeString("Radius", Radius.ToString());
            }
            if (YRadius.HasValue)
            {
                writer.WriteAttributeString("YRadius", YRadius.ToString());
            }
            if (InnerRadius.HasValue)
            {
                writer.WriteAttributeString("InnerRadius", InnerRadius.ToString());
            }

            if (ToX.HasValue)
            {
                writer.WriteAttributeString("ToX", ToX.ToString());
            }
            if (ToY.HasValue)
            {
                writer.WriteAttributeString("ToY", ToY.ToString());
            }
        }
Beispiel #3
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Directrix != null ? Directrix.ToStepValue() : "$");
            parameters.Add(Radius != null ? Radius.ToStepValue() : "$");
            parameters.Add(InnerRadius != null ? InnerRadius.ToStepValue() : "$");
            parameters.Add(StartParam != null ? StartParam.ToStepValue() : "$");
            parameters.Add(EndParam != null ? EndParam.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
Beispiel #4
0
    /*
     * void OnMouseDown()
     * {
     *  CursorSelect(Experiment.Input.mousePosition);
     * }
     * void OnMouseUp()
     * {
     *  CursorDeselect(Experiment.Input.mousePosition);
     * }
     */

    private void CursorSelect(Vector2 pos)
    {
        pos = Camera.main.ScreenToWorldPoint(new Vector3(pos.x, pos.y, Camera.main.nearClipPlane));
        if (InnerRadius.OverlapPoint(pos))
        {
            SelectionOffset = ((Vector2)transform.position) - pos;
            Disconnect();
            CursorSelected       = true;
            transform.localScale = baseScale * 1.15f;

            sprite.sortingOrder = 4;
        }
    }
Beispiel #5
0
 /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// <see langword="true" /> if the current object is equal to the <paramref name="other" />
 /// parameter; otherwise, <see langword="false" />.
 /// </returns>
 public bool Equals(PlanetaryRing other) => Icy == other.Icy &&
 InnerRadius.Equals(other.InnerRadius) &&
 OuterRadius.Equals(other.OuterRadius);
Beispiel #6
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (StartValue.HasValue)
            {
                writer.WriteAttributeString("StartValue", StartValue.ToString());
            }
            if (EndValue.HasValue)
            {
                writer.WriteAttributeString("EndValue", EndValue.ToString());
            }
            if (DisplayValue.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("DisplayValue", DisplayValue);
            }
            if (ValueInside.HasValue)
            {
                writer.WriteAttributeString("ValueInside", ValueInside.GetHashCode().ToString());
            }

            if (Color.HasValue)
            {
                writer.WriteAttributeString("Color", Color.Value.ToHexString());
            }
            if (Thickness.HasValue)
            {
                writer.WriteAttributeString("Thickness", Thickness.ToString());
            }

            if (ShowBorder.HasValue)
            {
                writer.WriteAttributeString("ShowBorder", ShowBorder.GetHashCode().ToString());
            }
            if (BorderColor.HasValue)
            {
                writer.WriteAttributeString("BorderColor", BorderColor.Value.ToHexString());
            }

            if (Radius.HasValue)
            {
                writer.WriteAttributeString("Radius", Radius.ToString());
            }
            if (InnerRadius.HasValue)
            {
                writer.WriteAttributeString("InnerRadius", InnerRadius.ToString());
            }

            if (Dashed.HasValue)
            {
                writer.WriteAttributeString("Dashed", Dashed.GetHashCode().ToString());
            }
            if (DashLen.HasValue)
            {
                writer.WriteAttributeString("DashLen", DashLen.ToString());
            }
            if (DashGap.HasValue)
            {
                writer.WriteAttributeString("DashGap", DashGap.ToString());
            }

            if (UseMarker.HasValue)
            {
                writer.WriteAttributeString("UseMarker", UseMarker.GetHashCode().ToString());
            }
            if (MarkerColor.HasValue)
            {
                writer.WriteAttributeString("MarkerColor", MarkerColor.Value.ToHexString());
            }
            if (MarkerBorderColor.HasValue)
            {
                writer.WriteAttributeString("MarkerBorderColor", MarkerBorderColor.Value.ToHexString());
            }
            if (MarkerRadius.HasValue)
            {
                writer.WriteAttributeString("MarkerRadius", MarkerRadius.ToString());
            }
            if (MarkerTooltext.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("MarkerTooltext", MarkerTooltext);
            }
        }