コード例 #1
0
        public PhysicsScene CreateSimplePhysicsEngine()
        {
            Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource();
            config.AddConfig("Startup");
            config.Configs["Startup"].Set("physics", "basicphysics");

            PhysicsScene           pScene = new BasicScene();
            INonSharedRegionModule mod    = pScene as INonSharedRegionModule;

            mod.Initialise(config);

            return(pScene);
        }
コード例 #2
0
        private void SaveKarty(object sender, RoutedEventArgs e)
        {
            string cesta = Properties.Settings.Default.LokaceKaret;

            foreach (AKarta k in Karty)
            {
                string     path = cesta + "/" + k.Karta.Id + ".pk";
                FileStream f    = File.Create(path);
                f.Close();
                Nini.Config.IniConfigSource source = new Nini.Config.IniConfigSource(path);
                source.AddConfig("Karta");
                k.Karta.Save(source.Configs["Karta"]);
                source.Save();
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: Legomaniak/PPLCG
 private void SaveKarty(object sender, RoutedEventArgs e)
 {
     string cesta = Properties.Settings.Default.LokaceKaret;
     foreach (AKarta k in Karty)
     {
         string path = cesta + "/" + k.Karta.Id + ".pk";
         FileStream f = File.Create(path);
         f.Close();
         Nini.Config.IniConfigSource source = new Nini.Config.IniConfigSource(path);
         source.AddConfig("Karta");
         k.Karta.Save(source.Configs["Karta"]);
         source.Save();
     }
 }
コード例 #4
0
        // Create an OpenSimulator Scene and add enough auxillery services and objects
        //   to it so it will allow the loading of assets.
        public Scene CreateScene(IAssetService memAssetService, string regionName)
        {
            RegionInfo regionInfo = new RegionInfo(0, 0, null, regionName);

            regionInfo.RegionName  = regionName;
            regionInfo.RegionSizeX = regionInfo.RegionSizeY = Constants.RegionSize;
            regionInfo.RegionID    = OMV.UUID.Random();
            var estateSettings = new EstateSettings();

            estateSettings.EstateOwner = OMV.UUID.Random();
            regionInfo.EstateSettings  = estateSettings;

            Scene scene = new Scene(regionInfo);

            // Add an in-memory asset service for all the loaded assets to go into
            scene.RegisterModuleInterface <IAssetService>(memAssetService);

            ISimulationDataService simulationDataService = new NullDataService();

            scene.RegisterModuleInterface <ISimulationDataService>(simulationDataService);

            IRegionSerialiserModule serializerModule = new SerialiserModule();

            scene.RegisterModuleInterface <IRegionSerialiserModule>(serializerModule);

            IUserAccountService userAccountService = new NullUserAccountService();

            scene.RegisterModuleInterface <IUserAccountService>(userAccountService);

            PhysicsScene physScene = CreateSimplePhysicsEngine();

            ((INonSharedRegionModule)physScene).AddRegion(scene);
            ((INonSharedRegionModule)physScene).RegionLoaded(scene);
            scene.PhysicsScene = physScene;

            scene.LandChannel = new TestLandChannel(scene); // simple land with no parcels
            Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource();
            config.AddConfig("Terrain");
            config.Configs["Terrain"].Set("InitialTerrain", "flat");
            var terrainModule = new TerrainModule();

            try {
                terrainModule.Initialise(config);
                terrainModule.AddRegion(scene);
            }
            catch (ReflectionTypeLoadException e) {
                // The terrain module loads terrain brushes and they might not all have been included
                StringBuilder sb = new StringBuilder();
                foreach (Exception exSub in e.LoaderExceptions)
                {
                    sb.AppendLine(exSub.Message);
                    FileNotFoundException exFileNotFound = exSub as FileNotFoundException;
                    if (exFileNotFound != null)
                    {
                        if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                        {
                            sb.AppendLine("Fusion Log:");
                            sb.AppendLine(exFileNotFound.FusionLog);
                        }
                    }
                    sb.AppendLine();
                }
                string errorMessage = sb.ToString();
                ConvOAR.Globals.log.Log("BConverterOS.CreateScene: exception adding region:");
                ConvOAR.Globals.log.Log(errorMessage);
            }
            catch (Exception e) {
                ConvOAR.Globals.log.Log("BConverterOS.CreateScene: exception adding region: {0}", e);
            }

            SceneManager.Instance.Add(scene);

            return(scene);
        }