本文整理汇总了C#中LuaValue.Count方法的典型用法代码示例。如果您正苦于以下问题:C# LuaValue.Count方法的具体用法?C# LuaValue.Count怎么用?C# LuaValue.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaValue
的用法示例。
在下文中一共展示了LuaValue.Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: proxyLandAt
public LuaValue proxyLandAt(LuaValue[] args)
{
if (args.Count() < 2 && args.Count() > 3)
{
throw new Exception("landAt usage: landAt(latitude, longitude) or landAt(latitude, longitude, autoWarpOnDescent)");
}
double argLatitude;
double argLongitude;
try
{
argLatitude = ((LuaNumber)args[0]).Number;
}
catch (Exception)
{
throw new Exception("landAt: invalid latitude");
}
try
{
argLongitude = ((LuaNumber)args[1]).Number;
}
catch (Exception)
{
throw new Exception("landAt: invalid longitude");
}
if (args.Count() == 3)
{
try
{
autoWarpOnDescent = ((LuaBoolean)args[2]).BoolValue;
}
catch (Exception)
{
throw new Exception("landAt: invalid autoWarpOnDescent");
}
}
else
{
autoWarpOnDescent = true;
}
landAt(argLatitude, argLongitude);
return LuaNil.Nil;
}
示例2: proxyWarpToEvent
public LuaValue proxyWarpToEvent(LuaValue[] args)
{
if (args.Count() == 0 || args.Count() > 2) throw new Exception("warpToEvent usage: warpToEvent(event) or warpToEvent(event, lead time)");
try
{
if (args[0].ToString().ToLower().Contains("pe")) warpPoint = WarpPoint.PERIAPSIS;
else if (args[0].ToString().ToLower().Contains("ap")) warpPoint = WarpPoint.APOAPSIS;
else if (args[0].ToString().ToLower().Contains("soi")) warpPoint = WarpPoint.SOI_CHANGE;
else throw new Exception("warpToEvent: event must be one of \"pe\", \"ap\", \"soi\"");
}
catch (Exception)
{
throw new Exception("warpToEvent: invalid event");
}
if (args.Count() == 2)
{
try
{
warpTimeOffset = ((LuaNumber)args[1]).Number;
}
catch (Exception)
{
throw new Exception("warpToEvent: invalid lead time");
}
}
else
{
warpTimeOffset = 0;
}
warpTimeOffsetString = warpTimeOffset.ToString();
this.enabled = true;
core.controlClaim(this);
currentOperation = Operation.WARP;
guiTab = Operation.WARP;
return LuaNil.Nil;
}
示例3: proxyHold
public LuaValue proxyHold(LuaValue[] args)
{
if (args.Count() != 2) throw new Exception("ilsHold usage: ilsHold(altitude [in meters], heading [in degrees])");
double altitude;
double heading;
try
{
altitude = ((LuaNumber)args[0]).Number;
}
catch (Exception)
{
throw new Exception("ilsHold: invalid altitude");
}
try
{
heading = ((LuaNumber)args[1]).Number;
}
catch (Exception)
{
throw new Exception("ilsHold: invalid heading");
}
hold(altitude, heading);
return LuaNil.Nil;
}
示例4: proxyChangePe
public LuaValue proxyChangePe(LuaValue[] args)
{
if (args.Count() != 1) throw new Exception("changePe usage: changePe(periapsis [in meters])");
try
{
newPeA = ((LuaNumber)args[0]).Number;
}
catch (Exception)
{
throw new Exception("changePe: invalid periapsis");
}
newPeAString = (newPeA / 1000.0).ToString();
this.enabled = true;
core.controlClaim(this);
currentOperation = Operation.PERIAPSIS;
raisingApsis = (part.vessel.orbit.PeA < newPeA);
guiTab = Operation.PERIAPSIS;
return LuaNil.Nil;
}
示例5: proxyTransfer
public LuaValue proxyTransfer(LuaValue[] args)
{
if (args.Count() != 2) throw new Exception("transfer usage: transfer(target body, final periapsis [in meters])");
try
{
foreach (CelestialBody body in part.vessel.mainBody.orbitingBodies)
{
if (body.name.ToLower().Contains(args[0].ToString().ToLower()))
{
transferTarget = body;
break;
}
}
}
catch (Exception)
{
throw new Exception("transfer: invalid target body");
}
try
{
desiredPostTransferPeA = ((LuaNumber)args[1]).Number;
}
catch (Exception)
{
throw new Exception("transfer: invalid final periapsis");
}
desiredPostTransferPeAString = (desiredPostTransferPeA / 1000.0).ToString();
this.enabled = true;
core.controlClaim(this);
currentOperation = Operation.TRANSFER_INJECTION;
transState = TRANSState.WAITING_FOR_INJECTION;
guiTab = Operation.TRANSFER_INJECTION;
return LuaNil.Nil;
}
示例6: proxyAttitudeTo
public LuaValue proxyAttitudeTo(LuaValue[] arg)
{
if ((arg.Count() != 2) || !(arg[0] is LuaTable))
{
throw new Exception("usage: attitudeTo(vector, reference)");
}
AttitudeReference r;
try
{
r = (AttitudeReference)Enum.Parse(typeof(AttitudeReference), arg[1].ToString(), true);
}
catch (Exception)
{
throw new Exception("attitudeTo: invalid reference");
}
if (((LuaTable)arg[0]).Count == 4)
{
Quaternion dir;
try
{
dir = LuaUtils.valueToQuaternion(arg[0]);
}
catch (Exception e)
{
throw new Exception("attitudeTo: invalid quaternion - " + e.Message);
}
return LuaBoolean.From(attitudeTo(dir, r, autom8));
}
else
{
Vector3d dir;
try
{
dir = LuaUtils.valueToVector3d(arg[0]);
}
catch (Exception e)
{
throw new Exception("attitudeTo: invalid vector - " + e.Message);
}
return LuaBoolean.From(attitudeTo(dir, r, autom8));
}
}
示例7: proxyChangeApAndPe
public LuaValue proxyChangeApAndPe(LuaValue[] args)
{
if (args.Count() != 2) throw new Exception("changeAp usage: changeApAndPe(apoapsis[in meters], periapsis [in meters])");
try
{
newApA = ((LuaNumber)args[0]).Number;
}
catch (Exception)
{
throw new Exception("changeAp: invalid apoapsis");
}
try
{
newPeA = ((LuaNumber)args[1]).Number;
}
catch (Exception)
{
throw new Exception("changeApAndPe: invalid periapsis");
}
newApAString = (newApA / 1000.0).ToString();
newPeAString = (newPeA / 1000.0).ToString();
this.enabled = true;
core.controlClaim(this);
currentOperation = Operation.ELLIPTICIZE;
guiTab = Operation.ELLIPTICIZE;
return LuaNil.Nil;
}
示例8: proxyThrustActivate
public LuaValue proxyThrustActivate(LuaValue[] arg)
{
TMode t = TMode.DIRECT;
if ((arg.Count() > 1) && (arg[1] is LuaString)) {
try
{
t = (TMode)Enum.Parse(typeof(TMode), arg[1].ToString(), true);
}
catch (Exception)
{
throw new Exception("thrustActivate: invalid mode");
}
}
return LuaBoolean.From(thrustActivate(autom8, ((arg.Count() > 0) && (arg[0] is LuaNumber)) ? (float)(arg[0] as LuaNumber).Number : 0, t));
}
示例9: proxyWarpIncrease
public LuaValue proxyWarpIncrease(LuaValue[] arg)
{
return LuaBoolean.From(warpIncrease(autom8, (arg.Count() > 0) ? arg[0].GetBooleanValue() : true, ((arg.Count() > 1) && (arg[1] is LuaNumber)) ? (arg[1] as LuaNumber).Number : 10000));
}
示例10: proxyGetModule
public LuaValue proxyGetModule(LuaValue[] arg)
{
return ObjectToLua.ToLuaValue(getModule((arg.Count() > 0) ? arg[0].ToString() : ""));
}
示例11: proxyLandActivate
//public LuaValue proxySetTarget(LuaValue[] arg) { }
public LuaValue proxyLandActivate(LuaValue[] arg)
{
return LuaBoolean.From(landActivate(autom8, ((arg.Count() > 0) && (arg[0] is LuaNumber)) ? (arg[0] as LuaNumber).Number : 0.5));
}
示例12: proxyControlRelease
public LuaValue proxyControlRelease(LuaValue[] arg)
{
return LuaBoolean.From(controlRelease(autom8, (arg.Count() > 0) ? arg[0].GetBooleanValue() : false));
}
示例13: proxyAutoStageActivate
public LuaValue proxyAutoStageActivate(LuaValue[] arg)
{
return LuaBoolean.From(autoStageActivate(autom8, ((arg.Count() > 0) && (arg[0] is LuaNumber)) ? (arg[0] as LuaNumber).Number : 1.0, ((arg.Count() > 1) && (arg[1] is LuaNumber)) ? (int)(arg[1] as LuaNumber).Number : 0));
}
示例14: proxyAttitudeWorldToReference
public LuaValue proxyAttitudeWorldToReference(LuaValue[] arg)
{
if (arg.Count() != 2)
{
throw new Exception("usage: attitudeWorldToReference(vector, reference)");
}
Vector3d dir;
try
{
dir = LuaUtils.valueToVector3d(arg[0]);
}
catch (Exception e)
{
throw new Exception("attitudeWorldToReference: invalid vector - " + e.Message);
}
AttitudeReference r;
try
{
r = (AttitudeReference)Enum.Parse(typeof(AttitudeReference), arg[1].ToString(), true);
}
catch (Exception)
{
throw new Exception("attitudeWorldToReference: invalid reference");
}
return LuaUtils.Vector3dToTable(attitudeWorldToReference(dir, r));
}
示例15: proxySetLanding
public LuaValue proxySetLanding(LuaValue[] args)
{
if (args.Count() < 2)
{
throw new Exception("setLanding usage: setLanding(latitude, longitude)");
}
double argLatitude;
double argLongitude;
try
{
argLatitude = ((LuaNumber)args[0]).Number;
}
catch (Exception)
{
throw new Exception("landAt: invalid latitude");
}
try
{
argLongitude = ((LuaNumber)args[1]).Number;
}
catch (Exception)
{
throw new Exception("landAt: invalid longitude");
}
setLanding(argLatitude, argLongitude);
return LuaNil.Nil;
}