コード例 #1
0
ファイル: SceneXmlLoader.cs プロジェクト: Gnu32/Silverfin
        public static void LoadPrimsFromXml(IScene scene, string fileName, bool newIDS, Vector3 loadOffset)
        {
            XmlDocument doc = new XmlDocument();

            if (fileName.StartsWith("http:") || File.Exists(fileName))
            {
                XmlTextReader reader = new XmlTextReader(fileName) {WhitespaceHandling = WhitespaceHandling.None};
                doc.Load(reader);
                reader.Close();
                XmlNode rootNode = doc.FirstChild;
                foreach (XmlNode aPrimNode in rootNode.ChildNodes)
                {
                    SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(aPrimNode.OuterXml, scene);
                    if (group == null)
                        return;

                    group.IsDeleted = false;
                    group.m_isLoaded = true;
                    foreach (SceneObjectPart part in group.ChildrenList)
                    {
                        part.IsLoading = false;
                    }
                    scene.SceneGraph.AddPrimToScene(group);
                }
            }
            else
            {
                throw new Exception("Could not open file " + fileName + " for reading");
            }
        }
コード例 #2
0
        public void AddRegion(IScene scene)
        {
            m_scene = scene;

            m_scene.EventManager.OnNewClient += OnNewClient;
            m_scene.EventManager.OnClosingClient += OnClosingClient;
        }
コード例 #3
0
ファイル: NewFileAgentInventory.cs プロジェクト: thoys/simian
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("NewFileAgentInventory requires an IHttpServer");
                return;
            }

            m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>();
            if (m_assetClient == null)
            {
                m_log.Warn("NewFileAgentInventory requires an IAssetClient");
                return;
            }

            m_inventoryClient = m_scene.Simian.GetAppModule<IInventoryClient>();
            if (m_inventoryClient == null)
            {
                m_log.Warn("NewFileAgentInventory requires an IInventoryClient");
            }

            m_permissions = m_scene.GetSceneModule<LLPermissions>();

            //m_scene.Capabilities.AddProtectedResource(m_scene.ID, "NewFileAgentInventory", NewFileAgentInventoryHandler);
            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "NewFileAgentInventoryVariablePrice", NewFileAgentInventoryVariablePriceHandler);
        }
コード例 #4
0
        public void AddRegion (IScene scene)
        {
            if (m_scene == null)
                m_scene = scene;

            scene.RegisterModuleInterface<IJ2KDecoder>(this);
        }
コード例 #5
0
 public void AddRegion (IScene scene)
 {
     m_scene = scene;
     m_scene.RegisterModuleInterface<IBuySellModule>(this);
     m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
     m_scene.EventManager.OnClosingClient += UnsubscribeFromClientEvents;
 }
コード例 #6
0
 public virtual void cleanup()
 {
     if (null != this.activeScene)
         this.activeScene.cleanup();
     this.activeScene = null;
     this.currentSceneIndex = 0;
 }
コード例 #7
0
        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            //IConfig serverConfig = config.Configs["SimulationService"];
            //if (serverConfig == null)
            //    throw new Exception("No section 'SimulationService' in config file");

            //string simService = serverConfig.GetString("LocalServiceModule",
            //        String.Empty);

            //if (simService == String.Empty)
            //    throw new Exception("No SimulationService in config file");

            //Object[] args = new Object[] { config };
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
                    //ServerUtils.LoadPlugin<ISimulationService>(simService, args);

            //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
            //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);

            //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
        }
コード例 #8
0
        public void RegionLoaded(IScene scene)
        {
            //Set up the incoming handler
            MainServer.Instance.AddStreamHandler(new CRBSIncoming(this));

            //Call up other sims
            IConfig banSysConfig = m_config.Configs["CrossRegionBanSystem"];
            if (banSysConfig != null)
            {
                if (!banSysConfig.GetBoolean("Enabled", false))
                    return;

                OurGetPassword = banSysConfig.GetString("OurPassword", "");

                string URLlist = banSysConfig.GetString("URLs", string.Empty);
                if (URLlist == string.Empty)
                    return;
                List<string> URLS = new List<string>(URLlist.Split(','));

                string Passlist = banSysConfig.GetString("Passwords", string.Empty);
                if (Passlist == string.Empty)
                    return;
                List<string> Passwords = new List<string>(Passlist.Split(','));

                int i = 0;
                foreach (string URL in URLS)
                {
                    AskForeignServerForBans(URL, Passwords[i]);
                    i++;
                }
            }
        }
コード例 #9
0
        public void AddRegion(IScene scene)
        {
            m_scene = scene;

            Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
            m_graph = Graphics.FromImage(bitmap);
        }
コード例 #10
0
 /// <summary>
 ///   Can be called from other modules.
 /// </summary>
 /// <param name = "scene"></param>
 public void RemoveScene(IScene scene)
 {
     lock (m_sceneList)
     {
         m_sceneList.Remove(scene);
     }
 }
コード例 #11
0
        bool m_renderMeshes = true;     // true if to render meshes rather than just bounding boxes

        #region IMapTileTerrainRenderer Members

        public void Initialise (IScene scene, IConfigSource config)
        {
            m_scene = scene;
            m_imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder> ();
            m_config = config;
            m_assetCacheDir = m_config.Configs ["AssetCache"].GetString ("CacheDirectory", m_assetCacheDir);
            if (m_assetCacheDir == "") {
                var defpath = scene.RequestModuleInterface<ISimulationBase> ().DefaultDataPath;
                m_assetCacheDir = System.IO.Path.Combine (defpath, Constants.DEFAULT_ASSETCACHE_DIR);
            }

            List<string> renderers = RenderingLoader.ListRenderers (Util.ExecutingDirectory ());
            if (renderers.Count > 0) {
                m_primMesher = RenderingLoader.LoadRenderer (renderers [0]);
                MainConsole.Instance.Debug ("[WarpTile generator]: Loaded prim mesher " + m_primMesher);
            } else {
                MainConsole.Instance.Info ("[WarpTile generator]: No prim mesher loaded, prim rendering will be disabled");
            }

            var mapConfig = m_config.Configs ["MapModule"];
            if (mapConfig != null) {
                m_texturePrimSize = mapConfig.GetFloat ("TexturePrimSize", m_texturePrimSize);
                m_renderMeshes = mapConfig.GetBoolean ("RenderMeshes", m_renderMeshes);
            }


            ReadCacheMap ();
        }
コード例 #12
0
 public void AddRegion(IScene scene)
 {
     m_scene = scene;
     m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
     m_scene.EventManager.OnClosingClient += EventManager_OnClosingClient;
     m_scene.EventManager.OnRegisterCaps += RegisterCaps;
 }
コード例 #13
0
 public void AddRegion(IScene scene)
 {
     scene.EventManager.OnNewClient += EventManager_OnNewClient;
     scene.EventManager.OnClosingClient += EventManager_OnClosingClient;
     scene.EventManager.OnNewPresence += EventManager_OnNewPresence;
     scene.EventManager.OnRemovePresence += EventManager_OnRemovePresence;
 }
コード例 #14
0
 public void Initialise(IScene scene, IConfigSource config)
 {
     m_scene = scene;
     m_imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
     m_config = config;
     ReadCacheMap();
 }
コード例 #15
0
 public TerrainChannel(IScene scene)
 {
     m_scene = scene;
     m_Width = m_scene.RegionInfo.RegionSizeX;
     m_Height = m_scene.RegionInfo.RegionSizeY;
     CreateDefaultTerrain(m_scene.RegionInfo.RegionTerrain);
 }
コード例 #16
0
ファイル: World.cs プロジェクト: savino1976/Aurora-Sim
 public World(IScene internalScene, ISecurityCredential securityCredential)
 {
     m_security = securityCredential;
     m_internalScene = internalScene;
     m_heights = new Heightmap(m_internalScene);
     m_objs = new ObjectAccessor(m_internalScene, securityCredential);
 }
コード例 #17
0
        public static void PlayScene1(IScene scene, string fileName, string webaddress, ISceneSerializer sceneSerializer)
        {
            Console.WriteLine("EndlessDialogs library demonstration");
            Console.WriteLine("----------------------------");

            Console.WriteLine("Example");
            Console.WriteLine("1) Linear conversation");
            Console.WriteLine("2) Branched conversation");
            Console.WriteLine("3) Save Scene");
            Console.WriteLine("4) Load Scene");
            int answer = ReadAnswerNumber(1, 4);

            if (answer == 1)
                ConversationRunner(scene.GetConversations().First());
            else if(answer == 2)
                ConversationRunner(scene.GetConversations().Skip(1).ToList().First());
            else if (answer == 3)
            {
                sceneSerializer.Serialize(scene, fileName);
                Console.WriteLine("Scene saved to file: TestScene.xml");
            }
            else if (answer == 4)
            {
                IScene loadedScene = sceneSerializer.Deserialize(fileName);
                Console.WriteLine("Scene loaded from file: TestScene.xml");
                ConversationRunner(loadedScene.GetConversations().Skip(1).ToList().First());
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("----------------------------");
            Console.WriteLine("More: \"" + webaddress + "\"");
            Console.ReadKey();
        }
コード例 #18
0
        public void Initialise(IScene scene, IConfigSource source, ISimulationBase openSimBase)
        {
            IConfig PhysConfig = source.Configs["Physics"];
            IConfig MeshingConfig = source.Configs["Meshing"];
            string engine = "";
            string meshEngine = "";
            string Path = "Physics";
            if (PhysConfig != null)
            {
                Path = PhysConfig.GetString("PathToPhysicsAssemblies", Path);
                engine = PhysConfig.GetString("DefaultPhysicsEngine", "WhiteCoreOpenDynamicsEngine");
                meshEngine = MeshingConfig.GetString("DefaultMeshingEngine", "Meshmerizer");
                string regionName = scene.RegionInfo.RegionName.Trim().Replace(' ', '_');
                string RegionPhysicsEngine = PhysConfig.GetString("Region_" + regionName + "_PhysicsEngine",
                                                                  String.Empty);
                if (RegionPhysicsEngine != "")
                    engine = RegionPhysicsEngine;
                string RegionMeshingEngine = MeshingConfig.GetString("Region_" + regionName + "_MeshingEngine",
                                                                     String.Empty);
                if (RegionMeshingEngine != "")
                    meshEngine = RegionMeshingEngine;
            }
            else
            {
                //Load Sane defaults
                engine = "WhiteCoreOpenDynamicsEngine";
                meshEngine = "Meshmerizer";
            }
            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies(Util.BasePathCombine(Path));

            PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(engine, meshEngine, source, scene);
            scene.PhysicsScene = pScene;
        }
コード例 #19
0
        public void AddRegion(IScene scene)
        {
            if (!m_enabled)
                return;

            m_scene = scene;
            m_scene.RegisterModuleInterface<IDialogModule> (this);
            m_scene.EventManager.OnPermissionError += SendAlertToUser;

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand (
                    "alert user",
                    "alert user <<first last> message>",
                    "Send an alert to a user in the current region",
                    HandleAlertConsoleCommand, true, true);

                MainConsole.Instance.Commands.AddCommand (
                    "alert general",
                    "alert general <message>",
                    "Send an alert to everyone in the current region",
                    HandleAlertConsoleCommand, true, true);

                MainConsole.Instance.Commands.AddCommand (
                    "alert broadcast",
                    "alert broadcast <message>",
                    "Send an alert to everyone logged in",
                    HandleAlertConsoleCommand, false, true);

            }
        }
コード例 #20
0
        public void RemoveRegion(IScene scene)
        {
            m_scene.EventManager.OnNewClient -= OnNewClient;
            m_scene.EventManager.OnClosingClient -= OnClosingClient;

            m_scene.UnregisterModuleInterface<ISoundModule>(this);
        }
コード例 #21
0
        public GridInstantMessage(IScene scene, UUID _fromAgentID,
                string _fromAgentName, UUID _toAgentID,
                byte _dialog, bool _fromGroup, string _message,
                UUID _imSessionID, bool _offline, Vector3 _position,
                byte[] _binaryBucket, bool addTimestamp)
        {
            fromAgentID = _fromAgentID.Guid;
            fromAgentName = _fromAgentName;
            toAgentID = _toAgentID.Guid;
            dialog = _dialog;
            fromGroup = _fromGroup;
            message = _message;
            imSessionID = _imSessionID.Guid;
            if (_offline)
                offline = 1;
            else
                offline = 0;
            Position = _position;
            binaryBucket = _binaryBucket;

            if (scene != null)
            {
                ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID;
                RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid;
            }

            if (addTimestamp)
                timestamp = (uint)Util.UnixTimeSinceEpoch();
        }
コード例 #22
0
        public void FinishedStartup()
        {
            if (m_registry == null)
                return;
            ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
            if (manager != null)
            {
                manager.OnAddedScene += (scene) =>
                {
                                                m_scene = scene;
                                                scene.EventManager.OnNewClient += OnNewClient;
                                                scene.EventManager.OnClosingClient += OnClosingClient;
                                                scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
                                                scene.EventManager.OnValidateBuyLand += EventManager_OnValidateBuyLand;
                                                scene.RegisterModuleInterface<IMoneyModule>(this);
                                            };
                manager.OnCloseScene += (scene) =>
                                            {
                                                m_scene.EventManager.OnNewClient -= OnNewClient;
                                                m_scene.EventManager.OnClosingClient -= OnClosingClient;
                                                m_scene.EventManager.OnMakeRootAgent -= OnMakeRootAgent;
                                                scene.EventManager.OnValidateBuyLand -= EventManager_OnValidateBuyLand;
                                                m_scene.RegisterModuleInterface<IMoneyModule>(this);
                                                m_scene = null;
                                            };
            }

            if (!m_connector.DoRemoteCalls)
            {
                if ((m_connector.GetConfig().GiveStipends) && (m_connector.GetConfig().Stipend > 0))
                    new GiveStipends(m_connector.GetConfig(), m_registry, m_connector);
            }
        }
コード例 #23
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_dataStore = m_scene.Simian.GetAppModule<IDataStore>();
            if (m_dataStore == null)
            {
                m_log.Error("LLPrimitiveLoader requires an IDataStore");
                return;
            }

            m_primMesher = m_scene.GetSceneModule<IPrimMesher>();
            if (m_primMesher == null)
            {
                m_log.Error("LLPrimitiveLoader requires an IPrimMesher");
                return;
            }

            m_writeQueue = new ThrottledQueue<UUID, PrimSerialization>(5, 1000 * 30, true, SerializationHandler);
            m_writeQueue.Start();

            m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler;
            m_scene.OnEntityRemove += EntityRemoveHandler;

            Deserialize();
        }
コード例 #24
0
ファイル: Upload.cs プロジェクト: thoys/simian
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>();
            if (m_assetClient == null)
            {
                m_log.Warn("Upload requires an IAssetClient");
                return;
            }

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("Upload requires an IHttpServer");
                return;
            }

            m_primMesher = m_scene.GetSceneModule<IPrimMesher>();
            m_permissions = m_scene.GetSceneModule<LLPermissions>();

            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTexture", UploadBakedTextureHandler);
            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTextureData", UploadBakedTextureDataHandler);
            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadObjectAsset", UploadObjectAssetHandler);
        }
コード例 #25
0
        public void RevertShadeWorld(IScene scene, string[] cmd)
        {
            ISceneEntity[] entities = scene.Entities.GetEntities();
            foreach (ISceneEntity entity in entities)
            {
                foreach (ISceneChildEntity child in entity.ChildrenEntities())
                {
                    UUID[] textures = GetTextures(child.Shape.Textures);
                    foreach (UUID t in textures)
                    {
                        UUID oldID = t;
                        AssetBase oldAsset = null;
                        while (m_revertConverted.ContainsKey(oldID))
                        {
                            child.Shape.Textures = SetTexture(child.Shape, m_revertConverted[oldID], oldID);
                            oldID = m_revertConverted[oldID];
                        }

                        UUID newID;
                        while ((oldAsset = scene.AssetService.Get(oldID.ToString())) != null && UUID.TryParse(oldAsset.Description, out newID))
                        {
                            child.Shape.Textures = SetTexture(child.Shape, newID, oldID);
                        }
                    }
                }
            }
            m_revertConverted.Clear();
            m_previouslyConverted.Clear();
        }
コード例 #26
0
        public void FinishStartup(IScene scene, IConfigSource source, ISimulationBase openSimBase)
        {
            IEstateConnector EstateConnector = Framework.Utilities.DataManager.RequestPlugin<IEstateConnector>();
            if (EstateConnector != null)
            {
                EstateSettings ES = EstateConnector.GetEstateSettings(scene.RegionInfo.RegionID);
                if (ES == null)
                {
                    //It could not find the estate service, wait until it can find it
                    MainConsole.Instance.Warn(
                        "We could not find the estate service for this sim. Please make sure that your URLs are correct in grid mode.");
                    while (true)
                    {
                        MainConsole.Instance.Prompt("Press enter to try again.");
                        if ((ES = EstateConnector.GetEstateSettings(scene.RegionInfo.RegionID)) == null ||
                            ES.EstateID == 0)
                        {
                            ES = CreateEstateInfo(scene);
                            break;
                        }
                        if (ES != null)
                            break;
                    }
                }
                else if (ES.EstateID == 0)
                {
                    //It found the estate service, but found no estates for this region, make a new one
                    MainConsole.Instance.Warn("[EstateInitializer]: Your region " + scene.RegionInfo.RegionName +
                                              " is not part of an estate.");

                    ES = CreateEstateInfo(scene);
                }
                scene.RegionInfo.EstateSettings = ES;
            }
        }
コード例 #27
0
ファイル: UIManager.cs プロジェクト: penspanic/SnowRun
    public void SetGameState(GameState state)
    {
        if (!moveEnd)
            return;

        prevScene = currScene;

        this.state = state;

        switch (this.state)
        {
            case GameState.Main:
                currScene = main;
                break;
            case GameState.Shop:
                currScene = shop;
                break;
            case GameState.Pick:
                currScene = pick;
                break;
            case GameState.InGame:
                currScene = inGame;
                break;
        }
        StartCoroutine(SceneMove());
    }
コード例 #28
0
 public void RegionLoaded(IScene scene)
 {
     if (!m_Enabled)
         return;
     scene.EventManager.OnNewClient += OnNewClient;
     scene.EventManager.OnClosingClient -= OnClosingClient;
 }
コード例 #29
0
        protected void HandleAbuseReports(IScene scene, string [] cmd)
        {

            int reports;
            while (!int.TryParse (MainConsole.Instance.Prompt ("Number of reports to display: ", "7"), out reports))
                MainConsole.Instance.Info ("Bad input, must be a number > 0");

            string abuseInfo;

            abuseInfo = string.Format ("{0, -8}", "Card");
            abuseInfo += string.Format ("{0, -30}", "Category");
            abuseInfo += string.Format ("{0, -30}", "Summary");
            abuseInfo += string.Format ("{0, -20}", "Reporter");
            abuseInfo += string.Format ("{0, -20}", "Assigned");
 
            MainConsole.Instance.CleanInfo (abuseInfo);

            MainConsole.Instance.CleanInfo (
                "----------------------------------------------------------------------------------------------------");

            List<AbuseReport> abuseReports =  abuseConnector.GetAbuseReports(0, reports, true);

            foreach (AbuseReport rpt in abuseReports) {
                abuseInfo = string.Format ("{0, -8}", rpt.Number);
                abuseInfo += string.Format ("{0, -30}", rpt.Category.ToString().Substring(0,28));   
                abuseInfo += string.Format ("{0, -30}", rpt.AbuseSummary);
                abuseInfo += string.Format ("{0, -20}", rpt.ReporterName);
                abuseInfo += string.Format ("{0, -12}", rpt.AssignedTo);

                MainConsole.Instance.CleanInfo (abuseInfo);
                MainConsole.Instance.CleanInfo ("");

            }
        }
コード例 #30
0
        public void Help (IScene scene, string [] cmd)
        {
            List<string> help = m_Commands.GetHelp (cmd);

            foreach (string s in help)
                Output (s, Level.Off);
        }
コード例 #31
0
 private void HandleRegionReadyStatusChange(IScene scene)
 {
     lock (m_localScenes)
         AllRegionsReady = m_localScenes.FindAll(s => !s.Ready).Count == 0;
 }
コード例 #32
0
 public void AddRegion(IScene scene)
 {
     m_scene = scene;
     scene.RegisterModuleInterface <IBotManager>(this);
     scene.RegisterModuleInterface(this);
 }
コード例 #33
0
        public UUID CreateAvatar(string firstName, string lastName, IScene scene, AvatarAppearance avatarApp,
                                 UUID creatorID, Vector3 startPos)
        {
            //Add the circuit data so they can login
            AgentCircuitData m_aCircuitData = new AgentCircuitData
            {
                IsChildAgent = false,
                CircuitCode  = (uint)Util.RandomClass.Next()
            };

            //Create the new bot data
            BotClientAPI m_character = new BotClientAPI(scene, m_aCircuitData);

            m_character.Name       = firstName + " " + lastName;
            m_aCircuitData.AgentID = m_character.AgentId;

            //Set up appearance
            var origOwner = avatarApp.Owner;

            avatarApp.Owner = m_character.AgentId;
            List <AvatarAttachment> attachments = avatarApp.GetAttachments();

            avatarApp.ClearAttachments();
            // get original attachments
            foreach (AvatarAttachment t in attachments)
            {
                InventoryItemBase item = scene.InventoryService.GetItem(origOwner, t.ItemID);
                if (item != null)
                {
                    item.ID     = UUID.Random();
                    item.Owner  = m_character.AgentId;
                    item.Folder = UUID.Zero;
                    scene.InventoryService.AddCacheItemAsync(item);
                    //Now fix the ItemID
                    avatarApp.SetAttachment(t.AttachPoint, item.ID, t.AssetID);
                }
            }

            scene.AuthenticateHandler.AgentCircuits.Add(m_character.CircuitCode, m_aCircuitData);
            //This adds them to the scene and sets them inworld
            AddAndWaitUntilAgentIsAdded(scene, m_character);

            IScenePresence SP = scene.GetScenePresence(m_character.AgentId);

            if (SP == null)
            {
                return(UUID.Zero); //Failed!
            }
            IAvatarAppearanceModule appearance = SP.RequestModuleInterface <IAvatarAppearanceModule>();

            appearance.Appearance = avatarApp;
            appearance.InitialHasWearablesBeenSent = true;
            Bot bot = new Bot();

            bot.Initialize(SP, creatorID);
            SP.MakeRootAgent(startPos, false, true);
            //Move them
            SP.Teleport(startPos);

            foreach (var presence in scene.GetScenePresences())
            {
                presence.SceneViewer.QueuePresenceForUpdate(SP, PrimUpdateFlags.ForcedFullUpdate);
            }
            IAttachmentsModule attModule = SP.Scene.RequestModuleInterface <IAttachmentsModule>();

            if (attModule != null)
            {
                foreach (AvatarAttachment att in attachments)
                {
                    attModule.RezSingleAttachmentFromInventory(SP.ControllingClient, att.ItemID, att.AssetID, 0, true);
                }
            }

            //Save them in the bots list
            m_bots.Add(m_character.AgentId, bot);
            AddTagToBot(m_character.AgentId, "AllBots", bot.AvatarCreatorID);

            MainConsole.Instance.InfoFormat("[BotManager]: Added bot {0} to region {1}",
                                            m_character.Name, scene.RegionInfo.RegionName);

            //Return their UUID
            return(m_character.AgentId);
        }
コード例 #34
0
 public void AddRegion(IScene scene)
 {
     scene.WhiteCoreEventManager.RegisterEventHandler("AgentIsAZombie", OnGenericEvent);
     scene.EventManager.OnNewClient     += OnNewClient;
     scene.EventManager.OnClosingClient += OnClosingClient;
 }
コード例 #35
0
 public void RemoveRegion(IScene scene)
 {
 }
コード例 #36
0
 public void RegionLoaded(IScene scene)
 {
 }
コード例 #37
0
        //現在のシーンを変更

        public void ChangeCurrentScene(SceneCreator sceneCreator)
        {
            currentScene.Dispose();
            unitySceneController.SetScene();
            currentScene = sceneCreator();
        }
コード例 #38
0
 public void RemoveRegion(IScene scene)
 {
     scene.EventManager.OnNewPresence    -= EventManager_OnNewPresence;
     scene.EventManager.OnRemovePresence -= EventManager_OnRemovePresence;
 }
コード例 #39
0
 public virtual ITerrainChannel LoadStream(Stream stream, IScene scene)
 {
     return(LoadBitmap(new Bitmap(stream), scene));
 }
コード例 #40
0
        private void button_Import_Click(object sender, System.EventArgs e)
        {
            // point to the first selected feature:
            ESRI.ArcGIS.Animation.IAGImportPathOptions AGImportPathOptionsCls = new ESRI.ArcGIS.Animation.AGImportPathOptionsClass();

            // Set properties for AGImportPathOptions
            AGImportPathOptionsCls.BasicMap        = (ESRI.ArcGIS.Carto.IBasicMap)globe;              // Explicit Cast
            AGImportPathOptionsCls.AnimationTracks = (ESRI.ArcGIS.Animation.IAGAnimationTracks)globe; // Explicit Cast
            AGImportPathOptionsCls.AnimationType   = new ESRI.ArcGIS.GlobeCore.AnimationTypeGlobeCameraClass();
            AGImportPathOptionsCls.AnimatedObject  = globe.GlobeDisplay.ActiveViewer.Camera;

            if (this.radioButton_flyby.Checked == true)
            {
                AGImportPathOptionsCls.ConversionType = esriFlyFromPathType.esriFlyFromPathObsAndTarget;
                AGImportPathOptionsCls.PutAngleCalculationMethods(esriPathAngleCalculation.esriAngleAddRelative, esriPathAngleCalculation.esriAngleAddRelative, esriPathAngleCalculation.esriAngleAddRelative);
                AGImportPathOptionsCls.PutAngleCalculationValues(0.0, 0.0, 0.0);
            }
            else if (this.radioButton_currentTarget.Checked == true)
            {
                AGImportPathOptionsCls.ConversionType = esriFlyFromPathType.esriFlyFromPathObserver;
            }
            else if (this.radioButton_currentObserver.Checked == true)
            {
                AGImportPathOptionsCls.ConversionType = esriFlyFromPathType.esriFlyFromPathTarget;
            }

            double pAzimuth, pInclination, pRollVal;

            AGImportPathOptionsCls.GetAngleCalculationValues(out pAzimuth, out pInclination, out pRollVal);

            AGImportPathOptionsCls.LookaheadFactor   = this.trackBarSimplificationFactor.Value / 100;
            AGImportPathOptionsCls.TrackName         = this.textBox_TrackName.Text;
            AGImportPathOptionsCls.OverwriteExisting = Convert.ToBoolean(this.checkBox_Overwrite.CheckState);
            AGImportPathOptionsCls.VerticalOffset    = Convert.ToDouble(this.textBox_VertOffset.Text);
            AGImportPathOptionsCls.ReversePath       = Convert.ToBoolean(this.checkBox_ReverseOrder.CheckState);

            // get the layer selected in the combo box
            if (this.comboBoxLayers.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a layer before you proceed");
            }
            else
            {
                //set the layer based on the item selected in the combo box
                ESRI.ArcGIS.Carto.ILayer layer = (ESRI.ArcGIS.Carto.ILayer)layerArray.get_Element(this.comboBoxLayers.SelectedIndex);                  // Explicit Cast

                // Get the line feature selected in the layer
                ESRI.ArcGIS.Carto.IFeatureLayer       featureLayer     = (ESRI.ArcGIS.Carto.IFeatureLayer)layer;       // Explicit Cast
                ESRI.ArcGIS.Carto.IFeatureSelection   featureSelection = (ESRI.ArcGIS.Carto.IFeatureSelection)layer;   // Explicit Cast
                ESRI.ArcGIS.Geodatabase.ISelectionSet selectionSet     = featureSelection.SelectionSet;
                ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass     = featureLayer.FeatureClass;
                string shapeField = featureClass.ShapeFieldName;
                ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilterCls = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();

                IScene scene = globe.GlobeDisplay.Scene;

                ESRI.ArcGIS.Geometry.ISpatialReference spatialReference = scene.SpatialReference;
                spatialFilterCls.GeometryField = shapeField;
                spatialFilterCls.set_OutputSpatialReference(shapeField, spatialReference);
                ESRI.ArcGIS.Geodatabase.ICursor cursor;
                selectionSet.Search(spatialFilterCls, true, out cursor);
                ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = (ESRI.ArcGIS.Geodatabase.IFeatureCursor)cursor;                 // Explicit Cast

                ESRI.ArcGIS.Geodatabase.IFeature lineFeature;
                lineFeature = featureCursor.NextFeature();
                if (lineFeature == null)
                {
                    MessageBox.Show("Please select a feature in the feature layer selected");
                }
                else
                {
                    CreateFlybyFromPathAnimation(globe, lineFeature, AGImportPathOptionsCls);
                }
            }
            this.Close();
        }
コード例 #41
0
        /// <summary>
        ///     Handle an alert command from the console.
        /// </summary>
        /// <param name="cmdparams"></param>
        protected void HandleAlertConsoleCommand(IScene scene, string [] cmdparams)
        {
            string message  = "";
            string userName = "";
            string cmdType  = cmdparams [1].ToLower();

            if (cmdType.StartsWith("g", StringComparison.Ordinal) || cmdType.StartsWith("b", StringComparison.Ordinal))
            {
                // general
                if (cmdparams.Length > 2)
                {
                    message = Util.CombineParams(cmdparams, 2);
                }
                else
                {
                    message = MainConsole.Instance.Prompt("Message to send?", "");
                }
                if (message == "")
                {
                    return;
                }

                if (cmdType.StartsWith("g", StringComparison.Ordinal))
                {
                    MainConsole.Instance.InfoFormat("[DIALOG]: Sending general alert in region {0} with message '{1}'",
                                                    scene.RegionInfo.RegionName, message);

                    // send the message
                    scene.ForEachScenePresence(delegate(IScenePresence sp) {
                        if (!sp.IsChildAgent)
                        {
                            sp.ControllingClient.SendAlertMessage(message);
                        }
                    });
                }
                else
                {
                    MainConsole.Instance.InfoFormat("[DIALOG]: Sending broadcast alert to all regions with message '{0}'", message);

                    // broadcast the message
                    foreach (IScene scn in MainConsole.Instance.ConsoleScenes)
                    {
                        scn.ForEachScenePresence(delegate(IScenePresence sp) {
                            if (!sp.IsChildAgent)
                            {
                                sp.ControllingClient.SendAlertMessage(message);
                            }
                        });
                    }
                }
                return;
            }

            // user alert
            if (cmdparams.Length >= 4)
            {
                userName = cmdparams [2] + " " + cmdparams [3];
            }
            else
            {
                userName = MainConsole.Instance.Prompt("User name? (First Last)", "");
            }
            if (userName == "")
            {
                return;
            }

            if (cmdparams.Length > 4)
            {
                message = Util.CombineParams(cmdparams, 4);
            }
            else
            {
                message = MainConsole.Instance.Prompt("Message to send?", "");
            }
            if (message == "")
            {
                return;
            }


            MainConsole.Instance.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} with message '{2}'",
                                            scene.RegionInfo.RegionName, userName, message);

            // send the message to the user
            IScenePresence spc = scene.SceneGraph.GetScenePresence(userName);

            if (spc != null && !spc.IsChildAgent)
            {
                spc.ControllingClient.SendAgentAlertMessage(message, false);
            }
        }
コード例 #42
0
 /// <summary>
 ///     Loads a file from a specified filename on the disk,
 ///     parses the image using the System.Drawing parsers
 ///     then returns a terrain channel. Values are
 ///     returned based on HSL brightness between 0m and 128m
 /// </summary>
 /// <param name="filename">The target image to load</param>
 /// <param name="scene"></param>
 /// <returns>A terrain channel generated from the image.</returns>
 public virtual ITerrainChannel LoadFile(string filename, IScene scene)
 {
     return(LoadBitmap(new Bitmap(filename), scene));
 }
コード例 #43
0
 // Called to indicate that all loadable modules have now been added
 public void RegionLoaded(IScene scene)
 {
     // Do nothing.
 }
コード例 #44
0
 public InfoButton(IPoint topLeftPoint, IScene infoScene)
     : base(topLeftPoint, ButtonText)
 {
     this.infoScene = infoScene;
 }
コード例 #45
0
 public void Add(Scene.Scene name, IScene scene)
 {
     scenes.Add(name, scene);
 }
コード例 #46
0
 public void RegionLoaded(IScene scene)
 {
     m_muteListModule = m_scene.RequestModuleInterface <IMuteListModule> ();
 }
コード例 #47
0
        protected void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID)
        {
            OSDMap args = Utils.GetOSDMap((string)request["body"]);

            if (args == null)
            {
                responsedata["int_response_code"]   = 400;
                responsedata["str_response_string"] = "false";
                return;
            }
            // retrieve the input arguments
            int     x = 0, y = 0;
            UUID    uuid        = UUID.Zero;
            string  regionname  = string.Empty;
            Vector3 newPosition = Vector3.Zero;

            if (args.ContainsKey("destination_x") && args["destination_x"] != null)
            {
                Int32.TryParse(args["destination_x"].AsString(), out x);
            }
            if (args.ContainsKey("destination_y") && args["destination_y"] != null)
            {
                Int32.TryParse(args["destination_y"].AsString(), out y);
            }
            if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
            {
                UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
            }
            if (args.ContainsKey("destination_name") && args["destination_name"] != null)
            {
                regionname = args["destination_name"].ToString();
            }
            if (args.ContainsKey("new_position") && args["new_position"] != null)
            {
                Vector3.TryParse(args["new_position"], out newPosition);
            }

            GridRegion destination = new GridRegion();

            destination.RegionID   = uuid;
            destination.RegionLocX = x;
            destination.RegionLocY = y;
            destination.RegionName = regionname;

            string sogXmlStr = "", extraStr = "", stateXmlStr = "";

            if (args.ContainsKey("sog") && args["sog"] != null)
            {
                sogXmlStr = args["sog"].AsString();
            }
            if (args.ContainsKey("extra") && args["extra"] != null)
            {
                extraStr = args["extra"].AsString();
            }

            IScene       s   = m_SimulationService.GetScene(destination.RegionHandle);
            ISceneObject sog = null;

            try
            {
                //m_log.DebugFormat("[OBJECT HANDLER]: received {0}", sogXmlStr);
                sog = s.DeserializeObject(sogXmlStr);
                sog.ExtraFromXmlString(extraStr);
            }
            catch (Exception ex)
            {
                m_log.InfoFormat("[OBJECT HANDLER]: exception on deserializing scene object {0}", ex.Message);
                responsedata["int_response_code"]   = HttpStatusCode.BadRequest;
                responsedata["str_response_string"] = "Bad request";
                return;
            }

            if (args.ContainsKey("modified"))
            {
                sog.HasGroupChanged = args["modified"].AsBoolean();
            }
            else
            {
                sog.HasGroupChanged = false;
            }

            if ((args["state"] != null) && s.AllowScriptCrossings)
            {
                stateXmlStr = args["state"].AsString();
                if (stateXmlStr != "")
                {
                    try
                    {
                        sog.SetState(stateXmlStr, s);
                    }
                    catch (Exception ex)
                    {
                        m_log.InfoFormat("[OBJECT HANDLER]: exception on setting state for scene object {0}", ex.Message);
                        // ignore and continue
                    }
                }
            }

            bool result = false;

            try
            {
                // This is the meaning of POST object
                result = CreateObject(destination, newPosition, sog);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[OBJECT HANDLER]: Exception in CreateObject: {0}", e.StackTrace);
            }

            responsedata["int_response_code"]   = HttpStatusCode.OK;
            responsedata["str_response_string"] = result.ToString();
        }
コード例 #48
0
        public void TestLayerLocking()
        {
            try
            {
                const string TEST_SCENENAME  = "TestSceneLocking";
                const string TEST_SCENENAME2 = "TestSceneLocking_SaveAsTest";

                // Create a new project and scene
                TestManager.Helpers.CreateTestScene(TEST_SCENENAME);
                EditorProject project    = EditorApp.Project;
                IScene        scene      = project.Scene;
                Layer         firstLayer = scene.Layers[0];

                // First layer must be writeable
                Assert.IsTrue(firstLayer.OwnsLock);
                Assert.IsTrue(firstLayer.SaveToFile());

                // close scene
                string layerFilePath = firstLayer.AbsoluteLayerFilename;
                firstLayer = null;
                scene.Close();
                Assert.IsNull(project.Scene);

                // Get external lock on layer file
                IFileLock extFileLock = EditorManager.FileLockFactory.GetFileLock(layerFilePath);
                Assert.IsTrue(extFileLock.TryLock());

                // Reopen scene: must fail on saving layer (locked externally)
                Assert.IsTrue(project.OpenScene(TEST_SCENENAME));
                scene      = project.Scene;
                firstLayer = scene.Layers[0];
                Assert.IsFalse(firstLayer.OwnsLock);

                // Release lock: OwnsWriteLock state must get updated
                extFileLock.Unlock();
                // Give windows time to inform the file watcher
                System.Threading.Thread.Sleep(1000); TestManager.Helpers.ProcessEvents();
                // And then give the file watcher time to send his queued/delayed notification
                System.Threading.Thread.Sleep(1000); TestManager.Helpers.ProcessEvents();
                Assert.IsTrue(firstLayer.LockStatus == Layer.LayerLockStatus_e.NotLocked);

                // Let the scene lock the layer again: saving file must be successful
                firstLayer.TryLock(null, false);
                Assert.IsTrue(firstLayer.OwnsLock);
                Assert.IsTrue(firstLayer.SaveToFile());

                // Getting external lock must fail (since file is locked by scene)
                Assert.IsFalse(extFileLock.TryLock());

                // Rename the scene file
                Assert.IsTrue(scene.SaveAs(TEST_SCENENAME2));
                string renamedLayerFilePath = firstLayer.AbsoluteLayerFilename;
                Assert.IsTrue(renamedLayerFilePath != layerFilePath);

                // Getting external lock must work after scene-save-as
                Assert.IsTrue(firstLayer.OwnsLock);
                Assert.IsTrue(extFileLock.TryLock());
                extFileLock.Unlock();

                // Getting external lock on renamed file must fail
                IFileLock extFileLockRenamed = EditorManager.FileLockFactory.GetFileLock(renamedLayerFilePath);
                Assert.IsFalse(extFileLockRenamed.TryLock());

                // Verify that a scene can't be opened without closing it at first
                // (important, since we otherwise still have the lock on the old scene)
                Assert.IsFalse(project.OpenScene(TEST_SCENENAME));

                // Close scene
                scene.Close();
                Assert.IsNull(project.Scene);

                // Test correct behaviour for readonly layer files
                {
                    // Set the layer as readonly (as done by some version control systems
                    // when using exclusive locking)
                    File.SetAttributes(layerFilePath, File.GetAttributes(layerFilePath) | FileAttributes.ReadOnly);

                    // Reopen scene
                    Assert.IsTrue(project.OpenScene(TEST_SCENENAME));
                    scene      = project.Scene;
                    firstLayer = scene.Layers[0];

                    // Layer must not be locked due to being readonly.
                    Assert.IsFalse(firstLayer.OwnsLock);
                    Assert.AreEqual(Layer.LayerLockStatus_e.ReadOnly, firstLayer.LockStatus);

                    // Close scene
                    scene.Close();
                    Assert.IsNull(project.Scene);

                    // Set the layer as readonly (as done by some version control systems
                    // when using exclusive locking)
                    File.SetAttributes(layerFilePath, File.GetAttributes(layerFilePath) & (~FileAttributes.ReadOnly));
                }

                TestManager.Helpers.CloseTestProject();
            }
            catch (Exception ex)
            {
                EditorManager.DumpException(ex);
                throw ex;
            }
        }
コード例 #49
0
        /// <summary>
        /// Execute the region creation process.  This includes setting up scene infrastructure.
        /// </summary>
        /// <param name="regionInfo"></param>
        /// <param name="portadd_flag"></param>
        /// <param name="do_post_init"></param>
        /// <returns></returns>
        public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
        {
            int port = regionInfo.InternalEndPoint.Port;

            // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims)
            // Commented this out because otherwise regions can't register with
            // the grid as there is already another region with the same UUID
            // at those coordinates. This is required for the load balancer to work.
            // --Mike, 2009.02.25
            //regionInfo.originRegionID = regionInfo.RegionID;

            // set initial ServerURI
            regionInfo.HttpPort  = m_httpServerPort;
            regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";

            regionInfo.osSecret = m_osSecret;

            if ((proxyUrl.Length > 0) && (portadd_flag))
            {
                // set proxy url to RegionInfo
                regionInfo.proxyUrl    = proxyUrl;
                regionInfo.ProxyOffset = proxyOffset;
                Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
            }

            Scene scene = SetupScene(regionInfo, proxyOffset, Config);

            m_log.Info("[MODULES]: Loading Region's modules (old style)");

            // Use this in the future, the line above will be deprecated soon
            m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
            IRegionModulesController controller;

            if (ApplicationRegistry.TryGet(out controller))
            {
                controller.AddRegionToModules(scene);
            }
            else
            {
                m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
            }

            scene.SetModuleInterfaces();

            while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
            {
                SetUpEstateOwner(scene);
            }

            // Prims have to be loaded after module configuration since some modules may be invoked during the load
            scene.LoadPrimsFromStorage(regionInfo.originRegionID);

            // TODO : Try setting resource for region xstats here on scene
            MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo));

            scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
            scene.EventManager.TriggerParcelPrimCountUpdate();

            try
            {
                scene.RegisterRegionWithGrid();
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(
                    "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}",
                    e.Message, e.StackTrace);

                // Carrying on now causes a lot of confusion down the
                // line - we need to get the user's attention
                Environment.Exit(1);
            }

            // We need to do this after we've initialized the
            // scripting engines.
            scene.CreateScriptInstances();

            SceneManager.Add(scene);

            //if (m_autoCreateClientStack)
            //{
            //    foreach (IClientNetworkServer clientserver in clientServers)
            //    {
            //        m_clientServers.Add(clientserver);
            //        clientserver.Start();
            //    }
            //}

            scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };

            mscene = scene;

            //return clientServers;
        }
コード例 #50
0
ファイル: XmlRequest.cs プロジェクト: satlanski2/Aurora-Sim
 public void AddRegion(IScene scene)
 {
     m_modules.Add(scene.RequestModuleInterface <IXMLRPC>());
 }
コード例 #51
0
 /// <summary>
 /// Execute the region creation process.  This includes setting up scene infrastructure.
 /// </summary>
 /// <param name="regionInfo"></param>
 /// <param name="portadd_flag"></param>
 /// <returns></returns>
 public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene)
 {
     CreateRegion(regionInfo, portadd_flag, false, out scene);
 }
コード例 #52
0
 /// <summary>
 ///     Startup is complete, trigger the modules and allow logins
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="data"></param>
 public void StartupComplete(IScene scene, List <string> data)
 {
     //Tell the SceneManager about it
     m_sceneManager.HandleStartupComplete(data);
 }
コード例 #53
0
 public virtual void RunConfig(IScene scene, string[] cmd)
 {
     BaseApplication.Configure(true);
 }
コード例 #54
0
 /// <summary>
 /// Execute the region creation process.  This includes setting up scene infrastructure.
 /// </summary>
 /// <param name="regionInfo"></param>
 /// <returns></returns>
 public void CreateRegion(RegionInfo regionInfo, out IScene scene)
 {
     CreateRegion(regionInfo, false, true, out scene);
 }
コード例 #55
0
 public SimFrameMonitor(IScene scene)
 {
 }
コード例 #56
0
 public virtual void HandleShowVersion(IScene scene, string[] cmd)
 {
     MainConsole.Instance.InfoFormat("Version: {0}", m_version);
 }
コード例 #57
0
        public XmlRpcResponse XmlRpcUpdateWelcomeMethod(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            m_log.Info("[Concierge]: processing UpdateWelcome request");
            XmlRpcResponse response     = new XmlRpcResponse();
            Hashtable      responseData = new Hashtable();

            try
            {
                Hashtable requestData = (Hashtable)request.Params[0];
                checkStringParameters(request, new string[] { "password", "region", "welcome" });

                // check password
                if (!String.IsNullOrEmpty(m_xmlRpcPassword) &&
                    (string)requestData["password"] != m_xmlRpcPassword)
                {
                    throw new Exception("wrong password");
                }

                if (String.IsNullOrEmpty(m_welcomes))
                {
                    throw new Exception("welcome templates are not enabled, ask your OpenSim operator to set the \"welcomes\" option in the [Concierge] section of OpenSim.ini");
                }

                string msg = (string)requestData["welcome"];
                if (String.IsNullOrEmpty(msg))
                {
                    throw new Exception("empty parameter \"welcome\"");
                }

                string regionName = (string)requestData["region"];
                IScene scene      = m_scenes.Find(delegate(IScene s) { return(s.RegionInfo.RegionName == regionName); });
                if (scene == null)
                {
                    throw new Exception(String.Format("unknown region \"{0}\"", regionName));
                }

                if (!m_conciergedScenes.Contains(scene))
                {
                    throw new Exception(String.Format("region \"{0}\" is not a concierged region.", regionName));
                }

                string welcome = Path.Combine(m_welcomes, regionName);
                if (File.Exists(welcome))
                {
                    m_log.InfoFormat("[Concierge]: UpdateWelcome: updating existing template \"{0}\"", welcome);
                    string welcomeBackup = String.Format("{0}~", welcome);
                    if (File.Exists(welcomeBackup))
                    {
                        File.Delete(welcomeBackup);
                    }
                    File.Move(welcome, welcomeBackup);
                }
                File.WriteAllText(welcome, msg);

                responseData["success"] = "true";
                response.Value          = responseData;
            }
            catch (Exception e)
            {
                m_log.InfoFormat("[Concierge]: UpdateWelcome failed: {0}", e.Message);

                responseData["success"] = "false";
                responseData["error"]   = e.Message;

                response.Value = responseData;
            }
            m_log.Debug("[Concierge]: done processing UpdateWelcome request");
            return(response);
        }
コード例 #58
0
 public virtual void HandleForceGC(IScene scene, string[] cmd)
 {
     GC.Collect();
     MainConsole.Instance.Warn("[Garbage Collection Service]: Garbage collection finished");
 }
コード例 #59
0
ファイル: OpenSimBase.cs プロジェクト: imdongchen/CySim
        /// <summary>
        /// Execute the region creation process.  This includes setting up scene infrastructure.
        /// </summary>
        /// <param name="regionInfo"></param>
        /// <param name="portadd_flag"></param>
        /// <param name="do_post_init"></param>
        /// <returns></returns>
        public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
        {
            int port = regionInfo.InternalEndPoint.Port;

            // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims)
            // Commented this out because otherwise regions can't register with
            // the grid as there is already another region with the same UUID
            // at those coordinates. This is required for the load balancer to work.
            // --Mike, 2009.02.25
            //regionInfo.originRegionID = regionInfo.RegionID;

            // set initial ServerURI
            regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
            regionInfo.HttpPort  = m_httpServerPort;

            regionInfo.osSecret = m_osSecret;

            if ((proxyUrl.Length > 0) && (portadd_flag))
            {
                // set proxy url to RegionInfo
                regionInfo.proxyUrl    = proxyUrl;
                regionInfo.ProxyOffset = proxyOffset;
                Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
            }

            IClientNetworkServer clientServer;
            Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer);

            m_log.Info("[MODULES]: Loading Region's modules (old style)");

            List <IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");

            // This needs to be ahead of the script engine load, so the
            // script module can pick up events exposed by a module
            m_moduleLoader.InitialiseSharedModules(scene);

            // Use this in the future, the line above will be deprecated soon
            m_log.Info("[MODULES]: Loading Region's modules (new style)");
            IRegionModulesController controller;

            if (ApplicationRegistry.TryGet(out controller))
            {
                controller.AddRegionToModules(scene);
            }
            else
            {
                m_log.Error("[MODULES]: The new RegionModulesController is missing...");
            }

            scene.SetModuleInterfaces();

            // Prims have to be loaded after module configuration since some modules may be invoked during the load
            scene.LoadPrimsFromStorage(regionInfo.originRegionID);

            // moved these here as the terrain texture has to be created after the modules are initialized
            // and has to happen before the region is registered with the grid.
            scene.CreateTerrainTexture();

            // TODO : Try setting resource for region xstats here on scene
            MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));

            try
            {
                scene.RegisterRegionWithGrid();
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace);

                // Carrying on now causes a lot of confusion down the
                // line - we need to get the user's attention
                Environment.Exit(1);
            }

            scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
            scene.EventManager.TriggerParcelPrimCountUpdate();

            // We need to do this after we've initialized the
            // scripting engines.
            scene.CreateScriptInstances();

            m_sceneManager.Add(scene);

            if (m_autoCreateClientStack)
            {
                m_clientServers.Add(clientServer);
                clientServer.Start();
            }

            if (do_post_init)
            {
                foreach (IRegionModule module in modules)
                {
                    module.PostInitialise();
                }
            }
            scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };

            mscene = scene;

            scene.StartTimer();

            return(clientServer);
        }
コード例 #60
0
        public static Color4 GetAverageColor(UUID textureID, byte[] j2kData, IScene scene, out int width, out int height)
        {
            ulong  r      = 0;
            ulong  g      = 0;
            ulong  b      = 0;
            ulong  a      = 0;
            Bitmap bitmap = null;

            try
            {
                IJ2KDecoder decoder = scene.RequestModuleInterface <IJ2KDecoder>();

                bitmap = (Bitmap)decoder.DecodeToImage(j2kData);
                width  = 0;
                height = 0;
                if (bitmap == null)
                {
                    return(new Color4(0.5f, 0.5f, 0.5f, 1.0f));
                }
                j2kData = null;
                width   = bitmap.Width;
                height  = bitmap.Height;

                BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly,
                                                        bitmap.PixelFormat);
                int pixelBytes = (bitmap.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;

                // Sum up the individual channels
                unsafe
                {
                    if (pixelBytes == 4)
                    {
                        for (int y = 0; y < height; y++)
                        {
                            byte *row = (byte *)bitmapData.Scan0 + (y * bitmapData.Stride);

                            for (int x = 0; x < width; x++)
                            {
                                b += row[x * pixelBytes + 0];
                                g += row[x * pixelBytes + 1];
                                r += row[x * pixelBytes + 2];
                                a += row[x * pixelBytes + 3];
                            }
                        }
                    }
                    else
                    {
                        for (int y = 0; y < height; y++)
                        {
                            byte *row = (byte *)bitmapData.Scan0 + (y * bitmapData.Stride);

                            for (int x = 0; x < width; x++)
                            {
                                b += row[x * pixelBytes + 0];
                                g += row[x * pixelBytes + 1];
                                r += row[x * pixelBytes + 2];
                            }
                        }
                    }
                }

                // Get the averages for each channel
                const decimal OO_255      = 1m / 255m;
                decimal       totalPixels = (width * height);

                decimal rm = (r / totalPixels) * OO_255;
                decimal gm = (g / totalPixels) * OO_255;
                decimal bm = (b / totalPixels) * OO_255;
                decimal am = (a / totalPixels) * OO_255;

                if (pixelBytes == 3)
                {
                    am = 1m;
                }

                return(new Color4((float)rm, (float)gm, (float)bm, (float)am));
            }
            catch (Exception ex)
            {
                MainConsole.Instance.WarnFormat("[MAPTILE]: Error decoding JPEG2000 texture {0} ({1} bytes): {2}",
                                                textureID,
                                                j2kData.Length, ex.Message);
                width  = 0;
                height = 0;
                return(new Color4(0.5f, 0.5f, 0.5f, 1.0f));
            }
            finally
            {
                if (bitmap != null)
                {
                    bitmap.Dispose();
                }
                bitmap = null;
            }
        }