Exemple #1
0
        protected override void AddLayoutLine(LayoutLine line, VisualElementType elementType, LineExportConfig lineConfig)
        {
            switch (elementType)
            {
            case VisualElementType.Fret:
                AddDxfLine("Frets", line, lineConfig);
                break;

            case VisualElementType.String:
                AddDxfLine("Strings", line, lineConfig);
                break;

            case VisualElementType.FingerboardEdge:
            case VisualElementType.FingerboardMargin:
            case VisualElementType.FingerboardContinuation:
                AddDxfLine("Fingerboard", line, lineConfig);
                break;

            case VisualElementType.CenterLine:
            case VisualElementType.GuideLine:
            case VisualElementType.StringMidline:
                AddDxfLine("Layout", line, lineConfig);
                break;
            }
        }
Exemple #2
0
        private bool AreSimilar(ILayoutLine line1, ILayoutLine line2, VisualElementType lineType)
        {
            switch (lineType)
            {
            case VisualElementType.Fret:
                return((line1 as FretLine).FretIndex == (line2 as FretLine).FretIndex);

            case VisualElementType.String:
                return((line1 as StringLine).Index == (line2 as StringLine).Index);

            case VisualElementType.StringMidline:
                return((line1 as StringCenter).Right.Index == (line2 as StringCenter).Right.Index &&
                       (line1 as StringCenter).Left.Index == (line2 as StringCenter).Left.Index);

            case VisualElementType.FingerboardEdge:
            {
                if (line1 is FingerboardSideEdge side1 && line2 is FingerboardSideEdge side2)
                {
                    return(side1.Side == side2.Side);
                }
                break;
            }
            }
            return(false);
        }
Exemple #3
0
 protected void UpdatePlayerWhileRemoving(VisualElementType visualElementType)
 {
     if (Player.GetType() != typeof(Player))
     {
         Player = ((PlayerDecorator)Player).RemoveLayer(visualElementType);
     }
 }
Exemple #4
0
        protected override void AddLayoutSpline(LayoutPolyLine line, VisualElementType elementType, LineExportConfig lineConfig)
        {
            switch (elementType)
            {
                case VisualElementType.Fret:
                    {
                        var svgSpline = CreateSvgSpline(GetLayer("Frets"), line, lineConfig);

                        FretLine fretLine = (line as FretLine) ?? (line.Tag as FretLine);
                        if (fretLine != null)
                        {
                            if (fretLine.IsNut)
                                svgSpline.CustomAttributes.Add("Fret", "Nut");
                            else
                                svgSpline.CustomAttributes.Add("Fret", fretLine.FretIndex.ToString());
                        }
                        break;
                    }
                case VisualElementType.FingerboardEdge:
                case VisualElementType.FingerboardMargin:
                case VisualElementType.FingerboardContinuation:
                    CreateSvgSpline(GetLayer("Fingerboard"), line, lineConfig);
                    break;

                //case VisualElementType.GuideLine:
                default:
                    CreateSvgSpline(GetLayer("Layout"), line, lineConfig);
                    break;
            }
        }
Exemple #5
0
        public static Uri GetPlayerPowerUp(VisualElementType visual)
        {
            byte[] data;

            string resource;

            switch (visual)
            {
            case VisualElementType.DoubleJump:
                resource = "PlayerDoubleJumpVisual";
                break;

            case VisualElementType.Invulnerability:
                resource = "PlayerInvulnerabilityVisual";
                break;

            case VisualElementType.SpeedBoost:
                resource = "PlayerSpeedBoostVisual";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(visual), visual, null);
            }

            spritesReader.GetResourceData(resource, out _, out data);

            return(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\.." +
                           System.Text.Encoding.UTF8.GetString(data).Substring(1)));
        }
Exemple #6
0
        public override IVisualElement RemoveLayer(VisualElementType visualElementType)
        {
            if (visualElementType == VisualElementType.Invulnerability)
            {
                return(Player);
            }

            UpdatePlayerWhileRemoving(visualElementType);

            return(this);
        }
Exemple #7
0
        public override IVisualElement RemoveLayer(VisualElementType visualElementType)
        {
            if (visualElementType == VisualElementType.DoubleJump)
            {
                return(Player);
            }

            UpdatePlayerWhileRemoving(visualElementType);

            return(this);
        }
Exemple #8
0
        public override IVisualElement RemoveLayer(VisualElementType visualElementType)
        {
            if (visualElementType == VisualElementType.SpeedBoost)
            {
                MediaPlayer.Pause();
                MediaPlayer.Close();

                return(Player);
            }

            UpdatePlayerWhileRemoving(visualElementType);

            return(this);
        }
Exemple #9
0
        protected override void AddLayoutLine(LayoutLine line, VisualElementType elementType, LineExportConfig lineConfig)
        {
            switch (elementType)
            {
                case VisualElementType.Fret:
                    {
                        var svgLine = CreateSvgLine(GetLayer("Frets"), line, lineConfig);

                        if (line.Tag is FretLine fretLine)
                        {
                            if (fretLine.IsNut)
                                svgLine.CustomAttributes.Add("Fret", "Nut");
                            else
                                svgLine.CustomAttributes.Add("Fret", fretLine.FretIndex.ToString());
                        }
                        break;
                    }
                
                case VisualElementType.FingerboardEdge:
                case VisualElementType.FingerboardMargin:
                case VisualElementType.FingerboardContinuation:
                    CreateSvgLine(GetLayer("Fingerboard"), line, lineConfig);
                    break;

                case VisualElementType.CenterLine:
                case VisualElementType.StringMidline:
                case VisualElementType.GuideLine:
                    CreateSvgLine(GetLayer("Layout"), line, lineConfig);
                    break;

                case VisualElementType.String:
                    {
                        var stringInfo = line as StringLine;
                        SvgLine svgLine;
                        if (Options.UseStringGauge && !stringInfo.String.Gauge.IsEmpty)
                        {
                            var lineThickness = GetRelativeUnit(stringInfo.String.Gauge);
                            svgLine = CreateSvgLine(GetLayer("Strings"), line, lineThickness, Options.Strings.Color);
                        }
                        else
                            svgLine = CreateSvgLine(GetLayer("Strings"), line, lineConfig);

                        svgLine.CustomAttributes.Add("Index", stringInfo.Index.ToString());
                        break;
                    }
            }
        }
Exemple #10
0
        protected override void AddLayoutSpline(LayoutPolyLine line, VisualElementType elementType, LineExportConfig lineConfig)
        {
            switch (elementType)
            {
            case VisualElementType.Fret:
                AddDxfSpline("Frets", line, lineConfig);
                break;

            case VisualElementType.FingerboardEdge:
            case VisualElementType.FingerboardMargin:
            case VisualElementType.FingerboardContinuation:
                AddDxfSpline("Fingerboard", line, lineConfig);
                break;

            //case VisualElementType.GuideLine:
            default:
                AddDxfSpline("Layout", line, lineConfig);
                break;
            }
        }
Exemple #11
0
 public LayoutPolyLine(IEnumerable <PointM> points, VisualElementType elementType) : base(elementType)
 {
     _Points = new ObservableCollectionEx <PointM>();
     _Points.CollectionChanged += Points_CollectionChanged;
     _Points.AddRange(points);
 }
 internal static KeyValuePair <VisualElementType, string> GetVisualElement(XDocument Manifest, VisualElementType VisualElementType)
 {
     return(new KeyValuePair <VisualElementType, string>(VisualElementType, GetAttributeValueOf(Manifest, Data.CONTAINER, Data.NAMES[VisualElementType])));
 }
 internal static bool HasVisualElement(XDocument Manifest, VisualElementType VisualElementType)
 {
     return(HasAttributeOn(Manifest, Data.CONTAINER, Data.NAMES[VisualElementType]));
 }
Exemple #14
0
 protected VisualElement(VisualElementType elementType)
 {
     _ElementType = elementType;
 }
Exemple #15
0
 public LayoutLine(PointM p1, PointM p2)
 {
     P1           = p1;
     P2           = p2;
     _ElementType = VisualElementType.GuideLine;
 }
Exemple #16
0
 public LayoutLine()
 {
     _ElementType = VisualElementType.GuideLine;
 }
Exemple #17
0
 public LayoutLine(PointM p1, PointM p2, VisualElementType type)
 {
     P1           = p1;
     P2           = p2;
     _ElementType = type;
 }
Exemple #18
0
 protected virtual void AddLayoutSpline(LayoutPolyLine line, VisualElementType elementType, LineExportConfig lineConfig)
 {
 }
Exemple #19
0
 public virtual IVisualElement RemoveLayer(VisualElementType visualElementType)
 {
     throw new NotImplementedException("Call concrete, not abstract");
 }