internal void Write(EndianBinaryWriter writer) { TransferMode.Write(writer); if (writer.AddressSpace == AddressSpace.Int64) { writer.WriteNulls(4); } AnchorX.Write(writer); AnchorY.Write(writer); PositionX.Write(writer); PositionY.Write(writer); Rotation.Write(writer); ScaleX.Write(writer); ScaleY.Write(writer); Opacity.Write(writer); writer.ScheduleWriteOffsetIf(Video3D != null, 8, AlignmentMode.Left, () => { Video3D.Write(writer); }); }
internal void Read(EndianBinaryReader reader) { TransferMode.Read(reader); if (reader.AddressSpace == AddressSpace.Int64) { reader.SeekCurrent(4); } AnchorX.Read(reader); AnchorY.Read(reader); PositionX.Read(reader); PositionY.Read(reader); Rotation.Read(reader); ScaleX.Read(reader); ScaleY.Read(reader); Opacity.Read(reader); reader.ReadOffset(() => { Video3D = new LayerVideo3D(); Video3D.Read(reader); }); }
public static IVector AnchorSize(IVector yourSize, IVector parentSize, AnchorX xAnchor, AnchorY yAnchor) { IVector pos = IVector.zero; if (xAnchor == AnchorX.Left) { pos.x = 0; } if (xAnchor == AnchorX.Right) { pos.x = parentSize.x - yourSize.x; } if (xAnchor == AnchorX.Middle) { pos.x = (parentSize.x / 2) - (yourSize.x / 2); } if (yAnchor == AnchorY.Top) { pos.y = 0; } if (yAnchor == AnchorY.Bottom) { pos.y = parentSize.y - yourSize.y; } if (yAnchor == AnchorY.Middle) { pos.y = (parentSize.y / 2) - (yourSize.y / 2); } return(pos); }
public static IVector Anchor(IVector size, IVector desiredPosition, AnchorX xAnchor, AnchorY yAnchor) { IVector pos = IVector.zero; if (xAnchor == AnchorX.Left) { pos.x = desiredPosition.x; } if (xAnchor == AnchorX.Right) { pos.x = desiredPosition.x - size.x; } if (xAnchor == AnchorX.Middle) { pos.x = desiredPosition.x - (size.x / 2); } if (yAnchor == AnchorY.Top) { pos.y = desiredPosition.y; } if (yAnchor == AnchorY.Bottom) { pos.y = desiredPosition.y - size.y; } if (yAnchor == AnchorY.Middle) { pos.y = desiredPosition.y - (size.y / 2); } return(pos); }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //INPUTVIEW case nameof(Keyboard): return(this.Keyboard.ToString()); //EDITOR case nameof(FontAttributes): return(this.FontAttributes.ToString()); case nameof(FontFamily): return(this.FontFamily); case nameof(FontSize): return(this.FontSize.ToString()); case nameof(Text): return(this.Text); case nameof(TextColor): return(this.TextColor.ToHex()); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //STEPPER case nameof(Maximum): return(Maximum.ToString()); case nameof(Minimum): return(Minimum.ToString()); case nameof(Value): return(Value.ToString()); case nameof(Increment): return(Increment.ToString()); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //PICKER case nameof(ItemsSource): return(ItemsSource.OfType <object>().Select(x => x.ToString()).Aggregate((x, y) => x + "," + y)); case nameof(SelectedItem): return(SelectedItem.ToString()); case nameof(SelectedIndex): return(SelectedIndex.ToString()); case nameof(Items): return(Items.Aggregate((x, y) => x + "," + y)); case nameof(Title): return(Title); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //ITEMSVIEW case nameof(ItemsSource): return(ItemsSource.OfType <object>().Select(x => x.ToString()).Aggregate((x, y) => x + "," + y)); //LISTVIEW case nameof(HasUnevenRows): return(HasUnevenRows.ToString()); case nameof(IsGroupingEnabled): return(IsGroupingEnabled.ToString()); case nameof(RowHeight): return(RowHeight.ToString()); case nameof(Footer): return(Footer.ToString()); case nameof(Header): return(Header.ToString()); case nameof(IsPullToRefreshEnabled): return(IsPullToRefreshEnabled.ToString()); case nameof(IsRefreshing): return(IsRefreshing.ToString()); case nameof(SelectedItem): return(SelectedItem.ToString()); case nameof(SeparatorColor): return(SeparatorColor.ToHex()); case nameof(this.SeparatorVisibility): return(SeparatorVisibility.ToString()); default: return(string.Empty); } }
public void OnGUI() { EditorGUILayout.Space(); EditorGUILayout.LabelField( "Volume Size: " + voxelObject.name + " (" + voxelObject.XSize + "," + voxelObject.YSize + "," + voxelObject.ZSize + ")", new GUIStyle() {fontStyle = FontStyle.Bold}); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("X:", new[] {GUILayout.Width(30)}); xSize = EditorGUILayout.IntField(xSize); EditorGUILayout.LabelField("Y:", new[] {GUILayout.Width(30)}); ySize = EditorGUILayout.IntField(ySize); EditorGUILayout.LabelField("Z:", new[] {GUILayout.Width(30)}); zSize = EditorGUILayout.IntField(zSize); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); anchorX = (AnchorX) EditorGUILayout.EnumPopup("X Anchor: ", anchorX); anchorY = (AnchorY) EditorGUILayout.EnumPopup("Y Anchor: ", anchorY); anchorZ = (AnchorZ) EditorGUILayout.EnumPopup("Z Anchor: ", anchorZ); EditorGUILayout.Space(); fillVoxels = EditorGUILayout.ToggleLeft(" Fill any added space", fillVoxels); EditorGUILayout.Space(); EditorGUILayout.LabelField( "Chunk Size: " + voxelObject.name + " (" + voxelObject.XChunkSize + "," + voxelObject.YChunkSize + "," + voxelObject.ZChunkSize + ")", new GUIStyle() { fontStyle = FontStyle.Bold }); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("X:", new[] { GUILayout.Width(30) }); xChunkSize = EditorGUILayout.IntField(xChunkSize); EditorGUILayout.LabelField("Y:", new[] { GUILayout.Width(30) }); yChunkSize = EditorGUILayout.IntField(yChunkSize); EditorGUILayout.LabelField("Z:", new[] { GUILayout.Width(30) }); zChunkSize = EditorGUILayout.IntField(zChunkSize); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Resize") && (xSize != voxelObject.XSize || ySize != voxelObject.YSize || zSize != voxelObject.ZSize || xChunkSize != voxelObject.XChunkSize || yChunkSize != voxelObject.YChunkSize || zChunkSize != voxelObject.ZChunkSize)) { if (xSize < 1) xSize = 1; if (ySize < 1) ySize = 1; if (zSize < 1) zSize = 1; if (xChunkSize < 1) xChunkSize = 1; if (yChunkSize < 1) yChunkSize = 1; if (zChunkSize < 1) zChunkSize = 1; int totalChunkSize = xChunkSize*yChunkSize*zChunkSize; if (totalChunkSize > 16*16*16) { UnityEditor.EditorUtility.DisplayDialog("PicaVoxel", "The largest chunk size is 16*16*16 voxels TOTAL. Decrease size in one axis to increase the other two.", "OK"); } else { voxelObject.XChunkSize = xChunkSize; voxelObject.YChunkSize = yChunkSize; voxelObject.ZChunkSize = zChunkSize; if (xSize != voxelObject.XSize || ySize != voxelObject.YSize || zSize != voxelObject.ZSize) { List<Object> undoObjects = new List<Object>(); foreach (Frame frame in voxelObject.Frames) { undoObjects.Add(frame); } undoObjects.Add(voxelObject); Undo.RecordObjects(undoObjects.ToArray(), "Resize Voxel Object"); foreach (Frame frame in voxelObject.Frames) UnityEditor.EditorUtility.SetDirty(frame); UnityEditor.EditorUtility.SetDirty(voxelObject); PicaVoxelBox copyDestBox = new PicaVoxelBox( anchorX == AnchorX.Left ? 0 : anchorX == AnchorX.Center ? (xSize/2) - (voxelObject.XSize/2) : xSize - voxelObject.XSize, anchorY == AnchorY.Bottom ? 0 : anchorY == AnchorY.Center ? (ySize/2) - (voxelObject.YSize/2) : ySize - voxelObject.YSize, anchorZ == AnchorZ.Front ? 0 : anchorZ == AnchorZ.Center ? (zSize/2) - (voxelObject.ZSize/2) : zSize - voxelObject.ZSize, (anchorX == AnchorX.Left ? 0 : anchorX == AnchorX.Center ? (xSize/2) - (voxelObject.XSize/2) : xSize - voxelObject.XSize) + (voxelObject.XSize - 1), (anchorY == AnchorY.Bottom ? 0 : anchorY == AnchorY.Center ? (ySize/2) - (voxelObject.YSize/2) : ySize - voxelObject.YSize) + (voxelObject.YSize - 1), (anchorZ == AnchorZ.Front ? 0 : anchorZ == AnchorZ.Center ? (zSize/2) - (voxelObject.ZSize/2) : zSize - voxelObject.ZSize) + (voxelObject.ZSize - 1)); foreach (Frame frame in voxelObject.Frames) { Voxel[] newVox = new Voxel[xSize*ySize*zSize]; if (fillVoxels) { for (int x = 0; x < xSize; x++) for (int y = 0; y < ySize; y++) for (int z = 0; z < zSize; z++) newVox[x + xSize*(y + ySize*z)] = new Voxel() { State = VoxelState.Active, Color = voxelObject.PaletteColors[0], Value = 128 }; } int destX = copyDestBox.BottomLeftFront.X; int destY = copyDestBox.BottomLeftFront.Y; int destZ = copyDestBox.BottomLeftFront.Z; for (int x = 0; x < voxelObject.XSize; x++) { for (int y = 0; y < voxelObject.YSize; y++) { for (int z = 0; z < voxelObject.ZSize; z++) { if (destX < 0 || destY < 0 || destZ < 0 || destX >= xSize || destY >= ySize || destZ >= zSize) { destZ++; continue; } newVox[destX + xSize*(destY + ySize*destZ)] = frame.Voxels[x + frame.XSize*(y + frame.YSize*z)]; destZ++; } destZ = copyDestBox.BottomLeftFront.Z; destY++; } destY = copyDestBox.BottomLeftFront.Y; destX++; } frame.XSize = xSize; frame.YSize = ySize; frame.ZSize = zSize; frame.EditingVoxels = null; frame.Voxels = newVox; } voxelObject.XSize = xSize; voxelObject.YSize = ySize; voxelObject.ZSize = zSize; } voxelObject.CreateChunks(); voxelObject.SaveForSerialize(); //EditorUtility.SetDirty(voxelObject); Close(); } } // } if (GUILayout.Button("Cancel")) Close(); EditorGUILayout.EndHorizontal(); }
public void SetPosition(IVector desiredPosition, AnchorX xAnchor, AnchorY yAnchor) => position = AnchorComponent(this, desiredPosition, xAnchor, yAnchor);
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //SEARCHBAR case nameof(CancelButtonColor): return(this.CancelButtonColor.ToHex()); case nameof(Placeholder): return(this.Placeholder); case nameof(SearchCommandParameter): return(SearchCommandParameter.ToString()); case nameof(Text): return(Text); default: return(string.Empty); } }
public void OnGUI() { EditorGUILayout.Space(); EditorUtility.SkinnedLabel("Volume Size: " + voxelObject.name + " (" + voxelObject.XSize + "," + voxelObject.YSize + "," + voxelObject.ZSize + ")"); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("X:", new[] { GUILayout.Width(30) }); xSize = EditorGUILayout.IntField(xSize); EditorGUILayout.LabelField("Y:", new[] { GUILayout.Width(30) }); ySize = EditorGUILayout.IntField(ySize); EditorGUILayout.LabelField("Z:", new[] { GUILayout.Width(30) }); zSize = EditorGUILayout.IntField(zSize); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); anchorX = (AnchorX)EditorGUILayout.EnumPopup("X Anchor: ", anchorX); anchorY = (AnchorY)EditorGUILayout.EnumPopup("Y Anchor: ", anchorY); anchorZ = (AnchorZ)EditorGUILayout.EnumPopup("Z Anchor: ", anchorZ); EditorGUILayout.Space(); fillVoxels = EditorGUILayout.ToggleLeft(" Fill any added space", fillVoxels); EditorGUILayout.Space(); EditorUtility.SkinnedLabel( "Chunk Size: " + voxelObject.name + " (" + voxelObject.XChunkSize + "," + voxelObject.YChunkSize + "," + voxelObject.ZChunkSize + ")"); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("X:", new[] { GUILayout.Width(30) }); xChunkSize = EditorGUILayout.IntField(xChunkSize); EditorGUILayout.LabelField("Y:", new[] { GUILayout.Width(30) }); yChunkSize = EditorGUILayout.IntField(yChunkSize); EditorGUILayout.LabelField("Z:", new[] { GUILayout.Width(30) }); zChunkSize = EditorGUILayout.IntField(zChunkSize); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Resize") && (xSize != voxelObject.XSize || ySize != voxelObject.YSize || zSize != voxelObject.ZSize || xChunkSize != voxelObject.XChunkSize || yChunkSize != voxelObject.YChunkSize || zChunkSize != voxelObject.ZChunkSize)) { if (xSize < 1) { xSize = 1; } if (ySize < 1) { ySize = 1; } if (zSize < 1) { zSize = 1; } if (xChunkSize < 1) { xChunkSize = 1; } if (yChunkSize < 1) { yChunkSize = 1; } if (zChunkSize < 1) { zChunkSize = 1; } int totalChunkSize = xChunkSize * yChunkSize * zChunkSize; if (totalChunkSize > 16 * 16 * 16) { UnityEditor.EditorUtility.DisplayDialog("PicaVoxel", "The largest chunk size is 16*16*16 voxels TOTAL. Decrease size in one axis to increase the other two.", "OK"); } else { voxelObject.XChunkSize = xChunkSize; voxelObject.YChunkSize = yChunkSize; voxelObject.ZChunkSize = zChunkSize; if (xSize != voxelObject.XSize || ySize != voxelObject.YSize || zSize != voxelObject.ZSize) { List <Object> undoObjects = new List <Object>(); foreach (Frame frame in voxelObject.Frames) { undoObjects.Add(frame); } undoObjects.Add(voxelObject); Undo.RecordObjects(undoObjects.ToArray(), "Resize Voxel Object"); foreach (Frame frame in voxelObject.Frames) { UnityEditor.EditorUtility.SetDirty(frame); } UnityEditor.EditorUtility.SetDirty(voxelObject); PicaVoxelBox copyDestBox = new PicaVoxelBox( anchorX == AnchorX.Left ? 0 : anchorX == AnchorX.Center ? (xSize / 2) - (voxelObject.XSize / 2) : xSize - voxelObject.XSize, anchorY == AnchorY.Bottom ? 0 : anchorY == AnchorY.Center ? (ySize / 2) - (voxelObject.YSize / 2) : ySize - voxelObject.YSize, anchorZ == AnchorZ.Front ? 0 : anchorZ == AnchorZ.Center ? (zSize / 2) - (voxelObject.ZSize / 2) : zSize - voxelObject.ZSize, (anchorX == AnchorX.Left ? 0 : anchorX == AnchorX.Center ? (xSize / 2) - (voxelObject.XSize / 2) : xSize - voxelObject.XSize) + (voxelObject.XSize - 1), (anchorY == AnchorY.Bottom ? 0 : anchorY == AnchorY.Center ? (ySize / 2) - (voxelObject.YSize / 2) : ySize - voxelObject.YSize) + (voxelObject.YSize - 1), (anchorZ == AnchorZ.Front ? 0 : anchorZ == AnchorZ.Center ? (zSize / 2) - (voxelObject.ZSize / 2) : zSize - voxelObject.ZSize) + (voxelObject.ZSize - 1)); foreach (Frame frame in voxelObject.Frames) { Voxel[] newVox = new Voxel[xSize * ySize * zSize]; if (fillVoxels) { for (int x = 0; x < xSize; x++) { for (int y = 0; y < ySize; y++) { for (int z = 0; z < zSize; z++) { newVox[x + xSize * (y + ySize * z)] = new Voxel() { State = VoxelState.Active, Color = voxelObject.PaletteColors[0], Value = 128 } } } } ; } int destX = copyDestBox.BottomLeftFront.X; int destY = copyDestBox.BottomLeftFront.Y; int destZ = copyDestBox.BottomLeftFront.Z; for (int x = 0; x < voxelObject.XSize; x++) { for (int y = 0; y < voxelObject.YSize; y++) { for (int z = 0; z < voxelObject.ZSize; z++) { if (destX < 0 || destY < 0 || destZ < 0 || destX >= xSize || destY >= ySize || destZ >= zSize) { destZ++; continue; } newVox[destX + xSize * (destY + ySize * destZ)] = frame.Voxels[x + frame.XSize * (y + frame.YSize * z)]; destZ++; } destZ = copyDestBox.BottomLeftFront.Z; destY++; } destY = copyDestBox.BottomLeftFront.Y; destX++; } frame.XSize = xSize; frame.YSize = ySize; frame.ZSize = zSize; frame.EditingVoxels = null; frame.Voxels = newVox; } voxelObject.XSize = xSize; voxelObject.YSize = ySize; voxelObject.ZSize = zSize; } voxelObject.CreateChunks(); voxelObject.SaveForSerialize(); //EditorUtility.SetDirty(voxelObject); Close(); } } // } if (GUILayout.Button("Cancel")) { Close(); } EditorGUILayout.EndHorizontal(); }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //IMAGE case nameof(Source): switch (Source) { case FileImageSource file: return(file.File); case UriImageSource uri: return(uri.Uri.ToString()); default: return(string.Empty); } case nameof(Aspect): return(this.Aspect.ToString()); case nameof(IsOpaque): return(this.IsOpaque.ToString()); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return ClassId.ToString(); case nameof(AutomationId): return AutomationId.ToString(); case nameof(Id): return Id.ToString(); case nameof(StyleId): return StyleId.ToString(); //VISUAL ELEMENT case nameof(AnchorX): return AnchorX.ToString(); case nameof(AnchorY): return AnchorY.ToString(); case nameof(BackgroundColor): return BackgroundColor.ToHex(); case nameof(Width): return this.Width.ToString(); case nameof(Height): return this.Height.ToString(); case nameof(IsEnabled): return IsEnabled.ToString(); case nameof(WidthRequest): return this.WidthRequest.ToString(); case nameof(HeightRequest): return this.HeightRequest.ToString(); case nameof(IsFocused): return IsFocused.ToString(); case nameof(IsVisible): return IsVisible.ToString(); case nameof(InputTransparent): return InputTransparent.ToString(); case nameof(X): return this.X.ToString(); case nameof(Y): return this.Y.ToString(); case nameof(Opacity): return this.Opacity.ToString(); case nameof(TranslationX): return this.TranslationX.ToString(); case nameof(TranslationY): return this.TranslationY.ToString(); case nameof(Rotation): return this.Rotation.ToString(); case nameof(RotationX): return this.RotationX.ToString(); case nameof(RotationY): return this.RotationY.ToString(); case nameof(Scale): return this.Scale.ToString(); //VIEW case nameof(Margin): return this.Margin.ToString(); case nameof(VerticalOptions): return this.VerticalOptions.ToString(); case nameof(HorizontalOptions): return this.HorizontalOptions.ToString(); //PROGRESSBAR case nameof(Progress): return this.Progress.ToString(); default: return string.Empty; } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //BUTTON case nameof(BorderColor): return(BorderColor.ToHex()); #pragma warning disable CS0618 // Type or member is obsolete case nameof(BorderRadius): return(BorderRadius.ToString()); #pragma warning restore CS0618 // Type or member is obsolete case nameof(BorderWidth): return(BorderWidth.ToString()); case nameof(CornerRadius): return(CornerRadius.ToString()); case nameof(CommandParameter): return(CommandParameter.ToString()); case nameof(FontAttributes): return(FontAttributes.ToString()); case nameof(FontFamily): return(FontFamily); case nameof(FontSize): return(FontSize.ToString()); case nameof(TextColor): return(TextColor.ToHex()); case nameof(Text): return(Text); default: return(string.Empty); } }
public static IVector AnchorComponent(Component c, IVector desiredPosition, AnchorX xAnchor, AnchorY yAnchor) => Anchor(c.Size, desiredPosition, xAnchor, yAnchor);