Esempio n. 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);
        }
Esempio n. 2
0
        private UserMotherJumpDataModel _cancel(IDbConnection connection, UserMotherJumpDataModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model), Error.NoData);
            }
            if (model.Completed)
            {
                throw new Exception(Error.TaskCompleted);
            }

            model.CancelJump = true;
            model.Completed  = true;
            return(AddOrUpdate(connection, model));
        }
Esempio n. 3
0
        private int _setCompleteJumpAndGetTimeToEnd(IDbConnection connection, UserMotherJumpDataModel mJump)
        {
            var currTime = UnixTime.UtcNow();

            if (mJump.EndTime > currTime)
            {
                return(currTime - mJump.EndTime);
            }

            mJump.Completed = true;
            mJump           = AddOrUpdate(connection, mJump);

            var mother = _mothershipService.GetMother(connection, mJump.MotherId);

            mother.StartSystemId = mJump.TargetSystem;
            _mothershipService.AddOrUpdate(connection, mother);
            return(0);
        }
Esempio n. 4
0
        public UserMotherJumpDataModel AddOrUpdate(IDbConnection connection, UserMotherJumpDataModel dataModel)
        {
            var db = _motherJumpRepo.AddOrUpdateeModel(connection, dataModel);

            return(_motherJumpCache.UpdateLocalItem(connection, db));
        }