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


C# MyTerminalControlCheckbox类代码示例

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


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

示例1: CreateTerminalControls

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

            var silent = new MyTerminalControlCheckbox<MyTimerBlock>("Silent", MySpaceTexts.BlockPropertyTitle_Silent, MySpaceTexts.ToolTipTimerBlock_Silent);
            silent.Getter = (x) => x.Silent;
            silent.Setter = (x, v) => x.Silent = v;
            silent.EnableAction();
            MyTerminalControlFactory.AddControl(silent);

            var slider = new MyTerminalControlSlider<MyTimerBlock>("TriggerDelay", MySpaceTexts.TerminalControlPanel_TimerDelay, MySpaceTexts.TerminalControlPanel_TimerDelay);
            slider.SetLogLimits(1, 60 * 60);
            slider.DefaultValue = 10;
            slider.Enabled = (x) => !x.IsCountingDown;
            slider.Getter = (x) => x.TriggerDelay;
            slider.Setter = (x, v) => x.m_timerSync.Value = ((int)(Math.Round(v, 1) * 1000));
            slider.Writer = (x, sb) => MyValueFormatter.AppendTimeExact(Math.Max(x.m_countdownMsStart, 1000) / 1000, sb);
            slider.EnableActions();
            MyTerminalControlFactory.AddControl(slider);

            var toolbarButton = new MyTerminalControlButton<MyTimerBlock>("OpenToolbar", MySpaceTexts.BlockPropertyTitle_TimerToolbarOpen, MySpaceTexts.BlockPropertyTitle_TimerToolbarOpen,
            delegate(MyTimerBlock self)
            {
                m_openedToolbars.Add(self.Toolbar);
                if (MyGuiScreenCubeBuilder.Static == null)
                {
                    m_shouldSetOtherToolbars = true;
                    MyToolbarComponent.CurrentToolbar = self.Toolbar;
                    MyGuiScreenBase screen = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
                    MyToolbarComponent.AutoUpdate = false;
                    screen.Closed += (source) =>
                    {
                        MyToolbarComponent.AutoUpdate = true;
                        m_openedToolbars.Clear();
                    };
                    MyGuiSandbox.AddScreen(screen);
                }
            });

            MyTerminalControlFactory.AddControl(toolbarButton);

            var triggerButton = new MyTerminalControlButton<MyTimerBlock>("TriggerNow", MySpaceTexts.BlockPropertyTitle_TimerTrigger, MySpaceTexts.BlockPropertyTitle_TimerTrigger, (x) => x.OnTrigger());
            triggerButton.EnableAction();
            MyTerminalControlFactory.AddControl(triggerButton);

            var startButton = new MyTerminalControlButton<MyTimerBlock>("Start", MySpaceTexts.BlockPropertyTitle_TimerStart, MySpaceTexts.BlockPropertyTitle_TimerStart, (x) => x.StartBtn());
            startButton.EnableAction();
            MyTerminalControlFactory.AddControl(startButton);

            var stopButton = new MyTerminalControlButton<MyTimerBlock>("Stop", MySpaceTexts.BlockPropertyTitle_TimerStop, MySpaceTexts.BlockPropertyTitle_TimerStop, (x) => x.StopBtn());
            stopButton.EnableAction();
            MyTerminalControlFactory.AddControl(stopButton);
        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:54,代码来源:MyTimerBlock.cs

示例2: MyShipWelder

 static MyShipWelder()
 {
     if (MyFakes.ENABLE_WELDER_HELP_OTHERS)
     {
         var helpOthersCheck = new MyTerminalControlCheckbox<MyShipWelder>("helpOthers", MySpaceTexts.ShipWelder_HelpOthers, MySpaceTexts.ShipWelder_HelpOthers);
         helpOthersCheck.Getter = (x) => x.HelpOthers;
         helpOthersCheck.Setter = (x, v) => x.SyncObject.ChangeHelpOthersMode(v);
         helpOthersCheck.EnableAction();
         MyTerminalControlFactory.AddControl(helpOthersCheck);
     }
 }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:11,代码来源:MyShipWelder.cs

示例3: MyShipWelder

 static MyShipWelder()
 {
     if (MyFakes.ENABLE_WELDER_HELP_OTHERS)
     {
         var helpOthersCheck = new MyTerminalControlCheckbox<MyShipWelder>("helpOthers", MyCommonTexts.ShipWelder_HelpOthers, MyCommonTexts.ShipWelder_HelpOthers);
         helpOthersCheck.Getter = (x) => x.HelpOthers;
         helpOthersCheck.Setter = (x, v) => x.m_helpOthers.Value = v;
         helpOthersCheck.EnableAction();
         MyTerminalControlFactory.AddControl(helpOthersCheck);
     }
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:11,代码来源:MyShipWelder.cs

示例4: MyShipWelder

 static MyShipWelder()
 {
     if (MyFakes.ENABLE_WELDER_HELP_OTHERS)
     {
         var helpOthersCheck = new MyTerminalControlCheckbox<MyShipWelder>("helpOthers", MySpaceTexts.ShipWelder_HelpOthers, MySpaceTexts.ShipWelder_HelpOthers);
         helpOthersCheck.Getter = (x) => x.m_helpOthers;
         helpOthersCheck.Setter = (x, v) =>
         {
             x.m_helpOthers = v;
         };
         MyTerminalControlFactory.AddControl(helpOthersCheck);
     }
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:13,代码来源:MyShipWelder.cs

示例5: 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; x.SyncObject.SendChangeGyroPowerRequest(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.SetGyroOverride(v); x.SyncObject.SendGyroOverrideRequest(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.Y;
                gyroOverrideSliderY.Setter = (x, v) => { SetGyroTorqueYaw(x, -v); x.SyncObject.SendGyroTorqueRequest(x.m_gyroOverrideVelocity); };
                gyroOverrideSliderY.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.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.X;
                gyroOverrideSliderX.Setter = (x, v) => { SetGyroTorquePitch(x, v); x.SyncObject.SendGyroTorqueRequest(x.m_gyroOverrideVelocity); };
                gyroOverrideSliderX.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.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.Z;
                gyroOverrideSliderZ.Setter = (x, v) => { SetGyroTorqueRoll(x, -v); x.SyncObject.SendGyroTorqueRequest(x.m_gyroOverrideVelocity); };
                gyroOverrideSliderZ.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.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:leandro1129,项目名称:SpaceEngineers,代码行数:51,代码来源:MyGyro.cs

示例6: CreateTerminalControls

 protected override void CreateTerminalControls()
 {
     if (MyTerminalControlFactory.AreControlsCreated<MyShipWelder>())
         return;
     base.CreateTerminalControls();
     if (MyFakes.ENABLE_WELDER_HELP_OTHERS)
     {
         var helpOthersCheck = new MyTerminalControlCheckbox<MyShipWelder>("helpOthers", MyCommonTexts.ShipWelder_HelpOthers, MyCommonTexts.ShipWelder_HelpOthers);
         helpOthersCheck.Getter = (x) => x.HelpOthers;
         helpOthersCheck.Setter = (x, v) => x.m_helpOthers.Value = v;
         helpOthersCheck.EnableAction();
         MyTerminalControlFactory.AddControl(helpOthersCheck);
     }
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyShipWelder.cs

示例7: MyBatteryBlock

        static MyBatteryBlock()
        {
            var recharge = new MyTerminalControlCheckbox<MyBatteryBlock>("Recharge", MySpaceTexts.BlockPropertyTitle_Recharge, MySpaceTexts.ToolTipBatteryBlock);
            recharge.Getter = (x) => !x.ProducerEnabled;
            recharge.Setter = (x, v) => x.SyncObject.SendProducerEnableChange(!v);
            recharge.Enabled = (x) => !x.SemiautoEnabled;
            recharge.EnableAction();

            var semiAuto = new MyTerminalControlCheckbox<MyBatteryBlock>("SemiAuto", MySpaceTexts.BlockPropertyTitle_Semiauto, MySpaceTexts.ToolTipBatteryBlock_Semiauto);
            semiAuto.Getter = (x) => x.SemiautoEnabled;
            semiAuto.Setter = (x, v) => x.SyncObject.SendSemiautoEnableChange(v);

            MyTerminalControlFactory.AddControl(recharge);
            MyTerminalControlFactory.AddControl(semiAuto);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:15,代码来源:MyBatteryBlock.cs

示例8: Solar

        static Solar()
        {
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MySolarPanel>());
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyOxygenFarm>());

            s_termControl_faceSun = new MyTerminalControlCheckbox<MyTerminalBlock>("FaceSun", MyStringId.GetOrCompute("Face Sun"), MyStringId.GetOrCompute("Face this block towards the sun"));
            IMyTerminalValueControl<bool> valueControl = s_termControl_faceSun as IMyTerminalValueControl<bool>;
            valueControl.Getter = GetFaceSun;
            valueControl.Setter = SetFaceSun;

            MyTerminalControlFactory.AddControl<MyTerminalBlock, MySolarPanel>(s_termControl_faceSun);
            MyTerminalControlFactory.AddControl<MyTerminalBlock, MyOxygenFarm>(s_termControl_faceSun);

            MyAPIGateway.Entities.OnCloseAll += Entities_OnCloseAll;
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:15,代码来源:Solar.cs

示例9: MyOxygenGenerator

        static MyOxygenGenerator()
        {
            var useConveyorSystem = new MyTerminalControlOnOffSwitch<MyOxygenGenerator>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
            useConveyorSystem.Getter = (x) => (x as IMyInventoryOwner).UseConveyorSystem;
            useConveyorSystem.Setter = (x, v) => MySyncConveyors.SendChangeUseConveyorSystemRequest(x.EntityId, v);
            useConveyorSystem.EnableToggleAction();
            MyTerminalControlFactory.AddControl(useConveyorSystem);

            var refillButton = new MyTerminalControlButton<MyOxygenGenerator>("Refill", MySpaceTexts.BlockPropertyTitle_Refill, MySpaceTexts.BlockPropertyTitle_Refill, OnRefillButtonPressed);
            refillButton.Enabled = (x) => x.CanRefill();
            refillButton.EnableAction();
            MyTerminalControlFactory.AddControl(refillButton);

            var autoRefill = new MyTerminalControlCheckbox<MyOxygenGenerator>("Auto-Refill", MySpaceTexts.BlockPropertyTitle_AutoRefill, MySpaceTexts.BlockPropertyTitle_AutoRefill);
            autoRefill.Getter = (x) => x.m_autoRefill;
            autoRefill.Setter = (x, v) => x.m_autoRefill = v;
            autoRefill.EnableAction();
            MyTerminalControlFactory.AddControl(autoRefill);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:19,代码来源:MyOxygenGenerator.cs

示例10: CreateTerminalControls

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

            var checkAccess = new MyTerminalControlCheckbox<MyButtonPanel>("AnyoneCanUse", MySpaceTexts.BlockPropertyText_AnyoneCanUse, MySpaceTexts.BlockPropertyDescription_AnyoneCanUse);
            checkAccess.Getter = (x) => x.AnyoneCanUse;
            checkAccess.Setter = (x, v) => x.AnyoneCanUse = v;
            checkAccess.EnableAction();
            MyTerminalControlFactory.AddControl(checkAccess);

            var toolbarButton = new MyTerminalControlButton<MyButtonPanel>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_SensorToolbarOpen, MySpaceTexts.BlockPropertyDescription_SensorToolbarOpen,
                delegate(MyButtonPanel self)
                {
                    m_openedToolbars.Add(self.Toolbar);
                    if (MyGuiScreenCubeBuilder.Static == null)
                    {
                        m_shouldSetOtherToolbars = true;
                        MyToolbarComponent.CurrentToolbar = self.Toolbar;
                        MyGuiScreenBase screen = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
                        MyToolbarComponent.AutoUpdate = false;
                        screen.Closed += (source) =>
                        {
                            MyToolbarComponent.AutoUpdate = true;
                            m_openedToolbars.Clear();
                        };
                        MyGuiSandbox.AddScreen(screen);
                    }
                });
            MyTerminalControlFactory.AddControl(toolbarButton);

            var buttonsList = new MyTerminalControlListbox<MyButtonPanel>("ButtonText", MySpaceTexts.BlockPropertyText_ButtonList, MySpaceTexts.Blank);
            buttonsList.ListContent = (x, list1, list2) => x.FillListContent(list1, list2);
            buttonsList.ItemSelected = (x, y) => x.SelectButtonToName(y);
            MyTerminalControlFactory.AddControl(buttonsList);

            var customButtonName = new MyTerminalControlTextbox<MyButtonPanel>("ButtonName", MySpaceTexts.BlockPropertyText_ButtonName, MySpaceTexts.Blank);
            customButtonName.Getter = (x) => x.GetButtonName();
            customButtonName.Setter = (x, v) => x.SetCustomButtonName(v);
            customButtonName.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(customButtonName);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:42,代码来源:MyButtonPanel.cs

示例11: 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

示例12: CreateTerminalControls

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

            var recharge = new MyTerminalControlCheckbox<MyBatteryBlock>("Recharge", MySpaceTexts.BlockPropertyTitle_Recharge, MySpaceTexts.ToolTipBatteryBlock);
            recharge.Getter = (x) => x.OnlyRecharge;
            recharge.Setter = (x, v) => x.OnlyRecharge = v;
            recharge.Enabled = (x) => !x.SemiautoEnabled && !x.OnlyDischarge;
            recharge.EnableAction();

            var discharge = new MyTerminalControlCheckbox<MyBatteryBlock>("Discharge", MySpaceTexts.BlockPropertyTitle_Discharge, MySpaceTexts.ToolTipBatteryBlock_Discharge);
            discharge.Getter = (x) => x.OnlyDischarge;
            discharge.Setter = (x, v) => x.OnlyDischarge = v;
            discharge.Enabled = (x) => !x.SemiautoEnabled && !x.OnlyRecharge;
            discharge.EnableAction();

            var semiAuto = new MyTerminalControlCheckbox<MyBatteryBlock>("SemiAuto", MySpaceTexts.BlockPropertyTitle_Semiauto, MySpaceTexts.ToolTipBatteryBlock_Semiauto);
            semiAuto.Getter = (x) => x.SemiautoEnabled;
            semiAuto.Setter = (x, v) => x.SemiautoEnabled = v;
            semiAuto.EnableAction();

            MyTerminalControlFactory.AddControl(recharge);
            MyTerminalControlFactory.AddControl(discharge);
            MyTerminalControlFactory.AddControl(semiAuto);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:26,代码来源:MyBatteryBlock.cs

示例13: MyMedicalRoom

        static MyMedicalRoom()
        {
            //terminal:
            var label = new MyTerminalControlLabel<MyMedicalRoom>("ScenarioControls", MySpaceTexts.TerminalScenarioSettingsLabel);
            var ownershipCheckbox = new MyTerminalControlCheckbox<MyMedicalRoom>("TakeOwnership", MySpaceTexts.MedicalRoom_ownershipAssignmentLabel, MySpaceTexts.MedicalRoom_ownershipAssignmentTooltip);
            ownershipCheckbox.Getter = (x) => x.m_takeSpawneeOwnership;
            ownershipCheckbox.Setter = (x, val) =>
            {
                x.m_takeSpawneeOwnership = val;
            };
            ownershipCheckbox.Enabled = (x) => MySession.Static.Settings.ScenarioEditMode;
            MyTerminalControlFactory.AddControl(label);
            MyTerminalControlFactory.AddControl(ownershipCheckbox);

            var factionCheckbox = new MyTerminalControlCheckbox<MyMedicalRoom>("SetFaction", MySpaceTexts.MedicalRoom_factionAssignmentLabel, MySpaceTexts.MedicalRoom_factionAssignmentTooltip);
            factionCheckbox.Getter = (x) => x.m_setFactionToSpawnee;
            factionCheckbox.Setter = (x, val) =>
            {
                x.m_setFactionToSpawnee = val;
            };
            factionCheckbox.Enabled = (x) => MySession.Static.Settings.ScenarioEditMode;
            MyTerminalControlFactory.AddControl(factionCheckbox);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:23,代码来源:MyMedicalRoom.cs

示例14: 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

示例15: MyProjector

        static MyProjector()
        {
            if (!MyFakes.ENABLE_PROJECTOR_BLOCK)
            {
                return;
            }

            var blueprintBtn = new MyTerminalControlButton<MyProjector>("Blueprint", MySpaceTexts.Blueprints, MySpaceTexts.Blank, (p) => p.SelectBlueprint());
            blueprintBtn.Enabled = (b) => b.CanProject();
            blueprintBtn.SupportsMultipleBlocks = false;

            MyTerminalControlFactory.AddControl(blueprintBtn);

            var removeBtn = new MyTerminalControlButton<MyProjector>("Remove", MySpaceTexts.RemoveProjectionButton, MySpaceTexts.Blank, (p) => p.SyncObject.SendRemoveProjection());
            removeBtn.Enabled = (b) => b.IsProjecting();
            MyTerminalControlFactory.AddControl(removeBtn);

            var keepProjectionToggle = new MyTerminalControlCheckbox<MyProjector>("KeepProjection", MySpaceTexts.KeepProjectionToggle, MySpaceTexts.KeepProjectionTooltip);
            keepProjectionToggle.Getter = (x) => x.m_keepProjection;
            keepProjectionToggle.Setter = (x, v) =>
                {
                    x.SyncObject.SendNewKeepProjection(v);
                };
            keepProjectionToggle.EnableAction();
            keepProjectionToggle.Enabled = (b) => b.IsProjecting();
            MyTerminalControlFactory.AddControl(keepProjectionToggle);

            //ShowOnlyBuildable
            var showOnlyBuildableBlockToggle = new MyTerminalControlCheckbox<MyProjector>("ShowOnlyBuildable", MySpaceTexts.ShowOnlyBuildableBlockToggle, MySpaceTexts.ShowOnlyBuildableTooltip);
            showOnlyBuildableBlockToggle.Getter = (x) => x.m_showOnlyBuildable;
            showOnlyBuildableBlockToggle.Setter = (x, v) =>
            {
                x.m_showOnlyBuildable = v;
                x.OnOffsetsChanged();
            };
            showOnlyBuildableBlockToggle.Enabled = (b) => b.IsProjecting();
            MyTerminalControlFactory.AddControl(showOnlyBuildableBlockToggle);

            //HideArmorBlocks
            var hideArmorBlockToggle = new MyTerminalControlCheckbox<MyProjector>("HideArmorBlocks", MySpaceTexts.HideArmorBlockToggle, MySpaceTexts.HideArmorBlockTooltip);
            hideArmorBlockToggle.Getter = (x) => x.m_hideArmorBlock;
            hideArmorBlockToggle.Setter = (x, v) =>
            {
                x.m_hideArmorBlock = v;
                x.OnOffsetsChanged();
            };
            hideArmorBlockToggle.Enabled = (b) => b.IsProjecting();
            MyTerminalControlFactory.AddControl(hideArmorBlockToggle);

            //Position
            var offsetX = new MyTerminalControlSlider<MyProjector>("X", MySpaceTexts.BlockPropertyTitle_ProjectionOffsetX, MySpaceTexts.Blank);
            offsetX.SetLimits(-50, 50);
            offsetX.DefaultValue = 0;
            offsetX.Getter = (x) => x.m_projectionOffset.X;
            offsetX.Setter = (x, v) =>
            {
                x.m_projectionOffset.X = Convert.ToInt32(v);
                x.OnOffsetsChanged();
            };
            offsetX.Writer = (x, result) => result.AppendInt32((int)(x.m_projectionOffset.X));
            offsetX.EnableActions(step: 0.01f);
            offsetX.Enabled = (x) => x.IsProjecting();
            MyTerminalControlFactory.AddControl(offsetX);

            var offsetY = new MyTerminalControlSlider<MyProjector>("Y", MySpaceTexts.BlockPropertyTitle_ProjectionOffsetY, MySpaceTexts.Blank);
            offsetY.SetLimits(-50, 50);
            offsetY.DefaultValue = 0;
            offsetY.Getter = (x) => x.m_projectionOffset.Y;
            offsetY.Setter = (x, v) =>
            {
                x.m_projectionOffset.Y = Convert.ToInt32(v);
                x.OnOffsetsChanged();
            };
            offsetY.Writer = (x, result) => result.AppendInt32((int)(x.m_projectionOffset.Y));
            offsetY.EnableActions(step: 0.01f);
            offsetY.Enabled = (x) => x.IsProjecting();
            MyTerminalControlFactory.AddControl(offsetY);

            var offsetZ = new MyTerminalControlSlider<MyProjector>("Z", MySpaceTexts.BlockPropertyTitle_ProjectionOffsetZ, MySpaceTexts.Blank);
            offsetZ.SetLimits(-50, 50);
            offsetZ.DefaultValue = 0;
            offsetZ.Getter = (x) => x.m_projectionOffset.Z;
            offsetZ.Setter = (x, v) =>
            {
                x.m_projectionOffset.Z = Convert.ToInt32(v);
                x.OnOffsetsChanged();
            };
            offsetZ.Writer = (x, result) => result.AppendInt32((int)(x.m_projectionOffset.Z));
            offsetZ.EnableActions(step: 0.01f);
            offsetZ.Enabled = (x) => x.IsProjecting();
            MyTerminalControlFactory.AddControl(offsetZ);

            //Rotation

            var rotationX = new MyTerminalControlSlider<MyProjector>("RotX", MySpaceTexts.BlockPropertyTitle_ProjectionRotationX, MySpaceTexts.Blank);
            rotationX.SetLimits(-2, 2);
            rotationX.DefaultValue = 0;
            rotationX.Getter = (x) => x.m_projectionRotation.X;
            rotationX.Setter = (x, v) =>
            {
//.........这里部分代码省略.........
开发者ID:blaho,项目名称:SpaceEngineers,代码行数:101,代码来源:MyProjector.cs


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