コード例 #1
0
        public void SnapLine_AdjustOffset(int offset, int adjustment, int expected)
        {
            var snapLine = new SnapLine(SnapLineType.Baseline, offset, DefaultFilter, DefaultPriority);

            snapLine.AdjustOffset(adjustment);
            Assert.Equal(expected, snapLine.Offset);
        }
コード例 #2
0
        public void SnapLine_ShouldSnap_should_return_false_if_types_differ()
        {
            var snapLine1 = new SnapLine(SnapLineType.Top, DefaultOffset, DefaultFilter, DefaultPriority);
            var snapLine2 = new SnapLine(SnapLineType.Baseline, DefaultOffset, DefaultFilter, DefaultPriority);

            Assert.False(SnapLine.ShouldSnap(snapLine1, snapLine2));
        }
コード例 #3
0
        public void SnapLine_ShouldSnap_should_return_expected_if_types_equal_and_filter_contains_padding(string snapLine1Filter, string snapLine2Filter, bool expected)
        {
            var snapLine1 = new SnapLine(SnapLineType.Top, DefaultOffset, snapLine1Filter, DefaultPriority);
            var snapLine2 = new SnapLine(SnapLineType.Top, DefaultOffset, snapLine2Filter, SnapLinePriority.Low);

            Assert.Equal(expected, SnapLine.ShouldSnap(snapLine1, snapLine2));
        }
コード例 #4
0
        public void SnapLine_ShouldSnap_should_return_false_if_types_equal_and_filters_not_match()
        {
            var snapLine1 = new SnapLine(SnapLineType.Top, DefaultOffset, "custom filter", DefaultPriority);
            var snapLine2 = new SnapLine(SnapLineType.Top, DefaultOffset, "another filter", SnapLinePriority.Low);

            Assert.False(SnapLine.ShouldSnap(snapLine1, snapLine2));
        }
コード例 #5
0
        public void SnapLine_ShouldSnap_should_return_true_if_types_equal_and_both_filters_null()
        {
            var snapLine1 = new SnapLine(SnapLineType.Top, DefaultOffset, null, DefaultPriority);
            var snapLine2 = new SnapLine(SnapLineType.Top, DefaultOffset, null, SnapLinePriority.Low);

            Assert.True(SnapLine.ShouldSnap(snapLine1, snapLine2));
        }
コード例 #6
0
        public void SnapLine_ShouldSnap_should_return_false_if_types_equal_and_one_of_filters_not_null()
        {
            var snapLine1 = new SnapLine(SnapLineType.Top, DefaultOffset, null, DefaultPriority);
            var snapLine2 = new SnapLine(SnapLineType.Top, DefaultOffset, DefaultFilter, SnapLinePriority.Low);

            Assert.False(SnapLine.ShouldSnap(snapLine1, snapLine2));
        }
コード例 #7
0
        /// <summary>
        ///  Returns true if SnapLine s1 should snap to SnapLine s2.
        /// </summary>
        public static bool ShouldSnap(SnapLine line1, SnapLine line2)
        {
            // types must first be equal
            if (line1.SnapLineType != line2.SnapLineType)
            {
                return(false);
            }

            // if the filters are both null - then return true
            if (line1.Filter == null && line2.Filter == null)
            {
                return(true);
            }

            // at least one filter is non-null so if the other is null
            // then we don't have a match
            if (line1.Filter == null || line2.Filter == null)
            {
                return(false);
            }

            // check for our special-cased margin filter
            if (line1.Filter.Contains(Margin))
            {
                if (line1.Filter.Equals(MarginRight) && (line2.Filter.Equals(MarginLeft) || line2.Filter.Equals(PaddingRight)) ||
                    line1.Filter.Equals(MarginLeft) && (line2.Filter.Equals(MarginRight) || line2.Filter.Equals(PaddingLeft)) ||
                    line1.Filter.Equals(MarginTop) && (line2.Filter.Equals(MarginBottom) || line2.Filter.Equals(PaddingTop)) ||
                    line1.Filter.Equals(MarginBottom) && (line2.Filter.Equals(MarginTop) || line2.Filter.Equals(PaddingBottom)))
                {
                    return(true);
                }

                return(false);
            }

            // check for padding & margins
            if (line1.Filter.Contains(Padding))
            {
                if ((line1.Filter.Equals(PaddingLeft) && line2.Filter.Equals(MarginLeft)) ||
                    (line1.Filter.Equals(PaddingRight) && line2.Filter.Equals(MarginRight)) ||
                    (line1.Filter.Equals(PaddingTop) && line2.Filter.Equals(MarginTop)) ||
                    (line1.Filter.Equals(PaddingBottom) && line2.Filter.Equals(MarginBottom)))
                {
                    return(true);
                }

                return(false);
            }

            // basic filter equality
            if (line1.Filter.Equals(line2.Filter))
            {
                return(true);
            }

            // not equal!
            return(false);
        }
コード例 #8
0
        public void SnapLine_Ctor_type_offset()
        {
            var snapLine = new SnapLine(SnapLineType.Baseline, DefaultOffset);

            Assert.Equal(SnapLineType.Baseline, snapLine.SnapLineType);
            Assert.Equal(DefaultOffset, snapLine.Offset);
            Assert.Null(snapLine.Filter);
            Assert.Equal(SnapLinePriority.Low, snapLine.Priority);
        }
コード例 #9
0
        public void SnapLine_Ctor_type_offset_filter_priority()
        {
            var snapLine = new SnapLine(SnapLineType.Baseline, DefaultOffset, DefaultFilter, DefaultPriority);

            Assert.Equal(SnapLineType.Baseline, snapLine.SnapLineType);
            Assert.Equal(DefaultOffset, snapLine.Offset);
            Assert.Equal(DefaultFilter, snapLine.Filter);
            Assert.Equal(DefaultPriority, snapLine.Priority);
        }
コード例 #10
0
ファイル: SnapLine.cs プロジェクト: Profit0004/mono
		public static bool ShouldSnap (SnapLine line1, SnapLine line2)
		{
			throw new NotImplementedException ();
		}
コード例 #11
0
 public static bool ShouldSnap(SnapLine line1, SnapLine line2)
 {
 }
コード例 #12
0
        public void SnapLine_IsVertical(SnapLineType type, bool expected)
        {
            var snapLine = new SnapLine(type, DefaultOffset, DefaultFilter, DefaultPriority);

            Assert.Equal(expected, snapLine.IsVertical);
        }
コード例 #13
0
        public void SnapLine_ToString(string filter, string expected)
        {
            var snapLine = new SnapLine(SnapLineType.Baseline, DefaultOffset, filter, DefaultPriority);

            Assert.Equal(expected, snapLine.ToString());
        }
コード例 #14
0
 public static bool ShouldSnap(SnapLine line1, SnapLine line2)
 {
 }
コード例 #15
0
 public static bool ShouldSnap(SnapLine line1, SnapLine line2)
 {
     throw null;
 }
コード例 #16
0
        protected override void Draw()
        {
            if (Radar2D.Option.IsVisible)
            {
                Radar2D.Draw(Render2D, RenderSurface.Size);
            }

            foreach (Player player in _players)
            {
                if (player.IsValid() && player.Name != _localPlayer.Name)
                {
                    if (Name.Option.IsVisible)
                    {
                        if (!Name.Option.IsOnlyEnemyVisible || Name.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            Name.Draw_y(Render2D, player.Position, _localPlayer.ViewProj, new Size(1920, 1080), player.Name, player.Height, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                        }
                    }

                    if (Health.Option.IsVisible)
                    {
                        if (!Health.Option.IsOnlyEnemyVisible || Health.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            Health.Draw_y(Render2D, player.Position, _localPlayer.ViewProj, new Size(1920, 1080), player.Health, player.MaxHealth, player.Height, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                        }
                    }

                    if (Box2D.Option.IsVisible)
                    {
                        if (!Box2D.Option.IsOnlyEnemyVisible || Box2D.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            Box2D.Draw_y(Render2D, new Size(1920, 1080), _localPlayer.ViewProj, player.Position, player.Height, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                        }
                    }

                    if (Box3D.Option.IsVisible)
                    {
                        if (!Box3D.Option.IsOnlyEnemyVisible || Box3D.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            Box3D.Draw_y(Render2D, player.BoundingBox(), player.Position, player.Yaw, _localPlayer.ViewProj, new Size(1920, 1080), player.IsVisible, _localPlayer.TeamId == player.TeamId);
                        }
                    }

                    if (SnapLine.Option.IsVisible)
                    {
                        if (!SnapLine.Option.IsOnlyEnemyVisible || SnapLine.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            SnapLine.Draw_y(Render2D, player.Position, _localPlayer.ViewProj, RenderSurface.Size, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                        }
                    }

                    if (Radar2D.Option.IsVisible)
                    {
                        if (!Radar2D.Option.IsOnlyEnemyVisible || Radar2D.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            Radar2D.DrawPlayer(Render2D, player.Position, _localPlayer.Position, RenderSurface.Size, _localPlayer.Yaw, player.IsVisible, _localPlayer.TeamId == player.TeamId);

                            if (Radar2D.Option.IsVisibleName)
                            {
                                Radar2D.DrawName(Render2D, player.Position, _localPlayer.Position, RenderSurface.Size, player.Name, _localPlayer.Yaw, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                            }
                        }
                    }

                    if (CrosshairRadar.Option.IsVisible)
                    {
                        if (!CrosshairRadar.Option.IsOnlyEnemyVisible || CrosshairRadar.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            CrosshairRadar.DrawPlayer(Render2D, player.Position, _localPlayer.Position, RenderSurface.Size, _localPlayer.Yaw, player.IsVisible, _localPlayer.TeamId == player.TeamId);

                            if (CrosshairRadar.Option.IsVisibleName)
                            {
                                CrosshairRadar.DrawName(Render2D, player.Position, _localPlayer.Position, RenderSurface.Size, player.Name, _localPlayer.Yaw, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                            }
                        }
                    }

                    if (DisplayRadar.Option.IsVisible)
                    {
                        if (!DisplayRadar.Option.IsOnlyEnemyVisible || DisplayRadar.Option.IsOnlyEnemyVisible && _localPlayer.TeamId != player.TeamId)
                        {
                            DisplayRadar.DrawPlayer(Render2D, player.Position, _localPlayer.Position, RenderSurface.Size, _localPlayer.Yaw, player.IsVisible, _localPlayer.TeamId == player.TeamId);
                        }
                    }
                }
            }

            if (Crosshair.Option.IsVisible)
            {
                Crosshair.Draw(Render2D, RenderSurface.Size);
            }
        }
コード例 #17
0
        public void SnapLine_ensure_IsHorizontal_IsVertical_do_not_overlap(SnapLineType type)
        {
            var snapLine = new SnapLine(type, DefaultOffset, DefaultFilter, DefaultPriority);

            Assert.NotEqual(snapLine.IsHorizontal, snapLine.IsVertical);
        }
コード例 #18
0
 /// <summary>
 ///     Returns true if SnapLine s1 should snap to SnapLine s2.
 /// </summary>
 public static bool ShouldSnap(SnapLine line1, SnapLine line2)
 {
     throw new NotImplementedException(SR.NotImplementedByDesign);
 }
コード例 #19
0
 public void SetSnap(SnapLine snap)
 {
     snaps.Add(snap);
 }