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


C# IScene.RequestModuleInterfaces方法代码示例

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


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

示例1: SaveRegionBackup

        public void SaveRegionBackup(TarArchiveWriter writer, IScene scene)
        {
            writer.WriteDir("assets"); //Used by many, create it by default

            IAuroraBackupModule[] modules = scene.RequestModuleInterfaces<IAuroraBackupModule>();
            foreach (IAuroraBackupModule module in modules)
                module.SaveModuleToArchive(writer, scene);

            foreach (IAuroraBackupModule module in modules)
            {
                while (module.IsArchiving) //Wait until all are done
                    Thread.Sleep(100);
            }

            writer.Close();
            GC.Collect();
            MainConsole.Instance.Info("[Archive]: Finished saving of archive.");
        }
开发者ID:BillyWarrhol,项目名称:Aurora-Sim,代码行数:18,代码来源:AuroraArchiver.cs

示例2: LoadRegionBackup

        public void LoadRegionBackup(TarArchiveReader reader, IScene scene)
        {
            IAuroraBackupModule[] modules = scene.RequestModuleInterfaces<IAuroraBackupModule>();

            byte[] data;
            string filePath;
            TarArchiveReader.TarEntryType entryType;

            foreach (IAuroraBackupModule module in modules)
                module.BeginLoadModuleFromArchive(scene);

            while ((data = reader.ReadEntry(out filePath, out entryType)) != null)
            {
                if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
                    continue;
                foreach (IAuroraBackupModule module in modules)
                    module.LoadModuleFromArchive(data, filePath, entryType, scene);
            }

            reader.Close();

            foreach (IAuroraBackupModule module in modules)
                module.EndLoadModuleFromArchive(scene);
        }
开发者ID:BillyWarrhol,项目名称:Aurora-Sim,代码行数:24,代码来源:AuroraArchiver.cs

示例3: RegisterRegionWithGrid

        /// <summary>
        ///   Register this region with the grid service
        /// </summary>
        /// <param name = "scene"></param>
        /// <param name = "returnResponseFirstTime">Should we try to walk the user through what went wrong?</param>
        /// <param name="continueTrying"> </param>
        /// <param name="password"> </param>
        public bool RegisterRegionWithGrid(IScene scene, bool returnResponseFirstTime, bool continueTrying, string password)
        {
            GridRegion region = BuildGridRegion(scene.RegionInfo);

            IGenericsConnector g = DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridSessionID s = null;
            IGridService GridService = scene.RequestModuleInterface<IGridService>();
            if (g != null) //Get the sessionID from the database if possible
                s = g.GetGeneric<GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID");

            if (s == null)
            {
                s = new GridSessionID {SessionID = scene.RegionInfo.GridSecureSessionID};
                //Set it from the regionInfo if it knows anything
            }

            scene.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region);

            //Tell the grid service about us
            RegisterRegion error = GridService.RegisterRegion(region, s.SessionID, password);
            if (error.Error == String.Empty)
            {
                s.SessionID = error.SessionID;
                //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it
                scene.RegionInfo.GridSecureSessionID = error.SessionID;
                //Update our local copy of what our region flags are
                scene.RegionInfo.RegionFlags = error.RegionFlags;
                scene.RegionInfo.ScopeID = error.Region.ScopeID;
                scene.RegionInfo.AllScopeIDs = error.Region.AllScopeIDs;

                //Save the new SessionID to the database
                if (g != null) g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD());

                m_knownNeighbors[scene.RegionInfo.RegionID] = error.Neighbors;
                return true; //Success
            }
            if (returnResponseFirstTime && !continueTrying)
            {
                MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region with grid failed again - " + error.Error);
                return false;
            }

            //Parse the error and try to do something about it if at all possible
            if (error.Error == "Region location is reserved")
            {
                MainConsole.Instance.Error(
                    "[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region.");
                int X = 0, Y = 0;
                int.TryParse(MainConsole.Instance.Prompt("New Region Location X", "1000"), out X);
                int.TryParse(MainConsole.Instance.Prompt("New Region Location Y", "1000"), out Y);

                scene.RegionInfo.RegionLocX = X*Constants.RegionSize;
                scene.RegionInfo.RegionLocY = Y*Constants.RegionSize;

                IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>();
                foreach (IRegionLoader loader in loaders)
                {
                    loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo);
                }
            }
            else if (error.Error == "Region overlaps another region")
            {
                MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName +
                                           " with the grid failed - The region location you specified is already in use. You must move your region.");
                int X = 0, Y = 0;
                int.TryParse(
                    MainConsole.Instance.Prompt("New Region Location X",
                                                (scene.RegionInfo.RegionLocX/256).ToString()), out X);
                int.TryParse(
                    MainConsole.Instance.Prompt("New Region Location Y",
                                                (scene.RegionInfo.RegionLocY/256).ToString()), out Y);

                scene.RegionInfo.RegionLocX = X*Constants.RegionSize;
                scene.RegionInfo.RegionLocY = Y*Constants.RegionSize;

                IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>();
                foreach (IRegionLoader loader in loaders)
                {
                    loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo);
                }
            }
            else if (error.Error.Contains("Can't move this region"))
            {
                MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName +
                                           " with the grid failed - You can not move this region. Moving it back to its original position.");
                //Opensim Grid Servers don't have this functionality.
                try
                {
                    string[] position = error.Error.Split(',');

                    scene.RegionInfo.RegionLocX = int.Parse(position[1])*Constants.RegionSize;
                    scene.RegionInfo.RegionLocY = int.Parse(position[2])*Constants.RegionSize;

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

示例4: EndLoadModuleFromArchive

            public void EndLoadModuleFromArchive(IScene scene)
            {
                IBackupModule backup = scene.RequestModuleInterface<IBackupModule>();
                IScriptModule[] modules = scene.RequestModuleInterfaces<IScriptModule>();
                //Reeanble now that we are done
                foreach (IScriptModule module in modules)
                {
                    module.Disabled = false;
                }
                //Reset backup too
                if (backup != null)
                    backup.LoadingPrims = false;

                //Update the database as well!
                IParcelManagementModule parcelManagementModule = scene.RequestModuleInterface<IParcelManagementModule>();
                if (parcelManagementModule != null && !m_merge) //Only if we are not merging
                {
                    if (m_parcels.Count > 0)
                    {
                        scene.EventManager.TriggerIncomingLandDataFromStorage(m_parcels, Vector2.Zero);
                        //Update the database as well!
                        foreach (LandData parcel in m_parcels)
                        {
                            parcelManagementModule.UpdateLandObject(parcelManagementModule.GetLandObject(parcel.LocalID));
                        }
                    }
                    else parcelManagementModule.ResetSimLandObjects();
                    m_parcels.Clear();
                }

                foreach (ISceneEntity sceneObject in m_groups)
                {
                    foreach (ISceneChildEntity part in sceneObject.ChildrenEntities())
                    {
                        if (!ResolveUserUuid(part.CreatorID))
                            part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        if (!ResolveUserUuid(part.OwnerID))
                            part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        if (!ResolveUserUuid(part.LastOwnerID))
                            part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        // Fix ownership/creator of inventory items
                        // Not doing so results in inventory items
                        // being no copy/no mod for everyone
                        lock (part.TaskInventory)
                        {
                            TaskInventoryDictionary inv = part.TaskInventory;
                            foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
                            {
                                if (!ResolveUserUuid(kvp.Value.OwnerID))
                                {
                                    kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
                                }
                                if (!ResolveUserUuid(kvp.Value.CreatorID))
                                {
                                    kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
                                }
                            }
                        }
                    }

                    if (scene.SceneGraph.AddPrimToScene(sceneObject))
                    {
                        sceneObject.HasGroupChanged = true;
                        sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
                        sceneObject.CreateScriptInstances(0, false, StateSource.RegionStart, UUID.Zero, false);
                    }
                }
            }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:71,代码来源:Backup.cs

示例5: BeginLoadModuleFromArchive

 public void BeginLoadModuleFromArchive(IScene scene)
 {
     IBackupModule backup = scene.RequestModuleInterface<IBackupModule>();
     IScriptModule[] modules = scene.RequestModuleInterfaces<IScriptModule>();
     IParcelManagementModule parcelModule = scene.RequestModuleInterface<IParcelManagementModule>();
     //Disable the script engine so that it doesn't load in the background and kill OAR loading
     foreach (IScriptModule module in modules)
     {
         if (module != null)
             module.Disabled = true;
     }
     //Disable backup for now as well
     if (backup != null)
     {
         backup.LoadingPrims = true;
         m_loadAssets =
             MainConsole.Instance.Prompt(
                 "Should any stored assets be loaded? (If you got this .abackup from another grid, choose yes",
                 "no").ToLower() == "yes";
         m_merge =
             MainConsole.Instance.Prompt(
                 "Should we merge prims together (keep the prims from the old region too)?", "no").ToLower() ==
             "yes";
         if (!m_merge)
         {
             DateTime before = DateTime.Now;
             MainConsole.Instance.Info("[ARCHIVER]: Clearing all existing scene objects");
             backup.DeleteAllSceneObjects();
             MainConsole.Instance.Info("[ARCHIVER]: Cleared all existing scene objects in " +
                                       (DateTime.Now - before).Minutes + ":" +
                                       (DateTime.Now - before).Seconds);
             if (parcelModule != null)
                 parcelModule.ClearAllParcels();
         }
     }
 }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:36,代码来源:Backup.cs

示例6: EndLoadModuleFromArchive

            public void EndLoadModuleFromArchive(IScene scene)
            {
                IBackupModule backup = scene.RequestModuleInterface<IBackupModule>();
                IScriptModule[] modules = scene.RequestModuleInterfaces<IScriptModule>();
                //Reeanble now that we are done
                foreach (IScriptModule module in modules)
                {
                    module.Disabled = false;
                }
                //Reset backup too
                if (backup != null)
                    backup.LoadingPrims = false;

                //Update the database as well!
                IParcelManagementModule parcelManagementModule = scene.RequestModuleInterface<IParcelManagementModule>();
                if (parcelManagementModule != null && !m_merge) //Only if we are not merging
                {
                    if (m_parcels.Count > 0)
                    {
                        scene.EventManager.TriggerIncomingLandDataFromStorage(m_parcels, Vector2.Zero);
                        //Update the database as well!
                        if (parcelManagementModule != null)
                        {
                            foreach (LandData parcel in m_parcels)
                            {
                                parcelManagementModule.UpdateLandObject(parcelManagementModule.GetLandObject(parcel.LocalID));
                            }
                        }
                    }
                    else if (parcelManagementModule != null)
                        parcelManagementModule.ResetSimLandObjects ();
                    m_parcels.Clear();
                }
            }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:34,代码来源:Backup.cs

示例7: RegisterRegionWithGrid

        /// <summary>
        /// Register this region with the grid service
        /// </summary>
        /// <param name="scene"></param>
        public void RegisterRegionWithGrid(IScene scene)
        {
            GridRegion region = BuildGridRegion(scene.RegionInfo);

            IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridSessionID s = null;
            IGridService GridService = scene.RequestModuleInterface<IGridService>();
            if (g != null) //Get the sessionID from the database if possible
                s = g.GetGeneric<GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", new GridSessionID());

            if (s == null)
            {
                s = new GridSessionID();
                //Set it from the regionInfo if it knows anything
                s.SessionID = scene.RegionInfo.GridSecureSessionID;
            }

            scene.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region);

            List<GridRegion> neighbors = new List<GridRegion> ();
            //Tell the grid service about us
            string error = GridService.RegisterRegion (region, s.SessionID, out s.SessionID, out neighbors);
            if (error == String.Empty)
            {
                //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it
                scene.RegionInfo.GridSecureSessionID = s.SessionID;

                //Save the new SessionID to the database
                g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD());

                m_knownNeighbors[scene.RegionInfo.RegionID] = neighbors;
            }
            else
            {
                //Parse the error and try to do something about it if at all possible
                if (error == "Region location is reserved")
                {
                    m_log.Error("[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region.");
                    int X = 0, Y = 0;
                    int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X);
                    int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y);

                    scene.RegionInfo.RegionLocX = X * Constants.RegionSize;
                    scene.RegionInfo.RegionLocY = Y * Constants.RegionSize;

                    IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>();
                    foreach (IRegionLoader loader in loaders)
                    {
                        loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo);
                    }
                }
                if (error == "Region overlaps another region")
                {
                    m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region.");
                    int X = 0, Y = 0;
                    int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X);
                    int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y);

                    scene.RegionInfo.RegionLocX = X * Constants.RegionSize;
                    scene.RegionInfo.RegionLocY = Y * Constants.RegionSize;

                    IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>();
                    foreach (IRegionLoader loader in loaders)
                    {
                        loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo);
                    }
                }
                if (error.Contains("Can't move this region"))
                {
                    m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position.");
                    //Opensim Grid Servers don't have this functionality.
                    try
                    {
                        string[] position = error.Split(',');

                        scene.RegionInfo.RegionLocX = int.Parse(position[1]) * Constants.RegionSize;
                        scene.RegionInfo.RegionLocY = int.Parse(position[2]) * Constants.RegionSize;

                        IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>();
                        foreach (IRegionLoader loader in loaders)
                        {
                            loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo);
                        }
                    }
                    catch (Exception e)
                    {
                        m_log.Error("Unable to move the region back to its original position, is this an opensim server? Please manually move the region back.");
                        throw e;
                    }
                }
                if (error == "Duplicate region name")
                {
                    m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name.");
                    string oldRegionName = scene.RegionInfo.RegionName;
                    scene.RegionInfo.RegionName = MainConsole.Instance.CmdPrompt("New Region Name", "");

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

示例8: SaveRegionBackup

        public void SaveRegionBackup(TarArchiveWriter writer, IScene scene)
        {
            writer.WriteDir("assets"); //Used by many, create it by default

            IAuroraBackupModule[] modules = scene.RequestModuleInterfaces<IAuroraBackupModule>();
            foreach (IAuroraBackupModule module in modules)
                module.SaveModuleToArchive(writer, scene);

            foreach (IAuroraBackupModule module in modules)
            {
                while (module.IsArchiving) //Wait until all are done
                    System.Threading.Thread.Sleep(100);
            }

            writer.Close();
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:16,代码来源:AuroraArchiver.cs

示例9: NewUserConnection

        /// <summary>
        /// Do the work necessary to initiate a new user connection for a particular scene.
        /// At the moment, this consists of setting up the caps infrastructure
        /// The return bool should allow for connections to be refused, but as not all calling paths
        /// take proper notice of it let, we allowed banned users in still.
        /// </summary>
        /// <param name="agent">CircuitData of the agent who is connecting</param>
        /// <param name="reason">Outputs the reason for the false response on this string,
        /// If the agent was accepted, this will be the Caps SEED for the region</param>
        /// <param name="requirePresenceLookup">True for normal presence. False for NPC
        /// or other applications where a full grid/Hypergrid presence may not be required.</param>
        /// <returns>True if the region accepts this agent.  False if it does not.  False will 
        /// also return a reason.</returns>
        public bool NewUserConnection (IScene scene, AgentCircuitData agent, uint teleportFlags, out string reason)
        {
            reason = String.Empty;

            // Don't disable this log message - it's too helpful
            m_log.DebugFormat (
                "[ConnectionBegin]: Region {0} told of incoming {1} agent {2} (circuit code {3}, teleportflags {4})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode, teleportFlags);

            if (!AuthorizeUser (scene, agent, out reason))
            {
                OSDMap map = new OSDMap ();
                map["Reason"] = reason;
                map["Success"] = false;
                reason = OSDParser.SerializeJsonString (map);
                return false;
            }

            IScenePresence sp = scene.GetScenePresence (agent.AgentID);

            if (sp != null && !sp.IsChildAgent)
            {
                // We have a zombie from a crashed session. 
                // Or the same user is trying to be root twice here, won't work.
                // Kill it.
                m_log.InfoFormat ("[Scene]: Zombie scene presence detected for {0} in {1}", agent.AgentID, scene.RegionInfo.RegionName);
                IActivityDetector[] activityDetectors = scene.RequestModuleInterfaces<IActivityDetector> ();
                foreach (IActivityDetector det in activityDetectors)
                {
                    if(det != null)
                        det.AgentIsAZombie (sp.UUID);
                }
                scene.RemoveAgent (sp);
                sp = null;
            }

            //Add possible Urls for the given agent
            IConfigurationService configService = scene.RequestModuleInterface<IConfigurationService> ();
            if (configService != null && agent.OtherInformation.ContainsKey ("UserUrls"))
            {
                configService.AddNewUser (agent.AgentID.ToString (), (OSDMap)agent.OtherInformation["UserUrls"]);
            }

            OSDMap responseMap = new OSDMap ();
            responseMap["CapsUrls"] = scene.EventManager.TriggerOnRegisterCaps (agent.AgentID);

            // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
            agent.teleportFlags = teleportFlags;

            responseMap["Agent"] = agent.PackAgentCircuitData ();

            object[] obj = new object[2];
            obj[0] = responseMap;
            obj[1] = agent;
            scene.AuroraEventManager.FireGenericEventHandler ("NewUserConnection", obj);

            //Add the circuit at the end
            scene.AuthenticateHandler.AddNewCircuit (agent.circuitcode, agent);

            m_log.InfoFormat (
                "[ConnectionBegin]: Region {0} authenticated and authorized incoming {1} agent {2} (circuit code {3})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode);

            responseMap["Success"] = true;
            reason = OSDParser.SerializeJsonString (responseMap);
            return true;
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:82,代码来源:EntityTransferModule.cs


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