当前位置: 首页>>代码示例>>C#>>正文


C# MyTerminalControlSlider类代码示例

本文整理汇总了C#中MyTerminalControlSlider的典型用法代码示例。如果您正苦于以下问题:C# MyTerminalControlSlider类的具体用法?C# MyTerminalControlSlider怎么用?C# MyTerminalControlSlider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyTerminalControlSlider类属于命名空间,在下文中一共展示了MyTerminalControlSlider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyBeacon>())
                return;
            base.CreateTerminalControls();
            //MyTerminalControlFactory.RemoveBaseClass<MyBeacon, MyTerminalBlock>(); // this removed also controls shared with other blocks

            //removed unnecessary controls
            var controlList = MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls;
            controlList.Remove(controlList[4]);//name
            controlList.Remove(controlList[4]);//show on HUD

            var customName = new MyTerminalControlTextbox<MyBeacon>("CustomName", MyCommonTexts.Name, MySpaceTexts.Blank);
            customName.Getter = (x) => x.CustomName;
            customName.Setter = (x, v) => x.SetCustomName(v);
            customName.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(customName);
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyBeacon>());

            var broadcastRadius = new MyTerminalControlSlider<MyBeacon>("Radius", MySpaceTexts.BlockPropertyTitle_BroadcastRadius, MySpaceTexts.BlockPropertyDescription_BroadcastRadius);
            broadcastRadius.SetLogLimits(1, MyEnergyConstants.MAX_RADIO_POWER_RANGE);
            broadcastRadius.DefaultValue = 10000;
            broadcastRadius.Getter = (x) => x.RadioBroadcaster.BroadcastRadius;
            broadcastRadius.Setter = (x, v) => x.m_radius.Value = v;
            broadcastRadius.Writer = (x, result) => result.Append(new StringBuilder().AppendDecimal(x.RadioBroadcaster.BroadcastRadius, 0).Append(" m"));
            broadcastRadius.EnableActions();
            MyTerminalControlFactory.AddControl(broadcastRadius);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:28,代码来源:MyBeacon.cs

示例2: MyBeacon

        static MyBeacon()
        {
            MyTerminalControlFactory.RemoveBaseClass<MyBeacon, MyTerminalBlock>();

            var show = new MyTerminalControlOnOffSwitch<MyBeacon>("ShowInTerminal", MySpaceTexts.Terminal_ShowInTerminal, MySpaceTexts.Terminal_ShowInTerminalToolTip);
            show.Getter = (x) => x.ShowInTerminal;
            show.Setter = (x, v) => x.ShowInTerminal= v;
            MyTerminalControlFactory.AddControl(show);

            var showConfig = new MyTerminalControlOnOffSwitch<MyBeacon>("ShowInToolbarConfig", MySpaceTexts.Terminal_ShowInToolbarConfig, MySpaceTexts.Terminal_ShowInToolbarConfigToolTip);
            showConfig.Getter = (x) => x.ShowInToolbarConfig;
            showConfig.Setter = (x, v) => x.ShowInToolbarConfig = v;
            MyTerminalControlFactory.AddControl(showConfig);

            var customName = new MyTerminalControlTextbox<MyBeacon>("CustomName", MyCommonTexts.Name, MySpaceTexts.Blank);
            customName.Getter = (x) => x.CustomName;
            customName.Setter = (x, v) => x.SetCustomName(v);
            customName.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(customName);
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyBeacon>());

            var broadcastRadius = new MyTerminalControlSlider<MyBeacon>("Radius", MySpaceTexts.BlockPropertyTitle_BroadcastRadius, MySpaceTexts.BlockPropertyDescription_BroadcastRadius);
            broadcastRadius.SetLogLimits(1, MyEnergyConstants.MAX_RADIO_POWER_RANGE);
            broadcastRadius.DefaultValue = 10000;
            broadcastRadius.Getter = (x) => x.RadioBroadcaster.BroadcastRadius;
            broadcastRadius.Setter = (x, v) => x.m_radius.Value = v;
            broadcastRadius.Writer = (x, result) => result.Append(new StringBuilder().AppendDecimal(x.RadioBroadcaster.BroadcastRadius, 0).Append(" m"));
            broadcastRadius.EnableActions();
            MyTerminalControlFactory.AddControl(broadcastRadius);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:30,代码来源:MyBeacon.cs

示例3: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyGravityGenerator>())
                return;
            base.CreateTerminalControls();
            var fieldWidth = new MyTerminalControlSlider<MyGravityGenerator>("Width", MySpaceTexts.BlockPropertyTitle_GravityFieldWidth, MySpaceTexts.BlockPropertyDescription_GravityFieldWidth);
            fieldWidth.SetLimits((x) => x.BlockDefinition.MinFieldSize.X, (x) => x.BlockDefinition.MaxFieldSize.X);
            fieldWidth.DefaultValue = 150;
            fieldWidth.Getter = (x) => x.m_fieldSize.Value.X;
            fieldWidth.Setter = (x, v) =>
            {
                Vector3 fieldSize = x.m_fieldSize;
                fieldSize.X = v;
                x.m_fieldSize.Value = fieldSize;
            };
            fieldWidth.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_fieldSize.Value.X, NUM_DECIMALS)).Append(" m");
            fieldWidth.EnableActions();
            MyTerminalControlFactory.AddControl(fieldWidth);

            var fieldHeight = new MyTerminalControlSlider<MyGravityGenerator>("Height", MySpaceTexts.BlockPropertyTitle_GravityFieldHeight, MySpaceTexts.BlockPropertyDescription_GravityFieldHeight);
            fieldHeight.SetLimits((x) => x.BlockDefinition.MinFieldSize.Y, (x) => x.BlockDefinition.MaxFieldSize.Y);
            fieldHeight.DefaultValue = 150;
            fieldHeight.Getter = (x) => x.m_fieldSize.Value.Y;
            fieldHeight.Setter = (x, v) =>
            {
                Vector3 fieldSize = x.m_fieldSize;
                fieldSize.Y = v;
                x.m_fieldSize.Value = fieldSize;
            };
            fieldHeight.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_fieldSize.Value.Y, NUM_DECIMALS)).Append(" m");

            fieldHeight.EnableActions();
            MyTerminalControlFactory.AddControl(fieldHeight);

            var fieldDepth = new MyTerminalControlSlider<MyGravityGenerator>("Depth", MySpaceTexts.BlockPropertyTitle_GravityFieldDepth, MySpaceTexts.BlockPropertyDescription_GravityFieldDepth);
            fieldDepth.SetLimits((x) => x.BlockDefinition.MinFieldSize.Z, (x) => x.BlockDefinition.MaxFieldSize.Z);
            fieldDepth.DefaultValue = 150;
            fieldDepth.Getter = (x) => x.m_fieldSize.Value.Z;
            fieldDepth.Setter = (x, v) =>
            {
                Vector3 fieldSize = x.m_fieldSize;
                fieldSize.Z = v;
                x.m_fieldSize.Value = fieldSize;
            };
            fieldDepth.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_fieldSize.Value.Z, NUM_DECIMALS)).Append(" m");
            fieldDepth.EnableActions();
            MyTerminalControlFactory.AddControl(fieldDepth);

            var gravityAcceleration = new MyTerminalControlSlider<MyGravityGenerator>("Gravity", MySpaceTexts.BlockPropertyTitle_GravityAcceleration, MySpaceTexts.BlockPropertyDescription_GravityAcceleration);
            gravityAcceleration.SetLimits((x) => x.BlockDefinition.MinGravityAcceleration, (x) => x.BlockDefinition.MaxGravityAcceleration);
            gravityAcceleration.DefaultValue = MyGravityProviderSystem.G;
            gravityAcceleration.Getter = (x) => x.GravityAcceleration;
            gravityAcceleration.Setter = (x, v) => x.GravityAcceleration = v;
            gravityAcceleration.Writer = (x, result) => result.AppendDecimal(x.GravityAcceleration / MyGravityProviderSystem.G, 2).Append(" G");
            gravityAcceleration.EnableActions();
            MyTerminalControlFactory.AddControl(gravityAcceleration);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:57,代码来源:MyGravityGenerator.cs

示例4: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyGravityGeneratorSphere>())
                return;
            base.CreateTerminalControls();
            if (MyFakes.ENABLE_GRAVITY_GENERATOR_SPHERE)
            {
                var fieldRadius = new MyTerminalControlSlider<MyGravityGeneratorSphere>("Radius", MySpaceTexts.BlockPropertyTitle_GravityFieldRadius, MySpaceTexts.BlockPropertyDescription_GravityFieldRadius);
                fieldRadius.DefaultValue = DEFAULT_RADIUS;
                fieldRadius.Getter = (x) => x.Radius;
                fieldRadius.Setter = (x, v) =>
                {
                    if (v < x.BlockDefinition.MinRadius)
                    {
                        v = x.BlockDefinition.MinRadius;
                    }
                    x.Radius = v;
                };
                fieldRadius.Normalizer = (x, v) =>
                {
                    if (v == 0)
                    {
                        return 0;
                    }
                    else
                    {
                        return (v - x.BlockDefinition.MinRadius) / (x.BlockDefinition.MaxRadius - x.BlockDefinition.MinRadius);
                    }
                };
                fieldRadius.Denormalizer = (x, v) =>
                {
                    if (v == 0)
                    {
                        return 0;
                    }
                    else
                    {
                        return v * (x.BlockDefinition.MaxRadius - x.BlockDefinition.MinRadius) + x.BlockDefinition.MinRadius;
                    }
                };
                fieldRadius.Writer = (x, result) => result.AppendInt32((int)x.m_radius).Append(" m");
                fieldRadius.EnableActions();
                MyTerminalControlFactory.AddControl(fieldRadius);

                var gravityAcceleration = new MyTerminalControlSlider<MyGravityGeneratorSphere>("Gravity", MySpaceTexts.BlockPropertyTitle_GravityAcceleration, MySpaceTexts.BlockPropertyDescription_GravityAcceleration);
                gravityAcceleration.SetLimits((x) => x.BlockDefinition.MinGravityAcceleration, (x) => x.BlockDefinition.MaxGravityAcceleration);
                gravityAcceleration.DefaultValue = MyGravityProviderSystem.G;
                gravityAcceleration.Getter = (x) => x.GravityAcceleration;
                gravityAcceleration.Setter = (x, v) => x.GravityAcceleration =  v;
                gravityAcceleration.Writer = (x, result) => result.AppendDecimal(x.m_gravityAcceleration / MyGravityProviderSystem.G, 2).Append(" G");
                gravityAcceleration.EnableActions();
                MyTerminalControlFactory.AddControl(gravityAcceleration);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:54,代码来源:MyGravityGeneratorSphere.cs

示例5: MyGravityGenerator

        static MyGravityGenerator()
        {
            var fieldWidth = new MyTerminalControlSlider<MyGravityGenerator>("Width", MySpaceTexts.BlockPropertyTitle_GravityFieldWidth, MySpaceTexts.BlockPropertyDescription_GravityFieldWidth);
            fieldWidth.SetLimits(1, 150);
            fieldWidth.DefaultValue = 150;
            fieldWidth.Getter = (x) => x.m_fieldSize.Value.X;
            fieldWidth.Setter = (x, v) =>
            {
                Vector3 fieldSize = x.m_fieldSize;
                fieldSize.X = v;
                x.m_fieldSize.Value = fieldSize;
            };
            fieldWidth.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_fieldSize.Value.X, NUM_DECIMALS)).Append(" m");
            fieldWidth.EnableActions();
            MyTerminalControlFactory.AddControl(fieldWidth);

            var fieldHeight = new MyTerminalControlSlider<MyGravityGenerator>("Height", MySpaceTexts.BlockPropertyTitle_GravityFieldHeight, MySpaceTexts.BlockPropertyDescription_GravityFieldHeight);
            fieldHeight.SetLimits(1, 150);
            fieldHeight.DefaultValue = 150;
            fieldHeight.Getter = (x) => x.m_fieldSize.Value.Y;
            fieldHeight.Setter = (x, v) =>
            {
                Vector3 fieldSize = x.m_fieldSize;
                fieldSize.Y = v;
                x.m_fieldSize.Value = fieldSize;
            };
            fieldHeight.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_fieldSize.Value.Y, NUM_DECIMALS)).Append(" m");

            fieldHeight.EnableActions();
            MyTerminalControlFactory.AddControl(fieldHeight);

            var fieldDepth = new MyTerminalControlSlider<MyGravityGenerator>("Depth", MySpaceTexts.BlockPropertyTitle_GravityFieldDepth, MySpaceTexts.BlockPropertyDescription_GravityFieldDepth);
            fieldDepth.SetLimits(1, 150);
            fieldDepth.DefaultValue = 150;
            fieldDepth.Getter = (x) => x.m_fieldSize.Value.Z;
            fieldDepth.Setter = (x, v) =>
            {
                Vector3 fieldSize = x.m_fieldSize;
                fieldSize.Z = v;
                x.m_fieldSize.Value = fieldSize;
            };
            fieldDepth.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_fieldSize.Value.Z, NUM_DECIMALS)).Append(" m");
            fieldDepth.EnableActions();
            MyTerminalControlFactory.AddControl(fieldDepth);

            var gravityAcceleration = new MyTerminalControlSlider<MyGravityGenerator>("Gravity", MySpaceTexts.BlockPropertyTitle_GravityAcceleration, MySpaceTexts.BlockPropertyDescription_GravityAcceleration);
            gravityAcceleration.SetLimits(-MyGravityProviderSystem.G, MyGravityProviderSystem.G);
			gravityAcceleration.DefaultValue = MyGravityProviderSystem.G;
            gravityAcceleration.Getter = (x) => x.GravityAcceleration;
            gravityAcceleration.Setter = (x, v) => x.GravityAcceleration = v;
            gravityAcceleration.Writer = (x, result) => result.AppendDecimal(x.m_gravityAcceleration / MyGravityProviderSystem.G, 2).Append(" G");
            gravityAcceleration.EnableActions();
            MyTerminalControlFactory.AddControl(gravityAcceleration);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:54,代码来源:MyGravityGenerator.cs

示例6: MyGyro

        static MyGyro()
        {
            var gyroPower = new MyTerminalControlSlider<MyGyro>("Power", MySpaceTexts.BlockPropertyTitle_GyroPower, MySpaceTexts.BlockPropertyDescription_GyroPower);
            gyroPower.Getter = (x) => x.GyroPower;
            gyroPower.Setter = (x, v) => { x.GyroPower = v;};
            gyroPower.Writer = (x, result) => result.AppendInt32((int)(x.GyroPower * 100)).Append(" %");
            gyroPower.DefaultValue = 1;
            gyroPower.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE);
            MyTerminalControlFactory.AddControl(gyroPower);

            if (MyFakes.ENABLE_GYRO_OVERRIDE)
            {
                var gyroOverride = new MyTerminalControlCheckbox<MyGyro>("Override", MySpaceTexts.BlockPropertyTitle_GyroOverride, MySpaceTexts.BlockPropertyDescription_GyroOverride);
                gyroOverride.Getter = (x) => x.GyroOverride;
                gyroOverride.Setter = (x, v) => { x.GyroOverride = v; };
                gyroOverride.EnableAction();
                MyTerminalControlFactory.AddControl(gyroOverride);

                // Pitch = X axis, Yaw = Y axis, Roll = Z axis

                var gyroOverrideSliderY = new MyTerminalControlSlider<MyGyro>("Yaw", MySpaceTexts.BlockPropertyTitle_GyroYawOverride, MySpaceTexts.BlockPropertyDescription_GyroYawOverride);
                gyroOverrideSliderY.Getter = (x) => -x.m_gyroOverrideVelocity.Value.Y;
                gyroOverrideSliderY.Setter = (x, v) => { SetGyroTorqueYaw(x, -v);};
                gyroOverrideSliderY.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.Value.Y * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM");
                gyroOverrideSliderY.Enabled = (x) => x.GyroOverride;
                gyroOverrideSliderY.DefaultValue = 0;
                gyroOverrideSliderY.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f);
                gyroOverrideSliderY.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE);
                MyTerminalControlFactory.AddControl(gyroOverrideSliderY);

                var gyroOverrideSliderX = new MyTerminalControlSlider<MyGyro>("Pitch", MySpaceTexts.BlockPropertyTitle_GyroPitchOverride, MySpaceTexts.BlockPropertyDescription_GyroPitchOverride);
                gyroOverrideSliderX.Getter = (x) => x.m_gyroOverrideVelocity.Value.X;
                gyroOverrideSliderX.Setter = (x, v) => { SetGyroTorquePitch(x, v); };
                gyroOverrideSliderX.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.Value.X * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM");
                gyroOverrideSliderX.Enabled = (x) => x.GyroOverride;
                gyroOverrideSliderX.DefaultValue = 0;
                gyroOverrideSliderX.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f);
                gyroOverrideSliderX.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE);
                MyTerminalControlFactory.AddControl(gyroOverrideSliderX);

                var gyroOverrideSliderZ = new MyTerminalControlSlider<MyGyro>("Roll", MySpaceTexts.BlockPropertyTitle_GyroRollOverride, MySpaceTexts.BlockPropertyDescription_GyroRollOverride);
                gyroOverrideSliderZ.Getter = (x) => -x.m_gyroOverrideVelocity.Value.Z;
                gyroOverrideSliderZ.Setter = (x, v) => { SetGyroTorqueRoll(x, -v);};
                gyroOverrideSliderZ.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.Value.Z * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM");
                gyroOverrideSliderZ.Enabled = (x) => x.GyroOverride;
                gyroOverrideSliderZ.DefaultValue = 0;
                gyroOverrideSliderZ.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f);
                gyroOverrideSliderZ.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE);
                MyTerminalControlFactory.AddControl(gyroOverrideSliderZ);
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:51,代码来源:MyGyro.cs

示例7: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyWarhead>())
                return;
            base.CreateTerminalControls();
            var slider = new MyTerminalControlSlider<MyWarhead>("DetonationTime", MySpaceTexts.TerminalControlPanel_Warhead_DetonationTime, MySpaceTexts.TerminalControlPanel_Warhead_DetonationTime);
            slider.SetLogLimits(1, 60 * 60);
            slider.DefaultValue = 10;
            slider.Enabled = (x) => !x.IsCountingDown;
            slider.Getter = (x) => x.DetonationTime;
            slider.Setter = (x, v) => x.m_countdownMs.Value = (int)(v * 1000);
            slider.Writer = (x, sb) => MyValueFormatter.AppendTimeExact(Math.Max(x.m_countdownMs, 1000) / 1000, sb);
            slider.EnableActions();
            MyTerminalControlFactory.AddControl(slider);

            var startButton = new MyTerminalControlButton<MyWarhead>(
                "StartCountdown",
                MySpaceTexts.TerminalControlPanel_Warhead_StartCountdown,
                MySpaceTexts.TerminalControlPanel_Warhead_StartCountdown,
                (b) => MyMultiplayer.RaiseEvent(b, x => x.SetCountdown, true));
            startButton.EnableAction();
            MyTerminalControlFactory.AddControl(startButton);

            var stopButton = new MyTerminalControlButton<MyWarhead>(
                "StopCountdown",
                MySpaceTexts.TerminalControlPanel_Warhead_StopCountdown,
                MySpaceTexts.TerminalControlPanel_Warhead_StopCountdown,
                (b) => MyMultiplayer.RaiseEvent(b, x => x.SetCountdown, false));
            stopButton.EnableAction();
            MyTerminalControlFactory.AddControl(stopButton);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyWarhead>());

            var safetyCheckbox = new MyTerminalControlCheckbox<MyWarhead>(
                "Safety",
                MySpaceTexts.TerminalControlPanel_Warhead_Safety,
                MySpaceTexts.TerminalControlPanel_Warhead_SafetyTooltip,
                MySpaceTexts.TerminalControlPanel_Warhead_SwitchTextDisarmed,
                MySpaceTexts.TerminalControlPanel_Warhead_SwitchTextArmed);
            safetyCheckbox.Getter = (x) => !x.IsArmed;
            safetyCheckbox.Setter = (x, v) => x.IsArmed = !v;
            safetyCheckbox.EnableAction();
            MyTerminalControlFactory.AddControl(safetyCheckbox);

            var detonateButton = new MyTerminalControlButton<MyWarhead>(
                "Detonate",
                MySpaceTexts.TerminalControlPanel_Warhead_Detonate,
                MySpaceTexts.TerminalControlPanel_Warhead_Detonate,
                (b) => { if (b.IsArmed) { MyMultiplayer.RaiseEvent(b, x => x.DetonateRequest); } });
            detonateButton.Enabled = (x) => x.IsArmed;
            detonateButton.EnableAction();
            MyTerminalControlFactory.AddControl(detonateButton);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:53,代码来源:MyWarhead.cs

示例8: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyRemoteControl>())
                return;
            base.CreateTerminalControls();
            var controlBtn = new MyTerminalControlButton<MyRemoteControl>("Control", MySpaceTexts.ControlRemote, MySpaceTexts.Blank, (b) => b.RequestControl());
            controlBtn.Enabled = r => r.CanControl();
            controlBtn.SupportsMultipleBlocks = false;
            var action = controlBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
            if (action != null)
            {
                action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
                action.ValidForGroups = false;
            }
            MyTerminalControlFactory.AddControl(controlBtn);

            
            var autoPilotSeparator = new MyTerminalControlSeparator<MyRemoteControl>();
            MyTerminalControlFactory.AddControl(autoPilotSeparator);

            var autoPilot = new MyTerminalControlOnOffSwitch<MyRemoteControl>("AutoPilot", MySpaceTexts.BlockPropertyTitle_AutoPilot, MySpaceTexts.Blank);
            autoPilot.Getter = (x) => x.m_autoPilotEnabled;
            autoPilot.Setter = (x, v) => x.SetAutoPilotEnabled(v);
            autoPilot.Enabled = r => r.CanEnableAutoPilot();
            autoPilot.EnableToggleAction();
            autoPilot.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(autoPilot);

            var collisionAv = new MyTerminalControlOnOffSwitch<MyRemoteControl>("CollisionAvoidance", MySpaceTexts.BlockPropertyTitle_CollisionAvoidance, MySpaceTexts.Blank);
            collisionAv.Getter = (x) => x.m_useCollisionAvoidance;
            collisionAv.Setter = (x, v) => x.SetCollisionAvoidance(v);
            collisionAv.Enabled = r => true;
            collisionAv.EnableToggleAction();
            collisionAv.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(collisionAv);

            var dockignMode = new MyTerminalControlOnOffSwitch<MyRemoteControl>("DockingMode", MySpaceTexts.BlockPropertyTitle_EnableDockingMode, MySpaceTexts.Blank);
            dockignMode.Getter = (x) => x.m_dockingModeEnabled;
            dockignMode.Setter = (x, v) => x.SetDockingMode(v);
            dockignMode.Enabled = r => r.IsWorking;
            dockignMode.EnableToggleAction();
            dockignMode.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(dockignMode);

            var cameraList = new MyTerminalControlCombobox<MyRemoteControl>("CameraList", MySpaceTexts.BlockPropertyTitle_AssignedCamera, MySpaceTexts.Blank);
            cameraList.ComboBoxContentWithBlock = (x, list) => x.FillCameraComboBoxContent(list);
            cameraList.Getter = (x) => (long)x.m_bindedCamera;
            cameraList.Setter = (x, y) => x.m_bindedCamera.Value = y;
            MyTerminalControlFactory.AddControl(cameraList);
            m_cameraList = cameraList;

            var flightMode = new MyTerminalControlCombobox<MyRemoteControl>("FlightMode", MySpaceTexts.BlockPropertyTitle_FlightMode, MySpaceTexts.Blank);
            flightMode.ComboBoxContent = (x) => FillFlightModeCombo(x);
            flightMode.Getter = (x) => (long)x.m_currentFlightMode.Value;
            flightMode.Setter = (x, v) => x.ChangeFlightMode((FlightMode)v);
            flightMode.SetSerializerRange((int)MyEnum<FlightMode>.Range.Min, (int)MyEnum<FlightMode>.Range.Max);
            MyTerminalControlFactory.AddControl(flightMode);

            var directionCombo = new MyTerminalControlCombobox<MyRemoteControl>("Direction", MySpaceTexts.BlockPropertyTitle_ForwardDirection, MySpaceTexts.Blank);
            directionCombo.ComboBoxContent = (x) => FillDirectionCombo(x);
            directionCombo.Getter = (x) => (long)x.m_currentDirection.Value;
            directionCombo.Setter = (x, v) => x.ChangeDirection((Base6Directions.Direction)v);
            MyTerminalControlFactory.AddControl(directionCombo);

            if (MyFakes.ENABLE_VR_REMOTE_BLOCK_AUTOPILOT_SPEED_LIMIT)
            {
                var sliderSpeedLimit = new MyTerminalControlSlider<MyRemoteControl>("SpeedLimit", MySpaceTexts.BlockPropertyTitle_RemoteBlockSpeedLimit,
                    MySpaceTexts.BlockPropertyTitle_RemoteBlockSpeedLimit);
                sliderSpeedLimit.SetLimits(1, 200);
                sliderSpeedLimit.DefaultValue = MyObjectBuilder_RemoteControl.DEFAULT_AUTOPILOT_SPEED_LIMIT;
                sliderSpeedLimit.Getter = (x) => x.m_autopilotSpeedLimit;
                sliderSpeedLimit.Setter = (x, v) => x.m_autopilotSpeedLimit.Value = v;
                sliderSpeedLimit.Writer = (x, sb) => sb.Append(MyValueFormatter.GetFormatedFloat(x.m_autopilotSpeedLimit, 0));
                sliderSpeedLimit.EnableActions();
                MyTerminalControlFactory.AddControl(sliderSpeedLimit);
            }

            var waypointList = new MyTerminalControlListbox<MyRemoteControl>("WaypointList", MySpaceTexts.BlockPropertyTitle_Waypoints, MySpaceTexts.Blank, true);
            waypointList.ListContent = (x, list1, list2) => x.FillWaypointList(list1, list2);
            waypointList.ItemSelected = (x, y) => x.SelectWaypoint(y);
            if (!MySandboxGame.IsDedicated)
            {
                m_waypointGuiControl = (MyGuiControlListbox)((MyGuiControlBlockProperty)waypointList.GetGuiControl()).PropertyControl;
            }
            MyTerminalControlFactory.AddControl(waypointList);


            var toolbarButton = new MyTerminalControlButton<MyRemoteControl>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_AutoPilotToolbarOpen, MySpaceTexts.BlockPropertyPopup_AutoPilotToolbarOpen,
                delegate(MyRemoteControl self)
                {
                    var actions = self.m_selectedWaypoints[0].Actions;
                    if (actions != null)
                    {
                        for (int i = 0; i < actions.Length; i++)
                        {
                            if (actions[i] != null)
                            {
                                self.m_actionToolbar.SetItemAtIndex(i, actions[i]);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:101,代码来源:MyRemoteControl.cs

示例9: CreateTerminalControls

        static void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyShipConnector>())
                return;

            var throwOut = new MyTerminalControlOnOffSwitch<MyShipConnector>("ThrowOut", MySpaceTexts.Terminal_ThrowOut);
            throwOut.Getter = (block) => block.ThrowOut;
            throwOut.Setter = (block, value) => block.ThrowOut.Value = value;
            throwOut.EnableToggleAction();
            MyTerminalControlFactory.AddControl(throwOut);

            var collectAll = new MyTerminalControlOnOffSwitch<MyShipConnector>("CollectAll", MySpaceTexts.Terminal_CollectAll);
            collectAll.Getter = (block) => block.CollectAll;
            collectAll.Setter = (block, value) => block.CollectAll.Value = value;
            collectAll.EnableToggleAction();
            MyTerminalControlFactory.AddControl(collectAll);

            var lockBtn = new MyTerminalControlButton<MyShipConnector>("Lock", MySpaceTexts.BlockActionTitle_Lock, MySpaceTexts.Blank, (b) => b.TryConnect());
            lockBtn.Enabled = (b) => b.IsWorking && b.InConstraint;
            lockBtn.Visible = (b) => b.m_connectorMode == Mode.Connector;
            var actionLock = lockBtn.EnableAction();
            actionLock.Enabled = (b) => b.m_connectorMode == Mode.Connector;
            MyTerminalControlFactory.AddControl(lockBtn);

            var unlockBtn = new MyTerminalControlButton<MyShipConnector>("Unlock", MySpaceTexts.BlockActionTitle_Unlock, MySpaceTexts.Blank, (b) => b.TryDisconnect());
            unlockBtn.Enabled = (b) => b.IsWorking && b.InConstraint;
            unlockBtn.Visible = (b) => b.m_connectorMode == Mode.Connector;
            var actionUnlock = unlockBtn.EnableAction();
            actionUnlock.Enabled = (b) => b.m_connectorMode == Mode.Connector;
            MyTerminalControlFactory.AddControl(unlockBtn);

            var title = MyTexts.Get(MySpaceTexts.BlockActionTitle_SwitchLock);
            MyTerminalAction<MyShipConnector> switchLockAction = new MyTerminalAction<MyShipConnector>("SwitchLock", title, MyTerminalActionIcons.TOGGLE);
            switchLockAction.Action = (b) => b.TrySwitch();
            switchLockAction.Writer = (b, sb) => b.WriteLockStateValue(sb);
            switchLockAction.Enabled = (b) => b.m_connectorMode == Mode.Connector;
            MyTerminalControlFactory.AddAction(switchLockAction);

            var strength = new MyTerminalControlSlider<MyShipConnector>("Strength", MySpaceTexts.BlockPropertyTitle_Connector_Strength, MySpaceTexts.BlockPropertyDescription_Connector_Strength);
            strength.Getter = (x) => x.Strength;
            strength.Setter = (x, v) => x.Strength.Value = v;
            strength.DefaultValue = MyObjectBuilder_ShipConnector.DefaultStrength;
            strength.SetLogLimits(MinStrength, 1.0f);
            strength.EnableActions(enabled: (b) => b.m_connectorMode == Mode.Connector);
            strength.Enabled = (b) => b.m_connectorMode == Mode.Connector;
            strength.Visible = (b) => b.m_connectorMode == Mode.Connector;
            strength.Writer = (x, result) =>
            {
                if (x.Strength <= MinStrength)
                    result.Append(MyTexts.Get(MyCommonTexts.Disabled));
                else
                    result.AppendFormatedDecimal("", x.Strength * 100, 4, " %");
            };
            MyTerminalControlFactory.AddControl(strength);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:55,代码来源:MyShipConnector.cs

示例10: MyThrust

        static MyThrust()
        {
            float threshold = 1f;
            var thrustOverride = new MyTerminalControlSlider<MyThrust>("Override", MySpaceTexts.BlockPropertyTitle_ThrustOverride, MySpaceTexts.BlockPropertyDescription_ThrustOverride);
            thrustOverride.Getter = (x) => x.m_thrustOverride;
            thrustOverride.Setter = (x, v) =>
            {
                x.m_thrustOverride.Value = (v <= threshold ? 0 : v);
                x.RaisePropertiesChanged();
            };

            thrustOverride.DefaultValue = 0;
            thrustOverride.SetLimits((x) => 0f, (x) => 100f);
            thrustOverride.EnableActions();
            thrustOverride.Writer = (x, result) =>
                {
                    if (x.ThrustOverride < 1f)
                        result.Append(MyTexts.Get(MyCommonTexts.Disabled));
                    else
                        MyValueFormatter.AppendForceInBestUnit(x.ThrustOverride * x.m_thrustComponent.GetLastThrustMultiplier(x), result);
                };
            MyTerminalControlFactory.AddControl(thrustOverride);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:23,代码来源:MyThrust.cs

示例11: MyLightingBlock

        static MyLightingBlock()
        {
            var lightColor = new MyTerminalControlColor<MyLightingBlock>("Color", MySpaceTexts.BlockPropertyTitle_LightColor);
            lightColor.Getter = (x) => x.Color;
            lightColor.Setter = (x, v) => x.m_lightColor.Value = v;
            MyTerminalControlFactory.AddControl(lightColor);

            var lightRadius = new MyTerminalControlSlider<MyLightingBlock>("Radius", MySpaceTexts.BlockPropertyTitle_LightRadius, MySpaceTexts.BlockPropertyDescription_LightRadius);
            lightRadius.SetLimits((x) => x.RadiusBounds.Min, (x) => x.RadiusBounds.Max);
            lightRadius.DefaultValueGetter = (x) => x.RadiusBounds.Default;
            lightRadius.Getter = (x) => x.Radius;
            lightRadius.Setter = (x, v) => x.m_lightRadius.Value = v;
            lightRadius.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.Range, 1)).Append(" m");
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightRadius);

            var lightFalloff = new MyTerminalControlSlider<MyLightingBlock>("Falloff", MySpaceTexts.BlockPropertyTitle_LightFalloff, MySpaceTexts.BlockPropertyDescription_LightFalloff);
            lightFalloff.SetLimits((x) => x.FalloffBounds.Min, (x) => x.FalloffBounds.Max);
            lightFalloff.DefaultValueGetter = (x) => x.FalloffBounds.Default;
            lightFalloff.Getter = (x) => x.Falloff;
            lightFalloff.Setter = (x, v) => x.m_lightFalloff.Value = v;
            lightFalloff.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.Falloff, 1));
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightFalloff);

            var lightIntensity = new MyTerminalControlSlider<MyLightingBlock>("Intensity", MySpaceTexts.BlockPropertyTitle_LightIntensity, MySpaceTexts.BlockPropertyDescription_LightIntensity);
            lightIntensity.SetLimits((x) => x.IntensityBounds.Min, (x) => x.IntensityBounds.Max);
            lightIntensity.DefaultValueGetter = (x) => x.IntensityBounds.Default;
            lightIntensity.Getter = (x) => x.Intensity;
            lightIntensity.Setter = (x, v) => x.Intensity = v;
            lightIntensity.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.Intensity, 1));
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightIntensity);

            var lightBlinkTime = new MyTerminalControlSlider<MyLightingBlock>("Blink Interval", MySpaceTexts.BlockPropertyTitle_LightBlinkInterval, MySpaceTexts.BlockPropertyDescription_LightBlinkInterval);
            lightBlinkTime.SetLimits((x) => x.BlinkIntervalSecondsBounds.Min, (x) => x.BlinkIntervalSecondsBounds.Max);
            lightBlinkTime.DefaultValueGetter = (x) => x.BlinkIntervalSecondsBounds.Default;
            lightBlinkTime.Getter = (x) => x.BlinkIntervalSeconds;
            lightBlinkTime.Setter = (x, v) => x.BlinkIntervalSeconds = v;
            lightBlinkTime.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkIntervalSeconds, NUM_DECIMALS)).Append(" s");
            lightBlinkTime.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkTime);

            var lightBlinkLenght = new MyTerminalControlSlider<MyLightingBlock>("Blink Lenght", MySpaceTexts.BlockPropertyTitle_LightBlinkLenght, MySpaceTexts.BlockPropertyDescription_LightBlinkLenght);
            lightBlinkLenght.SetLimits((x) => x.BlinkLenghtBounds.Min, (x) => x.BlinkLenghtBounds.Max);
            lightBlinkLenght.DefaultValueGetter = (x) => x.BlinkLenghtBounds.Default;
            lightBlinkLenght.Getter = (x) => x.BlinkLength;
            lightBlinkLenght.Setter = (x, v) => x.BlinkLength = v;
            lightBlinkLenght.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkLength, NUM_DECIMALS)).Append(" %");
            lightBlinkLenght.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkLenght);

            var ligthBlinkOffset = new MyTerminalControlSlider<MyLightingBlock>("Blink Offset", MySpaceTexts.BlockPropertyTitle_LightBlinkOffset, MySpaceTexts.BlockPropertyDescription_LightBlinkOffset);
            ligthBlinkOffset.SetLimits((x) => x.BlinkOffsetBounds.Min, (x) => x.BlinkOffsetBounds.Max);
            ligthBlinkOffset.DefaultValueGetter = (x) => x.BlinkOffsetBounds.Default;
            ligthBlinkOffset.Getter = (x) => x.BlinkOffset;
            ligthBlinkOffset.Setter = (x, v) => x.BlinkOffset = v;
            ligthBlinkOffset.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkOffset, NUM_DECIMALS)).Append(" %");
            ligthBlinkOffset.EnableActions();
            MyTerminalControlFactory.AddControl(ligthBlinkOffset);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:61,代码来源:MyLightingBlock.cs

示例12: MyLandingGear

        static MyLandingGear()
        {
            var stateWriter = new MyTerminalControl<MyLandingGear>.WriterDelegate((b, sb) => b.WriteLockStateValue(sb));

            var lockBtn = new MyTerminalControlButton<MyLandingGear>("Lock", MySpaceTexts.BlockActionTitle_Lock, MySpaceTexts.Blank, (b) => b.RequestLandingGearLock());
            lockBtn.Enabled = (b) => b.IsWorking;
            lockBtn.EnableAction(MyTerminalActionIcons.TOGGLE, (MyStringId?)null, stateWriter);
            MyTerminalControlFactory.AddControl(lockBtn);

            var unlockBtn = new MyTerminalControlButton<MyLandingGear>("Unlock", MySpaceTexts.BlockActionTitle_Unlock, MySpaceTexts.Blank, (b) => b.RequestLandingGearUnlock());
            unlockBtn.Enabled = (b) => b.IsWorking;
            unlockBtn.EnableAction(MyTerminalActionIcons.TOGGLE, (MyStringId?)null, stateWriter);
            MyTerminalControlFactory.AddControl(unlockBtn);

            var title = MyTexts.Get(MySpaceTexts.BlockActionTitle_SwitchLock);
            MyTerminalAction<MyLandingGear> switchLockAction = new MyTerminalAction<MyLandingGear>("SwitchLock", title, MyTerminalActionIcons.TOGGLE);
            switchLockAction.Action = (b) => b.RequestLandingGearSwitch();
            switchLockAction.Writer = stateWriter;
            MyTerminalControlFactory.AddAction(switchLockAction);

            var autoLock = new MyTerminalControlCheckbox<MyLandingGear>("Autolock", MySpaceTexts.BlockPropertyTitle_LandGearAutoLock, MySpaceTexts.Blank);
            autoLock.Getter = (b) => b.m_autoLock;
            autoLock.Setter = (b, v) => b.SyncObject.SendAutoLockChange(v);
            autoLock.EnableAction();
            MyTerminalControlFactory.AddControl(autoLock);

            if (MyFakes.LANDING_GEAR_BREAKABLE)
            {
                var brakeForce = new MyTerminalControlSlider<MyLandingGear>("BreakForce", MySpaceTexts.BlockPropertyTitle_BreakForce, MySpaceTexts.BlockPropertyDescription_BreakForce);
                brakeForce.Getter = (x) => x.BreakForce;
                brakeForce.Setter = (x, v) => x.SyncObject.SendBrakeForceChange(v);
                brakeForce.DefaultValue = 1;
                brakeForce.Writer = (x, result) =>
                {
                    if (x.BreakForce >= MaxSolverImpulse) result.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_MotorAngleUnlimited));
                    else MyValueFormatter.AppendForceInBestUnit(x.BreakForce, result);
                };
                brakeForce.Normalizer = (b, v) => ThresholdToRatio(v);
                brakeForce.Denormalizer = (b, v) => RatioToThreshold(v);
                brakeForce.EnableActions();
                MyTerminalControlFactory.AddControl(brakeForce);
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:43,代码来源:MyLandingGear.cs

示例13: MyThrust

        static MyThrust()
        {
            float threshold = 0.01f;
            var thrustOverride = new MyTerminalControlSlider<MyThrust>("Override", MySpaceTexts.BlockPropertyTitle_ThrustOverride, MySpaceTexts.BlockPropertyDescription_ThrustOverride);
            thrustOverride.Getter = (x) => x.ThrustOverride;
            thrustOverride.Setter = (x, v) =>
            {
                float val = v;
                float limit = x.BlockDefinition.ForceMagnitude * threshold;

                x.SetThrustOverride(val <= limit ? 0 : v);
                x.SyncObject.SendChangeThrustOverrideRequest(x.ThrustOverride);
            };
            thrustOverride.DefaultValue = 0;
            thrustOverride.SetLogLimits((x) => x.BlockDefinition.ForceMagnitude * 0.01f, (x) => x.BlockDefinition.ForceMagnitude);
            thrustOverride.EnableActions();
            thrustOverride.Writer = (x, result) =>
                {
                    if (x.ThrustOverride <= x.BlockDefinition.ForceMagnitude * 0.01f)
                        result.Append(MyTexts.Get(MySpaceTexts.Disabled));
                    else
                        MyValueFormatter.AppendForceInBestUnit(x.ThrustOverride, result);
                };
            MyTerminalControlFactory.AddControl(thrustOverride);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:25,代码来源:MyThrust.cs

示例14: AddOffsetSlider

 private static void AddOffsetSlider(string id, string title, string toolTip, int dim)
 {
     MyTerminalControlSlider<MySpaceProjector> control = new MyTerminalControlSlider<MySpaceProjector>(id, MyStringId.GetOrCompute(title), MyStringId.GetOrCompute(toolTip));
     Func<IMyTerminalBlock, float> getter = block => GetOffset(block, dim);
     control.DefaultValue = dim == 1 ? 2.5f : 0f;
     control.Normalizer = (block, value) => Normalizer(MinOffset, MaxOffset, block, value);
     control.Denormalizer = (block, value) => Denormalizer(MinOffset, MaxOffset, block, value);
     control.Writer = (block, sb) => WriterMetres(getter, block, sb);
     IMyTerminalValueControl<float> valueControl = control;
     valueControl.Getter = getter;
     valueControl.Setter = (block, value) => SetOffset(block, dim, value);
     Static.TermControls_Offset.Add(control);
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:13,代码来源:Projector.cs

示例15: MySoundBlock

        static MySoundBlock()
        {      
            var volumeSlider = new MyTerminalControlSlider<MySoundBlock>("VolumeSlider", MySpaceTexts.BlockPropertyTitle_SoundBlockVolume, MySpaceTexts.BlockPropertyDescription_SoundBlockVolume);
            volumeSlider.SetLimits(0, 1.0f);
            volumeSlider.DefaultValue = 1;
            volumeSlider.Getter = (x) => x.Volume;
            volumeSlider.Setter = (x, v) => x.SyncObject.SendChangeSoundVolumeRequest(v);
            volumeSlider.Writer = (x, result) => result.AppendInt32((int)(x.Volume * 100.0)).Append(" %");
            volumeSlider.EnableActions();
            MyTerminalControlFactory.AddControl(volumeSlider);

            var rangeSlider = new MyTerminalControlSlider<MySoundBlock>("RangeSlider", MySpaceTexts.BlockPropertyTitle_SoundBlockRange, MySpaceTexts.BlockPropertyDescription_SoundBlockRange);
            rangeSlider.SetLimits(0, 500);
            rangeSlider.DefaultValue = 50;
            rangeSlider.Getter = (x) => x.Range;
            rangeSlider.Setter = (x, v) => x.SyncObject.SendChangeSoundRangeRequest(v);
            rangeSlider.Writer = (x, result) => result.AppendInt32((int)x.Range).Append(" m");
            rangeSlider.EnableActions();
            MyTerminalControlFactory.AddControl(rangeSlider);
            
            var playButton = new MyTerminalControlButton<MySoundBlock>("PlaySound", MySpaceTexts.BlockPropertyTitle_SoundBlockPlay, MySpaceTexts.Blank, (x) => x.SyncObject.SendPlaySoundRequest());
            playButton.Enabled = (x) => x.IsSoundSelected;
            playButton.EnableAction();
            MyTerminalControlFactory.AddControl(playButton);

            var stopButton = new MyTerminalControlButton<MySoundBlock>("StopSound", MySpaceTexts.BlockPropertyTitle_SoundBlockStop, MySpaceTexts.Blank, (x) => x.SyncObject.SendStopSoundRequest());
            stopButton.Enabled = (x) => x.IsSoundSelected;
            stopButton.EnableAction();
            MyTerminalControlFactory.AddControl(stopButton);

            var loopableTimeSlider = new MyTerminalControlSlider<MySoundBlock>("LoopableSlider", MySpaceTexts.BlockPropertyTitle_SoundBlockLoopTime, MySpaceTexts.Blank);
            loopableTimeSlider.DefaultValue = 1f;
            loopableTimeSlider.Getter = (x) => x.LoopPeriod;
            loopableTimeSlider.Setter = (x, f) => x.SyncObject.SendChangeLoopPeriodRequest(f);
            loopableTimeSlider.Writer = (x, result) => MyValueFormatter.AppendTimeInBestUnit(x.LoopPeriod, result);
            loopableTimeSlider.Enabled = (x) => x.IsLoopable;
            loopableTimeSlider.Normalizer = (x, f) => x.NormalizeLoopPeriod(f);
            loopableTimeSlider.Denormalizer = (x, f) => x.DenormalizeLoopPeriod(f);
            loopableTimeSlider.EnableActions();
            MyTerminalControlFactory.AddControl(loopableTimeSlider);

            var soundsList = new MyTerminalControlListbox<MySoundBlock>("SoundsList", MySpaceTexts.BlockPropertyTitle_SoundBlockSoundList, MySpaceTexts.Blank);
            soundsList.ListContent = (x, list1, list2) => x.FillListContent(list1, list2);
            soundsList.ItemSelected = (x, y) => x.SelectSound(y, true);
            MyTerminalControlFactory.AddControl(soundsList);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:46,代码来源:MySoundBlock.cs


注:本文中的MyTerminalControlSlider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。