コード例 #1
0
        public IMotherJumpOut GetJumpTaskModel(IDbConnection connection, UserMotherJumpDataModel task)
        {
            if (task == null)
            {
                return(null);
            }
            var activeJump = new MotherJumpOut {
                Id             = task.Id,
                StartTime      = task.StartTime,
                EndTime        = task.EndTime,
                SourceSystemId = task.StartSystem,
                TargetSystemId = task.TargetSystem,
                FlyDuration    = task.EndTime - task.StartTime,
                LeftImage      = ImageView.Img(_spriteImages.MapControlIcons("jumptomother").Icon, null, false, null),
                SourceOwnType  = false,
            };


            var startSystem  = _systemService.GetDetailSystemBySystemId(connection, activeJump.SourceSystemId);
            var targetSystem = _systemService.GetDetailSystemBySystemId(connection, activeJump.TargetSystemId);

            activeJump.SourceSystemName = startSystem.Name;
            activeJump.TargetSystemName = targetSystem.Name;

            //  var startSystemType = await _gameTypeService.GetGGameTypeAsync(startSystem.TypeId);
            var targetSystemType        = _gameTypeService.GetGGameType(connection, targetSystem.TypeId);
            var targetSystemTextureType = _systemService.GetGeometrySystem(connection, activeJump.TargetSystemId);

            activeJump.RightImage =
                ImageView.Img(_spriteImages.StarImages(targetSystemType.SubType, targetSystemTextureType.Id).Icon,
                              activeJump.SourceSystemName, false, activeJump.SourceSystemName);

            activeJump.TaskButtons();
            return(activeJump);
        }
コード例 #2
0
        public GalaxyInfoOut GetGalaxyInfo(IDbConnection connection, byte galaxyId)
        {
            var galaxy = _galaxyService.GetGalaxyById(connection, galaxyId, i => i);

            if (galaxy == null)
            {
                throw new ArgumentNullException(nameof(galaxy), Error.NoData);
            }

            var galaxyType   = _gameTypeService.GetGGameType(connection, galaxy.TypeId);
            var sectorsIds   = _gSectorsService.GetSectorsByGalaxy(connection, galaxyId, i => i.Id);
            var sectorsCount = sectorsIds.Count;

            var galaxyName = L10N.ExecuteTranslateNameOrDescr(galaxy.Translate, true, L10N.GetCurrentCulture());

            var galaxyInfo = new GalaxyInfoOut
            {
                Id                   = galaxy.Id,
                GalaxyId             = galaxy.Id,
                NativeName           = galaxy.NativeName,
                GalaxyName           = galaxyName,
                TranslateName        = galaxyName,
                TextureTypeId        = galaxy.TextureTypeId,
                TypeNativeName       = galaxyType.Type,
                TypeTranslateName    = galaxyName,
                SubtypeNativeName    = galaxyType.SubType,
                SubtypeTranslateName = "Spirale",
                SpriteImages         = new SpriteImages().GalaxyImages(galaxy.TextureTypeId),
                Description          = L10N.ExecuteTranslateNameOrDescr(galaxy.Translate, false),
                ChildCount           = (short)sectorsCount
            };


            //todo  сделать перевод
            galaxyInfo.SetComplexButtonView();
            return(galaxyInfo);
        }