本文整理汇总了C#中MyTerminalControlButton类的典型用法代码示例。如果您正苦于以下问题:C# MyTerminalControlButton类的具体用法?C# MyTerminalControlButton怎么用?C# MyTerminalControlButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyTerminalControlButton类属于命名空间,在下文中一共展示了MyTerminalControlButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MyProgrammableBlock
static MyProgrammableBlock()
{
var console = new MyTerminalControlButton<MyProgrammableBlock>("Edit", MySpaceTexts.TerminalControlPanel_EditCode, MySpaceTexts.TerminalControlPanel_EditCode_Tooltip, (b) => b.SyncObject.SendOpenEditorRequest(Sync.MyId));
console.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
MyTerminalControlFactory.AddControl(console);
var arg = new MyTerminalControlTextbox<MyProgrammableBlock>("ConsoleCommand", MySpaceTexts.TerminalControlPanel_RunArgument, MySpaceTexts.TerminalControlPanel_RunArgument_ToolTip);
arg.Visible = (e) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
arg.Getter = (e) => new StringBuilder(e.TerminalRunArgument);
arg.Setter = (e, v) => e.TerminalRunArgument = v.ToString();
MyTerminalControlFactory.AddControl(arg);
var terminalRun = new MyTerminalControlButton<MyProgrammableBlock>("TerminalRun", MySpaceTexts.TerminalControlPanel_RunCode, MySpaceTexts.TerminalControlPanel_RunCode_Tooltip, (b) => b.Run());
terminalRun.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
terminalRun.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
MyTerminalControlFactory.AddControl(terminalRun);
var runAction = new MyTerminalAction<MyProgrammableBlock>("Run", MyTexts.Get(MySpaceTexts.TerminalControlPanel_RunCode), OnRunApplied, null, MyTerminalActionIcons.START);
runAction.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
runAction.DoUserParameterRequest = RequestRunArgument;
runAction.ParameterDefinitions.Add(TerminalActionParameter.Get(string.Empty));
MyTerminalControlFactory.AddAction(runAction);
var runwithDefault = new MyTerminalAction<MyProgrammableBlock>("RunWithDefaultArgument", MyTexts.Get(MySpaceTexts.TerminalControlPanel_RunCodeDefault), OnRunDefaultApplied, MyTerminalActionIcons.START);
runwithDefault.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
MyTerminalControlFactory.AddAction(runwithDefault);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:27,代码来源:MyProgrammableBlock.cs
示例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.EnableToggleAction();
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.m_jumpTarget == null;
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);
if (!MySandboxGame.IsDedicated)
{
m_gpsGuiControl = (MyGuiControlListbox)((MyGuiControlBlockProperty)gpsList.GetGuiControl()).PropertyControl;
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:60,代码来源:MyJumpDrive.cs
示例3: MyScenarioBuildingBlock
static MyScenarioBuildingBlock()
{
MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyTerminalBlock>());
var idleButton = new MyTerminalControlButton<MyTerminalBlock>("CopyBlockID", MySpaceTexts.GuiScenarioEdit_CopyIds, MySpaceTexts.GuiScenarioEdit_CopyIdsTooltip,
delegate(MyTerminalBlock self)
{
AddToClipboard(self);
});
idleButton.Enabled = (x) => true;
idleButton.Visible = (x) => MySession.Static.Settings.ScenarioEditMode;
idleButton.SupportsMultipleBlocks = true;
MyTerminalControlFactory.AddControl(idleButton);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:14,代码来源:MyScenarioBuildingBlock.cs
示例4: CreateTerminalControls
protected override void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyTerminalBlock>())
return;
base.CreateTerminalControls();
MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyTerminalBlock>());
var idleButton = new MyTerminalControlButton<MyTerminalBlock>("CopyBlockID", MySpaceTexts.GuiScenarioEdit_CopyIds, MySpaceTexts.GuiScenarioEdit_CopyIdsTooltip,
delegate(MyTerminalBlock self)
{
AddToClipboard(self);
});
idleButton.Enabled = (x) => true;
idleButton.Visible = (x) => MySession.Static.Settings.ScenarioEditMode;
idleButton.SupportsMultipleBlocks = true;
MyTerminalControlFactory.AddControl(idleButton);
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:16,代码来源:MyScenarioBuildingBlock.cs
示例5: 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
示例6: MyCameraBlock
static MyCameraBlock()
{
var viewBtn = new MyTerminalControlButton<MyCameraBlock>("View", MySpaceTexts.BlockActionTitle_View, MySpaceTexts.Blank, (b) => b.RequestSetView());
viewBtn.Enabled = (b) => b.CanUse();
viewBtn.SupportsMultipleBlocks = false;
var action = viewBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
if (action != null)
{
action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
action.ValidForGroups = false;
}
MyTerminalControlFactory.AddControl(viewBtn);
var controlName = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
m_hudNotification = new MyHudNotification(MySpaceTexts.NotificationHintPressToExitCamera);
m_hudNotification.SetTextFormatArguments(controlName);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyCameraBlock.cs
示例7: 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
示例8: 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
示例9: 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:leandro1129,项目名称:SpaceEngineers,代码行数:20,代码来源:MyOxygenTank.cs
示例10: 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);
//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) =>
{
x.m_projectionRotation.X = Convert.ToInt32(v);
x.OnOffsetsChanged();
};
rotationX.Writer = (x, result) => result.AppendInt32((int)x.m_projectionRotation.X * 90).Append("°");
rotationX.EnableActions(step: 0.2f);
rotationX.Enabled = (x) => x.IsProjecting();
MyTerminalControlFactory.AddControl(rotationX);
var rotationY = new MyTerminalControlSlider<MyProjector>("RotY", MySpaceTexts.BlockPropertyTitle_ProjectionRotationY, MySpaceTexts.Blank);
rotationY.SetLimits(-2, 2);
rotationY.DefaultValue = 0;
rotationY.Getter = (x) => x.m_projectionRotation.Y;
rotationY.Setter = (x, v) =>
{
x.m_projectionRotation.Y = Convert.ToInt32(v);
x.OnOffsetsChanged();
};
rotationY.Writer = (x, result) => result.AppendInt32((int)x.m_projectionRotation.Y * 90).Append("°");
rotationY.EnableActions(step: 0.2f);
rotationY.Enabled = (x) => x.IsProjecting();
MyTerminalControlFactory.AddControl(rotationY);
//.........这里部分代码省略.........
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:101,代码来源:MyProjector.cs
示例11: 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]);
}
}
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:101,代码来源:MyRemoteControl.cs
示例12: MyShipConnector
static MyShipConnector()
{
var stateWriter = new MyTerminalControl<MyShipConnector>.WriterDelegate((b, sb) => b.WriteLockStateValue(sb));
var throwOut = new MyTerminalControlOnOffSwitch<MyShipConnector>("ThrowOut", MySpaceTexts.Terminal_ThrowOut);
throwOut.Getter = (block) => block.ThrowOut;
throwOut.Setter = (block, value) => MySyncShipConnector.SendChangePropertyMessage(value, block, MySyncShipConnector.Properties.ThrowOut);
throwOut.EnableToggleAction();
MyTerminalControlFactory.AddControl(throwOut);
var collectAll = new MyTerminalControlOnOffSwitch<MyShipConnector>("CollectAll", MySpaceTexts.Terminal_CollectAll);
collectAll.Getter = (block) => block.CollectAll;
collectAll.Setter = (block, value) => MySyncShipConnector.SendChangePropertyMessage(value, block, MySyncShipConnector.Properties.CollectAll);
collectAll.EnableToggleAction();
MyTerminalControlFactory.AddControl(collectAll);
var lockBtn = new MyTerminalControlButton<MyShipConnector>("Lock", MySpaceTexts.BlockActionTitle_Lock, MySpaceTexts.Blank, (b) => b.TryConnect());
lockBtn.Enabled = (b) => b.IsWorking && b.InConstraint;
lockBtn.Visible = (b) => b.m_connectorMode == Mode.Connector;
MyTerminalControlFactory.AddControl(lockBtn);
var unlockBtn = new MyTerminalControlButton<MyShipConnector>("Unlock", MySpaceTexts.BlockActionTitle_Unlock, MySpaceTexts.Blank, (b) => b.TryDisconnect());
unlockBtn.Enabled = (b) => b.IsWorking && b.InConstraint;
unlockBtn.Visible = (b) => b.m_connectorMode == Mode.Connector;
MyTerminalControlFactory.AddControl(unlockBtn);
var title = MyTexts.Get(MySpaceTexts.BlockActionTitle_SwitchLock);
MyTerminalAction<MyShipConnector> switchLockAction = new MyTerminalAction<MyShipConnector>("SwitchLock", title, MyTerminalActionIcons.TOGGLE);
switchLockAction.Action = (b) => b.TrySwitch();
switchLockAction.Writer = stateWriter;
switchLockAction.Enabled = (b) => b.m_connectorMode == Mode.Connector;
MyTerminalControlFactory.AddAction(switchLockAction);
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:33,代码来源:MyShipConnector.cs
示例13: 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
示例14: 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
示例15: CreateTerminalControls
//.........这里部分代码省略.........
var invertSteer = new MyTerminalControlCheckbox<MyMotorSuspension>("InvertSteering", MySpaceTexts.BlockPropertyTitle_Motor_InvertSteer, MySpaceTexts.BlockPropertyDescription_Motor_InvertSteer);
invertSteer.Getter = (x) => x.InvertSteer;
invertSteer.Setter = (x, v) => x.InvertSteer = v;
invertSteer.EnableAction();
invertSteer.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(invertSteer);
var propulsion = new MyTerminalControlCheckbox<MyMotorSuspension>("Propulsion", MySpaceTexts.BlockPropertyTitle_Motor_Propulsion, MySpaceTexts.BlockPropertyDescription_Motor_Propulsion);
propulsion.Getter = (x) => x.Propulsion;
propulsion.Setter = (x, v) => x.Propulsion = v;
propulsion.EnableAction();
propulsion.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(propulsion);
var invertPropulsion = new MyTerminalControlCheckbox<MyMotorSuspension>("InvertPropulsion", MySpaceTexts.BlockPropertyTitle_Motor_InvertPropulsion, MySpaceTexts.BlockPropertyDescription_Motor_InvertPropulsion);
invertPropulsion.Getter = (x) => x.InvertPropulsion;
invertPropulsion.Setter = (x, v) => x.InvertPropulsion = v;
invertPropulsion.EnableAction();
invertPropulsion.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(invertPropulsion);
var power = new MyTerminalControlSlider<MyMotorSuspension>("Power", MySpaceTexts.BlockPropertyTitle_Motor_Power, MySpaceTexts.BlockPropertyDescription_Motor_Power);
power.SetLimits(0, 100);
power.DefaultValue = 100;
power.Getter = (x) => x.GetPowerForTerminal();
power.Setter = (x, v) => x.Power = v / 100;
power.Writer = (x, res) => res.AppendInt32((int)(x.Power * 100)).Append("%");
power.EnableActions();
power.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(power);
var friction = new MyTerminalControlSlider<MyMotorSuspension>("Friction", MySpaceTexts.BlockPropertyTitle_Motor_Friction, MySpaceTexts.BlockPropertyDescription_Motor_Friction);
friction.SetLimits(0, 100);
friction.DefaultValue = 150f / 800;
friction.Getter = (x) => x.GetFrictionForTerminal();
friction.Setter = (x, v) => x.Friction = v / 100;
friction.Writer = (x, res) => res.AppendInt32((int)(x.Friction * 100)).Append("%");
friction.EnableActions();
friction.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(friction);
var damping = new MyTerminalControlSlider<MyMotorSuspension>("Damping", MySpaceTexts.BlockPropertyTitle_Motor_Damping, MySpaceTexts.BlockPropertyTitle_Motor_Damping);
damping.SetLimits(0, 100);
damping.Getter = (x) => x.GetDampingForTerminal();
damping.Setter = (x, v) => x.Damping = v / 100;
damping.Writer = (x, res) => res.AppendInt32((int)(x.GetDampingForTerminal())).Append("%");
damping.EnableActions();
damping.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(damping);
var strength = new MyTerminalControlSlider<MyMotorSuspension>("Strength", MySpaceTexts.BlockPropertyTitle_Motor_Strength, MySpaceTexts.BlockPropertyTitle_Motor_Strength);
strength.SetLimits(0, 100);
strength.Getter = (x) => x.GetStrengthForTerminal();
strength.Setter = (x, v) => x.Strength = v / 100;
strength.Writer = (x, res) => res.AppendInt32((int)(x.GetStrengthForTerminal())).Append("%");
strength.EnableActions();
strength.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(strength);
var height = new MyTerminalControlSlider<MyMotorSuspension>("Height", MySpaceTexts.BlockPropertyTitle_Motor_Height, MySpaceTexts.BlockPropertyDescription_Motor_Height);
height.SetLimits((x) => x.BlockDefinition.MinHeight, (x) => x.BlockDefinition.MaxHeight);
height.DefaultValue = 0;
height.Getter = (x) => x.GetHeightForTerminal();
height.Setter = (x, v) => x.Height = v;
height.Writer = (x, res) => MyValueFormatter.AppendDistanceInBestUnit(x.Height, res);
height.EnableActionsWithReset();
height.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(height);
var travel = new MyTerminalControlSlider<MyMotorSuspension>("Travel", MySpaceTexts.BlockPropertyTitle_Motor_SuspensionTravel, MySpaceTexts.BlockPropertyDescription_Motor_SuspensionTravel);
travel.SetLimits(0, 100);
travel.DefaultValue = 100;
travel.Getter = (x) => x.GetSuspensionTravelForTerminal();
travel.Setter = (x, v) => x.SuspensionTravel = v / 100.0f;
travel.Writer = (x, res) => res.AppendInt32((int)x.GetSuspensionTravelForTerminal()).Append("%");
travel.EnableActionsWithReset();
travel.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(travel);
var speed = new MyTerminalControlSlider<MyMotorSuspension>("Speed Limit", MySpaceTexts.BlockPropertyTitle_Motor_SuspensionSpeed, MySpaceTexts.BlockPropertyDescription_Motor_SuspensionSpeed);
speed.SetLimits(0, MaxSpeedLimit);
speed.DefaultValue = MaxSpeedLimit;
speed.Getter = (x) => x.SpeedLimit;
speed.Setter = (x, v) => x.SpeedLimit = v;
speed.Writer = (x, res) =>
{
if (x.SpeedLimit >= MyMotorSuspension.MaxSpeedLimit)
res.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_MotorAngleUnlimited));
else
res.AppendInt32((int)x.SpeedLimit).Append("km/h");
};
speed.EnableActionsWithReset();
speed.Enabled = (x) => x.m_constraint != null;
MyTerminalControlFactory.AddControl(speed);
var addWheel = new MyTerminalControlButton<MyMotorSuspension>("Add Wheel", MySpaceTexts.BlockActionTitle_AddWheel, MySpaceTexts.BlockActionTooltip_AddWheel, (b) => b.RecreateRotor());
addWheel.Enabled = (b) => (b.m_topBlock == null);
a
|
请发表评论