本文整理汇总了C#中OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetVector3Item方法的典型用法代码示例。如果您正苦于以下问题:C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetVector3Item方法的具体用法?C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetVector3Item怎么用?C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetVector3Item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
的用法示例。
在下文中一共展示了OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetVector3Item方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tsuccirEvenlyDistributeChildPrims
public int tsuccirEvenlyDistributeChildPrims(UUID host, UUID script, object[] argsObj)
{
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
hostPart.AddScriptLPS(1);
LSL_List args = new LSL_List();
args.Data = argsObj;
LSL_Vector size = args.GetVector3Item(0);
LSL_Vector point = args.GetVector3Item(1);
LSL_Rotation rot = args.GetQuaternionItem(2);
LSL_Vector distribution = args.GetVector3Item(3);
LSL_Vector margin = args.GetVector3Item(4);
return EvenlyDistributeChildPrims(hostPart.ParentGroup, size, point, rot, distribution, margin) ? 1 : 0;
}
示例2: tsuccirEvenlyDistributeChildPrimsInOtherObject
public int tsuccirEvenlyDistributeChildPrimsInOtherObject(UUID host, UUID script, string otherObject, object[] argsObj)
{
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
hostPart.AddScriptLPS(1);
LSL_List args = new LSL_List();
args.Data = argsObj;
LSL_Vector size;
LSL_Vector point;
LSL_Rotation rot;
LSL_Vector distribution;
LSL_Vector margin;
try
{
size = args.GetVector3Item(0);
point = args.GetVector3Item(1);
rot = args.GetQuaternionItem(2);
distribution = args.GetVector3Item(3);
margin = args.GetVector3Item(4);
}
catch (Exception e)
{
ScriptError(hostPart, e.Message);
return 0;
}
UUID otherObjectKey;
if (!UUID.TryParse(otherObject, out otherObjectKey))
{
ScriptError(hostPart, "Other object key is not a valid UUID");
return 0;
}
SceneObjectPart other = hostPart.ParentGroup.Scene.GetSceneObjectPart(otherObjectKey);
if (other == null)
{
ScriptError(hostPart, "Other object could not be found");
return 0;
}
return EvenlyDistributeChildPrims(other.ParentGroup, size, point, rot, distribution, margin) ? 1 : 0;
}
示例3: SetParticleSystem
private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
if (rules.Length == 0)
{
part.RemoveParticleSystem();
part.ParentGroup.HasGroupChanged = true;
}
else
{
Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
LSL_Vector tempv = new LSL_Vector();
float tempf = 0;
for (int i = 0; i < rules.Length; i += 2)
{
switch (rules.GetLSLIntegerItem(i))
{
case (int)ScriptBaseClass.PSYS_PART_FLAGS:
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
break;
case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
tempv = rules.GetVector3Item(i + 1);
prules.PartStartColor.R = (float)tempv.x;
prules.PartStartColor.G = (float)tempv.y;
prules.PartStartColor.B = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartStartColor.A = tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
tempv = rules.GetVector3Item(i + 1);
prules.PartEndColor.R = (float)tempv.x;
prules.PartEndColor.G = (float)tempv.y;
prules.PartEndColor.B = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartEndColor.A = tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
tempv = rules.GetVector3Item(i + 1);
prules.PartStartScaleX = (float)tempv.x;
prules.PartStartScaleY = (float)tempv.y;
break;
case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
tempv = rules.GetVector3Item(i + 1);
prules.PartEndScaleX = (float)tempv.x;
prules.PartEndScaleY = (float)tempv.y;
break;
case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartMaxAge = tempf;
break;
case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
tempv = rules.GetVector3Item(i + 1);
prules.PartAcceleration.X = (float)tempv.x;
prules.PartAcceleration.Y = (float)tempv.y;
prules.PartAcceleration.Z = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
break;
// PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
// PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
// client tells the difference between the two by looking at the 0x02 bit in
// the PartFlags variable.
case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.InnerAngle = (float)tempf;
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
break;
case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.OuterAngle = (float)tempf;
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
break;
case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstRate = (float)tempf;
break;
//.........这里部分代码省略.........
示例4: SetPrimParams
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
{
int idx = 0;
bool positionChanged = false;
LSL_Vector currentPosition = GetPartLocalPos(part);
try
{
while (idx < rules.Length)
{
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
int face;
LSL_Vector v;
switch (code)
{
case (int)ScriptBaseClass.PRIM_POSITION:
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
if (remain < 1)
return;
v=rules.GetVector3Item(idx++);
positionChanged = true;
currentPosition = GetSetPosTarget(part, v, currentPosition);
break;
case (int)ScriptBaseClass.PRIM_SIZE:
if (remain < 1)
return;
v=rules.GetVector3Item(idx++);
SetScale(part, v);
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
if (remain < 1)
return;
LSL_Rotation q = rules.GetQuaternionItem(idx++);
// try to let this work as in SL...
if (part.ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
SetRot(part, Rot2Quaternion(q));
}
else
{
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectPart rootPart = part.ParentGroup.RootPart;
SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
}
break;
case (int)ScriptBaseClass.PRIM_TYPE:
if (remain < 3)
return;
code = (int)rules.GetLSLIntegerItem(idx++);
remain = rules.Length - idx;
float hollow;
LSL_Vector twist;
LSL_Vector taper_b;
LSL_Vector topshear;
float revolutions;
float radiusoffset;
float skew;
LSL_Vector holesize;
LSL_Vector profilecut;
switch (code)
{
case (int)ScriptBaseClass.PRIM_TYPE_BOX:
if (remain < 6)
return;
face = (int)rules.GetLSLIntegerItem(idx++);
v = rules.GetVector3Item(idx++); // cut
hollow = (float)rules.GetLSLFloatItem(idx++);
twist = rules.GetVector3Item(idx++);
taper_b = rules.GetVector3Item(idx++);
topshear = rules.GetVector3Item(idx++);
SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
(byte)ProfileShape.Square, (byte)Extrusion.Straight);
break;
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
if (remain < 6)
return;
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
v = rules.GetVector3Item(idx++); // cut
hollow = (float)rules.GetLSLFloatItem(idx++);
twist = rules.GetVector3Item(idx++);
//.........这里部分代码省略.........
示例5: llParticleSystem
public void llParticleSystem(LSL_List rules)
{
m_host.AddScriptLPS(1);
if (rules.Length == 0)
{
m_host.RemoveParticleSystem();
m_host.ParentGroup.HasGroupChanged = true;
}
else
{
Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
LSL_Vector tempv = new LSL_Vector();
float tempf = 0;
for (int i = 0; i < rules.Length; i += 2)
{
switch ((int)rules.Data[i])
{
case (int)ScriptBaseClass.PSYS_PART_FLAGS:
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
break;
case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
tempv = rules.GetVector3Item(i + 1);
prules.PartStartColor.R = (float)tempv.x;
prules.PartStartColor.G = (float)tempv.y;
prules.PartStartColor.B = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartStartColor.A = tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
tempv = rules.GetVector3Item(i + 1);
prules.PartEndColor.R = (float)tempv.x;
prules.PartEndColor.G = (float)tempv.y;
prules.PartEndColor.B = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartEndColor.A = tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
tempv = rules.GetVector3Item(i + 1);
prules.PartStartScaleX = (float)tempv.x;
prules.PartStartScaleY = (float)tempv.y;
break;
case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
tempv = rules.GetVector3Item(i + 1);
prules.PartEndScaleX = (float)tempv.x;
prules.PartEndScaleY = (float)tempv.y;
break;
case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartMaxAge = tempf;
break;
case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
tempv = rules.GetVector3Item(i + 1);
prules.PartAcceleration.X = (float)tempv.x;
prules.PartAcceleration.Y = (float)tempv.y;
prules.PartAcceleration.Z = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
break;
case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstRate = (float)tempf;
break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1);
break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstRadius = (float)tempf;
break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.BurstSpeedMin = (float)tempf;
break;
case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
//.........这里部分代码省略.........
示例6: SetPrimParams
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
{
int idx = 0;
while (idx < rules.Length)
{
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
int face;
LSL_Vector v;
switch (code)
{
case (int)ScriptBaseClass.PRIM_POSITION:
if (remain < 1)
return;
v=rules.GetVector3Item(idx++);
SetPos(part, v);
break;
case (int)ScriptBaseClass.PRIM_SIZE:
if (remain < 1)
return;
v=rules.GetVector3Item(idx++);
SetScale(part, v);
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
if (remain < 1)
return;
LSL_Rotation q = rules.GetQuaternionItem(idx++);
// try to let this work as in SL...
if (part.ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
SetRot(part, Rot2Quaternion(q));
}
else
{
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectGroup group = part.ParentGroup;
if (group != null) // a bit paranoid, maybe
{
SceneObjectPart rootPart = group.RootPart;
if (rootPart != null) // again, better safe than sorry
{
SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
}
}
}
break;
case (int)ScriptBaseClass.PRIM_TYPE:
if (remain < 3)
return;
code = (int)rules.GetLSLIntegerItem(idx++);
remain = rules.Length - idx;
float hollow;
LSL_Vector twist;
LSL_Vector taper_b;
LSL_Vector topshear;
float revolutions;
float radiusoffset;
float skew;
LSL_Vector holesize;
LSL_Vector profilecut;
switch (code)
{
case (int)ScriptBaseClass.PRIM_TYPE_BOX:
if (remain < 6)
return;
face = (int)rules.GetLSLIntegerItem(idx++);
v = rules.GetVector3Item(idx++); // cut
hollow = (float)rules.GetLSLFloatItem(idx++);
twist = rules.GetVector3Item(idx++);
taper_b = rules.GetVector3Item(idx++);
topshear = rules.GetVector3Item(idx++);
part.Shape.PathCurve = (byte)Extrusion.Straight;
SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1);
break;
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
if (remain < 6)
return;
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
v = rules.GetVector3Item(idx++); // cut
hollow = (float)rules.GetLSLFloatItem(idx++);
twist = rules.GetVector3Item(idx++);
//.........这里部分代码省略.........
示例7: llSetKeyframedMotion
public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
{
SceneObjectGroup group = m_host.ParentGroup;
if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical)
return;
if (group.IsAttachment)
return;
if (frames.Data.Length > 0) // We are getting a new motion
{
if (group.RootPart.KeyframeMotion != null)
group.RootPart.KeyframeMotion.Delete();
group.RootPart.KeyframeMotion = null;
int idx = 0;
KeyframeMotion.PlayMode mode = KeyframeMotion.PlayMode.Forward;
KeyframeMotion.DataFormat data = KeyframeMotion.DataFormat.Translation | KeyframeMotion.DataFormat.Rotation;
while (idx < options.Data.Length)
{
int option = (int)options.GetLSLIntegerItem(idx++);
int remain = options.Data.Length - idx;
switch (option)
{
case ScriptBaseClass.KFM_MODE:
if (remain < 1)
break;
int modeval = (int)options.GetLSLIntegerItem(idx++);
switch(modeval)
{
case ScriptBaseClass.KFM_FORWARD:
mode = KeyframeMotion.PlayMode.Forward;
break;
case ScriptBaseClass.KFM_REVERSE:
mode = KeyframeMotion.PlayMode.Reverse;
break;
case ScriptBaseClass.KFM_LOOP:
mode = KeyframeMotion.PlayMode.Loop;
break;
case ScriptBaseClass.KFM_PING_PONG:
mode = KeyframeMotion.PlayMode.PingPong;
break;
}
break;
case ScriptBaseClass.KFM_DATA:
if (remain < 1)
break;
int dataval = (int)options.GetLSLIntegerItem(idx++);
data = (KeyframeMotion.DataFormat)dataval;
break;
}
}
group.RootPart.KeyframeMotion = new KeyframeMotion(group, mode, data);
idx = 0;
int elemLength = 2;
if (data == (KeyframeMotion.DataFormat.Translation | KeyframeMotion.DataFormat.Rotation))
elemLength = 3;
List<KeyframeMotion.Keyframe> keyframes = new List<KeyframeMotion.Keyframe>();
while (idx < frames.Data.Length)
{
int remain = frames.Data.Length - idx;
if (remain < elemLength)
break;
KeyframeMotion.Keyframe frame = new KeyframeMotion.Keyframe();
frame.Position = null;
frame.Rotation = null;
if ((data & KeyframeMotion.DataFormat.Translation) != 0)
{
LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++);
frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z);
}
if ((data & KeyframeMotion.DataFormat.Rotation) != 0)
{
LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++);
Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s);
q.Normalize();
frame.Rotation = q;
}
float tempf = (float)frames.GetLSLFloatItem(idx++);
frame.TimeMS = (int)(tempf * 1000.0f);
keyframes.Add(frame);
}
group.RootPart.KeyframeMotion.SetKeyframes(keyframes.ToArray());
group.RootPart.KeyframeMotion.Start();
}
else
{
//.........这里部分代码省略.........
示例8: SetAgentParams
protected LSL_List SetAgentParams(ScenePresence sp, LSL_List rules, string originFunc, ref uint rulesParsed)
{
int idx = 0;
int idxStart = 0;
try
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
switch (code)
{
case (int)ScriptBaseClass.PRIM_POSITION:
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
if (remain < 1)
return null;
sp.OffsetPosition = rules.GetVector3Item(idx++);
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
if (remain < 1)
return null;
Quaternion inRot = rules.GetQuaternionItem(idx++);
SceneObjectPart parentPart = sp.ParentPart;
if (parentPart != null)
sp.Rotation = m_host.GetWorldRotation() * inRot;
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
if (remain < 1)
return null;
sp.Rotation = rules.GetQuaternionItem(idx++);
break;
}
}
}
catch (InvalidCastException e)
{
Error(
originFunc,
string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
}
return null;
}
示例9: getWindlightProfileFromRules
private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
{
RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
// LSL_List values = new LSL_List();
int idx = 0;
while (idx < rules.Length)
{
uint rule;
try
{
rule = (uint)rules.GetLSLIntegerItem(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule type: arg #{0} - parameter type must be integer", idx));
}
LSL_Types.Quaternion iQ;
LSL_Types.Vector3 iV;
switch (rule)
{
case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
idx++;
try
{
wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule WL_SUN_MOON_POSITION: arg #{0} - parameter 1 must be float", idx));
}
break;
case (int)ScriptBaseClass.WL_AMBIENT:
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule WL_AMBIENT: arg #{0} - parameter 1 must be rotation", idx));
}
wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
idx++;
try
{
iV = rules.GetVector3Item(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule WL_BIG_WAVE_DIRECTION: arg #{0} - parameter 1 must be vector", idx));
}
wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
break;
case (int)ScriptBaseClass.WL_BLUE_DENSITY:
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule WL_BLUE_DENSITY: arg #{0} - parameter 1 must be rotation", idx));
}
wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
idx++;
try
{
wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule WL_BLUR_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
}
break;
case (int)ScriptBaseClass.WL_CLOUD_COLOR:
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_COLOR: arg #{0} - parameter 1 must be rotation", idx));
}
wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
idx++;
try
{
wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
}
catch (InvalidCastException)
//.........这里部分代码省略.........
示例10: SetAgentParams
protected LSL_List SetAgentParams(ScenePresence sp, LSL_List rules, string originFunc, ref uint rulesParsed)
{
int idx = 0;
int idxStart = 0;
try
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
switch (code)
{
case ScriptBaseClass.PRIM_POSITION:
case ScriptBaseClass.PRIM_POS_LOCAL:
if (remain < 1)
return new LSL_List();
try
{
sp.OffsetPosition = rules.GetVector3Item(idx++);
}
catch(InvalidCastException)
{
if (code == ScriptBaseClass.PRIM_POSITION)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
}
else
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
}
return new LSL_List();
}
break;
case ScriptBaseClass.PRIM_ROTATION:
if (remain < 1)
return new LSL_List();
Quaternion inRot;
try
{
inRot = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
SceneObjectPart parentPart = sp.ParentPart;
if (parentPart != null)
sp.Rotation = m_host.GetWorldRotation() * inRot;
break;
case ScriptBaseClass.PRIM_ROT_LOCAL:
if (remain < 1)
return new LSL_List();
try
{
sp.Rotation = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
break;
case ScriptBaseClass.PRIM_TYPE:
Error(originFunc, "PRIM_TYPE disallowed on agent");
return new LSL_List();
case ScriptBaseClass.PRIM_OMEGA:
Error(originFunc, "PRIM_OMEGA disallowed on agent");
return new LSL_List();
case ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return new LSL_List();
return rules.GetSublist(idx, -1);
default:
Error(originFunc,
string.Format("Error running rule #{0} on agent: arg #{1} - disallowed on agent", rulesParsed, idx - idxStart));
return new LSL_List();
}
}
}
//.........这里部分代码省略.........
示例11: SetPrimParams
protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed)
{
int idx = 0;
int idxStart = 0;
bool positionChanged = false;
LSL_Vector currentPosition = GetPartLocalPos(part);
try
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
int face;
LSL_Vector v;
switch (code)
{
case ScriptBaseClass.PRIM_POSITION:
case ScriptBaseClass.PRIM_POS_LOCAL:
if (remain < 1)
return new LSL_List();
try
{
v = rules.GetVector3Item(idx++);
}
catch(InvalidCastException)
{
if(code == ScriptBaseClass.PRIM_POSITION)
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
else
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
positionChanged = true;
currentPosition = GetSetPosTarget(part, v, currentPosition);
break;
case ScriptBaseClass.PRIM_SIZE:
if (remain < 1)
return new LSL_List();
v=rules.GetVector3Item(idx++);
SetScale(part, v);
break;
case ScriptBaseClass.PRIM_ROTATION:
if (remain < 1)
return new LSL_List();
LSL_Rotation q;
try
{
q = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 1 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
// try to let this work as in SL...
if (part.ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
SetRot(part, q);
}
else
{
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectPart rootPart = part.ParentGroup.RootPart;
SetRot(part, rootPart.RotationOffset * (Quaternion)q);
}
break;
case ScriptBaseClass.PRIM_TYPE:
if (remain < 3)
return new LSL_List();
try
{
code = (int)rules.GetLSLIntegerItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
remain = rules.Length - idx;
float hollow;
LSL_Vector twist;
LSL_Vector taper_b;
LSL_Vector topshear;
float revolutions;
//.........这里部分代码省略.........
示例12: SetParticleSystem
private void SetParticleSystem(SceneObjectPart part, LSL_List rules, string originFunc)
{
if (rules.Length == 0)
{
part.RemoveParticleSystem();
part.ParentGroup.HasGroupChanged = true;
}
else
{
Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
LSL_Vector tempv = new LSL_Vector();
float tempf = 0;
int tmpi = 0;
for (int i = 0; i < rules.Length; i += 2)
{
int psystype;
try
{
psystype = rules.GetLSLIntegerItem(i);
}
catch (InvalidCastException)
{
Error(originFunc, string.Format("Error running particle system params index #{0}: particle system parameter type must be integer", i));
return;
}
switch (psystype)
{
case (int)ScriptBaseClass.PSYS_PART_FLAGS:
try
{
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule PSYS_PART_FLAGS: arg #{0} - parameter 1 must be integer", i + 1));
return;
}
break;
case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
try
{
tempv = rules.GetVector3Item(i + 1);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule PSYS_PART_START_COLOR: arg #{0} - parameter 1 must be vector", i + 1));
return;
}
prules.PartStartColor.R = (float)tempv.x;
prules.PartStartColor.G = (float)tempv.y;
prules.PartStartColor.B = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
try
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule PSYS_PART_START_ALPHA: arg #{0} - parameter 1 must be float", i + 1));
return;
}
prules.PartStartColor.A = tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
try
{
tempv = rules.GetVector3Item(i + 1);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule PSYS_PART_END_COLOR: arg #{0} - parameter 1 must be vector", i + 1));
return;
}
prules.PartEndColor.R = (float)tempv.x;
prules.PartEndColor.G = (float)tempv.y;
prules.PartEndColor.B = (float)tempv.z;
break;
case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
try
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule PSYS_PART_END_ALPHA: arg #{0} - parameter 1 must be float", i + 1));
return;
}
prules.PartEndColor.A = tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
try
{
//.........这里部分代码省略.........
示例13: SetPrimParams
protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules, string originFunc, ref uint rulesParsed)
{
//This is a special version of SetPrimParams to deal with avatars which are sitting on the linkset.
int idx = 0;
int idxStart = 0;
bool positionChanged = false;
try
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
switch (code)
{
case (int)ScriptBaseClass.PRIM_POSITION:
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
{
if (remain < 1)
return new LSL_List();
LSL_Vector v;
v = rules.GetVector3Item(idx++);
if(!av.LegacySitOffsets)
{
LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
v = v + 2 * sitOffset;
}
av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
positionChanged = true;
}
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
{
if (remain < 1)
return new LSL_List();
Quaternion r;
r = rules.GetQuaternionItem(idx++);
av.Rotation = m_host.GetWorldRotation() * r;
positionChanged = true;
}
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
{
if (remain < 1)
return new LSL_List();
LSL_Rotation r;
r = rules.GetQuaternionItem(idx++);
av.Rotation = r;
positionChanged = true;
}
break;
// parse rest doing nothing but number of parameters error check
case (int)ScriptBaseClass.PRIM_SIZE:
case (int)ScriptBaseClass.PRIM_MATERIAL:
case (int)ScriptBaseClass.PRIM_PHANTOM:
case (int)ScriptBaseClass.PRIM_PHYSICS:
case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
case (int)ScriptBaseClass.PRIM_NAME:
case (int)ScriptBaseClass.PRIM_DESC:
if (remain < 1)
return new LSL_List();
idx++;
break;
case (int)ScriptBaseClass.PRIM_GLOW:
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
case (int)ScriptBaseClass.PRIM_TEXGEN:
if (remain < 2)
return new LSL_List();
idx += 2;
break;
case (int)ScriptBaseClass.PRIM_TYPE:
if (remain < 3)
return new LSL_List();
code = (int)rules.GetLSLIntegerItem(idx++);
remain = rules.Length - idx;
switch (code)
{
case (int)ScriptBaseClass.PRIM_TYPE_BOX:
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
if (remain < 6)
//.........这里部分代码省略.........