当前位置: 首页>>代码示例>>C#>>正文


C# IScene.GetScenePresence方法代码示例

本文整理汇总了C#中IScene.GetScenePresence方法的典型用法代码示例。如果您正苦于以下问题:C# IScene.GetScenePresence方法的具体用法?C# IScene.GetScenePresence怎么用?C# IScene.GetScenePresence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScene的用法示例。


在下文中一共展示了IScene.GetScenePresence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Reload

 public void Reload (IScene scene, float direction)
 {
     foreach (KeyValuePair<UUID, PhysicsState> kvp in m_activePrims)
     {
         ISceneChildEntity childPrim = scene.GetSceneObjectPart (kvp.Key);
         if (childPrim != null && childPrim.PhysActor != null)
             ResetPrim (childPrim.PhysActor, kvp.Value, direction);
         else
         {
             IScenePresence sp = scene.GetScenePresence (kvp.Key);
             if (sp != null)
                 ResetAvatar (sp.PhysicsActor, kvp.Value, direction);
         }
     }
 }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:15,代码来源:PhysicsStateModule.cs

示例2: ChatSessionRequest

        /// <summary>
        /// Callback for a client request for a private chat channel
        /// </summary>
        /// <param name="scene">current scene object of the client</param>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        /// <returns></returns>
        public byte[] ChatSessionRequest(IScene scene, UUID agentID)
        {
            IScenePresence avatar = scene.GetScenePresence(agentID);
            string        avatarName = avatar.Name;

            m_log.DebugFormat("[VivoxVoice][CHATSESSION]: avatar \"{0}\"",
                              avatarName);
            if (avatar.Scene.RegionInfo.EstateSettings.AllowVoice)
                return OSDParser.SerializeLLSDXmlBytes(true);
            return OSDParser.SerializeLLSDXmlBytes(false);
        }
开发者ID:nhede,项目名称:Aurora-Sim-Optional-Modules,代码行数:18,代码来源:VivoxVoiceModule.cs

示例3: GetAppearance

 /// <summary>
 ///   Finds the given users appearance
 /// </summary>
 /// <param name = "target"></param>
 /// <param name = "scene"></param>
 /// <returns></returns>
 private AvatarAppearance GetAppearance(UUID target, IScene scene)
 {
     IScenePresence sp = scene.GetScenePresence(target);
     if (sp != null)
     {
         IAvatarAppearanceModule aa = sp.RequestModuleInterface<IAvatarAppearanceModule>();
         if (aa != null)
             return new AvatarAppearance(aa.Appearance);
     }
     return scene.AvatarService.GetAppearance(target);
 }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:17,代码来源:BotManager.cs

示例4: SimChat

        public void SimChat(string message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                            UUID fromID, bool fromAgent, bool broadcast, float range, UUID ToAgentID, IScene scene)
        {
            OSChatMessage args = new OSChatMessage
                                     {
                                         Message = message,
                                         Channel = channel,
                                         Type = type,
                                         Position = fromPos,
                                         Range = range,
                                         SenderUUID = fromID,
                                         Scene = scene,
                                         ToAgentID = ToAgentID
                                     };


            if (fromAgent)
            {
                IScenePresence user = scene.GetScenePresence(fromID);
                if (user != null)
                    args.Sender = user.ControllingClient;
            }
            else
            {
                args.SenderObject = scene.GetSceneObjectPart(fromID);
            }

            args.From = fromName;
            //args.

            if (broadcast)
            {
                OnChatBroadcast(scene, args);
                scene.EventManager.TriggerOnChatBroadcast(scene, args);
            }
            else
            {
                OnChatFromWorld(scene, args);
                scene.EventManager.TriggerOnChatFromWorld(scene, args);
            }
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:41,代码来源:AuroraChatModule.cs

示例5: CanCompileScript

 private bool CanCompileScript(UUID ownerUUID, string scriptType, IScene scene)
 {
     //MainConsole.Instance.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
     switch (scriptType)
     {
         case "lsl":
         case "lsl2":
             if ((m_allowedLSLScriptCompilers == UserSet.Administrators && !IsAdministrator(ownerUUID)) ||
                 (m_allowedLSLScriptCompilers == UserSet.ParcelOwners &&
                  !GenericParcelPermission(ownerUUID, scene.GetScenePresence(ownerUUID).AbsolutePosition, 0)) ||
                 GrantLSL.Count == 0 || GrantLSL.ContainsKey(ownerUUID.ToString()))
             {
                 return (true);
             }
             break;
         case "cs":
             if ((m_allowedCSScriptCompilers == UserSet.Administrators && !IsAdministrator(ownerUUID)) ||
                 (m_allowedCSScriptCompilers == UserSet.ParcelOwners &&
                  !GenericParcelPermission(ownerUUID, scene.GetScenePresence(ownerUUID).AbsolutePosition, 0)) ||
                 GrantCS.Count == 0 || GrantCS.ContainsKey(ownerUUID.ToString()))
             {
                 return (true);
             }
             break;
         case "vb":
             if ((m_allowedVBScriptCompilers == UserSet.Administrators && !IsAdministrator(ownerUUID)) ||
                 (m_allowedVBScriptCompilers == UserSet.ParcelOwners &&
                  !GenericParcelPermission(ownerUUID, scene.GetScenePresence(ownerUUID).AbsolutePosition, 0)) ||
                 GrantVB.Count == 0 || GrantVB.ContainsKey(ownerUUID.ToString()))
             {
                 return (true);
             }
             break;
         case "js":
             if ((m_allowedJSScriptCompilers == UserSet.Administrators && !IsAdministrator(ownerUUID)) ||
                 (m_allowedJSScriptCompilers == UserSet.ParcelOwners &&
                  !GenericParcelPermission(ownerUUID, scene.GetScenePresence(ownerUUID).AbsolutePosition, 0)) ||
                 GrantJS.Count == 0 || GrantJS.ContainsKey(ownerUUID.ToString()))
             {
                 return (true);
             }
             break;
         case "yp":
             if ((m_allowedYPScriptCompilers == UserSet.Administrators && !IsAdministrator(ownerUUID)) ||
                 (m_allowedYPScriptCompilers == UserSet.ParcelOwners &&
                  !GenericParcelPermission(ownerUUID, scene.GetScenePresence(ownerUUID).AbsolutePosition, 0)) ||
                 GrantYP.Count == 0 || GrantYP.ContainsKey(ownerUUID.ToString()))
             {
                 return (true);
             }
             break;
         case "ascript":
             if ((m_allowedAScriptScriptCompilers == UserSet.Administrators && !IsAdministrator(ownerUUID)) ||
                 (m_allowedAScriptScriptCompilers == UserSet.ParcelOwners &&
                  !GenericParcelPermission(ownerUUID, scene.GetScenePresence(ownerUUID).AbsolutePosition, 0)) ||
                 GrantAScript.Count == 0 || GrantAScript.ContainsKey(ownerUUID.ToString()))
             {
                 return (true);
             }
             break;
     }
     return false;
 }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:63,代码来源:PermissionsModule.cs

示例6: CanEditScript

        /// <summary>
        ///   Check whether the specified user can edit the given script
        /// </summary>
        /// <param name = "script"></param>
        /// <param name = "objectID"></param>
        /// <param name = "user"></param>
        /// <param name = "scene"></param>
        /// <returns></returns>
        private bool CanEditScript(UUID script, UUID objectID, UUID user, IScene scene)
        {
            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user))
                return false;
            if (m_allowedScriptEditors == UserSet.ParcelOwners &&
                !GenericParcelPermission(user, scene.GetScenePresence(user).AbsolutePosition, 0))
                return false;

            // Ordinarily, if you can view it, you can edit it
            // There is no viewing a no mod script
            //
            return CanViewScript(script, objectID, user, scene);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:24,代码来源:PermissionsModule.cs

示例7: RemoveAvatar

 public void RemoveAvatar (UUID avatarID, IScene scene)
 {
     if (!m_bots.Remove (avatarID))
         return;
     IScenePresence sp = scene.GetScenePresence (avatarID);
     if (sp == null)
         return;
     //Kill the agent
     IEntityTransferModule module = scene.RequestModuleInterface<IEntityTransferModule> ();
     module.IncomingCloseAgent (scene, avatarID);
 }
开发者ID:LOG123,项目名称:Aurora-Sim-PhysX,代码行数:11,代码来源:BotManager.cs

示例8: OnAllowedIncomingTeleport

        private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, uint TeleportFlags, out Vector3 newPosition, out string reason)
        {
            newPosition = Position;
            UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID);

            IScenePresence Sp = scene.GetScenePresence(userID);
            if(account == null)
            {
                IUserAgentService uas = scene.RequestModuleInterface<IUserAgentService> ();
                AgentCircuitData circuit;
                if (uas == null ||
                    (circuit = scene.AuthenticateHandler.GetAgentCircuitData(userID)) != null ||
                    !uas.VerifyAgent(circuit))
                {
                    reason = "Failed authentication.";
                    return false; //NO!
                }
            }

            
            //Make sure that this user is inside the region as well
            if (Position.X < -2f || Position.Y < -2f || 
                Position.X > scene.RegionInfo.RegionSizeX+2 || Position.Y > scene.RegionInfo.RegionSizeY+2)
            {
                m_log.DebugFormat(
                    "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping",
                    Position, Name, userID);
                bool changedX = false;
                bool changedY = false;
                while (Position.X < 0)
                {
                    Position.X += scene.RegionInfo.RegionSizeX;
                    changedX = true;
                }
                while (Position.X > scene.RegionInfo.RegionSizeX)
                {
                    Position.X -= scene.RegionInfo.RegionSizeX;
                    changedX = true;
                }

                while (Position.Y < 0)
                {
                    Position.Y += scene.RegionInfo.RegionSizeY;
                    changedY = true;
                }
                while (Position.Y > scene.RegionInfo.RegionSizeY)
                {
                    Position.Y -= scene.RegionInfo.RegionSizeY;
                    changedY = true;
                }

                if (changedX)
                    Position.X = scene.RegionInfo.RegionSizeX - Position.X;
                if(changedY)
                    Position.Y = scene.RegionInfo.RegionSizeY - Position.Y;
            }

            IAgentConnector AgentConnector = DataManager.DataManager.RequestPlugin<IAgentConnector>();
            IAgentInfo agentInfo = null;
            if (AgentConnector != null)
                agentInfo = AgentConnector.GetAgent(userID);

            ILandObject ILO = null;
            IParcelManagementModule parcelManagement = scene.RequestModuleInterface<IParcelManagementModule>();
            if (parcelManagement != null)
                ILO = parcelManagement.GetLandObject(Position.X, Position.Y);

            if (ILO == null)
            {
                if (Sp != null)
                    Sp.ClearSavedVelocity (); //If we are moving the agent, clear their velocity
                //Can't find land, give them the first parcel in the region and find a good position for them
                ILO = parcelManagement.AllParcels()[0];
                Position = parcelManagement.GetParcelCenterAtGround(ILO);
            }

            //parcel permissions
            if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block
            {
                if (Sp != null)
                    Sp.ClearSavedVelocity (); //If we are moving the agent, clear their velocity
                if (Sp == null)
                {
                    reason = "Banned from this parcel.";
                    return false;
                }

                if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                {
                    //We found a place for them, but we don't need to check any further on positions here
                    //return true;
                }
            }
            //Move them out of banned parcels
            ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags;
            if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup &&
                (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList &&
                (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList)
            {
                if (Sp != null)
//.........这里部分代码省略.........
开发者ID:chazzmac,项目名称:Aurora-Sim,代码行数:101,代码来源:EstateService.cs

示例9: DistanceCulling

        public bool DistanceCulling(IScenePresence client, IEntity entity, IScene scene)
        {
            float DD = client.DrawDistance;
            if (DD < 32) //Limit to a small distance
                DD = 32;
            if (DD > scene.RegionInfo.RegionSizeX &&
                DD > scene.RegionInfo.RegionSizeY)
                return true; //Its larger than the region, no culling check even necessary
            Vector3 posToCheckFrom = client.GetAbsolutePosition();
            Vector3 entityPosToCheckFrom = Vector3.Zero;
            bool doHeavyCulling = false;
            if (entity is ISceneEntity)
            {
                doHeavyCulling = true;
                //We need to check whether this object is an attachment, and if so, set it so that we check from the avatar's
                // position, rather than from the offset of the attachment
                ISceneEntity sEntity = (ISceneEntity) entity;
                if (sEntity.RootChild.IsAttachment)
                {
                    IScenePresence attachedAvatar = scene.GetScenePresence(sEntity.RootChild.AttachedAvatar);
                    if (attachedAvatar != null)
                        entityPosToCheckFrom = attachedAvatar.AbsolutePosition;
                }
                else
                    entityPosToCheckFrom = sEntity.RootChild.GetGroupPosition();
            }
            else if (entity is IScenePresence)
            {
                //We need to check whether this presence is sitting on anything, so that we can check from the object's
                // position, rather than the offset position of the object that the avatar is sitting on
                IScenePresence pEntity = (IScenePresence) entity;
                if (pEntity.Sitting)
                {
                    ISceneChildEntity sittingEntity = scene.GetSceneObjectPart(pEntity.SittingOnUUID);
                    if (sittingEntity != null)
                        entityPosToCheckFrom = sittingEntity.GetGroupPosition();
                }
                else
                    entityPosToCheckFrom = pEntity.GetAbsolutePosition();
            }
            //If the distance is greater than the clients draw distance, its out of range
            if (Vector3.DistanceSquared(posToCheckFrom, entityPosToCheckFrom) >
                DD*DD) //Use squares to make it faster than having to do the sqrt
            {
                if (!doHeavyCulling)
                    return false; //Don't do the hardcore checks
                ISceneEntity childEntity = (entity as ISceneEntity);
                if (childEntity != null && HardCullingCheck(childEntity))
                {
                    #region Side culling check (X, Y, Z) plane checks

                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom + new Vector3(childEntity.OOBsize.X, 0, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom - new Vector3(childEntity.OOBsize.X, 0, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom + new Vector3(0, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom - new Vector3(0, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom + new Vector3(0, 0, childEntity.OOBsize.Z)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom - new Vector3(0, 0, childEntity.OOBsize.Z)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;

                    #endregion

                    #region Corner checks ((x,y),(-x,-y),(x,-y),(-x,y), (y,z),(-y,-z),(y,-z),(-y,z), (x,z),(-x,-z),(x,-z),(-x,z))

                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom +
                                                new Vector3(childEntity.OOBsize.X, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom -
                                                new Vector3(childEntity.OOBsize.X, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:101,代码来源:Prioritizer.cs

示例10: Populate

        public void Populate(IScene scene)
        {
            ISceneChildEntity part = scene.GetSceneObjectPart(Key);
            Vector3 tmp;
            if (part == null) // Avatar, maybe?
            {
                IScenePresence presence = scene.GetScenePresence(Key);
                if (presence == null)
                    return;

                Name = presence.Name;
                Owner = Key;

                tmp = presence.AbsolutePosition;
                Position = new LSL_Types.Vector3(
                    tmp.X,
                    tmp.Y,
                    tmp.Z);
                Quaternion rtmp = presence.Rotation;
                Rotation = new LSL_Types.Quaternion(
                    rtmp.X,
                    rtmp.Y,
                    rtmp.Z,
                    rtmp.W);
                tmp = presence.Velocity;
                Velocity = new LSL_Types.Vector3(
                    tmp.X,
                    tmp.Y,
                    tmp.Z);

                Type = 0x01; // Avatar
                if (presence.Velocity != Vector3.Zero)
                    Type |= 0x02; // Active

                Group = presence.ControllingClient.ActiveGroupId;

                return;
            }

            part = part.ParentEntity.RootChild; // We detect objects only

            LinkNum = 0; // Not relevant

            Group = part.GroupID;
            Name = part.Name;
            Owner = part.OwnerID;
            Type = part.Velocity == Vector3.Zero ? 0x04 : 0x02;

            foreach (ISceneChildEntity child in part.ParentEntity.ChildrenEntities())
                if (child.Inventory.ContainsScripts())
                    Type |= 0x08; // Scripted

            tmp = part.AbsolutePosition;
            Position = new LSL_Types.Vector3(tmp.X,
                                             tmp.Y,
                                             tmp.Z);

            Quaternion wr = part.ParentEntity.GroupRotation;
            Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);

            tmp = part.Velocity;
            Velocity = new LSL_Types.Vector3(tmp.X,
                                             tmp.Y,
                                             tmp.Z);
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:65,代码来源:Helpers.cs

示例11: SendEmail


//.........这里部分代码省略.........
                                    LastObjectPosition + "\n\n";
                            }

                            //Config SMTP Server
                            var smtpServer = new SmtpClient ();
                            smtpServer.Host = SMTP_SERVER_HOSTNAME;
                            smtpServer.Port = SMTP_SERVER_PORT;
                            smtpServer.EnableSsl = (SMTP_SERVER_PORT == 587);
                            smtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
                            smtpServer.UseDefaultCredentials = false;
                            smtpServer.Credentials = new NetworkCredential (SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
                            smtpServer.Timeout = 15000;

                            // Beware !! This effectively ignores the ssl validation and assumes that all is correct 
                            // For Mono, requires importation of the Google smtpd certificate (see SMTPEmail.ini)
                            // Possibly not needed for Windows
                            //ServicePointManager.ServerCertificateValidationCallback = 
                            //    delegate(object sim, X509Certificate certificate, X509Chain chain SslPolicyErrors sslPolicyErrors)
                            //{ return true; };

                            // if ((!SMTP_SERVER_MONO_CERT) && (Utilities.IsLinuxOs))
                            ServicePointManager.ServerCertificateValidationCallback = delegate {
                                return true;
                            };

                            // create the message
                            var emailMessage = new MailMessage (fromAddress, toAddress);
                            emailMessage.Subject = subject;
                            emailMessage.Body = body;

                            // sample for adding attachments is needed sometime :)
                            //if File(Exist(fullFileName))
                            //{
                            //    var mailAttactment = new Attachment(fullFileName);
                            //    emailMessage.Attachments.Add(mailAttactment);
                            //}

                            // send the message
                            try {
                                smtpServer.Send (emailMessage);
                            } catch (SmtpException ex) {
                                SmtpStatusCode status = ex.StatusCode;
                                if (status == SmtpStatusCode.Ok)
                                    MainConsole.Instance.Info ("[Email]: EMail sent to: " + address + " from object: " +
                                    fromEmailAddress);
                                else
                                    MainConsole.Instance.Info ("[Email]: EMail error sending to: " + address + " from object: " +
                                    fromEmailAddress + " status: " + ex.Message);
                            }
                            smtpServer.Dispose ();
                        } catch (Exception e) {
                            MainConsole.Instance.Error ("[Email]: DefaultEmailModule Exception: " + e.Message);
                            didError = true;
                        }
                    });

                    threadSendMail.IsBackground = true;
                    threadSendMail.Start ();

                }
                if (((didError) || (m_localOnly)) && (scene != null)) {
                    // Notify Owner
                    ISceneChildEntity part = findPrim (objectID, out LastObjectRegionName, scene);
                    if (part != null) {
                        IScenePresence sp = scene.GetScenePresence (part.OwnerID);
                        if ((sp != null) && (!sp.IsChildAgent)) {
                            sp.ControllingClient.SendAlertMessage ("llEmail: email module not configured for outgoing emails");
                        }
                    }
                }
            } else {
                // inter object email, keep it in the family
                string guid = address.Substring (0, address.IndexOf ("@", StringComparison.Ordinal));
                UUID toID = new UUID (guid);

                if (IsLocal (toID, scene)) {
                    // object in this region
                    InsertEmail (toID, new Email {
                        time =((int)((DateTime.UtcNow - new DateTime (1970, 1, 1, 0, 0, 0)).TotalSeconds)).ToString (CultureInfo.InvariantCulture),
                        subject = subject,
                        sender = objectID + "@" + m_InterObjectHostname,
                        message = "Object-Name: " + LastObjectName + "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
                            LastObjectPosition + "\n\n" + body,
                        toPrimID = toID
                    });
                } else {
                    // object on another region

                    Email email = new Email {
                        time =((int)((DateTime.UtcNow - new DateTime (1970, 1, 1, 0, 0, 0)).TotalSeconds)).ToString (CultureInfo.InvariantCulture),
                        subject = subject,
                        sender = objectID + "@" + m_InterObjectHostname,
                        message = body,
                        toPrimID = toID
                    };
                    IEmailConnector conn = Framework.Utilities.DataManager.RequestPlugin<IEmailConnector> ();
                    conn.InsertEmail (email);
                }
            }
        }
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:101,代码来源:EmailModule.cs

示例12: ProvisionVoiceAccountRequest

        /// <summary>
        /// Callback for a client request for Voice Account Details
        /// </summary>
        /// <param name="scene">current scene object of the client</param>
        /// <param name="request"></param>
        /// <param name="path"></param>
        /// <param name="param"></param>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        /// <returns></returns>
        public string ProvisionVoiceAccountRequest(IScene scene, string request, string path, string param,
            UUID agentID)
        {
            IScenePresence avatar = scene.GetScenePresence (agentID);
            if (avatar == null)
            {
                System.Threading.Thread.Sleep(2000);
                avatar = scene.GetScenePresence(agentID);

                if (avatar == null)
                    return "<llsd>undef</llsd>";
            }
            string avatarName = avatar.Name;

            try
            {
                m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
                                  request, path, param);

                //XmlElement    resp;
                string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
                string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16);

                // XXX: we need to cache the voice credentials, as
                // FreeSwitch is later going to come and ask us for
                // those
                agentname = agentname.Replace('+', '-').Replace('/', '_');

                lock (m_UUIDName)
                {
                    if (m_UUIDName.ContainsKey(agentname))
                    {
                        m_UUIDName[agentname] = avatarName;
                    }
                    else
                    {
                        m_UUIDName.Add(agentname, avatarName);
                    }
                }

                OSDMap map = new OSDMap();
                map["username"] = agentname;
                map["password"] = password;
                map["voice_sip_uri_hostname"] = m_freeSwitchRealm;
                map["voice_account_server_name"] = String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
                                                               m_freeSwitchServicePort, m_freeSwitchAPIPrefix);
                string r = OSDParser.SerializeLLSDXmlString(map);

                m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1}", avatarName, r);

                return r;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1}, retry later", avatarName, e.Message);
                m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1} failed", avatarName, e.ToString());

                return "<llsd>undef</llsd>";
            }
        }
开发者ID:andsim,项目名称:Aurora-Sim-Optional-Modules,代码行数:70,代码来源:FreeSwitchVoiceModule.cs

示例13: ParcelVoiceInfoRequest

        /// <summary>
        /// Callback for a client request for ParcelVoiceInfo
        /// </summary>
        /// <param name="scene">current scene object of the client</param>
        /// <param name="request"></param>
        /// <param name="path"></param>
        /// <param name="param"></param>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        /// <returns></returns>
        public string ParcelVoiceInfoRequest(IScene scene, string request, string path, string param,
            UUID agentID)
        {
            IScenePresence avatar = scene.GetScenePresence (agentID);
            string avatarName = avatar.Name;

            // - check whether we have a region channel in our cache
            // - if not:
            //       create it and cache it
            // - send it to the client
            // - send channel_uri: as "sip:[email protected]_sipDomain"
            try
            {
                string channelUri;

                IParcelManagementModule parcelManagement = scene.RequestModuleInterface<IParcelManagementModule>();
                if (parcelManagement == null)
                    throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
                                                      scene.RegionInfo.RegionName, avatarName));

                // get channel_uri: check first whether estate
                // settings allow voice, then whether parcel allows
                // voice, if all do retrieve or obtain the parcel
                // voice channel
                LandData land = parcelManagement.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y).LandData;

                m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
                                  scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);

                if (!scene.RegionInfo.EstateSettings.AllowVoice)
                {
                     m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
                                       scene.RegionInfo.RegionName);
                     channelUri = String.Empty;
                }

                //This option isn't really enabled anymore, disable the check for it...
                /*if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
                {
                    m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
                                      scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
                    channelUri = String.Empty;
                }
                else
                {*/
                    channelUri = ChannelUri(scene, land);
                //}

                // fill in our response to the client
                OSDMap map = new OSDMap();
                map["region_name"] = scene.RegionInfo.RegionName;
                map["parcel_local_id"] = land.LocalID;
                map["voice_credentials"] = new OSDMap();
                ((OSDMap)map["voice_credentials"])["channel_uri"] = channelUri;
                string r = OSDParser.SerializeLLSDXmlString(map);

                m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
                                  scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
                return r;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
                                  scene.RegionInfo.RegionName, avatarName, e.Message);
                m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
                                  scene.RegionInfo.RegionName, avatarName, e.ToString());

                return "<llsd>undef</llsd>";
            }
        }
开发者ID:andsim,项目名称:Aurora-Sim-Optional-Modules,代码行数:80,代码来源:FreeSwitchVoiceModule.cs

示例14: ProvisionVoiceAccountRequest

        /// <summary>
        /// Callback for a client request for Voice Account Details
        /// </summary>
        /// <param name="scene">current scene object of the client</param>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        /// <returns></returns>
        public byte[] ProvisionVoiceAccountRequest(IScene scene, UUID agentID)
        {
            try
            {

                IScenePresence avatar = null;
                string        avatarName = null;

                if (scene == null) throw new Exception("[VivoxVoice][PROVISIONVOICE] Invalid scene");

                avatar = scene.GetScenePresence(agentID);
                while (avatar == null)
                {
                    Thread.Sleep(100);
                    avatar = scene.GetScenePresence(agentID);
                }

                avatarName = avatar.Name;

                m_log.TraceFormat("[VivoxVoice][PROVISIONVOICE]: scene = {0}, agentID = {1}", scene, agentID);

                XmlElement    resp;
                bool          retry = false;
                string        agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
                string        password  = new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16);
                string        code = String.Empty;

                agentname = agentname.Replace('+', '-').Replace('/', '_');

                do
                {
                    resp = VivoxGetAccountInfo(agentname);

                    if (XmlFind(resp, "response.level0.status", out code))
                    {
                        if (code != "OK")
                        {
                            if (XmlFind(resp, "response.level0.body.code", out code))
                            {
                                // If the request was recognized, then this should be set to something
                                switch (code)
                                {
                                    case "201" : // Account expired
                                        m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Get account information failed : expired credentials",
                                                          avatarName);
                                        m_adminConnected = false;
                                        retry = DoAdminLogin();
                                        break;

                                    case "202" : // Missing credentials
                                        m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Get account information failed : missing credentials",
                                                          avatarName);
                                        break;

                                    case "212" : // Not authorized
                                        m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Get account information failed : not authorized",
                                                          avatarName);
                                        break;

                                    case "300" : // Required parameter missing
                                        m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Get account information failed : parameter missing",
                                                          avatarName);
                                        break;

                                    case "403" : // Account does not exist
                                        resp = VivoxCreateAccount(agentname,password);
                                        // Note: This REALLY MUST BE status. Create Account does not return code.
                                        if (XmlFind(resp, "response.level0.status", out code))
                                        {
                                            switch (code)
                                            {
                                                case "201" : // Account expired
                                                    m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Create account information failed : expired credentials",
                                                                      avatarName);
                                                    m_adminConnected = false;
                                                    retry = DoAdminLogin();
                                                    break;

                                                case "202" : // Missing credentials
                                                    m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Create account information failed : missing credentials",
                                                                      avatarName);
                                                    break;

                                                case "212" : // Not authorized
                                                    m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Create account information failed : not authorized",
                                                                      avatarName);
                                                    break;

                                                case "300" : // Required parameter missing
                                                    m_log.ErrorFormat("[VivoxVoice]: avatar \"{0}\": Create account information failed : parameter missing",
                                                                      avatarName);
                                                    break;

//.........这里部分代码省略.........
开发者ID:nhede,项目名称:Aurora-Sim-Optional-Modules,代码行数:101,代码来源:VivoxVoiceModule.cs

示例15: ParcelVoiceInfoRequest

        /// <summary>
        /// Callback for a client request for ParcelVoiceInfo
        /// </summary>
        /// <param name="scene">current scene object of the client</param>
        /// <param name="request"></param>
        /// <param name="path"></param>
        /// <param name="param"></param>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        /// <returns></returns>
        public byte[] ParcelVoiceInfoRequest(IScene scene, UUID agentID)
        {
            IScenePresence avatar = scene.GetScenePresence(agentID);
            string        avatarName = avatar.Name;

            // - check whether we have a region channel in our cache
            // - if not:
            //       create it and cache it
            // - send it to the client
            // - send channel_uri: as "sip:[email protected]_sipDomain"
            try
            {
                string channel_uri;

                // get channel_uri: check first whether estate
                // settings allow voice, then whether parcel allows
                // voice, if all do retrieve or obtain the parcel
                // voice channel
                LandData land = avatar.CurrentParcel.LandData;

                if (!scene.RegionInfo.EstateSettings.AllowVoice)
                {
                    m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
                                      scene.RegionInfo.RegionName);
                    channel_uri = String.Empty;
                }
                //Disable this, force voice chat on only configurable via estate since LL disabled this
                /*else if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
                {
                    m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
                                      scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
                    channel_uri = String.Empty;
                }*/
                else
                {
                    m_log.DebugFormat("[VivoxVoice]: region \"{0}\": voice enabled in estate settings, creating parcel voice",
                                      scene.RegionInfo.RegionName);
                    channel_uri = RegionGetOrCreateChannel(scene, land);
                }

                // fill in our response to the client
                OSDMap map = new OSDMap();
                map["region_name"] = scene.RegionInfo.RegionName;
                map["parcel_local_id"] = land.LocalID;
                map["voice_credentials"] = new OSDMap();
                ((OSDMap)map["voice_credentials"])["channel_uri"] = channel_uri;

                m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\"",
                                  scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
                return OSDParser.SerializeLLSDXmlBytes(map);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
                                  scene.RegionInfo.RegionName, avatarName, e.Message);
                m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
                                  scene.RegionInfo.RegionName, avatarName, e.ToString());

                return Encoding.UTF8.GetBytes("<llsd><undef /></llsd>");
            }
        }
开发者ID:nhede,项目名称:Aurora-Sim-Optional-Modules,代码行数:71,代码来源:VivoxVoiceModule.cs


注:本文中的IScene.GetScenePresence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。