本文整理汇总了C#中ZACommons.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ZACommons.GetValue方法的具体用法?C# ZACommons.GetValue怎么用?C# ZACommons.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZACommons
的用法示例。
在下文中一共展示了ZACommons.GetValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(ZACommons commons, EventDriver eventDriver)
{
var previous = commons.GetValue(LOSMinerKey);
if (previous != null)
{
var parts = previous.Split(';');
if (parts.Length == 13)
{
// Resume original mode and line-of-sight vector
var newMode = int.Parse(parts[0]);
StartPoint = new Vector3D();
StartDirection = new Vector3D();
StartUp = new Vector3D();
StartLeft = new Vector3D();
for (int i = 0; i < 3; i++)
{
StartPoint.SetDim(i, double.Parse(parts[i+1]));
StartDirection.SetDim(i, double.Parse(parts[i+4]));
StartUp.SetDim(i, double.Parse(parts[i+7]));
StartLeft.SetDim(i, double.Parse(parts[i+10]));
}
if (newMode == MINING)
{
Start((ShipControlCommons)commons, eventDriver);
}
else if (newMode == REVERSING)
{
StartReverse((ShipControlCommons)commons, eventDriver);
}
}
}
}
示例2: Init
public void Init(ZACommons commons, EventDriver eventDriver,
Func<ZACommons, EventDriver, bool> livenessCheck = null)
{
LivenessCheck = livenessCheck;
var lastCommand = commons.GetValue(LastCommandKey);
if (lastCommand != null)
{
HandleCommand(commons, eventDriver, lastCommand);
}
}
示例3: Init
public void Init(ZACommons commons, EventDriver eventDriver,
Func<ZACommons, EventDriver, bool> livenessCheck = null)
{
LivenessCheck = livenessCheck;
var lastCommand = commons.GetValue(LastCommandKey);
if (lastCommand != null)
{
HandleCommand(commons, eventDriver, lastCommand);
// Can't trust current state, force a reset on "cruise stop"
ThrusterStates.Clear();
FirstStop = true;
}
}
示例4: ConditionalInit
public void ConditionalInit(ZACommons commons, EventDriver eventDriver,
bool defaultActive = false)
{
var activeValue = commons.GetValue(ActiveKey);
if (activeValue != null)
{
bool active;
if (Boolean.TryParse(activeValue, out active))
{
if (active) Init(commons, eventDriver);
return;
}
}
if (defaultActive) Init(commons, eventDriver);
}
示例5: Init
public void Init(ZACommons commons, EventDriver eventDriver)
{
Mode = IDLE;
var modeString = commons.GetValue(ModeKey);
if (modeString != null)
{
var newMode = int.Parse(modeString);
switch (newMode)
{
case IDLE:
break;
case ACTIVE:
Start(commons, eventDriver, false);
break;
case AUTO:
Start(commons, eventDriver, true);
break;
}
}
}
示例6: Init
public void Init(ZACommons commons, EventDriver eventDriver)
{
var stateValue = commons.GetValue(StateKey);
if (stateValue != null)
{
int state;
if (int.TryParse(stateValue, out state))
{
// Use remembered state
CurrentState = state;
// Should really validate, but eh...
}
}
else
{
CurrentState = STATE_ACTIVE;
}
if (PRODUCTION_MANAGER_SETUP)
{
Setup(LIMIT_PRODUCTION_MANAGER_SAME_GRID ? commons.Blocks : commons.AllBlocks);
}
else if (CurrentState != STATE_INACTIVE)
{
eventDriver.Schedule(0.0, Run);
}
}
示例7: Init
public void Init(ZACommons commons, EventDriver eventDriver)
{
UndockTarget = null;
var previousTarget = commons.GetValue(UndockTargetKey);
if (previousTarget != null)
{
var parts = previousTarget.Split(';');
if (parts.Length == 9)
{
var newTarget = new Vector3D();
UndockForward = new Vector3D();
UndockUp = new Vector3D();
for (int i = 0; i < 3; i++)
{
newTarget.SetDim(i, double.Parse(parts[i]));
UndockForward.SetDim(i, double.Parse(parts[3+i]));
UndockUp.SetDim(i, double.Parse(parts[6+i]));
}
UndockTarget = newTarget; // Set only if all successfully parsed
}
}
UndockBackward = null;
var backwardString = commons.GetValue(BackwardKey);
if (backwardString != null)
{
// Enum.Parse apparently works, but I don't trust Keen
// not breaking it in the future (by making typeof() illegal)
//UndockBackward = (Base6Directions.Direction)Enum.Parse(typeof(Base6Directions.Direction), backwardString);
UndockBackward = (Base6Directions.Direction)byte.Parse(backwardString);
}
Mode = IDLE;
var modeString = commons.GetValue(ModeKey);
if (modeString != null)
{
Mode = int.Parse(modeString);
switch (Mode)
{
case IDLE:
break;
case UNDOCKING:
if (UndockTarget != null && UndockBackward != null)
{
BeginUndock(commons, eventDriver);
}
else ResetMode(commons);
break;
case RETURNING:
if (UndockTarget != null)
{
BeginReturn(commons, eventDriver);
}
else ResetMode(commons);
break;
case ORIENTING:
if (UndockTarget != null)
{
ReorientStart(commons, eventDriver);
}
else ResetMode(commons);
break;
}
}
}