private void RecreateDynamicProperties() { Vector2 controlsOriginLeft = m_position + new Vector2(-m_size.Value.X / 2.0f + 0.025f, -m_size.Value.Y / 2.0f + 0.025f); controlsOriginLeft.Y = m_offsetForSizeProperties; Vector2 labelOffset = new Vector2(-0.015f, 0f); Vector2 controlsDelta = MyGuiConstants.CONTROLS_DELTA * 0.6f; #region shape size slidebar foreach (MyGuiControlBase oldControl in m_dynamicControls) { m_controls.Remove(oldControl); } m_dynamicControls.Clear(); float propScale = 0.65f; float sliderWidth = MyGuiConstants.SLIDER_WIDTH * 1.2f; for (int i = 0; i < MyEditorVoxelHand.VoxelHandShape.GetPropertiesCount(); i++) { MyGuiControlLabel label = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyEditorVoxelHand.VoxelHandShape.GetPropertyName(i), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); MyGuiControlSlider voxelShapeSizeSlider = new MyGuiControlSlider(m_parent, controlsOriginLeft + new Vector2(0.145f, 0), sliderWidth, MyVoxelConstants.MIN_VOXEL_HAND_SIZE, MyVoxelConstants.MAX_VOXEL_HAND_SIZE * MyVoxelConstants.VOXEL_SIZE_IN_METRES, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder("{0}"), 0.05f, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f, propScale); m_dynamicControls.Add(label); m_dynamicControls.Add(voxelShapeSizeSlider); m_controls.Add(label); m_controls.Add(voxelShapeSizeSlider); voxelShapeSizeSlider.SetValue(MyEditorVoxelHand.VoxelHandShape.GetPropertyValue(i)); voxelShapeSizeSlider.UserData = i; voxelShapeSizeSlider.OnChange += OnSizeSliderChange; controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT * propScale * 0.75f); } controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT * propScale); #endregion #region shape distance slidebar if (m_voxelShapeDistanceLabel != null) { m_voxelShapeDistanceLabel.SetPosition(controlsOriginLeft + labelOffset); m_voxelShapeDistanceSlider.SetPosition(controlsOriginLeft + new Vector2(0.145f, 0)); } else { m_controls.Add(m_voxelShapeDistanceLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeDistance, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_voxelShapeDistanceSlider = new MyGuiControlSlider(m_parent, controlsOriginLeft + new Vector2(0.145f, 0), sliderWidth, MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE, MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder("{0:0.00}"), 0.05f, 2, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f, propScale); m_controls.Add(m_voxelShapeDistanceSlider); m_voxelShapeDistanceSlider.SetValue(MyEditorVoxelHand.GetShapeDistance()); m_voxelShapeDistanceSlider.OnChange += OnDistanceSliderChange; } #endregion controlsOriginLeft += MyGuiConstants.CONTROLS_DELTA; #region shape material Vector2 iconSize = new Vector2(0.095f, 0.095f); if (m_voxelShapeMaterialLabel != null) { m_voxelShapeMaterialLabel.SetPosition(controlsOriginLeft + labelOffset); controlsOriginLeft += controlsDelta; m_voxelShapeMaterialCombobox.SetPosition(new Vector2(controlsOriginLeft.X - 0.015f + MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, controlsOriginLeft.Y)); } else { m_controls.Add(m_voxelShapeMaterialLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeMaterial, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); controlsOriginLeft += controlsDelta; m_voxelShapeMaterialCombobox = new MyGuiControlCombobox(m_parent, new Vector2(controlsOriginLeft.X - 0.015f, controlsOriginLeft.Y) + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, iconSize.Y / 2.5f), MyGuiControlPreDefinedSize.MEDIUM, iconSize, new Vector2(0.015f, 0f), MyGuiConstants.COMBOBOX_BACKGROUND_COLOR * 0.7f, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4, true, false, true); foreach (MyMwcVoxelMaterialsEnum voxelMaterial in MyGuiAsteroidHelpers.MyMwcVoxelMaterialsEnumValues) { MyGuiVoxelMaterialHelper voxelMaterialHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelMaterialHelper(voxelMaterial); m_voxelShapeMaterialCombobox.AddItem((int)voxelMaterial, voxelMaterialHelper.Icon, voxelMaterialHelper.Description); } m_controls.Add(m_voxelShapeMaterialCombobox); m_voxelShapeMaterialCombobox.OnSelect += OnComboboxItemSelect; } #endregion controlsOriginLeft += 3.4f * MyGuiConstants.CONTROLS_DELTA; if (m_attachDetachVoxelHandCheckbox != null) { m_controls.Remove(m_attachDetachVoxelHandCheckbox); } if (m_detachLabel != null) { m_controls.Remove(m_detachLabel); } MyTextsWrapperEnum text = MyEditorVoxelHand.DetachedVoxelHand == null ? MyTextsWrapperEnum.DetachVoxelHand : MyTextsWrapperEnum.AttachVoxelHand; m_detachLabel = new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * propScale, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_controls.Add(m_detachLabel); m_attachDetachVoxelHandCheckbox = new MyGuiControlCheckbox(m_parent, new Vector2(controlsOriginLeft.X + 5 * MyGuiConstants.CHECKBOX_SIZE.X, controlsOriginLeft.Y), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, m_detachLabel); m_attachDetachVoxelHandCheckbox.OnCheck += OnAttachClick; m_controls.Add(m_attachDetachVoxelHandCheckbox); LoadSortedControlsByPriority(); }