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

C# MyTerminalControlOnOffSwitch类代码示例

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

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



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

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


示例2: MyReactor

 static MyReactor()
 {
     var useConveyorSystem = new MyTerminalControlOnOffSwitch<MyReactor>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
     useConveyorSystem.Getter = (x) => (x).UseConveyorSystem;
     useConveyorSystem.Setter = (x, v) => (x).UseConveyorSystem = v;
     useConveyorSystem.EnableToggleAction();
     MyTerminalControlFactory.AddControl(useConveyorSystem);
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:8,代码来源:MyReactor.cs


示例3: MyCollector

 static MyCollector()
 {
     var useConvSystem = new MyTerminalControlOnOffSwitch<MyCollector>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
     useConvSystem.Getter = (x) => (x as IMyInventoryOwner).UseConveyorSystem;
     useConvSystem.Setter = (x, v) => MySyncConveyors.SendChangeUseConveyorSystemRequest(x.EntityId, v);
     useConvSystem.EnableToggleAction();
     MyTerminalControlFactory.AddControl(useConvSystem);
 }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:8,代码来源:MyCollector.cs


示例4: MySmallMissileLauncher

 static MySmallMissileLauncher()
 {
     var useConveyor = new MyTerminalControlOnOffSwitch<MySmallMissileLauncher>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
     useConveyor.Getter = (x) => x.m_useConveyorSystem;
     useConveyor.Setter = (x, v) => MySyncConveyors.SendChangeUseConveyorSystemRequest(x.EntityId, v);
     useConveyor.Visible = (x) => x.CubeGrid.GridSizeEnum == MyCubeSize.Large; // Only large missile launchers can use conveyor system
     useConveyor.EnableToggleAction();
     MyTerminalControlFactory.AddControl(useConveyor);
 }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:9,代码来源:MySmallMissileLauncher.cs


示例5: MySmallMissileLauncherReload

 static MySmallMissileLauncherReload()
 {
     var useConveyor = new MyTerminalControlOnOffSwitch<MySmallMissileLauncher>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
     useConveyor.Getter = (x) => x.UseConveyorSystem;
     useConveyor.Setter = (x, v) => MySyncConveyors.SendChangeUseConveyorSystemRequest(x.EntityId, v);
     useConveyor.Visible = (x) => (true);
     useConveyor.EnableToggleAction();
     MyTerminalControlFactory.AddControl(useConveyor);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MySmallMissileLauncherReload.cs


示例6: MyAirtightDoorGeneric

 static MyAirtightDoorGeneric()
 {
     var open = new MyTerminalControlOnOffSwitch<MyAirtightDoorGeneric>("Open", MySpaceTexts.Blank, on: MySpaceTexts.BlockAction_DoorOpen, off: MySpaceTexts.BlockAction_DoorClosed);
     open.Getter = (x) => x.Open;
     open.Setter = (x, v) => x.ChangeOpenClose(v);
     open.EnableToggleAction();
     open.EnableOnOffActions();
     MyTerminalControlFactory.AddControl(open);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyAirtightDoorGeneric.cs


示例7: MyJumpDrive

        static MyJumpDrive()
        {
            var jumpButton = new MyTerminalControlButton<MyJumpDrive>("Jump", MySpaceTexts.BlockActionTitle_Jump, MySpaceTexts.Blank, (x) => x.RequestJump());
            jumpButton.Enabled = (x) => x.CanJump;
            jumpButton.SupportsMultipleBlocks = false;
            // Can only be called from toolbar of cockpit
            jumpButton.Visible = (x) => false;
            var action = jumpButton.EnableAction(MyTerminalActionIcons.TOGGLE);
            if (action != null)
            {
                action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel, MyToolbarType.Character, MyToolbarType.Seat };
                action.ValidForGroups = false;
            }
            MyTerminalControlFactory.AddControl(jumpButton);

            var recharging = new MyTerminalControlOnOffSwitch<MyJumpDrive>("Recharge", MySpaceTexts.BlockPropertyTitle_Recharge, MySpaceTexts.Blank);
            recharging.Getter = (x) => x.m_isRecharging;
            recharging.Setter = (x, v) => x.SetRecharging(v);
            recharging.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(recharging);

            var maxDistanceSlider = new MyTerminalControlSlider<MyJumpDrive>("JumpDistance", MySpaceTexts.BlockPropertyTitle_JumpDistance, MySpaceTexts.Blank);
            maxDistanceSlider.SetLimits(0f, 100f);
            maxDistanceSlider.DefaultValue = 100f;
            maxDistanceSlider.Enabled = (x) => x.CanJump;
            maxDistanceSlider.Getter = (x) => x.m_jumpDistanceRatio;
            maxDistanceSlider.Setter = (x, v) =>
                {
                    x.SetJumpDistanceRatio(v);
                };
            maxDistanceSlider.Writer = (x, v) =>
                {
                    v.AppendFormatedDecimal((x.m_jumpDistanceRatio / 100f).ToString("P0") + " (", (float)x.ComputeMaxDistance() / 1000f, 0, " km").Append(")");
                };
            maxDistanceSlider.EnableActions(0.01f);
            MyTerminalControlFactory.AddControl(maxDistanceSlider);


            var selectedTarget = new MyTerminalControlListbox<MyJumpDrive>("SelectedTarget", MySpaceTexts.BlockPropertyTitle_DestinationGPS, MySpaceTexts.Blank, false, 1);
            selectedTarget.ListContent = (x, list1, list2) => x.FillSelectedTarget(list1, list2);
            MyTerminalControlFactory.AddControl(selectedTarget);

            var removeBtn = new MyTerminalControlButton<MyJumpDrive>("RemoveBtn", MySpaceTexts.RemoveProjectionButton, MySpaceTexts.Blank, (x) => x.RemoveSelected());
            removeBtn.Enabled = (x) => x.CanRemove();
            MyTerminalControlFactory.AddControl(removeBtn);

            var selectBtn = new MyTerminalControlButton<MyJumpDrive>("SelectBtn", MySpaceTexts.SelectBlueprint, MySpaceTexts.Blank, (x) => x.SelectTarget());
            selectBtn.Enabled = (x) => x.CanSelect();
            MyTerminalControlFactory.AddControl(selectBtn);

            var gpsList = new MyTerminalControlListbox<MyJumpDrive>("GpsList", MySpaceTexts.BlockPropertyTitle_GpsLocations, MySpaceTexts.Blank, true);
            gpsList.ListContent = (x, list1, list2) => x.FillGpsList(list1, list2);
            gpsList.ItemSelected = (x, y) => x.SelectGps(y);
            MyTerminalControlFactory.AddControl(gpsList);
        }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:55,代码来源:MyJumpDrive.cs


示例8: MyFunctionalBlock

        static MyFunctionalBlock()
        {
            var onOffSwitch = new MyTerminalControlOnOffSwitch<MyFunctionalBlock>("OnOff", MySpaceTexts.BlockAction_Toggle);
            onOffSwitch.Getter = (x) => x.Enabled;
            onOffSwitch.Setter = (x, v) => x.RequestEnable(v);
            onOffSwitch.EnableToggleAction();
            onOffSwitch.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(0, onOffSwitch);

            MyTerminalControlFactory.AddControl(1, new MyTerminalControlSeparator<MyTerminalBlock>());
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:11,代码来源:MyFunctionalBlock.cs


示例9: CreateTerminalControls

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

            var useConveyorSystem = new MyTerminalControlOnOffSwitch<MyReactor>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
            useConveyorSystem.Getter = (x) => (x).UseConveyorSystem;
            useConveyorSystem.Setter = (x, v) => (x).UseConveyorSystem = v;
            useConveyorSystem.EnableToggleAction();
            MyTerminalControlFactory.AddControl(useConveyorSystem);
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:11,代码来源:MyReactor.cs


示例10: CreateTerminalControls

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

            var useConveyor = new MyTerminalControlOnOffSwitch<MySmallMissileLauncher>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
            useConveyor.Getter = (x) => x.UseConveyorSystem;
            useConveyor.Setter = (x, v) => x.UseConveyorSystem = v;
            useConveyor.Visible = (x) => (true);
            useConveyor.EnableToggleAction();
            MyTerminalControlFactory.AddControl(useConveyor);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:12,代码来源:MySmallMissileLauncherReload.cs


示例11: CreateTerminalControls

 protected override void CreateTerminalControls()
 {
     if (MyTerminalControlFactory.AreControlsCreated<MyDoorBase>())
         return;
     base.CreateTerminalControls();
     var open = new MyTerminalControlOnOffSwitch<MyDoorBase>("Open", MySpaceTexts.Blank, on: MySpaceTexts.BlockAction_DoorOpen, off: MySpaceTexts.BlockAction_DoorClosed);
     open.Getter = (x) => x.Open;
     open.Setter = (x, v) => x.SetOpenRequest(v, x.OwnerId);
     open.EnableToggleAction();
     open.EnableOnOffActions();
     MyTerminalControlFactory.AddControl(open);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:12,代码来源:MyDoorBase.cs


示例12: CreateTerminalControls

 protected override void CreateTerminalControls()
 {
     if (MyTerminalControlFactory.AreControlsCreated<MyLargeConveyorTurretBase>())
         return;
     base.CreateTerminalControls();
     var separator = new MyTerminalControlSeparator<MyLargeConveyorTurretBase>();
     MyTerminalControlFactory.AddControl(separator);
     var useConvSystem = new MyTerminalControlOnOffSwitch<MyLargeConveyorTurretBase>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
     useConvSystem.Getter = (x) => (x).UseConveyorSystem;
     useConvSystem.Setter = (x, v) => x.UseConveyorSystem = v;
     useConvSystem.EnableToggleAction();
     MyTerminalControlFactory.AddControl(useConvSystem);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:13,代码来源:MyLargeConveyorTurretBase.cs


示例13: CreateTerminalControls

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

            var onOffSwitch = new MyTerminalControlOnOffSwitch<MyFunctionalBlock>("OnOff", MySpaceTexts.BlockAction_Toggle);
            onOffSwitch.Getter = (x) => x.Enabled;
            onOffSwitch.Setter = (x, v) => x.Enabled = v;
            onOffSwitch.EnableToggleAction();
            onOffSwitch.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(0, onOffSwitch);

            MyTerminalControlFactory.AddControl(1, new MyTerminalControlSeparator<MyFunctionalBlock>());
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:14,代码来源:MyFunctionalBlock.cs


示例14: MyUserControllableGun

        static MyUserControllableGun()
        {
            if (MyFakes.ENABLE_WEAPON_TERMINAL_CONTROL)
            {
                var shootOnce = new MyTerminalControlButton<MyUserControllableGun>("ShootOnce", MySpaceTexts.Terminal_ShootOnce, MySpaceTexts.Blank, (b) => b.OnShootOncePressed());
                shootOnce.EnableAction();
                MyTerminalControlFactory.AddControl(shootOnce);

                var shoot = new MyTerminalControlOnOffSwitch<MyUserControllableGun>("Shoot", MySpaceTexts.Terminal_Shoot);
                shoot.Getter = (x) => x.m_isShooting;
                shoot.Setter = (x, v) => x.OnShootPressed(v);
                shoot.EnableToggleAction();
                shoot.EnableOnOffActions();
                MyTerminalControlFactory.AddControl(shoot);
                MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyUserControllableGun>());
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:17,代码来源:MyUserControllableGun.cs


示例15: MyTerminalBlock

        static MyTerminalBlock()
        {
            var show = new MyTerminalControlOnOffSwitch<MyTerminalBlock>("ShowInTerminal", MySpaceTexts.Terminal_ShowInTerminal, MySpaceTexts.Terminal_ShowInTerminalToolTip);
            show.Getter = (x) => x.m_showInTerminal;
            show.Setter = (x, v) => x.RequestShowInTerminal(v);
            MyTerminalControlFactory.AddControl(show);

            var customName = new MyTerminalControlTextbox<MyTerminalBlock>("Name", MySpaceTexts.Name, MySpaceTexts.Blank);
            customName.Getter = (x) => x.CustomName;
            customName.Setter = (x, v) => MySyncBlockHelpers.SendChangeNameRequest(x, v);
            customName.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(customName);

            var onOffSwitch = new MyTerminalControlOnOffSwitch<MyTerminalBlock>("ShowOnHUD", MySpaceTexts.Terminal_ShowOnHUD, MySpaceTexts.Terminal_ShowOnHUDToolTip);
            onOffSwitch.Getter = (x) => x.ShowOnHUD;
            onOffSwitch.Setter = (x, v) => x.RequestShowOnHUD(v);
            MyTerminalControlFactory.AddControl(onOffSwitch);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:18,代码来源:MyTerminalBlock.cs


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


示例17: MyGasGenerator

        static MyGasGenerator()
        {
            var useConveyorSystem = new MyTerminalControlOnOffSwitch<MyGasGenerator>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
            useConveyorSystem.Getter = (x) => x.UseConveyorSystem;
            useConveyorSystem.Setter = (x, v) => x.UseConveyorSystem = v ;
            useConveyorSystem.EnableToggleAction();
            MyTerminalControlFactory.AddControl(useConveyorSystem);

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

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


示例18: MyOxygenTank

        static MyOxygenTank()
        {
            var isStockpiling = new MyTerminalControlOnOffSwitch<MyOxygenTank>("Stockpile", MySpaceTexts.BlockPropertyTitle_Stockpile, MySpaceTexts.BlockPropertyDescription_Stockpile);
            isStockpiling.Getter = (x) => x.IsStockpiling;
            isStockpiling.Setter = (x, v) => x.SyncObject.ChangeStockpileMode(v);
            isStockpiling.EnableToggleAction();
            isStockpiling.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(isStockpiling);

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

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


示例19: MyTerminalBlock

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

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

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

            var onOffSwitch = new MyTerminalControlOnOffSwitch<MyTerminalBlock>("ShowOnHUD", MySpaceTexts.Terminal_ShowOnHUD, MySpaceTexts.Terminal_ShowOnHUDToolTip);
            onOffSwitch.Getter = (x) => x.ShowOnHUD;
            onOffSwitch.Setter = (x, v) => x.ShowOnHUD = v;
            MyTerminalControlFactory.AddControl(onOffSwitch);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:23,代码来源:MyTerminalBlock.cs


示例20: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyGasTank>())
                return;
            base.CreateTerminalControls();
            var isStockpiling = new MyTerminalControlOnOffSwitch<MyGasTank>("Stockpile", MySpaceTexts.BlockPropertyTitle_Stockpile, MySpaceTexts.BlockPropertyDescription_Stockpile)
            {
                Getter = (x) => x.IsStockpiling,
                Setter = (x, v) => x.ChangeStockpileMode(v)
            };
            isStockpiling.EnableToggleAction();
            isStockpiling.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(isStockpiling);

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

            var autoRefill = new MyTerminalControlCheckbox<MyGasTank>("Auto-Refill", MySpaceTexts.BlockPropertyTitle_AutoRefill, MySpaceTexts.BlockPropertyTitle_AutoRefill)
            {
                Getter = (x) => x.m_autoRefill,
                Setter = (x, v) => x.ChangeAutoRefill(v)
            };
            autoRefill.EnableAction();
            MyTerminalControlFactory.AddControl(autoRefill);

        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:30,代码来源:MyGasTank.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyTerminalControlSlider类代码示例发布时间:2022-05-24
下一篇:
C# MyTerminalControlCheckbox类代码示例发布时间: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