本文整理汇总了C#中MyTerminalControlSlider.SetLogLimits方法的典型用法代码示例。如果您正苦于以下问题:C# MyTerminalControlSlider.SetLogLimits方法的具体用法?C# MyTerminalControlSlider.SetLogLimits怎么用?C# MyTerminalControlSlider.SetLogLimits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyTerminalControlSlider
的用法示例。
在下文中一共展示了MyTerminalControlSlider.SetLogLimits方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTerminalControls
protected override void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyBeacon>())
return;
base.CreateTerminalControls();
//MyTerminalControlFactory.RemoveBaseClass<MyBeacon, MyTerminalBlock>(); // this removed also controls shared with other blocks
//removed unnecessary controls
var controlList = MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls;
controlList.Remove(controlList[4]);//name
controlList.Remove(controlList[4]);//show on HUD
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: 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);
}
示例3: MyThrust
static MyThrust()
{
float threshold = 0.01f;
var thrustOverride = new MyTerminalControlSlider<MyThrust>("Override", MySpaceTexts.BlockPropertyTitle_ThrustOverride, MySpaceTexts.BlockPropertyDescription_ThrustOverride);
thrustOverride.Getter = (x) => x.ThrustOverride;
thrustOverride.Setter = (x, v) =>
{
float val = v;
float limit = x.BlockDefinition.ForceMagnitude * threshold;
x.SetThrustOverride(val <= limit ? 0 : v);
x.SyncObject.SendChangeThrustOverrideRequest(x.ThrustOverride);
};
thrustOverride.DefaultValue = 0;
thrustOverride.SetLogLimits((x) => x.BlockDefinition.ForceMagnitude * 0.01f, (x) => x.BlockDefinition.ForceMagnitude);
thrustOverride.EnableActions();
thrustOverride.Writer = (x, result) =>
{
if (x.ThrustOverride <= x.BlockDefinition.ForceMagnitude * 0.01f)
result.Append(MyTexts.Get(MySpaceTexts.Disabled));
else
MyValueFormatter.AppendForceInBestUnit(x.ThrustOverride, result);
};
MyTerminalControlFactory.AddControl(thrustOverride);
}
示例4: MyWarhead
static MyWarhead()
{
var slider = new MyTerminalControlSlider<MyWarhead>("DetonationTime", MySpaceTexts.TerminalControlPanel_Warhead_DetonationTime, MySpaceTexts.TerminalControlPanel_Warhead_DetonationTime);
slider.SetLogLimits(1, 60 * 60);
slider.DefaultValue = 10;
slider.Enabled = (x) => !x.IsCountingDown;
slider.Getter = (x) => x.DetonationTime;
slider.Setter = (x, v) => MySyncWarhead.SetTimer(x, v * 1000);
slider.Writer = (x, sb) => MyValueFormatter.AppendTimeExact(Math.Max(x.m_countdownMs, 1000) / 1000, sb);
slider.EnableActions();
MyTerminalControlFactory.AddControl(slider);
var startButton = new MyTerminalControlButton<MyWarhead>(
"StartCountdown",
MySpaceTexts.TerminalControlPanel_Warhead_StartCountdown,
MySpaceTexts.TerminalControlPanel_Warhead_StartCountdown,
(b) => MySyncWarhead.StartCountdown(b));
startButton.EnableAction();
MyTerminalControlFactory.AddControl(startButton);
var stopButton = new MyTerminalControlButton<MyWarhead>(
"StopCountdown",
MySpaceTexts.TerminalControlPanel_Warhead_StopCountdown,
MySpaceTexts.TerminalControlPanel_Warhead_StopCountdown,
(b) => MySyncWarhead.StopCountdown(b));
stopButton.EnableAction();
MyTerminalControlFactory.AddControl(stopButton);
MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyWarhead>());
var safetyCheckbox = new MyTerminalControlCheckbox<MyWarhead>(
"Safety",
MySpaceTexts.TerminalControlPanel_Warhead_Safety,
MySpaceTexts.TerminalControlPanel_Warhead_SafetyTooltip,
MySpaceTexts.TerminalControlPanel_Warhead_SwitchTextDisarmed,
MySpaceTexts.TerminalControlPanel_Warhead_SwitchTextArmed);
safetyCheckbox.Getter = (x) => !x.IsArmed;
safetyCheckbox.Setter = (x, v) => MySyncWarhead.SetArm(x, !v);
safetyCheckbox.EnableAction();
MyTerminalControlFactory.AddControl(safetyCheckbox);
var detonateButton = new MyTerminalControlButton<MyWarhead>(
"Detonate",
MySpaceTexts.TerminalControlPanel_Warhead_Detonate,
MySpaceTexts.TerminalControlPanel_Warhead_Detonate,
(b) => MySyncWarhead.Detonate(b));
detonateButton.Enabled = (x) => x.IsArmed;
detonateButton.EnableAction();
MyTerminalControlFactory.AddControl(detonateButton);
}
示例5: CreateTerminalControls
protected override void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyWarhead>())
return;
base.CreateTerminalControls();
var slider = new MyTerminalControlSlider<MyWarhead>("DetonationTime", MySpaceTexts.TerminalControlPanel_Warhead_DetonationTime, MySpaceTexts.TerminalControlPanel_Warhead_DetonationTime);
slider.SetLogLimits(1, 60 * 60);
slider.DefaultValue = 10;
slider.Enabled = (x) => !x.IsCountingDown;
slider.Getter = (x) => x.DetonationTime;
slider.Setter = (x, v) => x.m_countdownMs.Value = (int)(v * 1000);
slider.Writer = (x, sb) => MyValueFormatter.AppendTimeExact(Math.Max(x.m_countdownMs, 1000) / 1000, sb);
slider.EnableActions();
MyTerminalControlFactory.AddControl(slider);
var startButton = new MyTerminalControlButton<MyWarhead>(
"StartCountdown",
MySpaceTexts.TerminalControlPanel_Warhead_StartCountdown,
MySpaceTexts.TerminalControlPanel_Warhead_StartCountdown,
(b) => MyMultiplayer.RaiseEvent(b, x => x.SetCountdown, true));
startButton.EnableAction();
MyTerminalControlFactory.AddControl(startButton);
var stopButton = new MyTerminalControlButton<MyWarhead>(
"StopCountdown",
MySpaceTexts.TerminalControlPanel_Warhead_StopCountdown,
MySpaceTexts.TerminalControlPanel_Warhead_StopCountdown,
(b) => MyMultiplayer.RaiseEvent(b, x => x.SetCountdown, false));
stopButton.EnableAction();
MyTerminalControlFactory.AddControl(stopButton);
MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyWarhead>());
var safetyCheckbox = new MyTerminalControlCheckbox<MyWarhead>(
"Safety",
MySpaceTexts.TerminalControlPanel_Warhead_Safety,
MySpaceTexts.TerminalControlPanel_Warhead_SafetyTooltip,
MySpaceTexts.TerminalControlPanel_Warhead_SwitchTextDisarmed,
MySpaceTexts.TerminalControlPanel_Warhead_SwitchTextArmed);
safetyCheckbox.Getter = (x) => !x.IsArmed;
safetyCheckbox.Setter = (x, v) => x.IsArmed = !v;
safetyCheckbox.EnableAction();
MyTerminalControlFactory.AddControl(safetyCheckbox);
var detonateButton = new MyTerminalControlButton<MyWarhead>(
"Detonate",
MySpaceTexts.TerminalControlPanel_Warhead_Detonate,
MySpaceTexts.TerminalControlPanel_Warhead_Detonate,
(b) => { if (b.IsArmed) { MyMultiplayer.RaiseEvent(b, x => x.DetonateRequest); } });
detonateButton.Enabled = (x) => x.IsArmed;
detonateButton.EnableAction();
MyTerminalControlFactory.AddControl(detonateButton);
}
示例6: CreateTerminalControls
static void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyShipConnector>())
return;
var throwOut = new MyTerminalControlOnOffSwitch<MyShipConnector>("ThrowOut", MySpaceTexts.Terminal_ThrowOut);
throwOut.Getter = (block) => block.ThrowOut;
throwOut.Setter = (block, value) => block.ThrowOut.Value = value;
throwOut.EnableToggleAction();
MyTerminalControlFactory.AddControl(throwOut);
var collectAll = new MyTerminalControlOnOffSwitch<MyShipConnector>("CollectAll", MySpaceTexts.Terminal_CollectAll);
collectAll.Getter = (block) => block.CollectAll;
collectAll.Setter = (block, value) => block.CollectAll.Value = value;
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;
var actionLock = lockBtn.EnableAction();
actionLock.Enabled = (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;
var actionUnlock = unlockBtn.EnableAction();
actionUnlock.Enabled = (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 = (b, sb) => b.WriteLockStateValue(sb);
switchLockAction.Enabled = (b) => b.m_connectorMode == Mode.Connector;
MyTerminalControlFactory.AddAction(switchLockAction);
var strength = new MyTerminalControlSlider<MyShipConnector>("Strength", MySpaceTexts.BlockPropertyTitle_Connector_Strength, MySpaceTexts.BlockPropertyDescription_Connector_Strength);
strength.Getter = (x) => x.Strength;
strength.Setter = (x, v) => x.Strength.Value = v;
strength.DefaultValue = MyObjectBuilder_ShipConnector.DefaultStrength;
strength.SetLogLimits(MinStrength, 1.0f);
strength.EnableActions(enabled: (b) => b.m_connectorMode == Mode.Connector);
strength.Enabled = (b) => b.m_connectorMode == Mode.Connector;
strength.Visible = (b) => b.m_connectorMode == Mode.Connector;
strength.Writer = (x, result) =>
{
if (x.Strength <= MinStrength)
result.Append(MyTexts.Get(MyCommonTexts.Disabled));
else
result.AppendFormatedDecimal("", x.Strength * 100, 4, " %");
};
MyTerminalControlFactory.AddControl(strength);
}
示例7: MyProjector
//.........这里部分代码省略.........
};
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);
var rotationZ = new MyTerminalControlSlider<MyProjector>("RotZ", MySpaceTexts.BlockPropertyTitle_ProjectionRotationZ, MySpaceTexts.Blank);
rotationZ.SetLimits(-2, 2);
rotationZ.DefaultValue = 0;
rotationZ.Getter = (x) => x.m_projectionRotation.Z;
rotationZ.Setter = (x, v) =>
{
x.m_projectionRotation.Z = Convert.ToInt32(v);
x.OnOffsetsChanged();
};
rotationZ.Writer = (x, result) => result.AppendInt32((int)x.m_projectionRotation.Z * 90).Append("°");
rotationZ.EnableActions(step: 0.2f);
rotationZ.Enabled = (x) => x.IsProjecting();
MyTerminalControlFactory.AddControl(rotationZ);
var scenarioSettingsSeparator = new MyTerminalControlSeparator<MyProjector>();
scenarioSettingsSeparator.Visible = (p) => p.ScenarioSettingsEnabled();
MyTerminalControlFactory.AddControl(scenarioSettingsSeparator);
var scenarioSettingsLabel = new MyTerminalControlLabel<MyProjector>("ScenarioLabel", MySpaceTexts.TerminalScenarioSettingsLabel);
scenarioSettingsLabel.Visible = (p) => p.ScenarioSettingsEnabled();
MyTerminalControlFactory.AddControl(scenarioSettingsLabel);
var spawnProjectionButton = new MyTerminalControlButton<MyProjector>("SpawnProjection", MySpaceTexts.BlockPropertyTitle_ProjectionSpawn, MySpaceTexts.Blank, (p) => p.TrySpawnProjection());
spawnProjectionButton.Visible = (p) => p.ScenarioSettingsEnabled();
spawnProjectionButton.Enabled = (p) => p.CanSpawnProjection();
spawnProjectionButton.EnableAction();
MyTerminalControlFactory.AddControl(spawnProjectionButton);
var instantBuildingCheckbox = new MyTerminalControlCheckbox<MyProjector>("InstantBuilding", MySpaceTexts.BlockPropertyTitle_Projector_InstantBuilding, MySpaceTexts.BlockPropertyTitle_Projector_InstantBuilding_Tooltip);
instantBuildingCheckbox.Visible = (p) => p.ScenarioSettingsEnabled();
instantBuildingCheckbox.Enabled = (p) => p.CanEnableInstantBuilding();
instantBuildingCheckbox.Getter = (p) => p.m_instantBuildingEnabled;
instantBuildingCheckbox.Setter = (p, v) => p.TrySetInstantBuilding(v);
MyTerminalControlFactory.AddControl(instantBuildingCheckbox);
var getOwnershipCheckbox = new MyTerminalControlCheckbox<MyProjector>("GetOwnership", MySpaceTexts.BlockPropertyTitle_Projector_GetOwnership, MySpaceTexts.BlockPropertiesTooltip_Projector_GetOwnership);
getOwnershipCheckbox.Visible = (p) => p.ScenarioSettingsEnabled();
getOwnershipCheckbox.Enabled = (p) => p.CanEditInstantBuildingSettings();
getOwnershipCheckbox.Getter = (p) => p.m_getOwnershipFromProjector;
getOwnershipCheckbox.Setter = (p, v) => p.TrySetGetOwnership(v);
MyTerminalControlFactory.AddControl(getOwnershipCheckbox);
var numberOfProjections = new MyTerminalControlSlider<MyProjector>("NumberOfProjections", MySpaceTexts.BlockPropertyTitle_Projector_NumberOfProjections, MySpaceTexts.BlockPropertyTitle_Projector_NumberOfProjections_Tooltip);
numberOfProjections.Visible = (p) => p.ScenarioSettingsEnabled();
numberOfProjections.Enabled = (p) => p.CanEditInstantBuildingSettings();
numberOfProjections.Getter = (p) => p.m_maxNumberOfProjections;
numberOfProjections.Setter = (p, v) => p.TryChangeNumberOfProjections(v);
numberOfProjections.Writer = (p, s) =>
{
if (p.m_maxNumberOfProjections == MAX_NUMBER_OF_PROJECTIONS)
{
s.AppendStringBuilder(MyTexts.Get(MySpaceTexts.ScreenTerminal_Infinite));
}
else
{
s.AppendInt32(p.m_maxNumberOfProjections);
}
};
numberOfProjections.SetLogLimits(1, MAX_NUMBER_OF_PROJECTIONS);
MyTerminalControlFactory.AddControl(numberOfProjections);
var numberOfBlocks = new MyTerminalControlSlider<MyProjector>("NumberOfBlocks", MySpaceTexts.BlockPropertyTitle_Projector_BlocksPerProjection, MySpaceTexts.BlockPropertyTitle_Projector_BlocksPerProjection_Tooltip);
numberOfBlocks.Visible = (p) => p.ScenarioSettingsEnabled();
numberOfBlocks.Enabled = (p) => p.CanEditInstantBuildingSettings();
numberOfBlocks.Getter = (p) => p.m_maxNumberOfBlocksPerProjection;
numberOfBlocks.Setter = (p, v) => p.TryChangeMaxNumberOfBlocksPerProjection(v);
numberOfBlocks.Writer = (p, s) =>
{
if (p.m_maxNumberOfBlocksPerProjection == MAX_NUMBER_OF_BLOCKS)
{
s.AppendStringBuilder(MyTexts.Get(MySpaceTexts.ScreenTerminal_Infinite));
}
else
{
s.AppendInt32(p.m_maxNumberOfBlocksPerProjection);
}
};
numberOfBlocks.SetLogLimits(1, MAX_NUMBER_OF_BLOCKS);
MyTerminalControlFactory.AddControl(numberOfBlocks);
}
示例8: CreateTerminalControls
static void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyTimerBlock>())
return;
var silent = new MyTerminalControlCheckbox<MyTimerBlock>("Silent", MySpaceTexts.BlockPropertyTitle_Silent, MySpaceTexts.ToolTipTimerBlock_Silent);
silent.Getter = (x) => x.Silent;
silent.Setter = (x, v) => x.Silent = v;
silent.EnableAction();
MyTerminalControlFactory.AddControl(silent);
var slider = new MyTerminalControlSlider<MyTimerBlock>("TriggerDelay", MySpaceTexts.TerminalControlPanel_TimerDelay, MySpaceTexts.TerminalControlPanel_TimerDelay);
slider.SetLogLimits(1, 60 * 60);
slider.DefaultValue = 10;
slider.Enabled = (x) => !x.IsCountingDown;
slider.Getter = (x) => x.TriggerDelay;
slider.Setter = (x, v) => x.m_timerSync.Value = ((int)(Math.Round(v, 1) * 1000));
slider.Writer = (x, sb) => MyValueFormatter.AppendTimeExact(Math.Max(x.m_countdownMsStart, 1000) / 1000, sb);
slider.EnableActions();
MyTerminalControlFactory.AddControl(slider);
var toolbarButton = new MyTerminalControlButton<MyTimerBlock>("OpenToolbar", MySpaceTexts.BlockPropertyTitle_TimerToolbarOpen, MySpaceTexts.BlockPropertyTitle_TimerToolbarOpen,
delegate(MyTimerBlock self)
{
m_openedToolbars.Add(self.Toolbar);
if (MyGuiScreenCubeBuilder.Static == null)
{
m_shouldSetOtherToolbars = true;
MyToolbarComponent.CurrentToolbar = self.Toolbar;
MyGuiScreenBase screen = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
MyToolbarComponent.AutoUpdate = false;
screen.Closed += (source) =>
{
MyToolbarComponent.AutoUpdate = true;
m_openedToolbars.Clear();
};
MyGuiSandbox.AddScreen(screen);
}
});
MyTerminalControlFactory.AddControl(toolbarButton);
var triggerButton = new MyTerminalControlButton<MyTimerBlock>("TriggerNow", MySpaceTexts.BlockPropertyTitle_TimerTrigger, MySpaceTexts.BlockPropertyTitle_TimerTrigger, (x) => x.OnTrigger());
triggerButton.EnableAction();
MyTerminalControlFactory.AddControl(triggerButton);
var startButton = new MyTerminalControlButton<MyTimerBlock>("Start", MySpaceTexts.BlockPropertyTitle_TimerStart, MySpaceTexts.BlockPropertyTitle_TimerStart, (x) => x.StartBtn());
startButton.EnableAction();
MyTerminalControlFactory.AddControl(startButton);
var stopButton = new MyTerminalControlButton<MyTimerBlock>("Stop", MySpaceTexts.BlockPropertyTitle_TimerStop, MySpaceTexts.BlockPropertyTitle_TimerStop, (x) => x.StopBtn());
stopButton.EnableAction();
MyTerminalControlFactory.AddControl(stopButton);
}
示例9: CreateTerminalControls
protected override void CreateTerminalControls()
{
if (MyTerminalControlFactory.AreControlsCreated<MyRadioAntenna>())
return;
base.CreateTerminalControls();
MyTerminalControlFactory.RemoveBaseClass<MyRadioAntenna, MyTerminalBlock>();
var show = new MyTerminalControlOnOffSwitch<MyRadioAntenna>("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<MyRadioAntenna>("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<MyRadioAntenna>("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<MyRadioAntenna>());
var broadcastRadius = new MyTerminalControlSlider<MyRadioAntenna>("Radius", MySpaceTexts.BlockPropertyTitle_BroadcastRadius, MySpaceTexts.BlockPropertyDescription_BroadcastRadius);
broadcastRadius.SetLogLimits((block) => 1, (block) => block.CubeGrid.GridSizeEnum == MyCubeSize.Large ? MyEnergyConstants.MAX_RADIO_POWER_RANGE : MyEnergyConstants.MAX_SMALL_RADIO_POWER_RANGE);
broadcastRadius.DefaultValueGetter = (block) => block.CubeGrid.GridSizeEnum == MyCubeSize.Large ? 10000 : 500;
broadcastRadius.Getter = (x) => x.RadioBroadcaster.BroadcastRadius;
broadcastRadius.Setter = (x, v) => x.m_radius.Value = v;
//broadcastRadius.Writer = (x, result) => result.Append(x.RadioBroadcaster.BroadcastRadius < MyEnergyConstants.MAX_RADIO_POWER_RANGE ? new StringBuilder().AppendDecimal(x.RadioBroadcaster.BroadcastRadius, 0).Append(" m") : MyTexts.Get(MySpaceTexts.ScreenTerminal_Infinite));
broadcastRadius.Writer = (x, result) =>
{
result.Append(new StringBuilder().AppendDecimal(x.RadioBroadcaster.BroadcastRadius, 0).Append(" m"));
};
broadcastRadius.EnableActions();
MyTerminalControlFactory.AddControl(broadcastRadius);
var enableBroadcast = new MyTerminalControlCheckbox<MyRadioAntenna>("EnableBroadCast", MySpaceTexts.Antenna_EnableBroadcast, MySpaceTexts.Antenna_EnableBroadcast);
enableBroadcast.Getter = (x) => x.RadioBroadcaster.Enabled;
enableBroadcast.Setter = (x, v) => x.m_enableBroadcasting.Value = v;
enableBroadcast.EnableAction();
MyTerminalControlFactory.AddControl(enableBroadcast);
var showShipName = new MyTerminalControlCheckbox<MyRadioAntenna>("ShowShipName", MySpaceTexts.BlockPropertyTitle_ShowShipName, MySpaceTexts.BlockPropertyDescription_ShowShipName);
showShipName.Getter = (x) => x.ShowShipName;
showShipName.Setter = (x, v) => x.ShowShipName = v;
showShipName.EnableAction();
MyTerminalControlFactory.AddControl(showShipName);
}