本文整理汇总了C#中ZACommons.Echo方法的典型用法代码示例。如果您正苦于以下问题:C# ZACommons.Echo方法的具体用法?C# ZACommons.Echo怎么用?C# ZACommons.Echo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZACommons
的用法示例。
在下文中一共展示了ZACommons.Echo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public void Display(ZACommons commons)
{
if (Indexes.Count > 0)
{
commons.Echo("Sequencer active: " + string.Join(", ", Indexes.Keys));
}
}
示例2: Run
public void Run(ZACommons commons, EventDriver eventDriver)
{
if (!Active) return;
TotalPower = 0.0f;
var solarGroups = commons.GetBlockGroupsWithPrefix(MAX_POWER_GROUP_PREFIX);
for (var e = solarGroups.GetEnumerator(); e.MoveNext();)
{
var group = e.Current;
var rotor = GetRotor(group);
if (rotor == null)
{
commons.Echo(string.Format("Group {0} ignored; needs exactly 1 rotor", group.Name));
continue;
}
else if (rotor.CubeGrid != commons.Me.CubeGrid)
{
// Skip if rotor is on a different grid than this programmable block
continue;
}
var solarPanelDetails = new SolarPanelDetails(group);
var currentMaxPower = solarPanelDetails.MaxPowerOutput;
float maxPower;
if (!MaxPowers.TryGetValue(group.Name, out maxPower)) maxPower = -100.0f;
var minError = solarPanelDetails.DefinedPowerOutput * SOLAR_ROTOR_MIN_ERROR;
var delta = currentMaxPower - maxPower;
MaxPowers[group.Name] = currentMaxPower;
if (delta > minError || currentMaxPower < minError /* failsafe */)
{
// Keep going
rotor.SetValue<bool>("OnOff", true);
}
else if (delta < -minError)
{
// Back up
rotor.SetValue<bool>("OnOff", true);
rotor.ApplyAction("Reverse");
}
else
{
// Hold still for a moment
rotor.SetValue<bool>("OnOff", false);
}
TotalPower += currentMaxPower;
}
eventDriver.Schedule(RunDelay, Run);
}
示例3: Display
public void Display(ZACommons commons)
{
if (PRODUCTION_MANAGER_SETUP)
{
commons.Echo("Setup complete. Set PRODUCTION_MANAGER_SETUP to false to enable ProductionManager");
}
else
{
commons.Echo("Production Manager: " +
(CurrentState == STATE_INACTIVE ? "Paused" : "Active"));
}
}
示例4: Display
public void Display(ZACommons commons)
{
switch (Mode)
{
case IDLE:
break;
case BURNING:
commons.Echo("VTVL: Burn phase");
if (Autodrop) commons.Echo("Auto-drop starting");
break;
case GLIDING:
commons.Echo("VTVL: Glide phase");
if (Autodrop)
{
commons.Echo(string.Format("Elevation: {0:F2} m", Elevation));
commons.Echo(string.Format("Brake Distance: {0:F2} m", Distance));
}
break;
case BRAKING:
commons.Echo("VTVL: Braking");
break;
case APPROACHING:
commons.Echo("VTVL: Approach phase");
commons.Echo(string.Format("Elevation: {0:F2} m", Elevation));
commons.Echo(string.Format("Stop Distance: {0:F2} m", Distance));
break;
case LAUNCHING:
commons.Echo("VTVL: Launching");
break;
case ORBITING:
commons.Echo("VTVL: Orbiting");
break;
}
}
示例5: Display
public void Display(ZACommons commons)
{
switch (Mode)
{
case IDLE:
break;
case UNDOCKING:
commons.Echo("SmartUndock: Undocking");
break;
case RETURNING:
commons.Echo("SmartUndock: Returning");
break;
case ORIENTING:
commons.Echo("SmartUndock: Orienting");
break;
}
}
示例6: Run
public void Run(ZACommons commons)
{
var batteries = GetBatteries(commons);
if (CurrentState == null)
{
// First time run, get to known state and return
CurrentState = STATE_NORMAL;
SinceLastStateChange = TimeSpan.FromSeconds(0);
ZACommons.SetBatteryRecharge(batteries, false);
return;
}
SinceLastStateChange += commons.Program.ElapsedTime;
var aggregateDetails = new AggregateBatteryDetails(batteries);
string stateStr = "Unknown";
switch (CurrentState)
{
case STATE_NORMAL:
if (SinceLastStateChange >= DischargeInterval)
{
// Don't check again until next interval, regardless of whether we
// change state
SinceLastStateChange = TimeSpan.FromSeconds(0);
// Only recharge if there is available power, e.g. the batteries have no load,
// and there is need to
if (aggregateDetails.CurrentPowerOutput == 0.0f &&
aggregateDetails.CurrentStoredPower < aggregateDetails.MaxStoredPower &&
Active)
{
CurrentState = STATE_RECHARGE;
ZACommons.SetBatteryRecharge(batteries, true);
}
else
{
// Force discharge, just in case
ZACommons.SetBatteryRecharge(batteries, false);
}
}
stateStr = Active ? "Normal" : "Paused";
break;
case STATE_RECHARGE:
// Too bad we don't have access to battery input (w/o parsing DetailInfo)
// Then we could figure out non-battery load and cancel recharge pre-emptively
// when needed
if (SinceLastStateChange >= RechargeInterval)
{
CurrentState = STATE_NORMAL;
SinceLastStateChange = TimeSpan.FromSeconds(0);
ZACommons.SetBatteryRecharge(batteries, false);
}
stateStr = "Recharging";
break;
case STATE_DISABLED:
// Switch back to auto if full
if (aggregateDetails.CurrentStoredPower >= aggregateDetails.MaxStoredPower)
{
CurrentState = STATE_NORMAL;
SinceLastStateChange = TimeSpan.FromSeconds(0);
ZACommons.SetBatteryRecharge(batteries, false);
}
stateStr = "Disabled";
break;
}
// See if we have a net power loss
var newDraining = AddDrainData(aggregateDetails.CurrentPowerOutput > 0.0f);
if (powerDrainHandler != null)
{
if (!Draining && newDraining)
{
powerDrainHandler.PowerDrainStarted(commons);
}
else if (Draining && !newDraining)
{
powerDrainHandler.PowerDrainEnded(commons);
}
}
Draining = newDraining;
commons.Echo(string.Format("Battery Manager: {0}", stateStr));
commons.Echo(string.Format("Total Stored Power: {0}h", ZACommons.FormatPower(aggregateDetails.CurrentStoredPower)));
commons.Echo(string.Format("Max Stored Power: {0}h", ZACommons.FormatPower(aggregateDetails.MaxStoredPower)));
if (Draining) commons.Echo("Net power loss!");
}
示例7: Display
public void Display(ZACommons commons)
{
commons.Echo(Result.ToString());
}
示例8: Display
public void Display(ZACommons commons)
{
if (Mode != IDLE)
{
commons.Echo("Damage Control: Active");
}
}
示例9: Display
public void Display(ZACommons commons)
{
if (!Active)
{
commons.Echo("Solar Max Power: Paused");
}
else
{
commons.Echo(string.Format("Solar Max Power: {0}", ZACommons.FormatPower(CurrentMaxPower)));
}
}
示例10: Display
public void Display(ZACommons commons)
{
if (Active)
{
commons.Echo("Cruise control active");
commons.Echo(string.Format("Set Speed: {0:F1} m/s", TargetSpeed));
commons.Echo(string.Format("Actual Speed: {0:F1} m/s", CurrentSpeed));
}
}