public void SetPositioning(AnchorTypes horiz, AnchorTypes vert, int gapx, int gapy) { mAnchorHoriz = horiz; mAnchorVert = vert; mGapx = gapx; mGapy = gapy; UpdatePosition(); }
public ctlAnchorable() { mCtlState = CtlState.Normal; InitializeComponent(); mGapx = 5; mGapy = 5; mAnchorHoriz = AnchorTypes.None; mAnchorVert = AnchorTypes.None; }
public ctlAnchorable() { mCtlState = CtlState.Normal; InitializeComponent(); mGapx = 5; mGapy = 5; mAnchorHoriz = AnchorTypes.None; mAnchorVert = AnchorTypes.None; mAutorepeatInitial = 0; mAutorepeatPeriod = 100; }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("WindowAnchor")) { // We may have OnTriggerEnter from the other anchor if (!gripped || attached) { return; } WindowAnchor otherAnchor = other.gameObject.GetComponent <WindowAnchor>(); if (otherAnchor.attached) { return; } AnchorTypes otherAnchorType = otherAnchor.anchorType; switch (anchorType) { case AnchorTypes.Left: if (otherAnchorType != AnchorTypes.Right) { return; } break; case AnchorTypes.Right: if (otherAnchorType != AnchorTypes.Left) { return; } break; case AnchorTypes.Bottom: if (otherAnchorType != AnchorTypes.Top) { return; } break; case AnchorTypes.Top: if (otherAnchorType != AnchorTypes.Bottom) { return; } break; } SetTarget(other.transform); StartCoroutine(AnimAnchors()); } }
protected int GetPosition(int refpos, int refwidth, int width, int gap, AnchorTypes anchor) { int retval = 0; switch (anchor) { case AnchorTypes.Top: case AnchorTypes.Left: retval = refpos + gap; break; case AnchorTypes.Center: retval = refpos + (refwidth - width) / 2 + gap; break; case AnchorTypes.Right: case AnchorTypes.Bottom: retval = refpos + refwidth - width - gap; break; } return(retval); }
protected int GetPosition(int refpos, int refwidth, int width, int gap, AnchorTypes anchor) { int retval = 0; switch (anchor) { case AnchorTypes.Top: case AnchorTypes.Left: retval = refpos + gap; break; case AnchorTypes.Center: retval = refpos + (refwidth - width) / 2 + gap; break; case AnchorTypes.Right: case AnchorTypes.Bottom: retval = refpos + refwidth - width - gap; break; } return retval; }