示例#1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            VerticalOrientation orientation = (VerticalOrientation)value;

            if (orientation == VerticalOrientation.Top)
            {
                return(Dock.Top);
            }

            return(Dock.Bottom);
        }
示例#2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            VerticalOrientation vertical = (VerticalOrientation)value;

            if (vertical == VerticalOrientation.Top)
            {
                return(new Thickness(10, 10, 10, 0));
            }

            return(new Thickness(10, 0, 10, 10));
        }
示例#3
0
    public static float GetSelfParentPosition(RectTransform self, VerticalOrientation orientation)
    {
        RectTransform parentTransform = ((RectTransform)self.parent.transform);
        float         heighestPoint   = self.anchorMax.y * parentTransform.rect.height;
        float         lowestPoint     = self.anchorMin.y * parentTransform.rect.height;

        if (orientation == VerticalOrientation.Up)
        {
            return(parentTransform.rect.height - heighestPoint);
        }
        else
        {
            return(0 - lowestPoint);
        }
    }
示例#4
0
        private int GetIndexByVerticalOrientation(VerticalOrientation vertical)
        {
            switch (vertical)
            {
            case VerticalOrientation.Top:
                return(0);

            case VerticalOrientation.Middle:
                return(1);

            case VerticalOrientation.Bottom:
                return(2);
            }
            return(0);
        }
    public static Rect GetScreenRectByOrientation(Vector2 scrPos, HorizontalOrientation hor, VerticalOrientation ver, float width, float height)
    {
        float x = Screen.width * scrPos.x;
        float y = Screen.height * scrPos.y;

        float xMin = 0;
        float xMax = 0;
        float yMin = 0;
        float yMax = 0;

        switch (hor)
        {
            case global::HorizontalOrientation.Left:
                xMin = x;
                xMax = x + width;
                break;
            case global::HorizontalOrientation.Middle:
                xMin = x - 0.5f * width;
                xMax = x + 0.5f * width;
                break;
            case global::HorizontalOrientation.Right:
                xMin = x - width;
                xMax = x;
                break;
        }

        switch (ver)
        {
            case global::VerticalOrientation.Top:
                yMin = y;
                yMax = y + height;
                break;
            case global::VerticalOrientation.Middle:
                yMin = y - 0.5f * height;
                yMax = y + 0.5f * height;
                break;
            case global::VerticalOrientation.Bottom:
                yMin = y - height;
                yMax = y;
                break;
        }
        return Rect.MinMaxRect(xMin, yMin, xMax, yMax);
    }
示例#6
0
        public RoboticArm(List <IMyTerminalBlock> allBlocks, IMyMotorStator baseRotor, IMyTerminalBlock tip,
                          VerticalOrientation verticalOrientation     = VerticalOrientation.Upper,
                          ArmBaseOrientationLayout armBaseOrientation = ArmBaseOrientationLayout.Right)
        {
            RotorRotation       = new HandyRotor(baseRotor);
            Tip                 = tip;
            VerticalOrientation = verticalOrientation;
            ArmBaseOrientation  = armBaseOrientation;

            // finding next 2 rotors to assign as robotic arm rotors
            var connectionBlocks = allBlocks.OfType <IMyMechanicalConnectionBlock>().ToList();
            var currentBlock     = baseRotor;

            currentBlock = GetNextRotorBlock(connectionBlocks, currentBlock);
            Rotor1       = new HandyRotor(currentBlock);

            currentBlock = GetNextRotorBlock(connectionBlocks, currentBlock);
            Rotor2       = new HandyRotor(currentBlock);
        }
示例#7
0
    public static Tweener MoveInVertSide(RectTransform transformToMove, float movementSpeed, VerticalOrientation moveInFrom, Ease ease = Ease.Unset)
    {
        Vector2 spawnPosition = transformToMove.anchoredPosition;
        Vector2 outsidePos    = spawnPosition;

        float heightCalculationObject = (transformToMove.rect.height);

        outsidePos.y = GetSelfParentPosition(transformToMove, moveInFrom);
        if (moveInFrom == VerticalOrientation.Up)
        {
            outsidePos.y += heightCalculationObject * transformToMove.pivot.y;
        }
        else
        {
            outsidePos.y -= heightCalculationObject * (1 - transformToMove.pivot.y);
        }

        transformToMove.anchoredPosition = outsidePos;

        return(transformToMove.DOAnchorPosY(spawnPosition.y, movementSpeed).SetEase(ease));
    }
示例#8
0
 public static Tweener MoveOutVertSide(Transform transformToCastAndMove, float movementSpeed, VerticalOrientation moveOutTo, Ease ease = Ease.Unset)
 {
     return(MoveOutVertSide((RectTransform)transformToCastAndMove, movementSpeed, moveOutTo, ease));
 }
示例#9
0
 public TextOrientation(VerticalOrientation vertical, HorizontalOrientation horizontal)
 {
     Vertical   = vertical;
     Horizontal = horizontal;
 }
示例#10
0
    public static Rect GetScreenRectByOrientation(Vector2 scrPos, HorizontalOrientation hor, VerticalOrientation ver, float width, float height)
    {
        float x = Screen.width * scrPos.x;
        float y = Screen.height * scrPos.y;

        float xMin = 0;
        float xMax = 0;
        float yMin = 0;
        float yMax = 0;

        switch (hor)
        {
        case global::HorizontalOrientation.Left:
            xMin = x;
            xMax = x + width;
            break;

        case global::HorizontalOrientation.Middle:
            xMin = x - 0.5f * width;
            xMax = x + 0.5f * width;
            break;

        case global::HorizontalOrientation.Right:
            xMin = x - width;
            xMax = x;
            break;
        }

        switch (ver)
        {
        case global::VerticalOrientation.Top:
            yMin = y;
            yMax = y + height;
            break;

        case global::VerticalOrientation.Middle:
            yMin = y - 0.5f * height;
            yMax = y + 0.5f * height;
            break;

        case global::VerticalOrientation.Bottom:
            yMin = y - height;
            yMax = y;
            break;
        }
        return(Rect.MinMaxRect(xMin, yMin, xMax, yMax));
    }