• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyTerminalControlCheckbox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: MySpaceBall

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

            var mass = new MyTerminalControlSlider<MySpaceBall>("VirtualMass", MySpaceTexts.BlockPropertyDescription_SpaceBallVirtualMass, MySpaceTexts.BlockPropertyDescription_SpaceBallVirtualMass);
            mass.Getter = (x) => x.VirtualMass;
            mass.Setter = (x, v) => x.VirtualMass = v;
            mass.DefaultValueGetter = (x) => DEFAULT_MASS;
            mass.SetLimits(x => 0, x => x.BlockDefinition.MaxVirtualMass);
            mass.Writer = (x, result) => MyValueFormatter.AppendWeightInBestUnit(x.VirtualMass, result);
            mass.EnableActions();
            MyTerminalControlFactory.AddControl(mass);

            if (MyPerGameSettings.BallFriendlyPhysics)
            {
                var friction = new MyTerminalControlSlider<MySpaceBall>("Friction", MySpaceTexts.BlockPropertyDescription_SpaceBallFriction, MySpaceTexts.BlockPropertyDescription_SpaceBallFriction);
                friction.Getter = (x) => x.Friction;
                friction.Setter = (x, v) => x.Friction  = v;
                friction.DefaultValueGetter = (x) => DEFAULT_FRICTION;
                friction.SetLimits(0, 1.0f);
                friction.Writer = (x, result) => result.AppendInt32((int)(x.Friction * 100)).Append("%");
                friction.EnableActions();
                MyTerminalControlFactory.AddControl(friction);

                var restitution = new MyTerminalControlSlider<MySpaceBall>("Restitution", MySpaceTexts.BlockPropertyDescription_SpaceBallRestitution, MySpaceTexts.BlockPropertyDescription_SpaceBallRestitution);
                restitution.Getter = (x) => x.Restitution;
                restitution.Setter = (x, v) => x.Restitution = v;
                restitution.DefaultValueGetter = (x) => DEFAULT_RESTITUTION;
                restitution.SetLimits(0, 1.0f);
                restitution.Writer = (x, result) => result.AppendInt32((int)(x.Restitution * 100)).Append("%");
                restitution.EnableActions();
                MyTerminalControlFactory.AddControl(restitution);  
            }

            var enableBroadcast = new MyTerminalControlCheckbox<MySpaceBall>("EnableBroadCast", MySpaceTexts.Antenna_EnableBroadcast, MySpaceTexts.Antenna_EnableBroadcast);
            enableBroadcast.Getter = (x) => x.RadioBroadcaster.Enabled;
            enableBroadcast.Setter = (x, v) => x.m_broadcastSync.Value = v;
            enableBroadcast.EnableAction();
            MyTerminalControlFactory.AddControl(enableBroadcast);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:40,代码来源:MySpaceBall.cs


示例17: MyMotorStator

        static MyMotorStator()
        {
            var reverse = new MyTerminalControlButton<MyMotorStator>("Reverse", MySpaceTexts.BlockActionTitle_Reverse, MySpaceTexts.Blank, (b) => b.TargetVelocityRPM = -b.TargetVelocityRPM);
            reverse.EnableAction(MyTerminalActionIcons.REVERSE);
            MyTerminalControlFactory.AddControl(reverse);

            var detach = new MyTerminalControlButton<MyMotorStator>("Detach", MySpaceTexts.BlockActionTitle_Detach, MySpaceTexts.Blank, (b) => b.m_rotorBlockId.Value = new State() { OtherEntityId = null, MasterToSlave = null});
            detach.Enabled = (b) => b.m_rotorBlockId.Value.OtherEntityId.HasValue;
            detach.Visible = (b) => b.m_canBeDetached;
            var actionDetach = detach.EnableAction(MyTerminalActionIcons.NONE);
            actionDetach.Enabled = (b) => b.m_canBeDetached;
            MyTerminalControlFactory.AddControl(detach);

            var attach = new MyTerminalControlButton<MyMotorStator>("Attach", MySpaceTexts.BlockActionTitle_Attach, MySpaceTexts.Blank, (b) => b.m_rotorBlockId.Value = new State() { OtherEntityId = 0, MasterToSlave = null});
            attach.Enabled = (b) => !b.m_rotorBlockId.Value.OtherEntityId.HasValue;
            attach.Visible = (b) => b.m_canBeDetached;
            var actionAttach = attach.EnableAction(MyTerminalActionIcons.NONE);
            actionAttach.Enabled = (b) => b.m_canBeDetached;
            MyTerminalControlFactory.AddControl(attach);

            var torque = new MyTerminalControlSlider<MyMotorStator>("Torque", MySpaceTexts.BlockPropertyTitle_MotorTorque, MySpaceTexts.BlockPropertyDescription_MotorTorque);
            torque.Getter = (x) => x.Torque;
            torque.Setter = (x, v) => x.Torque.Value = v;
            torque.DefaultValueGetter = (x) => x.MotorDefinition.MaxForceMagnitude;
            torque.Writer = (x, result) => MyValueFormatter.AppendTorqueInBestUnit(x.Torque, result);
            torque.EnableActions();
            torque.Denormalizer = (x, v) => x.DenormalizeTorque(v);
            torque.Normalizer = (x, v) => x.NormalizeTorque(v);
            MyTerminalControlFactory.AddControl(torque);

            var brakingTorque = new MyTerminalControlSlider<MyMotorStator>("BrakingTorque", MySpaceTexts.BlockPropertyTitle_MotorBrakingTorque, MySpaceTexts.BlockPropertyDescription_MotorBrakingTorque);
            brakingTorque.Getter = (x) => x.BrakingTorque;
            brakingTorque.Setter = (x, v) => x.BrakingTorque.Value = v;
            brakingTorque.DefaultValue = 0;
            brakingTorque.Writer = (x, result) => MyValueFormatter.AppendTorqueInBestUnit(x.BrakingTorque, result);
            brakingTorque.EnableActions();
            brakingTorque.Denormalizer = (x, v) => x.DenormalizeTorque(v);
            brakingTorque.Normalizer = (x, v) => x.NormalizeTorque(v);
            MyTerminalControlFactory.AddControl(brakingTorque);

            var targetVelocity = new MyTerminalControlSlider<MyMotorStator>("Velocity", MySpaceTexts.BlockPropertyTitle_MotorTargetVelocity, MySpaceTexts.BlockPropertyDescription_MotorVelocity);
            targetVelocity.Getter = (x) => x.TargetVelocityRPM;
            targetVelocity.Setter = (x, v) => x.TargetVelocityRPM = v;
            targetVelocity.DefaultValue = 0;
            targetVelocity.Writer = (x, result) => result.Concat(x.TargetVelocityRPM, 2).Append(" rpm");
            targetVelocity.EnableActionsWithReset();
            targetVelocity.Denormalizer = (x, v) => x.DenormalizeRPM(v);
            targetVelocity.Normalizer = (x, v) => x.NormalizeRPM(v);
            MyTerminalControlFactory.AddControl(targetVelocity);

            var lowerLimit = new MyTerminalControlSlider<MyMotorStator>("LowerLimit", MySpaceTexts.BlockPropertyTitle_MotorMinAngle, MySpaceTexts.BlockPropertyDescription_MotorLowerLimit);
            lowerLimit.Getter = (x) => x.MinAngle;
            lowerLimit.Setter = (x, v) => x.MinAngle = v;
            lowerLimit.DefaultValue = -361;
            lowerLimit.SetLimits(-361, 360);
            lowerLimit.Writer = (x, result) => WriteAngle(x.m_minAngle, result);
            lowerLimit.EnableActions();
            MyTerminalControlFactory.AddControl(lowerLimit);

            var upperLimit = new MyTerminalControlSlider<MyMotorStator>("UpperLimit", MySpaceTexts.BlockPropertyTitle_MotorMaxAngle, MySpaceTexts.BlockPropertyDescription_MotorUpperLimit);
            upperLimit.Getter = (x) => x.MaxAngle;
            upperLimit.Setter = (x, v) => x.MaxAngle = v;
            upperLimit.DefaultValue = 361;
            upperLimit.SetLimits(-360, 361);
            upperLimit.Writer = (x, result) => WriteAngle(x.m_maxAngle, result);
            upperLimit.EnableActions();
            MyTerminalControlFactory.AddControl(upperLimit);

            var rotorDisplacement = new MyTerminalControlSlider<MyMotorStator>("Displacement", MySpaceTexts.BlockPropertyTitle_MotorRotorDisplacement, MySpaceTexts.BlockPropertyDescription_MotorRotorDisplacement);
            rotorDisplacement.Getter = (x) => x.DummyDisplacement;
            rotorDisplacement.Setter = (x, v) => x.DummyDisplacement = v;
            rotorDisplacement.DefaultValueGetter = (x) => 0.0f;
            rotorDisplacement.SetLimits((x) => x.MotorDefinition.RotorDisplacementMin, (x) => x.MotorDefinition.RotorDisplacementMax);
            rotorDisplacement.Writer = (x, result) => MyValueFormatter.AppendDistanceInBestUnit(x.DummyDisplacement, result);
            rotorDisplacement.Enabled = (b) => b.m_isAttached;
            rotorDisplacement.EnableActions();
            MyTerminalControlFactory.AddControl(rotorDisplacement);

            var weldSpeed = new MyTerminalControlSlider<MyMotorStator>("Weld speed", MySpaceTexts.BlockPropertyTitle_WeldSpeed, MySpaceTexts.Blank);
            weldSpeed.SetLimits((block) => 0f, (block) => MyGridPhysics.SmallShipMaxLinearVelocity());
            weldSpeed.DefaultValueGetter = (block) => MyGridPhysics.LargeShipMaxLinearVelocity() - 5f;
            weldSpeed.Getter = (x) => (float)Math.Sqrt(x.m_weldSpeedSq);
            weldSpeed.Setter = (x, v) => x.m_weldSpeedSq.Value = v * v;
            weldSpeed.Writer = (x, res) => res.AppendDecimal((float)Math.Sqrt(x.m_weldSpeedSq), 1).Append("m/s");
            weldSpeed.EnableActions();
            MyTerminalControlFactory.AddControl(weldSpeed);

            var weldForce = new MyTerminalControlCheckbox<MyMotorStator>("Force weld", MySpaceTexts.BlockPropertyTitle_WeldForce, MySpaceTexts.Blank);
            weldForce.Getter = (x) => x.m_forceWeld;
            weldForce.Setter = (x, v) => x.m_forceWeld.Value = v;
            weldForce.EnableAction();
            MyTerminalControlFactory.AddControl(weldForce);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:93,代码来源:MyMotorStator.cs


示例18: MyShipController

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyTerminalControlOnOffSwitch类代码示例发布时间:2022-05-24
下一篇:
C# MyTerminalControlButton类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap