Ejemplo n.º 1
0
        private List <TabSpyOut> _getSpyItemsList(IDbConnection connection, int userId, int lastId = 0)
        {
            var reports = _uSpyService.GetSpyReports(connection, userId, s => new TabSpyOut
            {
                Id = s.Id,

                TargetPlanetId = s.TargetPlanetId,

                TargetUserName   = s.TargetUserName,
                TargetSystemName = s.TargetPlanetName.Substring(0, 5),
                TargetPlanetName = s.TargetPlanetName,
                TargetResource   = s.TargetResource,
                //SourceOwnType = false,
                TargetHangar = UnitList.ConvertToHangar(s.TargetPlanetHangar),

                //todo  временно назначен
                LeftImage  = ImageView.Img(_spriteImages.MapControlIcons("jumptoplanetoid").Icon),
                RightImage =
                    (s.TargetUserName == Npc.SkagyName)
                        ? ImageView.Img(_spriteImages.MapControlIcons("interface-skagry-icon").Icon, Npc.SkagyName,
                                        false, Npc.SkagyName)
                        : ImageView.Img(s.TargetUserImage.Icon, s.TargetUserName, true, s.TargetUserName),
                Date    = UnixTime.GetDateFromTimeStamp(s.DateActivate),
                TimeNow = UnixTime.GetTimeFromTimeStamp(s.DateActivate),
            }, lastId);

            return(reports);
        }
Ejemplo n.º 2
0
        public TabTaskOut SetTaskItem(UserTaskDataModel newTaskItem)
        {
            if (newTaskItem.Id == 0)
            {
                throw new Exception(Error.TaskNotExist);
            }
            var si = new SpriteImages();
            var ti = new TabTaskOut {
                Id               = newTaskItem.Id,
                StartTime        = newTaskItem.DateActivate,
                SourceOwnType    = newTaskItem.SourceOwnType,
                SourceOwnName    = newTaskItem.SourceOwnName,
                SourceSystemName = newTaskItem.SourceSystemName,
                TargetPlanetName = newTaskItem.TargetPlanetName,

                //TargetSystemName = targetPlanetName.Substring(0, 5),
                TargetSystemName = newTaskItem.TargetSystemName,
                FlyDuration      = newTaskItem.Duration,
                HangarInTask     = UnitList.ConvertToHangar(newTaskItem.SourceFleet.CloneDeep()),
                IsAtack          = newTaskItem.IsAtack,
                IsTransfer       = newTaskItem.IsTransfer
            };

            if (ti.SourceOwnType)
            {
                ti.LeftImage = ImageView.Img("t-LeftImage");
            }
            else
            {
                ti.LeftImage = ImageView.Img(si.MapControlIcons("jumptomother").Icon);
            }
            ti.RightImage = ImageView.Img(si.MapControlIcons("jumptoplanetoid").Icon);
            TabTaskOut.InitComplexBtnItem(ti);
            return(ti);
        }
        private static Dictionary <UnitType, HangarUnitsOut> GetherMotherUnits(UserMothershipDataModel mother,
                                                                               UserPremiumWorkModel userPremium)
        {
            var outUnits = UnitList.ConvertToHangar(mother.Hangar);

            if (mother.UnitProgress == null || !mother.UnitProgress.Any())
            {
                return(outUnits);
            }
            SetUnitUpgradeInHangarUnit(userPremium, 1, ref outUnits, mother.UnitProgress);
            return(outUnits);
        }
        private static Dictionary <UnitType, HangarUnitsOut> GetherPlanetUnits(GDetailPlanetDataModel planet,
                                                                               UserPremiumWorkModel userPremium)
        {
            var shipyardlevel = 1;
            var shipyard      = planet.BuildSpaceShipyard;

            if (shipyard?.Level != null)
            {
                shipyardlevel = (int)shipyard.Level;
            }
            var outUnits = UnitList.ConvertToHangar(planet.Hangar);

            if (planet.UnitProgress == null || !planet.UnitProgress.Any())
            {
                return(outUnits);
            }
            SetUnitUpgradeInHangarUnit(userPremium, shipyardlevel, ref outUnits, planet.UnitProgress);
            return(outUnits);
        }
Ejemplo n.º 5
0
        private TabSpyOut _writeAndReturnSpyItem(IDbConnection connection, int currentUserId, GDetailPlanetDataModel tPlanet)
        {
            var resource   = MaterialResource.ConvertStorageToMaterial(tPlanet.Resources).ConvertToInt();
            var planetType = _geometryPlanetService.GetGeometryPlanetById(connection, tPlanet.Id);

            var spyItem = new UserSpyDataModel {
                DateActivate       = UnixTime.UtcNow(),
                TargetPlanetTypeId = planetType.TypeId,
                TargetPlanetName   = tPlanet.Name,
                TargetPlanetId     = tPlanet.Id,
                TargetPlanetHangar = tPlanet.Hangar,
                TargetResource     = resource,
                SourceUserId       = currentUserId,
            };

            var isSkagry = false;

            if (tPlanet.UserId == Npc.SkagryGameUserId)
            {
                spyItem.TargetUserName = Npc.SkagyName;
                //todo  сделать стиль скагрей
                spyItem.TargetUserImage = _spriteImages.MapControlIcons("interface-skagry-icon");

                isSkagry = true;
            }
            else
            {
                var targetUser = _gameUserService.GetGameUser(connection, tPlanet.UserId);
                spyItem.TargetUserName  = targetUser.Nickname;
                spyItem.TargetUserImage = targetUser.Avatar;
            }

            var newSpyItem = _uSpyService.AddOrUpdate(connection, spyItem);

            if (newSpyItem.Id == 0)
            {
                throw new Exception(Error.NoData);
            }


            var leftSprite = new SpriteImages();

            leftSprite.MapControlIcons("jumptoplanetoid");
            var j = new TabSpyOut {
                // SourceOwnType = false,

                Id               = newSpyItem.Id,
                TargetUserName   = newSpyItem.TargetUserName,
                TargetResource   = newSpyItem.TargetResource,
                TargetHangar     = UnitList.ConvertToHangar(tPlanet.Hangar),
                TargetPlanetId   = newSpyItem.TargetPlanetId,
                TargetPlanetName = newSpyItem.TargetPlanetName,
                TargetSystemName = newSpyItem.TargetPlanetName.Substring(0, 5),
                LeftImage        = ImageView.Img(leftSprite.Icon),
                RightImage       =
                    (isSkagry)
                        ? ImageView.Img(spyItem.TargetUserImage.Icon)
                        : ImageView.Img(spyItem.TargetUserImage.Icon, null, true),
                Date    = UnixTime.GetDateFromTimeStamp(newSpyItem.DateActivate),
                TimeNow = UnixTime.GetTimeFromTimeStamp(newSpyItem.DateActivate)
            };

            j.RightImage.Title = j.RightImage.Alt = j.TargetUserName;

            TabSpyOut.InitComplexBtnItem(j);
            return(j);
        }