本文整理汇总了C#中Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list类的典型用法代码示例。如果您正苦于以下问题:C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list类的具体用法?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list怎么用?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list类属于命名空间,在下文中一共展示了Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
/// <summary>
/// Process the supplied list and return the
/// content of the list formatted as a comma
/// separated list. There is a space after
/// each comma.
/// </summary>
public LSL_String llList2CSV(LSL_List src)
{
string ret = String.Empty;
int x = 0;
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
if (src.Data.Length > 0)
{
ret = src.Data[x++].ToString();
for (; x < src.Data.Length; x++)
{
ret += ", "+src.Data[x].ToString();
}
}
return ret;
}
示例2: ParseString
// <summary>
// Scan the string supplied in 'src' and
// tokenize it based upon two sets of
// tokenizers provided in two lists,
// separators and spacers.
// </summary>
//
// <remarks>
// Separators demarcate tokens and are
// elided as they are encountered. Spacers
// also demarcate tokens, but are themselves
// retained as tokens.
//
// Both separators and spacers may be arbitrarily
// long strings. i.e. ":::".
//
// The function returns an ordered list
// representing the tokens found in the supplied
// sources string. If two successive tokenizers
// are encountered, then a NULL entry is added
// to the list.
//
// It is a precondition that the source and
// toekizer lisst are non-null. If they are null,
// then a null pointer exception will be thrown
// while their lengths are being determined.
//
// A small amount of working memoryis required
// of approximately 8*#tokenizers.
//
// There are many ways in which this function
// can be implemented, this implementation is
// fairly naive and assumes that when the
// function is invooked with a short source
// string and/or short lists of tokenizers, then
// performance will not be an issue.
//
// In order to minimize the perofrmance
// effects of long strings, or large numbers
// of tokeizers, the function skips as far as
// possible whenever a toekenizer is found,
// and eliminates redundant tokenizers as soon
// as is possible.
//
// The implementation tries to avoid any copying
// of arrays or other objects.
// </remarks>
private LSL_List ParseString(string src, LSL_List separators, LSL_List spacers, bool keepNulls)
{
int beginning = 0;
int srclen = src.Length;
int seplen = separators.Length;
object[] separray = separators.Data;
int spclen = spacers.Length;
object[] spcarray = spacers.Data;
int mlen = seplen + spclen;
int[] offset = new int[mlen + 1];
bool[] active = new bool[mlen];
int best;
int j;
// Initial capacity reduces resize cost
LSL_List tokens = new LSL_List();
// All entries are initially valid
for (int i = 0; i < mlen; i++)
active[i] = true;
offset[mlen] = srclen;
while (beginning < srclen)
{
best = mlen; // as bad as it gets
// Scan for separators
for (j = 0; j < seplen; j++)
{
if (separray[j].ToString() == String.Empty)
active[j] = false;
if (active[j])
{
// scan all of the markers
if ((offset[j] = src.IndexOf(separray[j].ToString(), beginning)) == -1)
{
// not present at all
active[j] = false;
}
else
{
// present and correct
if (offset[j] < offset[best])
{
//.........这里部分代码省略.........
示例3: llListInsertList
/// <summary>
/// Insert the list identified by <src> into the
/// list designated by <dest> such that the first
/// new element has the index specified by <index>
/// </summary>
public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
LSL_List pref = null;
LSL_List suff = null;
if (index < 0)
{
index = index+dest.Length;
if (index < 0)
{
index = 0;
}
}
if (index != 0)
{
pref = dest.GetSublist(0,index-1);
if (index < dest.Length)
{
suff = dest.GetSublist(index,-1);
return pref + src + suff;
}
else
{
return pref + src;
}
}
else
{
if (index < dest.Length)
{
suff = dest.GetSublist(index,-1);
return src + suff;
}
else
{
return src;
}
}
}
示例4: llListFindList
/// <summary>
/// Returns the index of the first occurrence of test
/// in src.
/// </summary>
public LSL_Integer llListFindList(LSL_List src, LSL_List test)
{
int index = -1;
int length = src.Length - test.Length + 1;
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
// If either list is empty, do not match
if (src.Length != 0 && test.Length != 0)
{
for (int i = 0; i < length; i++)
{
if (src.Data[i].Equals(test.Data[0]))
{
int j;
for (j = 1; j < test.Length; j++)
if (!src.Data[i+j].Equals(test.Data[j]))
break;
if (j == test.Length)
{
index = i;
break;
}
}
}
}
return index;
}
示例5: llList2ListStrided
/// <summary>
/// Elements in the source list starting with 0 and then
/// every i+stride. If the stride is negative then the scan
/// is backwards producing an inverted result.
/// Only those elements that are also in the specified
/// range are included in the result.
/// </summary>
public LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride)
{
LSL_List result = new LSL_List();
int[] si = new int[2];
int[] ei = new int[2];
bool twopass = false;
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
// First step is always to deal with negative indices
if (start < 0)
start = src.Length+start;
if (end < 0)
end = src.Length+end;
// Out of bounds indices are OK, just trim them
// accordingly
if (start > src.Length)
start = src.Length;
if (end > src.Length)
end = src.Length;
if (stride == 0)
stride = 1;
// There may be one or two ranges to be considered
if (start != end)
{
if (start <= end)
{
si[0] = start;
ei[0] = end;
}
else
{
si[1] = start;
ei[1] = src.Length;
si[0] = 0;
ei[0] = end;
twopass = true;
}
// The scan always starts from the beginning of the
// source list, but members are only selected if they
// fall within the specified sub-range. The specified
// range values are inclusive.
// A negative stride reverses the direction of the
// scan producing an inverted list as a result.
if (stride > 0)
{
for (int i = 0; i < src.Length; i += stride)
{
if (i<=ei[0] && i>=si[0])
result.Add(src.Data[i]);
if (twopass && i>=si[1] && i<=ei[1])
result.Add(src.Data[i]);
}
}
else if (stride < 0)
{
for (int i = src.Length - 1; i >= 0; i += stride)
{
if (i <= ei[0] && i >= si[0])
result.Add(src.Data[i]);
if (twopass && i >= si[1] && i <= ei[1])
result.Add(src.Data[i]);
}
}
}
else
{
if (start%stride == 0)
{
result.Add(src.Data[start]);
}
}
return result;
}
示例6: llListRandomize
/// <summary>
/// Randomizes the list, be arbitrarily reordering
/// sublists of stride elements. As the stride approaches
/// the size of the list, the options become very
/// limited.
/// </summary>
/// <remarks>
/// This could take a while for very large list
/// sizes.
/// </remarks>
public LSL_List llListRandomize(LSL_List src, int stride)
{
LSL_List result;
Random rand = new Random();
int chunkk;
int[] chunks;
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
if (stride <= 0)
{
stride = 1;
}
// Stride MUST be a factor of the list length
// If not, then return the src list. This also
// traps those cases where stride > length.
if (src.Length != stride && src.Length%stride == 0)
{
chunkk = src.Length/stride;
chunks = new int[chunkk];
for (int i = 0; i < chunkk; i++)
chunks[i] = i;
// Knuth shuffle the chunkk index
for (int i = chunkk - 1; i >= 1; i--)
{
// Elect an unrandomized chunk to swap
int index = rand.Next(i + 1);
int tmp;
// and swap position with first unrandomized chunk
tmp = chunks[i];
chunks[i] = chunks[index];
chunks[index] = tmp;
}
// Construct the randomized list
result = new LSL_List();
for (int i = 0; i < chunkk; i++)
{
for (int j = 0; j < stride; j++)
{
result.Add(src.Data[chunks[i]*stride+j]);
}
}
}
else {
object[] array = new object[src.Length];
Array.Copy(src.Data, 0, array, 0, src.Length);
result = new LSL_List(array);
}
return result;
}
示例7: switch
/// <summary>
/// The supplied string is scanned for commas
/// and converted into a list. Commas are only
/// effective if they are encountered outside
/// of '<' '>' delimiters. Any whitespace
/// before or after an element is trimmed.
/// </summary>
public LSL_List llCSV2List(string src)
{
LSL_List result = new LSL_List();
int parens = 0;
int start = 0;
int length = 0;
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
for (int i = 0; i < src.Length; i++)
{
switch (src[i])
{
case '<':
parens++;
length++;
break;
case '>':
if (parens > 0)
parens--;
length++;
break;
case ',':
if (parens == 0)
{
result.Add(new LSL_String(src.Substring(start,length).Trim()));
start += length+1;
length = 0;
}
else
{
length++;
}
break;
default:
length++;
break;
}
}
result.Add(src.Substring(start,length).Trim());
return result;
}
示例8: aaSetEnv
public void aaSetEnv(LSL_String name, LSL_List value)
{
if (name == ScriptBaseClass.ENABLE_GRAVITY)
{
LSL_Integer enabled = value.GetLSLIntegerItem(0);
float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce();
m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(enabled == 1, grav[0], grav[1], grav[2]);
}
else if (name == ScriptBaseClass.GRAVITY_FORCE_X)
{
LSL_Float f = value.GetLSLFloatItem(0);
float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce();
m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(true, (float) f.value, grav[1], grav[2]);
}
else if (name == ScriptBaseClass.GRAVITY_FORCE_Y)
{
LSL_Float f = value.GetLSLFloatItem(0);
float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce();
m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(true, grav[0], (float) f.value, grav[2]);
}
else if (name == ScriptBaseClass.GRAVITY_FORCE_Z)
{
LSL_Float f = value.GetLSLFloatItem(0);
float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce();
m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(true, grav[0], grav[1], (float) f.value);
}
else if (name == ScriptBaseClass.ADD_GRAVITY_POINT)
{
LSL_Vector pos = value.GetVector3Item(0);
LSL_Float gravForce = value.GetLSLFloatItem(1);
LSL_Float radius = value.GetLSLFloatItem(2);
LSL_Integer ident = value.GetLSLIntegerItem(3);
float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce();
m_host.ParentEntity.Scene.PhysicsScene.AddGravityPoint(false,
new Vector3((float) pos.x, (float) pos.y,
(float) pos.z),
0, 0, 0, (float) gravForce.value,
(float) radius.value, ident.value);
}
else if (name == ScriptBaseClass.ADD_GRAVITY_FORCE)
{
LSL_Vector pos = value.GetVector3Item(0);
LSL_Float xForce = value.GetLSLFloatItem(1);
LSL_Float yForce = value.GetLSLFloatItem(2);
LSL_Float zForce = value.GetLSLFloatItem(3);
LSL_Float radius = value.GetLSLFloatItem(4);
LSL_Integer ident = value.GetLSLIntegerItem(5);
float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce();
m_host.ParentEntity.Scene.PhysicsScene.AddGravityPoint(true,
new Vector3((float) pos.x, (float) pos.y,
(float) pos.z),
(float) xForce, (float) yForce, (float) zForce, 0,
(float) radius.value, ident.value);
}
else if (name == ScriptBaseClass.START_TIME_REVERSAL_SAVING)
{
IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>();
if (physicsState != null)
physicsState.StartSavingPhysicsTimeReversalStates();
}
else if (name == ScriptBaseClass.STOP_TIME_REVERSAL_SAVING)
{
IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>();
if (physicsState != null)
physicsState.StopSavingPhysicsTimeReversalStates();
}
else if (name == ScriptBaseClass.START_TIME_REVERSAL)
{
IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>();
if (physicsState != null)
physicsState.StartPhysicsTimeReversal();
}
else if (name == ScriptBaseClass.STOP_TIME_REVERSAL)
{
IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>();
if (physicsState != null)
physicsState.StopPhysicsTimeReversal();
}
}
示例9: aaSerializeXML
public LSL_String aaSerializeXML(LSL_List keys, LSL_List values)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "AASerializeXML", m_host, "AA", m_itemID))
return new LSL_String();
XmlDocument doc = new XmlDocument();
for (int i = 0; i < keys.Length; i++)
{
string key = keys.GetLSLStringItem(i);
string value = values.GetLSLStringItem(i);
XmlNode node = doc.CreateNode(XmlNodeType.Element, key, "");
node.InnerText = value;
doc.AppendChild(node);
}
return new LSL_String(doc.OuterXml);
}
示例10: aaDeserializeXMLValues
public LSL_List aaDeserializeXMLValues(LSL_String xmlFile)
{
if (
!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "AADeserializeXMLValues", m_host, "AA",
m_itemID)) return new LSL_List();
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlFile.m_string);
XmlNodeList children = doc.ChildNodes;
LSL_List values = new LSL_List();
foreach (XmlNode node in children)
{
values.Add(node.InnerText);
}
return values;
}
示例11: llGetBoundingBox
/// <summary>
/// A partial implementation.
/// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetBoundingBox
/// So far only valid for standing/flying/ground sitting avatars and single prim objects.
/// If the object has multiple prims and/or a sitting avatar then the bounding
/// box is for the root prim only.
/// </summary>
public LSL_List llGetBoundingBox(string obj)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
UUID objID = UUID.Zero;
LSL_List result = new LSL_List();
if (!UUID.TryParse(obj, out objID))
{
result.Add(new LSL_Vector());
result.Add(new LSL_Vector());
return result;
}
ScenePresence presence = World.GetScenePresence(objID);
if (presence != null)
{
if (presence.ParentID == UUID.Zero) // not sat on an object
{
LSL_Vector lower;
LSL_Vector upper;
if (presence.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{
// This is for ground sitting avatars
float height = presence.Appearance.AvatarHeight / 2.66666667f;
lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
}
else
{
// This is for standing/flying avatars
float height = presence.Appearance.AvatarHeight / 2.0f;
lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
}
result.Add(lower);
result.Add(upper);
return result;
}
else
{
// sitting on an object so we need the bounding box of that
// which should include the avatar so set the UUID to the
// UUID of the object the avatar is sat on and allow it to fall through
// to processing an object
SceneObjectPart p = World.GetSceneObjectPart(presence.ParentID);
objID = p.UUID;
}
}
SceneObjectPart part = World.GetSceneObjectPart(objID);
// Currently only works for single prims without a sitting avatar
if (part != null)
{
Vector3 halfSize = part.Scale * 0.5f;
LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f);
LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z);
result.Add(lower);
result.Add(upper);
return result;
}
// Not found so return empty values
result.Add(new LSL_Vector());
result.Add(new LSL_Vector());
return result;
}
示例12: llGetLinkPrimitiveParams
public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
List<SceneObjectPart> parts = GetLinkParts(linknumber);
LSL_List res = new LSL_List();
foreach (var part in parts)
{
LSL_List partRes = GetLinkPrimitiveParams(part, rules);
res += partRes;
}
return res;
}
示例13: llLinkParticleSystem
public void llLinkParticleSystem(int linknumber, LSL_List rules)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
List<SceneObjectPart> parts = GetLinkParts(linknumber);
foreach (var part in parts)
{
SetParticleSystem(part, rules);
}
}
示例14: llParticleSystem
public void llParticleSystem(LSL_List rules)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
SetParticleSystem(m_host, rules);
}
示例15: SetPrimParams
protected void SetPrimParams(ISceneEntity 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;
if (code == (int)ScriptBaseClass.PRIM_NAME)
{
if (remain < 1)
return;
string name = rules.Data[idx++].ToString();
if (part is SceneObjectPart)
(part as SceneObjectPart).Name = name;
}
else if (code == (int)ScriptBaseClass.PRIM_DESC)
{
if (remain < 1)
return;
string desc = rules.Data[idx++].ToString();
if (part is SceneObjectPart)
(part as SceneObjectPart).Description = desc;
}
else if (code == (int)ScriptBaseClass.PRIM_ROT_LOCAL)
{
if (remain < 1)
return;
LSL_Rotation lr = rules.GetQuaternionItem(idx++);
if (part is SceneObjectPart)
SetRot((part as SceneObjectPart), Rot2Quaternion(lr));
}
else if (code == (int)ScriptBaseClass.PRIM_POSITION)
{
if (remain < 1)
return;
v = rules.GetVector3Item(idx++);
if (part is SceneObjectPart)
SetPos(part as SceneObjectPart, v);
else if (part is ScenePresence)
{
(part as ScenePresence).OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
(part as ScenePresence).SendTerseUpdateToAllClients();
}
}
else if (code == (int)ScriptBaseClass.PRIM_SIZE)
{
if (remain < 1)
return;
v = rules.GetVector3Item(idx++);
if (part is SceneObjectPart)
SetScale(part as SceneObjectPart, v);
}
else if (code == (int)ScriptBaseClass.PRIM_ROTATION)
{
if (remain < 1)
return;
if (part is SceneObjectPart) { }
else return;
LSL_Rotation q = rules.GetQuaternionItem(idx++);
// try to let this work as in SL...
if ((part as SceneObjectPart).ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
SetRot(part as SceneObjectPart, 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 as SceneObjectPart).ParentGroup;
if (group != null) // a bit paranoid, maybe
{
SceneObjectPart rootPart = group.RootPart;
if (rootPart != null) // again, better safe than sorry
{
SetRot((part as SceneObjectPart), rootPart.RotationOffset * Rot2Quaternion(q));
}
}
}
}
else if (code == (int)ScriptBaseClass.PRIM_TYPE)
{
//.........这里部分代码省略.........