本文整理汇总了C#中OpenSim.Region.ScriptEngine.Shared.DetectParams类的典型用法代码示例。如果您正苦于以下问题:C# DetectParams类的具体用法?C# DetectParams怎么用?C# DetectParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DetectParams类属于OpenSim.Region.ScriptEngine.Shared命名空间,在下文中一共展示了DetectParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventParams
public EventParams(uint localID, string eventName, Object[] eventParams, DetectParams[] detectParams)
{
LocalID = localID;
EventName = eventName;
Params = eventParams;
DetectParams = detectParams;
}
示例2: land_collision_end
public void land_collision_end(uint localID, ColliderArgs col)
{
List<DetectParams> det = new List<DetectParams>();
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision_end",
new Object[] { new LSL_Types.Vector3(d.Position) },
det.ToArray()));
}
}
示例3: collision_end
public void collision_end(uint localID, ColliderArgs col)
{
// Add to queue for all scripts in ObjectID object
List<DetectParams> det = new List<DetectParams>();
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Key =detobj.keyUUID;
d.Populate(myScriptEngine.World);
det.Add(d);
}
if (det.Count > 0)
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision_end",
new Object[] { new LSL_Types.LSLInteger(det.Count) },
det.ToArray()));
}
示例4: touch_end
public void touch_end(uint localID, uint originalID, IClientAPI remoteClient,
SurfaceTouchEventArgs surfaceArgs)
{
// Add to queue for all scripts in ObjectID object
DetectParams[] det = new DetectParams[1];
det[0] = new DetectParams();
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
if (originalID == 0)
{
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
if (surfaceArgs != null)
{
det[0].SurfaceTouchArgs = surfaceArgs;
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"touch_end", new Object[] { new LSL_Types.LSLInteger(1) },
det));
}
示例5: UpdateTouchData
public void UpdateTouchData(uint localID, DetectParams[] det)
{
throw new System.NotImplementedException();
}
示例6: SensorSweep
private void SensorSweep(SenseRepeatClass ts)
{
if (ts.host == null)
{
return;
}
List<SensedEntity> sensedEntities = new List<SensedEntity>();
// Is the sensor type is AGENT and not SCRIPTED then include agents
if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0)
{
sensedEntities.AddRange(doAgentSensor(ts));
}
// If SCRIPTED or PASSIVE or ACTIVE check objects
if ((ts.type & SCRIPTED) != 0 || (ts.type & PASSIVE) != 0 || (ts.type & ACTIVE) != 0)
{
sensedEntities.AddRange(doObjectSensor(ts));
}
lock (SenseLock)
{
List<DetectParams> detected = new List<DetectParams>();
if (sensedEntities.Count == 0)
{
if (ts.host is ScenePresence)
{
//If it is a scenePresence, then it is a bot that is being used for scanning.
// We need to set the bot parameter in the detectParams so that iwDetectedBot works properly
// so we have to have at least one detectParam object
DetectParams detect = new DetectParams();
detect.BotID = ((ScenePresence)ts.host).UUID;
detected.Add(detect);
}
// send a "no_sensor"
// Add it to queue
m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
new EventParams("no_sensor", new Object[0],
detected.ToArray()));
}
else
{
// Sort the list to get everything ordered by distance
sensedEntities.Sort();
int count = sensedEntities.Count;
int idx;
for (idx = 0; idx < count; idx++)
{
try
{
DetectParams detect = new DetectParams();
detect.Key = sensedEntities[idx].itemID;
if (ts.host is ScenePresence)
{
//If it is a scenePresence, then it is a bot that is being used for scanning.
// We need to set the bot parameter in the detectParams so that iwDetectedBot works properly
detect.BotID = ((ScenePresence)ts.host).UUID;
if (detect.BotID == detect.Key)
continue;//Don't allow the ScenePresence that is scanning to detect itself
}
detect.Populate(m_CmdManager.m_ScriptEngine.World);
detected.Add(detect);
}
catch (Exception)
{
// Ignore errors, the object has been deleted or the avatar has gone and
// there was a problem in detect.Populate so nothing added to the list
}
if (detected.Count == maximumToReturn)
break;
}
if (detected.Count == 0)
{
if (ts.host is ScenePresence)
{
//If it is a scenePresence, then it is a bot that is being used for scanning.
// We need to set the bot parameter in the detectParams so that iwDetectedBot works properly
// so we have to have at least one detectParam object
DetectParams detect = new DetectParams();
detect.BotID = ((ScenePresence)ts.host).UUID;
detected.Add(detect);
}
// To get here with zero in the list there must have been some sort of problem
// like the object being deleted or the avatar leaving to have caused some
// difficulty during the Populate above so fire a no_sensor event
m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
new EventParams("no_sensor", new Object[0],
detected.ToArray()));
}
else
{
m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
new EventParams("sensor",
new Object[] {detected.Count},
detected.ToArray()));
//.........这里部分代码省略.........
示例7: AddToScriptQueue
/// <summary>
/// Add event to event execution queue
/// </summary>
/// <param name="localID">Region object ID</param>
/// <param name="itemID">Region script ID</param>
/// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
/// <param name="param">Array of parameters to match event mask</param>
public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, DetectParams[] qParams, params object[] param)
{
List<UUID> keylist = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
if (!keylist.Contains(itemID)) // We don't manage that script
{
return false;
}
lock (eventQueue)
{
if (eventQueue.Count >= EventExecutionMaxQueueSize)
{
m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event.");
m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
return false;
}
InstanceData id = m_ScriptEngine.m_ScriptManager.GetScript(
localID, itemID);
// Create a structure and add data
QueueItemStruct QIS = new QueueItemStruct();
QIS.localID = localID;
QIS.itemID = itemID;
QIS.functionName = FunctionName;
QIS.llDetectParams = qParams;
QIS.param = param;
if (id != null)
QIS.LineMap = id.LineMap;
// Add it to queue
eventQueue.Enqueue(QIS);
}
return true;
}
示例8: EventParams
public EventParams(string eventName, Object[] eventParams, DetectParams[] detectParams)
{
EventName = eventName;
Params = eventParams;
DetectParams = detectParams;
}
示例9: touch
public void touch(uint localID, uint originalID, Vector3 offsetPos,
IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
DetectParams[] det = new DetectParams[1];
det[0] = new DetectParams();
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
offsetPos.Y,
offsetPos.Z);
if (originalID == 0)
{
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"touch", new Object[] { new LSL_Types.LSLInteger(1) },
det));
}
示例10: llMapDestination
public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt)
{
m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0);
if (detectedParams == null)
{
if (m_host.ParentGroup.IsAttachment == true)
{
detectedParams = new DetectParams();
detectedParams.Key = m_host.OwnerID;
}
else
{
return;
}
}
ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
if (avatar != null)
{
avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
simname, pos, lookAt);
}
ScriptSleep(m_sleepMsOnMapDestination);
}
示例11: ExecuteEvent
// Execute a LL-event-function in Script
internal void ExecuteEvent(uint localID, UUID itemID,
string FunctionName, DetectParams[] qParams, object[] args)
{
int ExeStage=0; // ;^) Ewe Loon, for debuging
InstanceData id=null;
try // ;^) Ewe Loon,fix
{ // ;^) Ewe Loon,fix
ExeStage = 1; // ;^) Ewe Loon, for debuging
id = GetScript(localID, itemID);
if (id == null)
return;
ExeStage = 2; // ;^) Ewe Loon, for debuging
if (qParams.Length>0) // ;^) Ewe Loon,fix
detparms[id] = qParams;
ExeStage = 3; // ;^) Ewe Loon, for debuging
if (id.Running)
id.Script.ExecuteEvent(id.State, FunctionName, args);
ExeStage = 4; // ;^) Ewe Loon, for debuging
if (qParams.Length>0) // ;^) Ewe Loon,fix
detparms.Remove(id);
ExeStage = 5; // ;^) Ewe Loon, for debuging
}
catch (Exception e) // ;^) Ewe Loon, From here down tis fix
{
if ((ExeStage == 3)&&(qParams.Length>0))
detparms.Remove(id);
SceneObjectPart ob = m_scriptEngine.World.GetSceneObjectPart(localID);
m_log.InfoFormat("[Script Error] ,{0},{1},@{2},{3},{4},{5}", ob.Name , FunctionName, ExeStage, e.Message, qParams.Length, detparms.Count);
if (ExeStage != 2) throw e;
}
}
示例12: Deserialize
public static void Deserialize(string xml, ScriptInstance instance)
{
XmlDocument doc = new XmlDocument();
Dictionary<string, object> vars = instance.GetVars();
instance.PluginData = new Object[0];
doc.LoadXml(xml);
XmlNodeList rootL = doc.GetElementsByTagName("ScriptState");
if (rootL.Count != 1)
{
return;
}
XmlNode rootNode = rootL[0];
if (rootNode != null)
{
object varValue;
XmlNodeList partL = rootNode.ChildNodes;
instance.Run = true;
foreach (XmlNode part in partL)
{
switch (part.Name)
{
case "State":
instance.State=part.InnerText;
break;
case "Running":
instance.Running=bool.Parse(part.InnerText);
break;
case "Run":
instance.Run = bool.Parse(part.InnerText);
break;
case "Variables":
XmlNodeList varL = part.ChildNodes;
foreach (XmlNode var in varL)
{
string varName;
varValue=ReadTypedValue(var, out varName);
if (vars.ContainsKey(varName))
vars[varName] = varValue;
}
instance.SetVars(vars);
break;
case "Queue":
XmlNodeList itemL = part.ChildNodes;
foreach (XmlNode item in itemL)
{
List<Object> parms = new List<Object>();
List<DetectParams> detected =
new List<DetectParams>();
string eventName =
item.Attributes.GetNamedItem("event").Value;
XmlNodeList eventL = item.ChildNodes;
foreach (XmlNode evt in eventL)
{
switch (evt.Name)
{
case "Params":
XmlNodeList prms = evt.ChildNodes;
foreach (XmlNode pm in prms)
parms.Add(ReadTypedValue(pm));
break;
case "Detected":
XmlNodeList detL = evt.ChildNodes;
foreach (XmlNode det in detL)
{
string vect =
det.Attributes.GetNamedItem(
"pos").Value;
LSL_Types.Vector3 v =
new LSL_Types.Vector3(vect);
int d_linkNum=0;
UUID d_group = UUID.Zero;
string d_name = String.Empty;
UUID d_owner = UUID.Zero;
LSL_Types.Vector3 d_position =
new LSL_Types.Vector3();
LSL_Types.Quaternion d_rotation =
new LSL_Types.Quaternion();
int d_type = 0;
LSL_Types.Vector3 d_velocity =
new LSL_Types.Vector3();
try
{
string tmp;
tmp = det.Attributes.GetNamedItem(
"linkNum").Value;
int.TryParse(tmp, out d_linkNum);
tmp = det.Attributes.GetNamedItem(
//.........这里部分代码省略.........
示例13: money
public void money(SceneObjectPart part, UUID agentID, int amount, int paidLinkNum)
{
DetectParams[] det = new DetectParams[1];
det[0] = new DetectParams();
det[0].Key = agentID;
det[0].LinkNum = paidLinkNum;
myScriptEngine.PostObjectEvent(part.LocalId, new EventParams(
"money", new object[] {
agentID.ToString(),
amount },
det));
}
示例14: EventManager_OnObjectGrabUpdate
void EventManager_OnObjectGrabUpdate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
// Add to queue for all scripts in ObjectID object
DetectParams[] det = new DetectParams[1];
det[0] = new DetectParams();
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
det[0].OffsetPos = offsetPos;
if (originalID == 0)
{
SceneObjectPart part =
myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart =
myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
if (surfaceArgs != null)
{
det[0].SurfaceTouchArgs = surfaceArgs;
}
myScriptEngine.UpdateTouchData(localID, det);
}
示例15: TestScriptCrossOnSameSimulator
public void TestScriptCrossOnSameSimulator()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1);
int sceneObjectIdTail = 0x2;
EntityTransferModule etmA = new EntityTransferModule();
EntityTransferModule etmB = new EntityTransferModule();
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
XEngine xEngineA = new XEngine();
XEngine xEngineB = new XEngine();
xEngineA.DebugLevel = 1;
xEngineB.DebugLevel = 1;
IConfigSource configSource = new IniConfigSource();
IConfig startupConfig = configSource.AddConfig("Startup");
startupConfig.Set("DefaultScriptEngine", "XEngine");
startupConfig.Set("TrustBinaries", "true");
IConfig xEngineConfig = configSource.AddConfig("XEngine");
xEngineConfig.Set("Enabled", "true");
xEngineConfig.Set("StartDelay", "0");
// These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
// to AssemblyResolver.OnAssemblyResolve fails.
xEngineConfig.Set("AppDomainLoading", "false");
IConfig modulesConfig = configSource.AddConfig("Modules");
modulesConfig.Set("EntityTransferModule", etmA.Name);
modulesConfig.Set("SimulationServices", lscm.Name);
SceneHelpers sh = new SceneHelpers();
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000, configSource);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999, configSource);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, configSource, lscm);
SceneHelpers.SetupSceneModules(sceneA, configSource, etmA, xEngineA);
SceneHelpers.SetupSceneModules(sceneB, configSource, etmB, xEngineB);
sceneA.StartScripts();
sceneB.StartScripts();
SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId, "so1-", sceneObjectIdTail);
soSceneA.AbsolutePosition = new Vector3(128, 10, 20);
string soSceneAName = soSceneA.Name;
string scriptItemSceneAName = "script1";
// CREATE SCRIPT TODO
InventoryItemBase scriptItemSceneA = new InventoryItemBase();
// itemTemplate.ID = itemId;
scriptItemSceneA.Name = scriptItemSceneAName;
scriptItemSceneA.Folder = soSceneA.UUID;
scriptItemSceneA.InvType = (int)InventoryType.LSL;
AutoResetEvent chatEvent = new AutoResetEvent(false);
OSChatMessage messageReceived = null;
sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
sceneA.RezNewScript(userId, scriptItemSceneA,
@"integer c = 0;
default
{
state_entry()
{
llSay(0, ""Script running"");
}
changed(integer change)
{
llSay(0, ""Changed"");
}
touch_start(integer n)
{
c = c + 1;
llSay(0, (string)c);
}
}");
chatEvent.WaitOne(60000);
Assert.That(messageReceived, Is.Not.Null, "No chat message received.");
Assert.That(messageReceived.Message, Is.EqualTo("Script running"));
{
// XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
DetectParams[] det = new DetectParams[1];
det[0] = new DetectParams();
det[0].Key = userId;
det[0].Populate(sceneA);
EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
messageReceived = null;
chatEvent.Reset();
xEngineA.PostObjectEvent(soSceneA.LocalId, ep);
//.........这里部分代码省略.........