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); }
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)); }
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); } }
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); }
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); }
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)); }
public static Tweener MoveOutVertSide(Transform transformToCastAndMove, float movementSpeed, VerticalOrientation moveOutTo, Ease ease = Ease.Unset) { return(MoveOutVertSide((RectTransform)transformToCastAndMove, movementSpeed, moveOutTo, ease)); }
public TextOrientation(VerticalOrientation vertical, HorizontalOrientation horizontal) { Vertical = vertical; Horizontal = horizontal; }
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)); }