public static Color ToColor(this FaceColor fc) { switch (fc) { case FaceColor.White: return(Color.white); case FaceColor.Yellow: return(Color.yellow); case FaceColor.Orange: return(Color.magenta); case FaceColor.Red: return(Color.red); case FaceColor.Green: return(Color.green); case FaceColor.Blue: return(Color.blue); default: throw new ArgumentOutOfRangeException(nameof(fc), fc, null); } }
public void Rotate(FaceColor rotatingFace, RotationDirection direction) { //Handle the remapping of the rotating face rotateFace(rotatingFace, direction); //Handle the remapping of the adjacent faces switch (rotatingFace) { case FaceColor.Blue: rotateBlueAdjacentFaces(direction); break; case FaceColor.Green: rotateGreenAdjacentFaces(direction); break; case FaceColor.Orange: rotateOrangeAdjacentFaces(direction); break; case FaceColor.Red: rotateRedAdjacentFaces(direction); break; case FaceColor.White: rotateWhiteAdjacentFaces(direction); break; case FaceColor.Yellow: rotateYellowAdjacentFaces(direction); break; } }
public void SetRotatingFace(FaceColor faceColor) { rotatingFaceColor = faceColor; switch (faceColor) { case FaceColor.Blue: rotatingFace = blueFace; break; case FaceColor.Green: rotatingFace = greenFace; break; case FaceColor.Orange: rotatingFace = orangeFace; break; case FaceColor.Red: rotatingFace = redFace; break; case FaceColor.White: rotatingFace = whiteFace; break; case FaceColor.Yellow: rotatingFace = yellowFace; break; } }
public static ImmutableFaceletCube ToFaceletCube(this ICubieCube cubieCube) { var facelets = new FaceColor[Extensions.GetEnumValues <FaceletPosition>().Count()]; foreach (var i in Extensions.GetEnumValues <Corner>().Cast <int>()) { var corner = cubieCube.CornerPositions[i]; var orientation = cubieCube.CornerOrientations[i]; for (var k = 0; k < 3; k++) { facelets[(int)Definitions.CornerFacelet[i][(k + orientation) % 3]] = Definitions.CornerColor[(int)corner][k]; } } foreach (var i in Extensions.GetEnumValues <Edge>().Cast <int>()) { var edge = cubieCube.EdgePositions[i]; var orientation = cubieCube.EdgeOrientations[i]; for (var k = 0; k < 2; k++) { facelets[(int)Definitions.EdgeFacelet[i][(k + orientation) % 2]] = Definitions.EdgeColor[(int)edge][k]; } } //set centers foreach (var c in Extensions.GetEnumValues <FaceColor>()) { var centre = (int)c * 9 + 4; facelets[centre] = c; } var fc = new ImmutableFaceletCube(facelets); return(fc); }
public Card(FaceColor faceColor, FaceValue faceValue) { FaceColor = faceColor; FaceValue = faceValue; SetImage(); SetValues(); }
public StickerData(Vector3Int directions, FaceColor x = FaceColor.None, FaceColor y = FaceColor.None, FaceColor z = FaceColor.None) { Directions = directions; X = x; Y = y; Z = z; }
public CubeState() { for (byte currentFace = 0; currentFace < NUMBER_OF_FACES; currentFace++) { _squares[currentFace] = new FaceColor[CUBITS_PER_FACE]; for (byte currentSquare = 0; currentSquare < CUBITS_PER_FACE; currentSquare++) { _squares[currentFace][currentSquare] = (FaceColor)currentFace; } } }
private static GameObject Create(Vector3 direction, int multiplier, FaceColor faceColor, Transform parent) { var sticker = GameObject.CreatePrimitive(PrimitiveType.Cube); sticker.name = faceColor.ToString(); sticker.transform.SetParent(parent); Object.Destroy(sticker.GetComponent <BoxCollider>()); sticker.transform.localScale = new Vector3(0.8f, 0.8f, 0.1f); sticker.transform.SetPositionAndRotation( direction * multiplier * 0.5f, Quaternion.LookRotation(direction)); sticker.GetComponent <Renderer>().material.color = faceColor.ToColor(); return(sticker); }
private Orientation(FaceColor up, FaceColor right, FaceColor front, Direction upDirection, Direction rightDirection, Direction frontDirection, Direction downDirection, Direction leftDirection, Direction backDirection) { Directions = new Dictionary <FaceColor, Direction> { { FaceColor.U, upDirection }, { FaceColor.R, rightDirection }, { FaceColor.F, frontDirection }, { FaceColor.D, downDirection }, { FaceColor.L, leftDirection }, { FaceColor.B, backDirection }, }; Colors = new ReadonlyTwoWayDictionary <FaceColor, FaceColor>( (FaceColor.U, up), (FaceColor.R, right), (FaceColor.F, front), (FaceColor.D, GetOpposite(up)), (FaceColor.L, GetOpposite(right)), (FaceColor.B, GetOpposite(front)) ); }
private Orientation Transform(FaceColor newUp, FaceColor newRight, FaceColor newFront, RotationType upRotationType, RotationType rightRotationType, RotationType frontRotationType, RotationType downRotationType, RotationType leftRotationType, RotationType backRotationType) { var up = Colors.Forwards[newUp]; var right = Colors.Forwards[newRight]; var front = Colors.Forwards[newFront]; return(new Orientation(up, right, front, Move(Directions[newUp], upRotationType), Move(Directions[newRight], rightRotationType), Move(Directions[newFront], frontRotationType), Move(Directions[GetOpposite(newUp)], downRotationType), Move(Directions[GetOpposite(newRight)], leftRotationType), Move(Directions[GetOpposite(newFront)], backRotationType) )); }
private void rotateFace(FaceColor rotatingFace, RotationDirection direction) { var face = _squares[(byte)rotatingFace]; var tempCorner = face[Locations.TOP_LEFT]; var tempEdge = face[Locations.TOP]; if (direction == RotationDirection.Clockwise) { //Remap the corners face[Locations.TOP_LEFT] = face[Locations.BOTTOM_LEFT]; face[Locations.BOTTOM_LEFT] = face[Locations.BOTTOM_RIGHT]; face[Locations.BOTTOM_RIGHT] = face[Locations.TOP_RIGHT]; face[Locations.TOP_RIGHT] = tempCorner; //Remap the edges face[Locations.TOP] = face[Locations.LEFT]; face[Locations.LEFT] = face[Locations.BOTTOM]; face[Locations.BOTTOM] = face[Locations.RIGHT]; face[Locations.RIGHT] = tempEdge; } else { //Remap the corners face[Locations.TOP_LEFT] = face[Locations.TOP_RIGHT]; face[Locations.TOP_RIGHT] = face[Locations.BOTTOM_RIGHT]; face[Locations.BOTTOM_RIGHT] = face[Locations.BOTTOM_LEFT]; face[Locations.BOTTOM_LEFT] = tempCorner; //Remap the edges face[Locations.TOP] = face[Locations.RIGHT]; face[Locations.RIGHT] = face[Locations.BOTTOM]; face[Locations.BOTTOM] = face[Locations.LEFT]; face[Locations.LEFT] = tempEdge; } }
public Rotation(FaceColor faceColor, RotationDirection direction) { FaceColor = faceColor; Direction = direction; }
public void UpdateState(FaceColor rotatingFace, RotationDirection direction) { state.Rotate(rotatingFace, direction); }
public FaceColor?this[(FaceColor face, VerticalPositionEnum row, HorizontalPositionEnum column)index]
private void SetImage() { object imageObject = Resources.ResourceManager.GetObject(FaceColor.ToString() + (int)FaceValue); Image = (Image)imageObject; }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Visible != null) { hashCode = hashCode * 59 + Visible.GetHashCode(); } if (LegendGroup != null) { hashCode = hashCode * 59 + LegendGroup.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (UId != null) { hashCode = hashCode * 59 + UId.GetHashCode(); } if (Ids != null) { hashCode = hashCode * 59 + Ids.GetHashCode(); } if (CustomData != null) { hashCode = hashCode * 59 + CustomData.GetHashCode(); } if (Meta != null) { hashCode = hashCode * 59 + Meta.GetHashCode(); } if (MetaArray != null) { hashCode = hashCode * 59 + MetaArray.GetHashCode(); } if (HoverLabel != null) { hashCode = hashCode * 59 + HoverLabel.GetHashCode(); } if (Stream != null) { hashCode = hashCode * 59 + Stream.GetHashCode(); } if (UiRevision != null) { hashCode = hashCode * 59 + UiRevision.GetHashCode(); } if (X != null) { hashCode = hashCode * 59 + X.GetHashCode(); } if (Y != null) { hashCode = hashCode * 59 + Y.GetHashCode(); } if (Z != null) { hashCode = hashCode * 59 + Z.GetHashCode(); } if (I != null) { hashCode = hashCode * 59 + I.GetHashCode(); } if (J != null) { hashCode = hashCode * 59 + J.GetHashCode(); } if (K != null) { hashCode = hashCode * 59 + K.GetHashCode(); } if (Text != null) { hashCode = hashCode * 59 + Text.GetHashCode(); } if (TextArray != null) { hashCode = hashCode * 59 + TextArray.GetHashCode(); } if (HoverText != null) { hashCode = hashCode * 59 + HoverText.GetHashCode(); } if (HoverTextArray != null) { hashCode = hashCode * 59 + HoverTextArray.GetHashCode(); } if (HoverTemplate != null) { hashCode = hashCode * 59 + HoverTemplate.GetHashCode(); } if (HoverTemplateArray != null) { hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode(); } if (DelaunaYAxis != null) { hashCode = hashCode * 59 + DelaunaYAxis.GetHashCode(); } if (AlphaHull != null) { hashCode = hashCode * 59 + AlphaHull.GetHashCode(); } if (Intensity != null) { hashCode = hashCode * 59 + Intensity.GetHashCode(); } if (IntensityMode != null) { hashCode = hashCode * 59 + IntensityMode.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } if (VertexColor != null) { hashCode = hashCode * 59 + VertexColor.GetHashCode(); } if (FaceColor != null) { hashCode = hashCode * 59 + FaceColor.GetHashCode(); } if (CAuto != null) { hashCode = hashCode * 59 + CAuto.GetHashCode(); } if (CMin != null) { hashCode = hashCode * 59 + CMin.GetHashCode(); } if (CMax != null) { hashCode = hashCode * 59 + CMax.GetHashCode(); } if (CMid != null) { hashCode = hashCode * 59 + CMid.GetHashCode(); } if (ColorScale != null) { hashCode = hashCode * 59 + ColorScale.GetHashCode(); } if (AutoColorScale != null) { hashCode = hashCode * 59 + AutoColorScale.GetHashCode(); } if (ReverseScale != null) { hashCode = hashCode * 59 + ReverseScale.GetHashCode(); } if (ShowScale != null) { hashCode = hashCode * 59 + ShowScale.GetHashCode(); } if (ColorBar != null) { hashCode = hashCode * 59 + ColorBar.GetHashCode(); } if (ColorAxis != null) { hashCode = hashCode * 59 + ColorAxis.GetHashCode(); } if (Opacity != null) { hashCode = hashCode * 59 + Opacity.GetHashCode(); } if (FlatShading != null) { hashCode = hashCode * 59 + FlatShading.GetHashCode(); } if (Contour != null) { hashCode = hashCode * 59 + Contour.GetHashCode(); } if (LightPosition != null) { hashCode = hashCode * 59 + LightPosition.GetHashCode(); } if (Lighting != null) { hashCode = hashCode * 59 + Lighting.GetHashCode(); } if (HoverInfo != null) { hashCode = hashCode * 59 + HoverInfo.GetHashCode(); } if (HoverInfoArray != null) { hashCode = hashCode * 59 + HoverInfoArray.GetHashCode(); } if (ShowLegend != null) { hashCode = hashCode * 59 + ShowLegend.GetHashCode(); } if (XCalendar != null) { hashCode = hashCode * 59 + XCalendar.GetHashCode(); } if (YCalendar != null) { hashCode = hashCode * 59 + YCalendar.GetHashCode(); } if (ZCalendar != null) { hashCode = hashCode * 59 + ZCalendar.GetHashCode(); } if (Scene != null) { hashCode = hashCode * 59 + Scene.GetHashCode(); } if (IdsSrc != null) { hashCode = hashCode * 59 + IdsSrc.GetHashCode(); } if (CustomDataSrc != null) { hashCode = hashCode * 59 + CustomDataSrc.GetHashCode(); } if (MetaSrc != null) { hashCode = hashCode * 59 + MetaSrc.GetHashCode(); } if (XSrc != null) { hashCode = hashCode * 59 + XSrc.GetHashCode(); } if (YSrc != null) { hashCode = hashCode * 59 + YSrc.GetHashCode(); } if (ZSrc != null) { hashCode = hashCode * 59 + ZSrc.GetHashCode(); } if (ISrc != null) { hashCode = hashCode * 59 + ISrc.GetHashCode(); } if (JSrc != null) { hashCode = hashCode * 59 + JSrc.GetHashCode(); } if (KSrc != null) { hashCode = hashCode * 59 + KSrc.GetHashCode(); } if (TextSrc != null) { hashCode = hashCode * 59 + TextSrc.GetHashCode(); } if (HoverTextSrc != null) { hashCode = hashCode * 59 + HoverTextSrc.GetHashCode(); } if (HoverTemplateSrc != null) { hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode(); } if (IntensitySrc != null) { hashCode = hashCode * 59 + IntensitySrc.GetHashCode(); } if (VertexColorSrc != null) { hashCode = hashCode * 59 + VertexColorSrc.GetHashCode(); } if (FaceColorSrc != null) { hashCode = hashCode * 59 + FaceColorSrc.GetHashCode(); } if (HoverInfoSrc != null) { hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode(); } return(hashCode); } }
public bool Equals([AllowNull] Mesh3D other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) && (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) && (LegendGroup == other.LegendGroup && LegendGroup != null && other.LegendGroup != null && LegendGroup.Equals(other.LegendGroup)) && (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) && (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) && (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) && (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) && (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) && (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) && (HoverLabel == other.HoverLabel && HoverLabel != null && other.HoverLabel != null && HoverLabel.Equals(other.HoverLabel)) && (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) && (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) && (Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X)) && (Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y)) && (Equals(Z, other.Z) || Z != null && other.Z != null && Z.SequenceEqual(other.Z)) && (Equals(I, other.I) || I != null && other.I != null && I.SequenceEqual(other.I)) && (Equals(J, other.J) || J != null && other.J != null && J.SequenceEqual(other.J)) && (Equals(K, other.K) || K != null && other.K != null && K.SequenceEqual(other.K)) && (Text == other.Text && Text != null && other.Text != null && Text.Equals(other.Text)) && (Equals(TextArray, other.TextArray) || TextArray != null && other.TextArray != null && TextArray.SequenceEqual(other.TextArray)) && (HoverText == other.HoverText && HoverText != null && other.HoverText != null && HoverText.Equals(other.HoverText)) && (Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray)) && (HoverTemplate == other.HoverTemplate && HoverTemplate != null && other.HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate)) && (Equals(HoverTemplateArray, other.HoverTemplateArray) || HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)) && (DelaunaYAxis == other.DelaunaYAxis && DelaunaYAxis != null && other.DelaunaYAxis != null && DelaunaYAxis.Equals(other.DelaunaYAxis)) && (AlphaHull == other.AlphaHull && AlphaHull != null && other.AlphaHull != null && AlphaHull.Equals(other.AlphaHull)) && (Equals(Intensity, other.Intensity) || Intensity != null && other.Intensity != null && Intensity.SequenceEqual(other.Intensity)) && (IntensityMode == other.IntensityMode && IntensityMode != null && other.IntensityMode != null && IntensityMode.Equals(other.IntensityMode)) && (Color == other.Color && Color != null && other.Color != null && Color.Equals(other.Color)) && (Equals(VertexColor, other.VertexColor) || VertexColor != null && other.VertexColor != null && VertexColor.SequenceEqual(other.VertexColor)) && (Equals(FaceColor, other.FaceColor) || FaceColor != null && other.FaceColor != null && FaceColor.SequenceEqual(other.FaceColor)) && (CAuto == other.CAuto && CAuto != null && other.CAuto != null && CAuto.Equals(other.CAuto)) && (CMin == other.CMin && CMin != null && other.CMin != null && CMin.Equals(other.CMin)) && (CMax == other.CMax && CMax != null && other.CMax != null && CMax.Equals(other.CMax)) && (CMid == other.CMid && CMid != null && other.CMid != null && CMid.Equals(other.CMid)) && (ColorScale == other.ColorScale && ColorScale != null && other.ColorScale != null && ColorScale.Equals(other.ColorScale)) && (AutoColorScale == other.AutoColorScale && AutoColorScale != null && other.AutoColorScale != null && AutoColorScale.Equals(other.AutoColorScale)) && (ReverseScale == other.ReverseScale && ReverseScale != null && other.ReverseScale != null && ReverseScale.Equals(other.ReverseScale)) && (ShowScale == other.ShowScale && ShowScale != null && other.ShowScale != null && ShowScale.Equals(other.ShowScale)) && (ColorBar == other.ColorBar && ColorBar != null && other.ColorBar != null && ColorBar.Equals(other.ColorBar)) && (ColorAxis == other.ColorAxis && ColorAxis != null && other.ColorAxis != null && ColorAxis.Equals(other.ColorAxis)) && (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) && (FlatShading == other.FlatShading && FlatShading != null && other.FlatShading != null && FlatShading.Equals(other.FlatShading)) && (Contour == other.Contour && Contour != null && other.Contour != null && Contour.Equals(other.Contour)) && (LightPosition == other.LightPosition && LightPosition != null && other.LightPosition != null && LightPosition.Equals(other.LightPosition)) && (Lighting == other.Lighting && Lighting != null && other.Lighting != null && Lighting.Equals(other.Lighting)) && (HoverInfo == other.HoverInfo && HoverInfo != null && other.HoverInfo != null && HoverInfo.Equals(other.HoverInfo)) && (Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray)) && (ShowLegend == other.ShowLegend && ShowLegend != null && other.ShowLegend != null && ShowLegend.Equals(other.ShowLegend)) && (XCalendar == other.XCalendar && XCalendar != null && other.XCalendar != null && XCalendar.Equals(other.XCalendar)) && (YCalendar == other.YCalendar && YCalendar != null && other.YCalendar != null && YCalendar.Equals(other.YCalendar)) && (ZCalendar == other.ZCalendar && ZCalendar != null && other.ZCalendar != null && ZCalendar.Equals(other.ZCalendar)) && (Scene == other.Scene && Scene != null && other.Scene != null && Scene.Equals(other.Scene)) && (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) && (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) && (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) && (XSrc == other.XSrc && XSrc != null && other.XSrc != null && XSrc.Equals(other.XSrc)) && (YSrc == other.YSrc && YSrc != null && other.YSrc != null && YSrc.Equals(other.YSrc)) && (ZSrc == other.ZSrc && ZSrc != null && other.ZSrc != null && ZSrc.Equals(other.ZSrc)) && (ISrc == other.ISrc && ISrc != null && other.ISrc != null && ISrc.Equals(other.ISrc)) && (JSrc == other.JSrc && JSrc != null && other.JSrc != null && JSrc.Equals(other.JSrc)) && (KSrc == other.KSrc && KSrc != null && other.KSrc != null && KSrc.Equals(other.KSrc)) && (TextSrc == other.TextSrc && TextSrc != null && other.TextSrc != null && TextSrc.Equals(other.TextSrc)) && (HoverTextSrc == other.HoverTextSrc && HoverTextSrc != null && other.HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc)) && (HoverTemplateSrc == other.HoverTemplateSrc && HoverTemplateSrc != null && other.HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc)) && (IntensitySrc == other.IntensitySrc && IntensitySrc != null && other.IntensitySrc != null && IntensitySrc.Equals(other.IntensitySrc)) && (VertexColorSrc == other.VertexColorSrc && VertexColorSrc != null && other.VertexColorSrc != null && VertexColorSrc.Equals(other.VertexColorSrc)) && (FaceColorSrc == other.FaceColorSrc && FaceColorSrc != null && other.FaceColorSrc != null && FaceColorSrc.Equals(other.FaceColorSrc)) && (HoverInfoSrc == other.HoverInfoSrc && HoverInfoSrc != null && other.HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc))); }