示例#1
0
        /*
         * public void OnMyShadowCheckEnable(MyGuiControlCheckbox sender)
         * {
         *  foreach (MyPrefabLight prefabLight in m_prefabLights)
         *  {
         *      MyLight myLight = prefabLight.GetLight();
         *
         *      if (sender == m_spotLightShadowCheckbox)
         *      {
         *          myLight.ShadowsEnabled = sender.Checked;
         *      }
         *
         *      prefabLight.OnWorldPositionChanged(this);
         *      prefabLight.UpdateEffect();
         *  }
         *  OnComponentChange(null);
         * }
         */
        void OnComponentChange(MyGuiControlSlider sender)
        {
            foreach (MyPrefabLight prefabLight in m_prefabLights)
            {
                MyLight light    = prefabLight.GetLight();
                Color   tmpColor = new Color();
                tmpColor.R  = (byte)m_pointNormalLightColorSlider[0].GetValue();
                tmpColor.G  = (byte)m_pointNormalLightColorSlider[1].GetValue();
                tmpColor.B  = (byte)m_pointNormalLightColorSlider[2].GetValue();
                light.Color = tmpColor.ToVector4();

                tmpColor.R             = (byte)m_specularLightColorSlider[0].GetValue();
                tmpColor.G             = (byte)m_specularLightColorSlider[1].GetValue();
                tmpColor.B             = (byte)m_specularLightColorSlider[2].GetValue();
                light.SpecularColor    = tmpColor.ToVector3();
                light.Falloff          = m_pointFallOffSlider.GetValue();                                // allowed values 0.1f-5.0f
                light.Range            = m_pointRangeSlider.GetValue();                                  // allowed values 0.0f-MyLightsConstants.MAX_POINTLIGHT_RADIUS
                light.Intensity        = prefabLight.m_IntensityMax = m_pointIntensitySlider.GetValue(); // allowed values 0.0f-10.0f
                light.PointLightOffset = m_pointOffsetSlider.GetValue();

                tmpColor.R           = (byte)m_spotNormalLightColorSlider[0].GetValue();
                tmpColor.G           = (byte)m_spotNormalLightColorSlider[1].GetValue();
                tmpColor.B           = (byte)m_spotNormalLightColorSlider[2].GetValue();
                light.ReflectorColor = tmpColor.ToVector4();

                light.ReflectorFalloff   = m_spotFallOffSlider.GetValue();                                       // allowed values 0.1f-5.0f
                light.ReflectorRange     = m_spotRangeSlider.GetValue();                                         // allowed values 0.0f-MyLightsConstants.MAX_SPOTLIGHT_RANGE
                light.ReflectorIntensity = prefabLight.ReflectorIntensityMax = m_spotIntensitySlider.GetValue(); // allowed values 0.0f-10.0f

                light.ReflectorConeDegrees = m_spotAngleSlider.GetValue();                                       // allowed values 0.0f-MyLightsConstants.MAX_SPOTLIGHT_ANGLE
                light.ShadowDistance       = m_spotLightShadowDistance.GetValue();
                prefabLight.FlashOffset    = m_flashOffsetSlider.GetValue();
            }
        }
示例#2
0
        void OnComponentChange(MyGuiControlSlider sender)
        {
            if (!m_canUpdateValues)
            {
                return;
            }

            DummyPoint.Color = new Vector4(
                m_redSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE,
                m_greenSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE,
                m_blueSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE,
                m_alphaSlider.GetValue() / MyEditorConstants.COLOR_COMPONENT_MAX_VALUE);

            DummyPoint.UserScale = m_userScaleSlider.GetValue();

            UpdateValues();
        }
        private void UpdateVoxelHandProperties()
        {
            MyVoxelHandShapeType       voxelHandShapeType = (MyVoxelHandShapeType)m_voxelShapeTypeRadioButtonGroup.GetSelectedKey().Value;
            MyMwcVoxelHandModeTypeEnum modeType           = (MyMwcVoxelHandModeTypeEnum)m_voxelShapeModeRadioButtonGroup.GetSelectedKey().Value;
            MyMwcVoxelMaterialsEnum?   materialEnum       = (MyMwcVoxelMaterialsEnum)m_voxelShapeMaterialCombobox.GetSelectedKey();

            MyEditorVoxelHand.SetVoxelProperties(voxelHandShapeType, m_voxelShapeDistanceSlider.GetValue(), modeType, materialEnum, m_isProjectedCheckbox.Checked, m_isProjectedOnWaypointCheckbox.Checked);
        }
        private void OnSizeSliderChange(MyGuiControlSlider sliderSender)
        {
            int index = (int)sliderSender.UserData;

            MyEditorVoxelHand.VoxelHandShape.SetPropertyValue(index, sliderSender.GetValue());

            if (m_sizeChangedFromEditor)
            {
                m_sizeChangedFromEditor = false;
            }
            else
            {
                UpdateVoxelHandProperties();
            }
        }
 void OnFovChanged(MyGuiControlSlider sender)
 {
     m_fieldOfViewLabel.UpdateParams(MathHelper.ToDegrees(m_fieldOfViewSlider.GetValue()));
 }
示例#6
0
 private void OnSliderChange(MyGuiControlSlider sender)
 {
     SetValue(sender, sender.GetValue());
 }
示例#7
0
 void OnFovSlider(MyGuiControlSlider slider)
 {
     MyCamera.FieldOfViewAngle = slider.GetValue();
 }
示例#8
0
 void Save()
 {
     MyConfig.GameVolume  = m_gameVolumeSlider.GetValue();
     MyConfig.MusicVolume = m_musicVolumeSlider.GetValue();
     MyConfig.Save();
 }
 void OnComponentChange(MyGuiControlSlider sender)
 {
     m_radiusLabel.UpdateText(string.Format("{0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.MetersLong).ToString(), m_radiusSlider.GetValue()));
     m_firstSpawnLabel.UpdateText(string.Format("{0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.SecondsLong).ToString(), m_firstSpawnTimeSlider.GetValue() / 1000));
     m_respawnLabel.UpdateText(string.Format("{0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.SecondsLong).ToString(), m_respawnTimeSlider.GetValue() / 1000));
 }
 private void OnSeeDistanceChanged(MyGuiControlSlider sender)
 {
     m_seeDistanceLabel.UpdateText(string.Format(" {0:#,###0} " + MyTextsWrapper.Get(MyTextsWrapperEnum.MetersLong).ToString(), m_seeDistanceSlider.GetValue()));
 }
 private void OnAggresivityChanged(MyGuiControlSlider sender)
 {
     m_aggresivityLabel.UpdateText(string.Format(" {0:0.00}", m_aggresivitySlider.GetValue()));
 }
        public override void OnOkClick(MyGuiControlButton sender)
        {
            float radiusMin;
            float radiusMax;

            if (!float.TryParse(m_radiusMinTextBox.Text, out radiusMin))
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.YouHaveToSelect, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                return;
            }

            if (!float.TryParse(m_radiusMaxTextBox.Text, out radiusMax))
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.YouHaveToSelect, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                return;
            }

            // Disallow to enter lower MAX radius than MIN radius
            if (radiusMax < radiusMin)
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.RadiusMaxLowerThanRadiusMin, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                return;
            }

            if (!m_dustCheckbox.Checked && !m_radioactivityCheckbox.Checked && !m_soundCheckbox.Checked)
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.YouHaveToSelect, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                return;
            }

            if (m_soundCheckbox.Checked && m_selectSoundCombobox.GetSelectedKey() == -1)
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.YouHaveToSelect, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                return;
            }

            {
                base.OnOkClick(sender);

                float magnitude = m_strengthSlider.GetValue();

                var soundType = (MySoundCuesEnum)m_selectSoundCombobox.GetSelectedKey();

                if (HasEntity())
                {
                    // Update currently selected influence sphere properties
                    var influenceSphere = (MyInfluenceSphere)m_entity;

                    influenceSphere.Enabled = m_enabledCheckBox.Checked;

                    if (radiusMin > influenceSphere.RadiusMax)
                    {
                        influenceSphere.RadiusMax = radiusMax;
                        influenceSphere.RadiusMin = radiusMin;
                    }
                    else
                    {
                        influenceSphere.RadiusMin = radiusMin;
                        influenceSphere.RadiusMax = radiusMax;
                    }

                    var r = (byte)m_redColorSlider.GetValue();
                    var g = (byte)m_greenColorSlider.GetValue();
                    var b = (byte)m_blueColorSlider.GetValue();
                    var a = (byte)m_opacitySlider.GetValue();
                    influenceSphere.DustColor = new Color(r, g, b, a);

                    influenceSphere.Magnitude = magnitude;

                    influenceSphere.ChangeCueEnum(soundType);

                    influenceSphere.IsDust          = m_dustCheckbox.Checked;
                    influenceSphere.IsRadioactivity = m_radioactivityCheckbox.Checked;
                    influenceSphere.IsSound         = m_soundCheckbox.Checked;
                    influenceSphere.Activate(m_activatedCheckbox.Checked, false);
                }
                else
                {
                    // Create new influence sphere dust
                    var builder = new MyMwcObjectBuilder_InfluenceSphere();
                    builder.InfluenceFlags |= MyInfluenceFlags.Dust;
                    builder.RadiusMin       = radiusMin;
                    builder.RadiusMax       = radiusMax;
                    builder.Enabled         = m_enabledCheckBox.Checked;

                    var r = (byte)m_redColorSlider.GetValue();
                    var g = (byte)m_greenColorSlider.GetValue();
                    var b = (byte)m_blueColorSlider.GetValue();
                    var a = (byte)m_opacitySlider.GetValue();
                    builder.DustColor = new Color(r, g, b, a);

                    builder.Magnitude = magnitude;

                    builder.SoundCueId = (short)soundType;

                    builder.IsDust          = m_dustCheckbox.Checked;
                    builder.IsRadioactivity = m_radioactivityCheckbox.Checked;
                    builder.IsSound         = m_soundCheckbox.Checked;
                    if (!m_activatedCheckbox.Checked)
                    {
                        builder.PersistentFlags |= CommonLIB.AppCode.ObjectBuilders.MyPersistentEntityFlags.Deactivated;
                    }
                    MyEditor.Static.CreateFromObjectBuilder(builder, Matrix.Identity, m_screenPosition);
                }

                this.CloseScreen();
            }
        }