Esempio n. 1
0
    /// <summary>
    /// 读完表后处理
    /// </summary>
    protected override void afterReadConfig()
    {
        base.afterReadConfig();

        showPartsT      = ObjectUtils.parseIntIntMapByDIntArr(showParts);
        defaultHitRectT = SRect.createByConfig(defaultHitRect);
    }
Esempio n. 2
0
 public void copy(SRect rect)
 {
     x      = rect.x;
     y      = rect.y;
     width  = rect.width;
     height = rect.height;
 }
Esempio n. 3
0
 public void Set(SRect Obj_)
 {
     Left   = Obj_.Left;
     Right  = Obj_.Right;
     Bottom = Obj_.Bottom;
     Top    = Obj_.Top;
 }
Esempio n. 4
0
 public static SRect Multi(this SRect Rect_, SPoint Dir_)
 {
     Rect_.Left   *= Dir_.X;
     Rect_.Right  *= Dir_.X;
     Rect_.Bottom *= Dir_.Y;
     Rect_.Top    *= Dir_.Y;
     return(Rect_);
 }
Esempio n. 5
0
 public static SRect Add(this SRect Rect_, SPoint Dir_)
 {
     Rect_.Left   += Dir_.X;
     Rect_.Right  += Dir_.X;
     Rect_.Bottom += Dir_.Y;
     Rect_.Top    += Dir_.Y;
     return(Rect_);
 }
Esempio n. 6
0
 private void Find()
 {
     if (!string.IsNullOrEmpty(find))
     {
         SRect r = nodeRootList[int.Parse(find)].windowRect;
         nodeRootList[int.Parse(find)].windowRect = new SRect(0, 0, r.width, r.height);
     }
 }
Esempio n. 7
0
 public static bool IsOverlappedRectRect(SRect Rect0_, SRect Rect1_)
 {
     return(
         Rect0_.Left <= Rect1_.Right &&
         Rect0_.Right >= Rect1_.Left &&
         Rect0_.Bottom <= Rect1_.Top &&
         Rect0_.Top >= Rect1_.Bottom);
 }
Esempio n. 8
0
        public static bool IsCollidedRectRect2(SRect Rect0_, SRect Rect1_, SPoint Dir0_, SPoint Dir1_, SCollisionInfo CollisionInfo_)
        {
            if (!IsCollidedRectRect(Rect0_, Rect1_, Dir0_.GetSub(Dir1_), CollisionInfo_))
            {
                return(false);
            }

            CollisionInfo_.Point.Add(Dir1_.GetMulti(CollisionInfo_.Time));
            return(true);
        }
Esempio n. 9
0
        public static bool IsOverlappedPointRect(SPoint Point_, SRect Rect_)
        {
            if (
                Point_.X >= Rect_.Left &&
                Point_.X <= Rect_.Right &&
                Point_.Y >= Rect_.Bottom &&
                Point_.Y <= Rect_.Top)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 10
0
    public bool overlap(SRect rect)
    {
        if (rect == null)
        {
            return(false);
        }

        if (Math.Abs(x - rect.x) < Math.Abs(width / 2) + Math.Abs(rect.width / 2) && Math.Abs(y - rect.y) < Math.Abs(height / 2) + Math.Abs(rect.height / 2))
        {
            return(true);
        }

        return(false);
    }
Esempio n. 11
0
    /** 通过配置创建 */
    public static SRect createByConfig(float[] arr)
    {
        SRect re = new SRect();

        if (arr.Length >= 4)
        {
            re.x      = arr[0];
            re.y      = arr[1];
            re.width  = arr[2];
            re.height = arr[3];
        }

        return(re);
    }
Esempio n. 12
0
        public static bool IsCollidedRectRect(SRect Rect0_, SRect Rect1_, SPoint Dir_, SCollisionInfo CollisionInfo_)
        {
            if (Dir_.X > 0.0)
            {
                if (IsCollidedVSegmentVSegment(
                        new SVSegment(new SVLine(Rect0_.Right), Rect0_.Bottom, Rect0_.Top),
                        new SVSegment(new SVLine(Rect1_.Left), Rect1_.Bottom, Rect1_.Top),
                        Dir_, CollisionInfo_))
                {
                    return(true);
                }
            }
            else if (Dir_.X < 0.0)
            {
                if (IsCollidedVSegmentVSegment(
                        new SVSegment(new SVLine(Rect0_.Left), Rect0_.Bottom, Rect0_.Top),
                        new SVSegment(new SVLine(Rect1_.Right), Rect1_.Bottom, Rect1_.Top),
                        Dir_, CollisionInfo_))
                {
                    return(true);
                }
            }

            if (Dir_.Y > 0.0)
            {
                if (IsCollidedHSegmentHSegment(
                        new SHSegment(new SHLine(Rect0_.Top), Rect0_.Left, Rect0_.Right),
                        new SHSegment(new SHLine(Rect1_.Bottom), Rect1_.Left, Rect1_.Right),
                        Dir_, CollisionInfo_))
                {
                    return(true);
                }
            }
            else if (Dir_.Y < 0.0)
            {
                if (IsCollidedHSegmentHSegment(
                        new SHSegment(new SHLine(Rect0_.Bottom), Rect0_.Left, Rect0_.Right),
                        new SHSegment(new SHLine(Rect1_.Top), Rect1_.Left, Rect1_.Right),
                        Dir_, CollisionInfo_))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 13
0
        public static bool IsOverlappedCircleRect(SCircle Circle_, SRect Rect_)
        {
            if (
                // 세로로 긴 직사각형에 포함
                IsOverlappedPointRect(Circle_, new SRect(Rect_.Left, Rect_.Right, Rect_.Bottom - Circle_.Radius, Rect_.Top + Circle_.Radius)) ||
                // 가로로 긴 직사각형에 포함
                IsOverlappedPointRect(Circle_, new SRect(Rect_.Left - Circle_.Radius, Rect_.Right + Circle_.Radius, Rect_.Bottom, Rect_.Top)) ||
                // 네 모서리 1/4 원에 포함
                IsOverlappedPointCircle(new SPoint(Rect_.Left, Rect_.Bottom), Circle_) ||
                IsOverlappedPointCircle(new SPoint(Rect_.Right, Rect_.Bottom), Circle_) ||
                IsOverlappedPointCircle(new SPoint(Rect_.Left, Rect_.Top), Circle_) ||
                IsOverlappedPointCircle(new SPoint(Rect_.Right, Rect_.Top), Circle_)
                )
            {
                return(true);
            }

            return(false);
        }
Esempio n. 14
0
        public override SRect getSelfBox()
        {
            if (!_g11)
            {
                _m11 = instance.Type.GetMethod("getSelfBox", 0);
                _g11 = true;
            }

            if (_m11 != null && !_b11)
            {
                _b11 = true;
                SRect re = (SRect)appdomain.Invoke(_m11, instance, null);
                _b11 = false;
                return(re);
            }
            else
            {
                return(base.getSelfBox());
            }
        }
Esempio n. 15
0
        public override void Init()
        {
            m_interiorbg = new SRect(new Color(0.8f, 0.8f, 0.8f, 0.4f))
            {
                Parent = Elem,
                Size   = Elem.InnerSize
            };

            m_interior = new SRect(new Color(0.9f, 0.1f, 0.1f, 0.7f))
            {
                Parent = Elem,
                Size   = Elem.InnerSize,
                With   =
                {
                    new HealthBarInterior(m_HealthHaver)
                }
            };

            m_offset -= Elem.Size / 2f;
        }
Esempio n. 16
0
    protected override void afterReadConfig()
    {
        base.afterReadConfig();

        damageTypesT = new int[damages.Length];

        for (int i = damages.Length - 1; i >= 0; --i)
        {
            damageTypesT[i] = damages[i][0];
        }

        momentActionsT = new int[AttackMomentType.size][][];

        for (int i = momentActions.Length - 1; i >= 0; --i)
        {
            int[] arr = momentActions[i];

            int[][] arr2 = momentActionsT[arr[0]];

            if (arr2 == null)
            {
                arr2    = new int[1][];
                arr2[0] = arr;
            }
            else
            {
                int[][] arr3 = new int[arr2.Length + 1][];
                Array.Copy(arr2, 0, arr3, 0, arr2.Length);
                arr3[arr2.Length] = arr;
                arr2 = arr3;
            }

            momentActionsT[arr[0]] = arr2;
        }

        if (scope == AttackScopeType.AttackRect)
        {
            hitRect = SRect.createByConfig(scopeArgs);
        }
    }
Esempio n. 17
0
        public override SRect getAttackBox(AttackLevelConfig config)
        {
            if (!_g12)
            {
                _m12 = instance.Type.GetMethod("getAttackBox", 1);
                _g12 = true;
            }

            if (_m12 != null && !_b12)
            {
                _b12   = true;
                _p1[0] = config;
                SRect re = (SRect)appdomain.Invoke(_m12, instance, _p1);
                _p1[0] = null;
                _b12   = false;
                return(re);
            }
            else
            {
                return(base.getAttackBox(config));
            }
        }
Esempio n. 18
0
        public override SRect getAttackAround2DBox(float radius, float height)
        {
            if (!_g13)
            {
                _m13 = instance.Type.GetMethod("getAttackAround2DBox", 2);
                _g13 = true;
            }

            if (_m13 != null && !_b13)
            {
                _b13   = true;
                _p2[0] = radius;
                _p2[1] = height;
                SRect re = (SRect)appdomain.Invoke(_m13, instance, _p2);
                _p2[0] = null;
                _p2[1] = null;
                _b13   = false;
                return(re);
            }
            else
            {
                return(base.getAttackAround2DBox(radius, height));
            }
        }
Esempio n. 19
0
 public static SRect GetMulti(this SRect Rect_, SPoint Dir_)
 {
     return(new SRect(Rect_).Multi(Dir_));
 }
Esempio n. 20
0
 public SRectTheta(SRect Super_, Single Theta_) : base(Super_)
 {
     Theta = Theta_;
 }
Esempio n. 21
0
 public static float Width(this SRect Rect_)
 {
     return(Rect_.Right - Rect_.Left);
 }
Esempio n. 22
0
 public static float Height(this SRect Rect_)
 {
     return(Rect_.Top - Rect_.Bottom);
 }
Esempio n. 23
0
 public static SRect GetAdd(this SRect Rect_, SPoint Dir_)
 {
     return(new SRect(Rect_).Add(Dir_));
 }
Esempio n. 24
0
 public static SPoint Center(this SRect Rect_)
 {
     return(new SPoint((Rect_.Right + Rect_.Left) * 0.5f, (Rect_.Top + Rect_.Bottom) * 0.5f));
 }
Esempio n. 25
0
 public static SPoint GetRightBottom(this SRect Rect_)
 {
     return(new SPoint(Rect_.Right, Rect_.Bottom));
 }
Esempio n. 26
0
 public static SPoint GetLeftBottom(this SRect Rect_)
 {
     return(new SPoint(Rect_.Left, Rect_.Bottom));
 }
Esempio n. 27
0
 public static SPoint GetRightTop(this SRect Rect_)
 {
     return(new SPoint(Rect_.Right, Rect_.Top));
 }
Esempio n. 28
0
 public static SPoint GetLeftTop(this SRect Rect_)
 {
     return(new SPoint(Rect_.Left, Rect_.Top));
 }