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


C# ILandObject.IsRestrictedFromLand方法代码示例

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


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

示例1: TestLandRestrictions

        private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land,  out string reason)
        {
            bool banned = land.IsBannedFromLand(agent.AgentID);
            bool restricted = land.IsRestrictedFromLand(agent.AgentID);

            if (banned || restricted)
            {
                ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y);
                if (nearestParcel != null)
                {
                    //Move agent to nearest allowed
                    Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
                    agent.startpos.X = newPosition.X;
                    agent.startpos.Y = newPosition.Y;
                }
                else
                {
                    if (banned)
                    {
                        reason = "Cannot regioncross into banned parcel.";
                    }
                    else
                    {
                        reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
                                   RegionInfo.RegionName);
                    }
                    return false;
                }
            }
            reason = "";
            return true;
        }
开发者ID:CCIR,项目名称:opensim,代码行数:32,代码来源:Scene.cs

示例2: EnforceBans

        // checks and enforces bans or restrictions
        // returns true if enforced
        public bool EnforceBans(ILandObject land, ScenePresence avatar)
        {
            Vector3 agentpos = avatar.AbsolutePosition;
            float h = m_scene.GetGroundHeight(agentpos.X, agentpos.Y) + LandChannel.BAN_LINE_SAFETY_HEIGHT;
            float zdif = avatar.AbsolutePosition.Z - h;
            if (zdif > 0 )
            {
                forcedPosition.Remove(avatar.UUID);
                avatar.lastKnownAllowedPosition = agentpos;
                return false;
            }

            bool ban = false;
            string reason = "";
            if (land.IsRestrictedFromLand(avatar.UUID))
            {
                reason = "You do not have access to the parcel";
                ban = true;
            }

            if (land.IsBannedFromLand(avatar.UUID))
            {
                if ( m_allowedForcefulBans)
                {
                   reason ="You are banned from parcel";
                   ban = true;
                }
                else if(!ban)
                {
                    if (forcedPosition.Contains(avatar.UUID))
                        avatar.ControllingClient.SendAlertMessage("You are banned from parcel, please leave by your own will");
                    forcedPosition.Remove(avatar.UUID);
                    avatar.lastKnownAllowedPosition = agentpos;
                    return false;
                }
            }
     
            if(ban)
            {
                if (!forcedPosition.Contains(avatar.UUID))
                    avatar.ControllingClient.SendAlertMessage(reason);

                if(zdif > -4f)
                {

                    agentpos.Z = h + 4.0f;
                    ForceAvatarToPosition(avatar, agentpos);
                    return true;
                }

                if (land.ContainsPoint((int)avatar.lastKnownAllowedPosition.X,
                            (int) avatar.lastKnownAllowedPosition.Y))
                {
                    Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
                    if (pos == null)
                    {
                         forcedPosition.Remove(avatar.UUID);
                         m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
                    }
                    else
                        ForceAvatarToPosition(avatar, (Vector3)pos);
                }
                else
                {
                    ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
                }
                return true;
            }
            else
            {
                forcedPosition.Remove(avatar.UUID);
                avatar.lastKnownAllowedPosition = agentpos;
                return false;
            }
        }
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:77,代码来源:LandManagementModule.cs


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