本文整理汇总了C#中OpenSim.Region.Framework.Scenes.ScenePresence类的典型用法代码示例。如果您正苦于以下问题:C# ScenePresence类的具体用法?C# ScenePresence怎么用?C# ScenePresence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScenePresence类属于OpenSim.Region.Framework.Scenes命名空间,在下文中一共展示了ScenePresence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SceneViewer
public SceneViewer(ScenePresence presence)
{
m_presence = presence;
m_presence.Scene.EventManager.OnSignificantClientMovement += SignificantClientMovement;
m_prioritizer = new Prioritizer(presence.Scene);
m_partsUpdateQueue = new PriorityQueue<EntityUpdate, double>(presence.Scene.Entities.Count > 1000 ? presence.Scene.Entities.Count : 1000);
}
示例2: OnMakeRootAgent
public void OnMakeRootAgent(ScenePresence sp)
{
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
Util.FireAndForget(delegate(object o)
{
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
});
}
示例3: OnMakeRootAgent
public void OnMakeRootAgent(ScenePresence sp)
{
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
if (sp.PresenceType != PresenceType.Npc)
m_GridUserService.SetLastPosition(
sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
}
示例4: EventManager_OnNewPresence
void EventManager_OnNewPresence(ScenePresence presence)
{
if (_OnNewUser != null)
{
NewUserEventArgs e = new NewUserEventArgs();
e.Avatar = new SPAvatar(m_internalScene, presence.UUID);
_OnNewUser(this, e);
}
}
示例5: AvatarRemotePresences
public AvatarRemotePresences(Scene currentRegion, ScenePresence sp)
{
_scene = currentRegion;
_sp = sp;
_lastDrawDistanceFactor = Util.GetRegionUnitsFromDD((uint)sp.DrawDistance);
_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
_scene.EventManager.OnMakeChildAgent += EventManager_OnMakeChildAgent;
}
示例6: HandleOnSignificantClientMovement
public void HandleOnSignificantClientMovement(ScenePresence presence)
{
lock (m_avatars)
{
if (m_avatars.ContainsKey(presence.UUID) && presence.MovingToTarget)
{
double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget);
// m_log.DebugFormat(
// "[NPC MODULE]: Abs pos of {0} is {1}, target {2}, distance {3}",
// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position
if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT)
{
// We are close enough to the target
m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name);
if (presence.PhysicsActor.Flying)
{
Vector3 targetPos = presence.MoveToPositionTarget;
float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
if (targetPos.Z - terrainHeight < 0.2)
{
presence.PhysicsActor.Flying = false;
}
}
presence.Velocity = Vector3.Zero;
presence.AbsolutePosition = presence.MoveToPositionTarget;
presence.ResetMoveToTarget();
// FIXME: This doesn't work
if (presence.PhysicsActor.Flying)
presence.Animator.TrySetMovementAnimation("HOVER");
else
presence.Animator.TrySetMovementAnimation("STAND");
}
else
{
m_log.DebugFormat(
"[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}",
presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
Vector3 agent_control_v3 = new Vector3();
presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation);
presence.AddNewMovement(agent_control_v3, presence.Rotation);
}
//
//// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null);
//
//
}
}
}
示例7: OnMakeRootAgent
public void OnMakeRootAgent(ScenePresence sp)
{
if (sp.PresenceType != PresenceType.Npc)
{
string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID);
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
m_GridUserService.SetLastPosition(
userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
}
}
示例8: DoOnMakeRootAgent
public void DoOnMakeRootAgent(ScenePresence sp)
{
string userid;
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
if (sp.Scene.UserManagementModule.GetUserUUI(sp.UUID, out userid))
{
/* we only setposition on known agents that have a valid lookup */
m_GridUserService.SetLastPosition(
userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
}
}
示例9: EventManager_OnMakeRootAgent
void EventManager_OnMakeRootAgent(ScenePresence presence)
{
try
{
//Add the user
FileStream stream = new FileStream(m_fileName, FileMode.OpenOrCreate);
StreamWriter m_streamWriter = new StreamWriter(stream);
m_streamWriter.BaseStream.Position += m_streamWriter.BaseStream.Length;
m_streamWriter.WriteLine(presence.Name);
m_streamWriter.Close();
}
catch { }
}
示例10: OnMakeRootAgent
public void OnMakeRootAgent(ScenePresence sp)
{
if (sp.isNPC)
return;
if(sp.gotCrossUpdate)
{
Util.FireAndForget(delegate
{
DoOnMakeRootAgent(sp);
}, null, "PresenceDetector_MakeRoot");
}
else
DoOnMakeRootAgent(sp);
}
示例11: Setup
public void Setup()
{
mockScene = SceneHelper.CreateScene(REGION_PORT_BASE, 1000, 1000);
mockScene.RegisterModuleInterface<IEventQueue>(new InWorldz.Testing.MockEventQueue());
neighbor1left = SceneHelper.CreateScene(REGION_PORT_BASE+1, 999, 1000);
neighbor2left = SceneHelper.CreateScene(REGION_PORT_BASE+2, 998, 1000);
neighbor3left = SceneHelper.CreateScene(REGION_PORT_BASE+3, 997, 1000);
presence = new ScenePresence(mockScene, 256f, new MockClientAPI());
neighbor1left.CommsManager.HttpServer.AddHTTPHandler("/agent/", HandleAgentStuff);
neighbor1left.CommsManager.HttpServer.AddHTTPHandler("/agent2/", HandleAgentStuff);
neighbor2left.CommsManager.HttpServer.AddHTTPHandler("/agent/", HandleAgentStuff);
neighbor2left.CommsManager.HttpServer.AddHTTPHandler("/agent2/", HandleAgentStuff);
}
示例12: OnMakeRootAgent
void OnMakeRootAgent(ScenePresence presence)
{
try
{
//Add the user
FileStream stream = new FileStream(m_fileName, FileMode.OpenOrCreate);
StreamWriter m_streamWriter = new StreamWriter(stream);
m_streamWriter.BaseStream.Position += m_streamWriter.BaseStream.Length;
string LineToWrite = DateTime.Now.ToLongTimeString() + " - " + presence.Name + " entered " + presence.Scene.RegionInfo.RegionName + ".";
m_timesOfUsers[presence.UUID] = DateTime.Now;
m_streamWriter.WriteLine(LineToWrite);
m_streamWriter.WriteLine();
m_streamWriter.Close();
}
catch { }
}
示例13: OnMakeRootAgent
void OnMakeRootAgent(ScenePresence presence)
{
// Get system folders
// First check if they're here already
lock (m_InventoryCache)
{
if (m_InventoryCache.ContainsKey(presence.UUID))
{
m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, system folders for {0} {1} already in cache", presence.Firstname, presence.Lastname);
return;
}
}
// If not, go get them and place them in the cache
Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID);
m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
}
示例14: SyncInfoPresence
/// Constructor used for initializing SyncInfo from local (Scenepresence) data before syncing it out
/// <param name="sp">Presence to use for initial synced property values</param>
/// <param name="initUpdateTimestamp">Initial update timestamp</param>
/// <param name="syncID"></param>
/// <param name="scene">The local scene</param>
public SyncInfoPresence(ScenePresence sp, long initUpdateTimestamp, string syncID, Scene scene)
{
// DebugLog.WarnFormat("[SYNC INFO PRESENCE] Constructing SyncInfoPresence (from scene) for uuid {0}", sp.UUID);
UUID = sp.UUID;
Scene = scene;
SceneThing = sp;
lock (m_syncLock)
{
CurrentlySyncedProperties = new Dictionary<SyncableProperties.Type, SyncedProperty>();
foreach (SyncableProperties.Type property in SyncableProperties.AvatarProperties)
{
Object initValue = GetPropertyValue(sp, property);
if (initValue != null)
{
CurrentlySyncedProperties.Add(property, new SyncedProperty(property, initValue, initUpdateTimestamp, syncID));
}
}
}
}
示例15: Cross
public bool Cross(ScenePresence agent, bool isFlying)
{
Scene scene = agent.Scene;
Vector3 pos = agent.AbsolutePosition;
Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
uint neighbourx;
uint neighboury;
const float boundaryDistance = 1.7f;
// assuming that the need for crossing was verified by callers
int x, y;
if (scene.RegionInfo.CombinedRegionHandle != 0) // we are a slave region send to main region
{
Utils.LongToUInts(scene.RegionInfo.CombinedRegionHandle, out neighbourx, out neighboury);
agent.IsInTransit = true;
Vector3 newposition = pos;
newposition.X += ((int)scene.RegionInfo.RegionLocX * Constants.RegionSize - (int)neighbourx);
newposition.Y += ((int)scene.RegionInfo.RegionLocY * Constants.RegionSize - (int)neighboury);
agent.ControllingClient.SendAgentAlertMessage(
String.Format("Relocating you in root region"), false);
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
return true;
}
if (pos.X - boundaryDistance < 0) // going W
{
x = -1;
newpos.X = Constants.RegionSize + pos.X - boundaryDistance;
}
else // assume we are going E
{
x = ((int)(pos.X + boundaryDistance) / (int)Constants.RegionSize);
newpos.X = pos.X - x * (int)Constants.RegionSize;
}
x += (int)scene.RegionInfo.RegionLocX;
neighbourx = (uint)x;
x *= (int)Constants.RegionSize;
if (pos.Y - boundaryDistance < 0) // going S SW or SE
{
y = -1;
newpos.Y = Constants.RegionSize + pos.Y - boundaryDistance;
}
else // assume we are going N NW or NE
{
y = ((int)(pos.Y + boundaryDistance) / (int)Constants.RegionSize);
newpos.Y = pos.Y - y * (int)Constants.RegionSize;
}
y += (int)scene.RegionInfo.RegionLocY;
neighboury = (uint)y;
y *= (int)Constants.RegionSize;
// int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
ulong neighbourHandle = Utils.UIntsToLong((uint)x, (uint)y);
ExpiringCache<ulong, DateTime> r;
DateTime banUntil;
if (m_bannedRegions.TryGetValue(agent.ControllingClient.AgentId, out r))
{
if (r.TryGetValue(neighbourHandle, out banUntil))
{
if (DateTime.Now < banUntil)
return false;
r.Remove(neighbourHandle);
}
}
else
{
r = null;
}
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, x, y);
if (neighbourRegion == null)
return false;
string reason;
string version;
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
{
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
if (r == null)
{
r = new ExpiringCache<ulong, DateTime>();
r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
m_bannedRegions.Add(agent.ControllingClient.AgentId, r, TimeSpan.FromSeconds(45));
}
else
//.........这里部分代码省略.........