本文整理汇总了C#中MyTerminalControlOnOffSwitch.EnableOnOffActions方法的典型用法代码示例。如果您正苦于以下问题:C# MyTerminalControlOnOffSwitch.EnableOnOffActions方法的具体用法?C# MyTerminalControlOnOffSwitch.EnableOnOffActions怎么用?C# MyTerminalControlOnOffSwitch.EnableOnOffActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyTerminalControlOnOffSwitch
的用法示例。
在下文中一共展示了MyTerminalControlOnOffSwitch.EnableOnOffActions方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.m_open.Value = v;
open.EnableToggleAction();
open.EnableOnOffActions();
MyTerminalControlFactory.AddControl(open);
}
示例2: 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);
}
示例3: 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>());
}
示例4: 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);
}
示例5: 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>());
}
示例6: 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>());
}
}
示例7: 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);
}
示例8: MyDoor
static MyDoor()
{
var open = new MyTerminalControlOnOffSwitch<MyDoor>("Open", MySpaceTexts.Blank, on: MySpaceTexts.BlockAction_DoorOpen, off: MySpaceTexts.BlockAction_DoorClosed);
open.Getter = (x) => x.Open;
open.Setter = (x, v) => x.SyncObject.SendChangeDoorRequest(v, x.OwnerId);
open.EnableToggleAction();
open.EnableOnOffActions();
MyTerminalControlFactory.AddControl(open);
}
示例9: CreateTerminalControls
//.........这里部分代码省略.........
fieldDepthMin.SetLimits(block => 1, block => block.MaxRange);
fieldDepthMin.DefaultValue = 5;
fieldDepthMin.Getter = (x) => -x.m_fieldMin.Value.Z;
fieldDepthMin.Setter = (x, v) =>
{
var fieldMin = x.FieldMin;
if (fieldMin.Z == -v)
return;
fieldMin.Z = -v;
x.FieldMin = fieldMin;
};
fieldDepthMin.Writer = (x, result) => result.AppendInt32((int)-x.m_fieldMin.Value.Z).Append(" m");
fieldDepthMin.EnableActions();
MyTerminalControlFactory.AddControl(fieldDepthMin);
var separatorFilters = new MyTerminalControlSeparator<MySensorBlock>();
MyTerminalControlFactory.AddControl(separatorFilters);
var detectPlayProximitySoundSwitch = new MyTerminalControlOnOffSwitch<MySensorBlock>("Audible Proximity Alert", MySpaceTexts.BlockPropertyTitle_SensorPlaySound, MySpaceTexts.BlockPropertyTitle_SensorPlaySound);
detectPlayProximitySoundSwitch.Getter = (x) => x.PlayProximitySound;
detectPlayProximitySoundSwitch.Setter = (x, v) =>
{
x.PlayProximitySound = v;
};
MyTerminalControlFactory.AddControl(detectPlayProximitySoundSwitch);
var detectPlayersSwitch = new MyTerminalControlOnOffSwitch<MySensorBlock>("Detect Players", MySpaceTexts.BlockPropertyTitle_SensorDetectPlayers, MySpaceTexts.BlockPropertyTitle_SensorDetectPlayers);
detectPlayersSwitch.Getter = (x) => x.DetectPlayers;
detectPlayersSwitch.Setter = (x, v) =>
{
x.DetectPlayers = v;
};
detectPlayersSwitch.EnableToggleAction(MyTerminalActionIcons.CHARACTER_TOGGLE);
detectPlayersSwitch.EnableOnOffActions(MyTerminalActionIcons.CHARACTER_ON, MyTerminalActionIcons.CHARACTER_OFF);
MyTerminalControlFactory.AddControl(detectPlayersSwitch);
var detectFloatingObjectsSwitch = new MyTerminalControlOnOffSwitch<MySensorBlock>("Detect Floating Objects", MySpaceTexts.BlockPropertyTitle_SensorDetectFloatingObjects, MySpaceTexts.BlockPropertyTitle_SensorDetectFloatingObjects);
detectFloatingObjectsSwitch.Getter = (x) => x.DetectFloatingObjects;
detectFloatingObjectsSwitch.Setter = (x, v) =>
{
x.DetectFloatingObjects = v;
};
detectFloatingObjectsSwitch.EnableToggleAction(MyTerminalActionIcons.MOVING_OBJECT_TOGGLE);
detectFloatingObjectsSwitch.EnableOnOffActions(MyTerminalActionIcons.MOVING_OBJECT_ON, MyTerminalActionIcons.MOVING_OBJECT_OFF);
MyTerminalControlFactory.AddControl(detectFloatingObjectsSwitch);
var detectSmallShipsSwitch = new MyTerminalControlOnOffSwitch<MySensorBlock>("Detect Small Ships", MySpaceTexts.BlockPropertyTitle_SensorDetectSmallShips, MySpaceTexts.BlockPropertyTitle_SensorDetectSmallShips);
detectSmallShipsSwitch.Getter = (x) => x.DetectSmallShips;
detectSmallShipsSwitch.Setter = (x, v) =>
{
x.DetectSmallShips = v;
};
detectSmallShipsSwitch.EnableToggleAction(MyTerminalActionIcons.SMALLSHIP_TOGGLE);
detectSmallShipsSwitch.EnableOnOffActions(MyTerminalActionIcons.SMALLSHIP_ON, MyTerminalActionIcons.SMALLSHIP_OFF);
MyTerminalControlFactory.AddControl(detectSmallShipsSwitch);
var detectLargeShipsSwitch = new MyTerminalControlOnOffSwitch<MySensorBlock>("Detect Large Ships", MySpaceTexts.BlockPropertyTitle_SensorDetectLargeShips, MySpaceTexts.BlockPropertyTitle_SensorDetectLargeShips);
detectLargeShipsSwitch.Getter = (x) => x.DetectLargeShips;
detectLargeShipsSwitch.Setter = (x, v) =>
{
x.DetectLargeShips = v;
};
detectLargeShipsSwitch.EnableToggleAction(MyTerminalActionIcons.LARGESHIP_TOGGLE);
detectLargeShipsSwitch.EnableOnOffActions(MyTerminalActionIcons.LARGESHIP_ON, MyTerminalActionIcons.LARGESHIP_OFF);
MyTerminalControlFactory.AddControl(detectLargeShipsSwitch);
示例10: CreateTerminalControls
protected override void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyRemoteControl>())
return;
base.CreateTerminalControls();
var controlBtn = new MyTerminalControlButton<MyRemoteControl>("Control", MySpaceTexts.ControlRemote, MySpaceTexts.Blank, (b) => b.RequestControl());
controlBtn.Enabled = r => r.CanControl();
controlBtn.SupportsMultipleBlocks = false;
var action = controlBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
if (action != null)
{
action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
action.ValidForGroups = false;
}
MyTerminalControlFactory.AddControl(controlBtn);
var autoPilotSeparator = new MyTerminalControlSeparator<MyRemoteControl>();
MyTerminalControlFactory.AddControl(autoPilotSeparator);
var autoPilot = new MyTerminalControlOnOffSwitch<MyRemoteControl>("AutoPilot", MySpaceTexts.BlockPropertyTitle_AutoPilot, MySpaceTexts.Blank);
autoPilot.Getter = (x) => x.m_autoPilotEnabled;
autoPilot.Setter = (x, v) => x.SetAutoPilotEnabled(v);
autoPilot.Enabled = r => r.CanEnableAutoPilot();
autoPilot.EnableToggleAction();
autoPilot.EnableOnOffActions();
MyTerminalControlFactory.AddControl(autoPilot);
var collisionAv = new MyTerminalControlOnOffSwitch<MyRemoteControl>("CollisionAvoidance", MySpaceTexts.BlockPropertyTitle_CollisionAvoidance, MySpaceTexts.Blank);
collisionAv.Getter = (x) => x.m_useCollisionAvoidance;
collisionAv.Setter = (x, v) => x.SetCollisionAvoidance(v);
collisionAv.Enabled = r => true;
collisionAv.EnableToggleAction();
collisionAv.EnableOnOffActions();
MyTerminalControlFactory.AddControl(collisionAv);
var dockignMode = new MyTerminalControlOnOffSwitch<MyRemoteControl>("DockingMode", MySpaceTexts.BlockPropertyTitle_EnableDockingMode, MySpaceTexts.Blank);
dockignMode.Getter = (x) => x.m_dockingModeEnabled;
dockignMode.Setter = (x, v) => x.SetDockingMode(v);
dockignMode.Enabled = r => r.IsWorking;
dockignMode.EnableToggleAction();
dockignMode.EnableOnOffActions();
MyTerminalControlFactory.AddControl(dockignMode);
var cameraList = new MyTerminalControlCombobox<MyRemoteControl>("CameraList", MySpaceTexts.BlockPropertyTitle_AssignedCamera, MySpaceTexts.Blank);
cameraList.ComboBoxContentWithBlock = (x, list) => x.FillCameraComboBoxContent(list);
cameraList.Getter = (x) => (long)x.m_bindedCamera;
cameraList.Setter = (x, y) => x.m_bindedCamera.Value = y;
MyTerminalControlFactory.AddControl(cameraList);
m_cameraList = cameraList;
var flightMode = new MyTerminalControlCombobox<MyRemoteControl>("FlightMode", MySpaceTexts.BlockPropertyTitle_FlightMode, MySpaceTexts.Blank);
flightMode.ComboBoxContent = (x) => FillFlightModeCombo(x);
flightMode.Getter = (x) => (long)x.m_currentFlightMode.Value;
flightMode.Setter = (x, v) => x.ChangeFlightMode((FlightMode)v);
flightMode.SetSerializerRange((int)MyEnum<FlightMode>.Range.Min, (int)MyEnum<FlightMode>.Range.Max);
MyTerminalControlFactory.AddControl(flightMode);
var directionCombo = new MyTerminalControlCombobox<MyRemoteControl>("Direction", MySpaceTexts.BlockPropertyTitle_ForwardDirection, MySpaceTexts.Blank);
directionCombo.ComboBoxContent = (x) => FillDirectionCombo(x);
directionCombo.Getter = (x) => (long)x.m_currentDirection.Value;
directionCombo.Setter = (x, v) => x.ChangeDirection((Base6Directions.Direction)v);
MyTerminalControlFactory.AddControl(directionCombo);
if (MyFakes.ENABLE_VR_REMOTE_BLOCK_AUTOPILOT_SPEED_LIMIT)
{
var sliderSpeedLimit = new MyTerminalControlSlider<MyRemoteControl>("SpeedLimit", MySpaceTexts.BlockPropertyTitle_RemoteBlockSpeedLimit,
MySpaceTexts.BlockPropertyTitle_RemoteBlockSpeedLimit);
sliderSpeedLimit.SetLimits(1, 200);
sliderSpeedLimit.DefaultValue = MyObjectBuilder_RemoteControl.DEFAULT_AUTOPILOT_SPEED_LIMIT;
sliderSpeedLimit.Getter = (x) => x.m_autopilotSpeedLimit;
sliderSpeedLimit.Setter = (x, v) => x.m_autopilotSpeedLimit.Value = v;
sliderSpeedLimit.Writer = (x, sb) => sb.Append(MyValueFormatter.GetFormatedFloat(x.m_autopilotSpeedLimit, 0));
sliderSpeedLimit.EnableActions();
MyTerminalControlFactory.AddControl(sliderSpeedLimit);
}
var waypointList = new MyTerminalControlListbox<MyRemoteControl>("WaypointList", MySpaceTexts.BlockPropertyTitle_Waypoints, MySpaceTexts.Blank, true);
waypointList.ListContent = (x, list1, list2) => x.FillWaypointList(list1, list2);
waypointList.ItemSelected = (x, y) => x.SelectWaypoint(y);
if (!MySandboxGame.IsDedicated)
{
m_waypointGuiControl = (MyGuiControlListbox)((MyGuiControlBlockProperty)waypointList.GetGuiControl()).PropertyControl;
}
MyTerminalControlFactory.AddControl(waypointList);
var toolbarButton = new MyTerminalControlButton<MyRemoteControl>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_AutoPilotToolbarOpen, MySpaceTexts.BlockPropertyPopup_AutoPilotToolbarOpen,
delegate(MyRemoteControl self)
{
var actions = self.m_selectedWaypoints[0].Actions;
if (actions != null)
{
for (int i = 0; i < actions.Length; i++)
{
if (actions[i] != null)
{
self.m_actionToolbar.SetItemAtIndex(i, actions[i]);
}
}
//.........这里部分代码省略.........
示例11: CreateTerminalControls
static void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyAirVent>())
return;
var isDepressurizing = new MyTerminalControlOnOffSwitch<MyAirVent>("Depressurize", MySpaceTexts.BlockPropertyTitle_Depressurize, MySpaceTexts.BlockPropertyDescription_Depressurize);
isDepressurizing.Getter = (x) => x.IsDepressurizing;
isDepressurizing.Setter = (x, v) => x.IsDepressurizing = v;
isDepressurizing.EnableToggleAction();
isDepressurizing.EnableOnOffActions();
MyTerminalControlFactory.AddControl(isDepressurizing);
var toolbarButton = new MyTerminalControlButton<MyAirVent>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_SensorToolbarOpen, MySpaceTexts.BlockPropertyDescription_SensorToolbarOpen,
delegate(MyAirVent self)
{
if (self.m_onFullAction != null)
{
self.m_actionToolbar.SetItemAtIndex(0, self.m_onFullAction);
}
if (self.m_onEmptyAction != null)
{
self.m_actionToolbar.SetItemAtIndex(1, self.m_onEmptyAction);
}
self.m_actionToolbar.ItemChanged += self.Toolbar_ItemChanged;
if (MyGuiScreenCubeBuilder.Static == null)
{
MyToolbarComponent.CurrentToolbar = self.m_actionToolbar;
MyGuiScreenBase screen = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
MyToolbarComponent.AutoUpdate = false;
screen.Closed += (source) =>
{
MyToolbarComponent.AutoUpdate = true;
self.m_actionToolbar.ItemChanged -= self.Toolbar_ItemChanged;
self.m_actionToolbar.Clear();
};
MyGuiSandbox.AddScreen(screen);
}
});
toolbarButton.SupportsMultipleBlocks = false;
MyTerminalControlFactory.AddControl(toolbarButton);
}
示例12: 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);
}
示例13: MyAirVent
static MyAirVent()
{
var isDepressurizing = new MyTerminalControlOnOffSwitch<MyAirVent>("Depressurize", MySpaceTexts.BlockPropertyTitle_Depressurize, MySpaceTexts.BlockPropertyDescription_Depressurize);
isDepressurizing.Getter = (x) => (x as MyAirVent).IsDepressurizing;
isDepressurizing.Setter = (x, v) => (x as MyAirVent).SyncObject.ChangeDepressurizationMode(v);
isDepressurizing.EnableToggleAction();
isDepressurizing.EnableOnOffActions();
MyTerminalControlFactory.AddControl(isDepressurizing);
}
示例14: MyRemoteControl
static MyRemoteControl()
{
var controlBtn = new MyTerminalControlButton<MyRemoteControl>("Control", MySpaceTexts.ControlRemote, MySpaceTexts.Blank, (b) => b.RequestControl());
controlBtn.Enabled = r => r.CanControl();
controlBtn.SupportsMultipleBlocks = false;
var action = controlBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
if (action != null)
{
action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
action.ValidForGroups = false;
}
MyTerminalControlFactory.AddControl(controlBtn);
var autoPilotSeparator = new MyTerminalControlSeparator<MyRemoteControl>();
MyTerminalControlFactory.AddControl(autoPilotSeparator);
var autoPilot = new MyTerminalControlOnOffSwitch<MyRemoteControl>("AutoPilot", MySpaceTexts.BlockPropertyTitle_AutoPilot, MySpaceTexts.Blank);
autoPilot.Getter = (x) => x.m_autoPilotEnabled;
autoPilot.Setter = (x, v) => x.SetAutoPilotEnabled(v);
autoPilot.Enabled = r => r.CanEnableAutoPilot();
autoPilot.EnableToggleAction();
autoPilot.EnableOnOffActions();
MyTerminalControlFactory.AddControl(autoPilot);
var dockignMode = new MyTerminalControlOnOffSwitch<MyRemoteControl>("DockingMode", MySpaceTexts.BlockPropertyTitle_EnableDockingMode, MySpaceTexts.Blank);
dockignMode.Getter = (x) => x.m_dockingModeEnabled;
dockignMode.Setter = (x, v) => x.SetDockingMode(v);
dockignMode.Enabled = r => r.IsWorking;
dockignMode.EnableToggleAction();
dockignMode.EnableOnOffActions();
MyTerminalControlFactory.AddControl(dockignMode);
var flightMode = new MyTerminalControlCombobox<MyRemoteControl>("FlightMode", MySpaceTexts.BlockPropertyTitle_FlightMode, MySpaceTexts.Blank);
flightMode.ComboBoxContent = (x) => FillFlightModeCombo(x);
flightMode.Getter = (x) => (long)x.m_currentFlightMode;
flightMode.Setter = (x, v) => x.ChangeFlightMode((FlightMode)v);
MyTerminalControlFactory.AddControl(flightMode);
var directionCombo = new MyTerminalControlCombobox<MyRemoteControl>("Direction", MySpaceTexts.BlockPropertyTitle_ForwardDirection, MySpaceTexts.Blank);
directionCombo.ComboBoxContent = (x) => FillDirectionCombo(x);
directionCombo.Getter = (x) => (long)x.m_currentDirection;
directionCombo.Setter = (x, v) => x.ChangeDirection((Base6Directions.Direction)v);
MyTerminalControlFactory.AddControl(directionCombo);
var waypointList = new MyTerminalControlListbox<MyRemoteControl>("WaypointList", MySpaceTexts.BlockPropertyTitle_Waypoints, MySpaceTexts.Blank, true);
waypointList.ListContent = (x, list1, list2) => x.FillWaypointList(list1, list2);
waypointList.ItemSelected = (x, y) => x.SelectWaypoint(y);
if (!MySandboxGame.IsDedicated)
{
m_waypointGuiControl = (MyGuiControlListbox)((MyGuiControlBlockProperty)waypointList.GetGuiControl()).PropertyControl;
}
MyTerminalControlFactory.AddControl(waypointList);
var toolbarButton = new MyTerminalControlButton<MyRemoteControl>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_AutoPilotToolbarOpen, MySpaceTexts.BlockPropertyPopup_AutoPilotToolbarOpen,
delegate(MyRemoteControl self)
{
var actions = self.m_selectedWaypoints[0].Actions;
if (actions != null)
{
for (int i = 0; i < actions.Length; i++)
{
if (actions[i] != null)
{
self.m_actionToolbar.SetItemAtIndex(i, actions[i]);
}
}
}
self.m_actionToolbar.ItemChanged += self.Toolbar_ItemChanged;
if (MyGuiScreenCubeBuilder.Static == null)
{
MyToolbarComponent.CurrentToolbar = self.m_actionToolbar;
MyGuiScreenBase screen = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
MyToolbarComponent.AutoUpdate = false;
screen.Closed += (source) =>
{
MyToolbarComponent.AutoUpdate = true;
self.m_actionToolbar.ItemChanged -= self.Toolbar_ItemChanged;
self.m_actionToolbar.Clear();
};
MyGuiSandbox.AddScreen(screen);
}
});
toolbarButton.Enabled = r => r.m_selectedWaypoints.Count == 1;
toolbarButton.SupportsMultipleBlocks = false;
MyTerminalControlFactory.AddControl(toolbarButton);
var removeBtn = new MyTerminalControlButton<MyRemoteControl>("RemoveWaypoint", MySpaceTexts.BlockActionTitle_RemoveWaypoint, MySpaceTexts.Blank, (b) => b.RemoveWaypoints());
removeBtn.Enabled = r => r.CanRemoveWaypoints();
removeBtn.SupportsMultipleBlocks = false;
MyTerminalControlFactory.AddControl(removeBtn);
var moveUp = new MyTerminalControlButton<MyRemoteControl>("MoveUp", MySpaceTexts.BlockActionTitle_MoveWaypointUp, MySpaceTexts.Blank, (b) => b.MoveWaypointsUp());
moveUp.Enabled = r => r.CanMoveWaypointsUp();
moveUp.SupportsMultipleBlocks = false;
MyTerminalControlFactory.AddControl(moveUp);
var moveDown = new MyTerminalControlButton<MyRemoteControl>("MoveDown", MySpaceTexts.BlockActionTitle_MoveWaypointDown, MySpaceTexts.Blank, (b) => b.MoveWaypointsDown());
//.........这里部分代码省略.........