Exemple #1
0
        private void _ProjectPanel_ProjectLoaded(Project project)
        {
            _project           = project;
            _projectService    = new ProjectService(new ErrorService(), project);
            _graphicsService   = new GraphicsService(_errorService, project);
            _levelService      = new LevelService(_errorService, project);
            _palettesService   = new PalettesService(_errorService, project);
            _worldService      = new WorldService(_errorService, project);
            _tileService       = new TileService(_errorService, project);
            _textService       = new TextService(_errorService, project);
            _clipBoardService  = new ClipBoardService();
            _romService        = new RomService(_errorService, _graphicsService, _palettesService, _tileService, _levelService, _worldService, _textService);
            _gameObjectService = new GameObjectService(_errorService, project);

            _levelService.LevelUpdated += _levelService_LevelUpdated;
            _worldService.WorldUpdated += _worldService_WorldUpdated;


            List <WorldInfo> worldInfos = new List <WorldInfo>();

            worldInfos.AddRange(project.WorldInfo);
            worldInfos.Add(project.EmptyWorld);

            FilePanel.Initialize(_levelService, _worldService);

            SplashText.Visibility   = Visibility.Collapsed;
            _config.LastProjectPath = _project.DirectoryPath + "\\" + _project.Name + ".json";
        }
Exemple #2
0
 /// <summary>
 /// Sets the road network and mission for the car
 /// </summary>
 /// <param name="roadNetwork"></param>
 /// <param name="mission"></param>
 public override void SetRoadNetworkAndMission(ArbiterRoadNetwork roadNetwork, ArbiterMissionDescription mission)
 {
     this.roadNetwork = roadNetwork;
     this.mission     = mission;
     this.roadNetwork.SetSpeedLimits(mission.SpeedLimits);
     this.world = new WorldService(this.roadNetwork);
 }
        public OperationalSimVehicleState GetOperationalSimVehicleState(WorldService service)
        {
            TransmissionGear g = TransmissionGear.Neutral;

            switch (gear)
            {
            case '1': g = TransmissionGear.First; break;

            case '2': g = TransmissionGear.Second; break;

            case '3': g = TransmissionGear.Third; break;

            case '4': g = TransmissionGear.Fourth; break;

            case 'r': g = TransmissionGear.Reverse; break;
            }

            double rps2rpm          = 60.0 / (2.0 * Math.PI);
            double bleed_off_torque = TahoeParams.bleed_off_power / engine_speed;

            return(new OperationalSimVehicleState(
                       simVehicleState.Position, simVehicleState.Speed, simVehicleState.Heading.ArcTan, steering_wheel,
                       g, engine_torque + bleed_off_torque, master_cylinder_pressure, engine_speed * rps2rpm, carMode,
                       0, false, SimulatorClient.GetCurrentTimestamp));
        }
        protected override void OnUpdated()
        {
            base.OnUpdated();

            if (!WorldService.WorldBounds.Contains(this.CurrentMouseTilePosition))
            {
                return;
            }

            var tile = WorldService.GetTile(this.CurrentMouseTilePosition);
            var staticWorldObjects = tile.StaticObjects;

            this.RefreshTooltip(staticWorldObjects);

            if (ClientInputManager.IsButtonDown(EditorButton.EditorDeleteSelectedObjects))
            {
                this.deleteCallback(this.SelectedWorldObjects);
            }

            this.selectedWorldObjects.RemoveWhere(
                worldObject =>
            {
                if (!worldObject.IsDestroyed)
                {
                    return(false);
                }

                this.selectionComponent.Deselect(worldObject);
                return(true);
            });
        }
Exemple #5
0
        public static MoveLevelResult Show(LevelService levelService, WorldService worldService, WorldInfo hostWorld, LevelInfo parentLevel)
        {
            MoveLevelResult moveLevelResult = null;

            MoveLevelWindow window = new MoveLevelWindow(levelService, worldService, hostWorld, parentLevel);

            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();


            if (window.DialogResult == true)
            {
                moveLevelResult = new MoveLevelResult();
                if (window.ParentLevel != null)
                {
                    moveLevelResult.InfoNode = window.ParentLevel;
                }
                else
                {
                    moveLevelResult.InfoNode = window.HostWorld;
                }

                return(moveLevelResult);
            }

            return(moveLevelResult);
        }
        public void TestInitialize()
        {
            var gameDataManager = new GameDataManager();
            var worldRepository = new GameDataRepository <XIVData.Model.World>(gameDataManager.World);

            _worldService = new WorldService(worldRepository);
        }
Exemple #7
0
 public void Initialize(LevelService levelService, WorldService worldService)
 {
     _levelService = levelService;
     _worldService = worldService;
     _levelService.LevelUpdated  += _levelService_LevelUpdated;
     _levelService.LevelsUpdated += _levelService_LevelsUpdated;
     BuildTree();
 }
Exemple #8
0
        public IActionResult _Creatures()
        {
            return(_CreaturesAlternate());

            CreaturesVM creaturesVM = WorldService.GetCreaturesVM(HttpContext.Session.GetString(SelectedEnvironment));

            return(PartialView(nameof(_Creatures), creaturesVM));
        }
        public NewLevelWindow(LevelService levelService, WorldService worldService)
        {
            InitializeComponent();

            _levelService = levelService;
            _worldService = worldService;

            WorldList.ItemsSource = _worldService.AllWorlds();
        }
        public SimVehicleState Update(double dt, WorldService service)
        {
            UpdateVehicleState(dt);
            TahoeConstraints();
            CheckGear();

            // send out the vehicle state
            operationalStateChannel.PublishUnreliably(GetOperationalSimVehicleState(service));

            return(simVehicleState);
        }
Exemple #11
0
        public IActionResult _CreaturesAlternate()
        {
            string env = HttpContext.Session.GetString(SelectedEnvironment);

            Monster[] monsters = WorldService.GetMonsters();
            if (string.IsNullOrEmpty(env))
            {
                monsters = monsters.Where(m => m.Tags.Contains(env)).ToArray();
            }
            return(PartialView(nameof(_CreaturesAlternate), monsters));
        }
Exemple #12
0
        private void CreateWorldSelectors()
        {
            WorldService.GetAll(worlds =>
            {
                foreach (World world in worlds)
                {
                    CreateSelector(world);
                }

                SelectActiveWorld();
            }, e => throw e);
        }
Exemple #13
0
        private static WorldService CreateWorld()
        {
            WorldConfiguration configuration = ConfigurationService.LoadFromFile("WorldConfiguration.xml");

            var randomService = new RandomService(configuration.Seed);

            var world = new World(configuration);

            var worldService = new WorldService(world, randomService);

            return(worldService);
        }
Exemple #14
0
 public HomeController(ApplicationDbContext context,
                       UserManager <ApplicationUser> userManager,
                       IEmailSender emailSender,
                       WorldService worldService,
                       TaqweemService taqweemService)
 {
     _worldService   = worldService;
     _userManager    = userManager;
     _context        = context;
     Repository      = new EFRepository(_context);
     _emailSender    = emailSender;
     _taqweemService = taqweemService;
 }
Exemple #15
0
        public static string GetTrimmedPlayerName(string name, int worldId)
        {
            var isPil2NameFormat         = false;
            var isLegacyJaegerNameFormat = false;

            if (WorldService.IsJaegerWorldId(worldId))
            {
                if (_pil2NameRegex.Match(name).Success)
                {
                    isPil2NameFormat = true;
                }
                else if (_legacyJaegerNameRegex.Match(name).Success)
                {
                    isLegacyJaegerNameFormat = true;
                }
            }

            var trimmed    = name;
            var initLength = name.Length;

            if (isPil2NameFormat)
            {
                trimmed = name.Substring(0, initLength - 3);
            }
            else if (isLegacyJaegerNameFormat)
            {
                // Remove outfit tag from beginning of name
                var idx = name.IndexOf("x");
                if (idx >= 0 && idx < 5 && (idx != initLength - 1))
                {
                    trimmed = name.Substring(idx + 1, initLength - idx - 1);
                }
            }

            if (!isPil2NameFormat && _factionSufficRegex.Match(trimmed).Success)
            {
                // Remove faction abbreviation from end of name
                var end = trimmed.Length - 2;
                trimmed = trimmed.Substring(0, end);
            }

            if (string.IsNullOrWhiteSpace(trimmed) || trimmed.Length <= 1)
            {
                trimmed = name;
            }

            return(trimmed);
        }
Exemple #16
0
        private static void TestServices()
        {
            RoleService.Init();
            UserService.Init();
            CountryService.Init();
            LanguageService.Init();
            AvgAmountService.Init();
            CountryAdditionalHourService.Init();
            ColouringService.Init();
            FeastService.Init();
            AbsenceService.Init();
            WorkingModelService.Init();
            YearlyWorkingDayService.Init();
            EmployeeService.Init();
            EmployeeRelationService.Init();
            EmployeeContractService.Init();
            LongTimeAbsenceService.Init();
            EmployeeLongTimeAbsenceService.Init();
            StoreService.Init();
            WGRService.Init();
            HWGRService.Init();
            WorldService.Init();
            StoreToWorldService.Init();
            WorldToHWGRService.Init();
            HwgrToWgrService.Init();
            StoreWorkingTimeService.Init();
            StoreAdditionalHourService.Init();
            BufferHoursService.Init();
            BenchmarkService.Init();
            TrendCorrectionService.Init();
            PersonMinMaxService.Init();
            RegionService.Init();

            AbsenceTimePlanningService.Init();
            AbsenceTimeRecordingService.Init();
            WorkingTimePlanningService.Init();
            WorkingTimeRecordingService.Init();
            EmployeeTimeService.Init();
            AvgWorkingDaysInWeekService.Init();
            EmployeeDayStatePlanningService.Init();
            EmployeeDayStateRecordingService.Init();
            EmployeeWeekTimePlanningService.Init();
            EmployeeWeekTimeRecordingService.Init();
            EmployeePlanningWorkingModelService.Init();
            EmployeeRecordingWorkingModelService.Init();
        }
Exemple #17
0
        public TileBlockEditor(ProjectService projectService, WorldService worldService, LevelService levelService, GraphicsService graphicsService, PalettesService palettesService, TileService tileService, TextService textService)
        {
            _ignoreChanges = true;
            InitializeComponent();

            _projectService  = projectService;
            _palettesService = palettesService;
            _graphicsService = graphicsService;
            _worldService    = worldService;
            _levelService    = levelService;
            _tileService     = tileService;
            _textService     = textService;

            List <KeyValuePair <string, string> > tileSetText = _textService.GetTable("tile_sets");

            tileSetText.Insert(0, new KeyValuePair <string, string>("0", "Map"));

            TerrainList.ItemsSource        = _localTileTerrain = _tileService.GetTerrainCopy();
            LevelList.ItemsSource          = _levelService.AllWorldsLevels();
            MapInteractionList.ItemsSource = _localMapTileInteraction = _tileService.GetMapTileInteractionCopy();

            _graphicsAccessor = new GraphicsAccessor(_graphicsService.GetTileSection(0), _graphicsService.GetTileSection(0), _graphicsService.GetGlobalTiles(), _graphicsService.GetExtraTiles());

            _graphicsSetRenderer = new GraphicsSetRender(_graphicsAccessor);
            _tileSetRenderer     = new TileSetRenderer(_graphicsAccessor, _localTileTerrain, _localMapTileInteraction);

            Dpi dpi = this.GetDpi();

            _graphicsSetBitmap = new WriteableBitmap(128, 128, dpi.X, dpi.Y, PixelFormats.Bgra32, null);
            _tileBlockBitmap   = new WriteableBitmap(16, 16, dpi.X, dpi.Y, PixelFormats.Bgra32, null);

            GraphicsSetImage.Source = _graphicsSetBitmap;

            TileBlockImage.Source = _tileBlockBitmap;

            BlockSelector.Initialize(_graphicsAccessor, _tileService, _tileService.GetTileSet(0), _graphicsService.GetPalette(0), _tileSetRenderer);
            BlockSelector.TileBlockSelected += BlockSelector_TileBlockSelected;

            LevelList.SelectedIndex          = 1;
            BlockSelector.SelectedBlockValue = 0;
            _ignoreChanges = false;

            _graphicsService.GraphicsUpdated      += _graphicsService_GraphicsUpdated;
            _graphicsService.ExtraGraphicsUpdated += _graphicsService_GraphicsUpdated;
        }
        public static NewLevelResult Show(LevelService levelService, WorldService worldService)
        {
            Level          newLevel       = null;
            NewLevelResult newLevelResult = null;

            NewLevelWindow window = new NewLevelWindow(levelService, worldService);

            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();


            if (window.DialogResult == true)
            {
                newLevel = new Level();
                newLevel.AnimationType        = window.BaseLevel.AnimationType;
                newLevel.Effects              = window.BaseLevel.Effects;
                newLevel.EventType            = window.BaseLevel.EventType;
                newLevel.StaticTileTableIndex = window.BaseLevel.StaticTileTableIndex;
                newLevel.Id            = Guid.NewGuid();
                newLevel.MusicValue    = window.BaseLevel.MusicValue;
                newLevel.Name          = window.LevelName;
                newLevel.PaletteEffect = window.BaseLevel.PaletteEffect;
                newLevel.PaletteId     = window.BaseLevel.PaletteId;
                newLevel.ScreenLength  = window.BaseLevel.ScreenLength;
                newLevel.ScrollType    = window.BaseLevel.ScrollType;
                newLevel.StartX        = window.BaseLevel.StartX;
                newLevel.StartY        = window.BaseLevel.StartY;
                newLevel.TileSetIndex  = window.BaseLevel.TileSetIndex;

                newLevelResult           = new NewLevelResult();
                newLevelResult.Level     = newLevel;
                newLevelResult.LevelInfo = new LevelInfo()
                {
                    Name = newLevel.Name, SublevelsInfo = new List <LevelInfo>()
                };
                newLevelResult.WorldInfo = window.HostWorld;

                return(newLevelResult);
            }

            return(newLevelResult);
        }
Exemple #19
0
    private void ExitGameMode()
    {
        var gameWorld = WorldExporter.ExportCurrentWorld();

        gameWorld.UserId = worldSelector.worlds[worldSelector.index].UserId;
        var worldIndex = worldSelector.worlds.FindIndex((world) => world.Equals(gameWorld));

        if (worldIndex < 0)
        {
            worldSelector.worlds.Add(gameWorld);
        }
        else
        {
            worldSelector.worlds.RemoveAt(worldIndex);
            worldSelector.worlds.Insert(worldIndex, gameWorld);
        }

        var service = new WorldService();

        service.Post(gameWorld);
    }
Exemple #20
0
    // Use this for initialization
    void Start()
    {
        index     = 0;
        lastIndex = -1;
        var service = new WorldService();

        worlds = new List <GameWorldData>();
        try
        {
            worlds = service.Get().ToList();
        }
        catch (WebException socketException)
        {
            Debug.LogException(socketException);
        }
        catch (Exception exception)
        {
            Debug.LogException(exception);
        }
        worlds.Insert(0, new GameWorldData());
    }
Exemple #21
0
        public void ConvertPalettes()
        {
            ProjectService  projectService  = new ProjectService(new ErrorService());
            Project         project         = projectService.LoadProject(@"C:\Projects\Mario Adventure 3\Mushroom Mayhem\Mushroom Mayhem.json");
            LevelService    levelService    = new LevelService(new ErrorService(), project);
            WorldService    worldService    = new WorldService(new ErrorService(), project);
            PalettesService palettesService = new PalettesService(new ErrorService(), project);
            var             palettes        = palettesService.GetPalettes();

            foreach (IInfo info in levelService.AllWorldsLevels())
            {
                if (info.InfoType == InfoType.Level)
                {
                    LevelInfo levelInfo = info as LevelInfo;
                    Level     level     = levelService.LoadLevel(levelInfo);
                    Palette   palette   = palettes.Where(p => p.Id == level.PaletteId).FirstOrDefault();
                    if (!palette.Renamed)
                    {
                        palette.Name    = level.Name;
                        palette.Renamed = true;
                        palettesService.CommitPalette(palette);
                    }
                }

                if (info.InfoType == InfoType.World)
                {
                    WorldInfo worldInfo = info as WorldInfo;
                    World     world     = worldService.LoadWorld(worldInfo);
                    Palette   palette   = palettes.Where(p => p.Id == world.PaletteId).FirstOrDefault();
                    if (!palette.Renamed)
                    {
                        palette.Name    = world.Name;
                        palette.Renamed = true;
                        palettesService.CommitPalette(palette);
                    }
                }
            }

            projectService.SaveProject();
        }
Exemple #22
0
        private void RenderSectors()
        {
            WorldService.GetPopulationDensity(response =>
            {
                for (int index = 0; index < response.density.Length; index++)
                {
                    int population = response.density[index];
                    Sector sector  = Instantiate(sectorPrefab, worldContainer);
                    sector.Id      = index + 1;
                    sector.SetText(population.ToString());
                    sector.MouseClickEvent.AddListener(() => OnSectorSelected(sector));
                    sector.MouseDoubleClickEvent.AddListener(() =>
                    {
                        OnSectorSelected(sector);
                        OnSelectClick();
                    });

                    _sectors.Add(sector);
                }
            }, Debug.Log);

            overlay.SetActive(false);
        }
Exemple #23
0
        private static void SimulateWorld(WorldService worldService, int numYears)
        {
            var world = worldService.World;

            var timer = new Stopwatch();

            timer.Start();

            for (int year = 1; year <= numYears; year++)
            {
                if (year % 10 == 0)
                {
                    Console.WriteLine($"Year {year} ({world.LivingPeople.Count} living, {world.DeadPeople.Count} dead)");
                }

                worldService.SimulateYear();
            }

            timer.Stop();

            Console.WriteLine($"Completed {world.Date.Ticks} years in {timer.Elapsed}");
            Console.WriteLine($"# Living: {world.LivingPeople.Count}, # dead: {world.DeadPeople.Count}");
            Console.ReadKey();
        }
#pragma warning restore 67
        public void InitGameData()
        {
            var gameDataManager    = new GameDataManager();
            var languageRepository = new GameDataRepository <Language>(gameDataManager.Language);

            LanguageService = new LanguageService(languageRepository, _ffxivACTPluginWrapper, ACTConfig);
            var worldRepository = new GameDataRepository <World>(gameDataManager.World);

            WorldService = new WorldService(worldRepository);
            var classJobRepository = new GameDataRepository <ClassJob>(gameDataManager.ClassJob);

            ClassJobService = new ClassJobService(classJobRepository);
            LocationService = new LocationService(gameDataManager, _ffxivACTPluginWrapper);
            var contentRepository =
                new GameDataRepository <ContentFinderCondition>(gameDataManager.ContentFinderCondition);

            ContentService =
                new ContentService(_ffxivACTPluginWrapper.GetZoneList(), contentRepository);
            var itemRepository       = new GameDataRepository <Item>(gameDataManager.Item);
            var itemActionRepository = new GameDataRepository <ItemAction>(gameDataManager.ItemAction);

            ItemService   = new ItemService(itemRepository, itemActionRepository);
            PlayerService = new PlayerService(_actWrapper, _ffxivACTPluginWrapper, WorldService, ClassJobService);
        }
Exemple #25
0
        public MoveLevelWindow(LevelService levelService, WorldService worldService, WorldInfo hostWorld, LevelInfo parentLevel)
        {
            InitializeComponent();

            _levelService       = levelService;
            _worldService       = worldService;
            _defaultParentLevel = parentLevel;

            WorldList.ItemsSource = _worldService.AllWorlds();

            if (parentLevel == null)
            {
                LevelList.SelectedIndex = 0;
            }
            else
            {
                LevelList.SelectedItem = parentLevel;
            }

            if (hostWorld != null)
            {
                WorldList.SelectedItem = hostWorld;
            }
        }
 public void Initialize()
 {
     Service = new WorldService();
     Service.RealmStatusChanged += OnRealmStatusChanged;
     Service.Participate();
 }
        public WorldPanel(GraphicsService graphicsService, PalettesService palettesService, TextService textService, TileService tileService, WorldService worldService, LevelService levelService, GameObjectService gameObjectService, WorldInfo worldInfo)
        {
            InitializeComponent();

            _worldInfo         = worldInfo;
            _textService       = textService;
            _graphicsService   = graphicsService;
            _tileService       = tileService;
            _palettesService   = palettesService;
            _worldService      = worldService;
            _gameObjectService = gameObjectService;

            _historyService     = new HistoryService();
            _interactions       = _tileService.GetMapTileInteractions();
            _world              = _worldService.LoadWorld(_worldInfo);
            _compressionService = new CompressionService();
            Tile[] bottomTableSet = _graphicsService.GetTileSection(_world.TileTableIndex);
            Tile[] topTableSet    = _graphicsService.GetTileSection(_world.AnimationTileTableIndex);
            _graphicsAccessor  = new GraphicsAccessor(topTableSet, bottomTableSet, _graphicsService.GetGlobalTiles(), _graphicsService.GetExtraTiles());
            _worldDataAccessor = new WorldDataAccessor(_world);

            _bitmap        = new WriteableBitmap(WorldRenderer.BITMAP_WIDTH, WorldRenderer.BITMAP_HEIGHT, 96, 96, PixelFormats.Bgra32, null);
            _worldRenderer = new WorldRenderer(_graphicsAccessor, _worldDataAccessor, _palettesService, _tileService.GetMapTileInteractions());
            _worldRenderer.Initializing();

            _tileSet = _tileService.GetTileSet(_world.TileSetIndex);

            Palette palette = _palettesService.GetPalette(_world.PaletteId);

            _worldRenderer.Update(tileSet: _tileSet, palette: palette);

            WorldRenderSource.Source = _bitmap;
            WorldRenderSource.Width  = _bitmap.PixelWidth;
            WorldRenderSource.Height = _bitmap.PixelHeight;
            CanvasContainer.Width    = RenderContainer.Width = _world.ScreenLength * 16 * 16;

            SelectedEditMode.SelectedIndex = 0;
            SelectedDrawMode.SelectedIndex = 0;

            TileSelector.Initialize(_graphicsAccessor, _tileService, _tileSet, palette);
            ObjectSelector.Initialize(_gameObjectService, _palettesService, _graphicsAccessor, palette);
            PointerEditor.Initialize(levelService, _worldInfo);

            _world.ObjectData.ForEach(o => o.GameObject = gameObjectService.GetObject(o.GameObjectId));


            UpdateTextTables();

            _graphicsService.GraphicsUpdated      += _graphicsService_GraphicsUpdated;
            _graphicsService.ExtraGraphicsUpdated += _graphicsService_GraphicsUpdated;
            _palettesService.PalettesChanged      += _palettesService_PalettesChanged;
            _tileService.TileSetUpdated           += _tileService_TileSetUpdated;
            _worldService.WorldUpdated            += _worldService_WorldUpdated;
            gameObjectService.GameObjectUpdated   += GameObjectService_GameObjectsUpdated;


            _world.ObjectData.ForEach(o =>
            {
                o.CalcBoundBox();
                o.CalcVisualBox(true);
            });

            _initializing = false;
            _worldRenderer.Ready();
            Update();
        }
Exemple #28
0
 public DoomHttpClient()
 {
     // Provision Services
     PlayerService = new Player.PlayerService(CLIENT, URIBASE);
     WorldService  = new World.WorldService(CLIENT, URIBASE);
 }
Exemple #29
0
 public IActionResult _Obstacles()
 {
     return(PartialView(WorldService.GetObstacles()));
 }
Exemple #30
0
 public IActionResult _Puzzles()
 {
     return(PartialView(WorldService.GetPuzzles()));
 }