本文整理汇总了C#中MyTerminalControlOnOffSwitch类的典型用法代码示例。如果您正苦于以下问题:C# MyTerminalControlOnOffSwitch类的具体用法?C# MyTerminalControlOnOffSwitch怎么用?C# MyTerminalControlOnOffSwitch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyTerminalControlOnOffSwitch类属于命名空间,在下文中一共展示了MyTerminalControlOnOffSwitch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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>());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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>());
}
示例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>());
}
}
示例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);
}