/// <summary> /// 读完表后处理 /// </summary> protected override void afterReadConfig() { base.afterReadConfig(); showPartsT = ObjectUtils.parseIntIntMapByDIntArr(showParts); defaultHitRectT = SRect.createByConfig(defaultHitRect); }
public void copy(SRect rect) { x = rect.x; y = rect.y; width = rect.width; height = rect.height; }
public void Set(SRect Obj_) { Left = Obj_.Left; Right = Obj_.Right; Bottom = Obj_.Bottom; Top = Obj_.Top; }
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_); }
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_); }
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); } }
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); }
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); }
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); }
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); }
/** 通过配置创建 */ 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); }
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); }
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); }
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()); } }
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; }
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); } }
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)); } }
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)); } }
public static SRect GetMulti(this SRect Rect_, SPoint Dir_) { return(new SRect(Rect_).Multi(Dir_)); }
public SRectTheta(SRect Super_, Single Theta_) : base(Super_) { Theta = Theta_; }
public static float Width(this SRect Rect_) { return(Rect_.Right - Rect_.Left); }
public static float Height(this SRect Rect_) { return(Rect_.Top - Rect_.Bottom); }
public static SRect GetAdd(this SRect Rect_, SPoint Dir_) { return(new SRect(Rect_).Add(Dir_)); }
public static SPoint Center(this SRect Rect_) { return(new SPoint((Rect_.Right + Rect_.Left) * 0.5f, (Rect_.Top + Rect_.Bottom) * 0.5f)); }
public static SPoint GetRightBottom(this SRect Rect_) { return(new SPoint(Rect_.Right, Rect_.Bottom)); }
public static SPoint GetLeftBottom(this SRect Rect_) { return(new SPoint(Rect_.Left, Rect_.Bottom)); }
public static SPoint GetRightTop(this SRect Rect_) { return(new SPoint(Rect_.Right, Rect_.Top)); }
public static SPoint GetLeftTop(this SRect Rect_) { return(new SPoint(Rect_.Left, Rect_.Top)); }