本文整理汇总了C#中ParameterCollection.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection.Cast方法的具体用法?C# ParameterCollection.Cast怎么用?C# ParameterCollection.Cast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterCollection
的用法示例。
在下文中一共展示了ParameterCollection.Cast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Client_ScriptCommand
private void Client_ScriptCommand(ParameterCollection Parameters)
{
if (Player.Character.isInVehicle())
{
System.IO.File.AppendAllText("saved.txt",
"api.createVehicle(" + Player.Character.CurrentVehicle.Model.ToString() + ", new Vector3(" + Player.Character.CurrentVehicle.Position.X + "f, " +
Player.Character.CurrentVehicle.Position.Y + "f, " +
Player.Character.CurrentVehicle.Position.Z + "f), new Quaternion(" +
Player.Character.CurrentVehicle.RotationQuaternion.X + "f, " +
Player.Character.CurrentVehicle.RotationQuaternion.Y + "f, " +
Player.Character.CurrentVehicle.RotationQuaternion.Z + "f, " +
Player.Character.CurrentVehicle.RotationQuaternion.W + "f)); //" +
(Parameters.Count > 0 ? String.Join(" ", Parameters.Cast<string>()) : "") + "\r\n");
}
else
{
System.IO.File.AppendAllText("saved.txt",
"pos = " + Player.Character.Position.X + "f, " +
Player.Character.Position.Y + "f, " +
Player.Character.Position.Z + "f; heading = " + Player.Character.Heading + "f; //" +
(Parameters.Count > 0 ? Parameters[0].ToString() : "") + "\r\n");
}
}
示例2: Client_SaveAllCommand
private void Client_SaveAllCommand(ParameterCollection Parameters)
{
if (savedPositions == null) savedPositions = new List<Vector3>();
var vehicles = World.GetVehicles(World.GetGroundPosition(Game.CurrentCamera.Position, GroundType.Lowest), 300.0f);
int count = 0;
System.IO.File.AppendAllText("vehiclesavesession.txt", "// session date: " + DateTime.Now.ToLongDateString());
foreach (var vehicle in vehicles)
{
bool skip = false;
foreach (var position in savedPositions)
{
if (vehicle.Position.DistanceTo(position) < 70.0f)
{
skip = true;
break;
}
}
if (skip) continue;
System.IO.File.AppendAllText("vehiclesavesession.txt",
"api.createVehicle(" + vehicle.Model.ToString() + ", new Vector3(" + vehicle.Position.X + "f, " +
vehicle.Position.Y + "f, " +
vehicle.Position.Z + "f), new Quaternion(" +
vehicle.RotationQuaternion.X + "f, " +
vehicle.RotationQuaternion.Y + "f, " +
vehicle.RotationQuaternion.Z + "f, " +
vehicle.RotationQuaternion.W + "f)); //" +
(Parameters.Count > 0 ? String.Join(" ", Parameters.Cast<string>()) : "") + "\r\n");
count++;
}
savedPositions.Add(Player.Character.Position);
Game.Console.Print("Saved " + count.ToString());
}