Example #1
0
 public void SetPositioning(AnchorTypes horiz, AnchorTypes vert, int gapx, int gapy)
 {
     mAnchorHoriz = horiz;
     mAnchorVert  = vert;
     mGapx        = gapx;
     mGapy        = gapy;
     UpdatePosition();
 }
Example #2
0
 public ctlAnchorable()
 {
     mCtlState = CtlState.Normal;
     InitializeComponent();
     mGapx        = 5;
     mGapy        = 5;
     mAnchorHoriz = AnchorTypes.None;
     mAnchorVert  = AnchorTypes.None;
 }
Example #3
0
 public ctlAnchorable()
 {
     mCtlState = CtlState.Normal;
     InitializeComponent();
     mGapx              = 5;
     mGapy              = 5;
     mAnchorHoriz       = AnchorTypes.None;
     mAnchorVert        = AnchorTypes.None;
     mAutorepeatInitial = 0;
     mAutorepeatPeriod  = 100;
 }
 public ctlAnchorable()
 {
     mCtlState = CtlState.Normal;
     InitializeComponent();
     mGapx = 5;
     mGapy = 5;
     mAnchorHoriz = AnchorTypes.None;
     mAnchorVert = AnchorTypes.None;
     mAutorepeatInitial = 0;
     mAutorepeatPeriod = 100;
 }
Example #5
0
        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());
            }
        }
Example #6
0
        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;
        }
 public void SetPositioning(AnchorTypes horiz, AnchorTypes vert, int gapx, int gapy)
 {
     mAnchorHoriz = horiz;
     mAnchorVert = vert;
     mGapx = gapx;
     mGapy = gapy;
     UpdatePosition();
 }