Example #1
0
        public IList <TabSpyOut> GetSpyItems(IDbConnection connection, int currentUserId, int lastSpyId)
        {
            var collection = _getSpyItemsList(connection, currentUserId, lastSpyId);

            TabSpyOut.InitComplexBtnCollection(collection);
            return(collection);
        }
Example #2
0
        public IPlanshetViewData InitialPlanshet(IDbConnection connection, int currentUserId, List <int> userPlanetIds = null)
        {
            if (userPlanetIds == null)
            {
                var up = _gDetailPlanetService.GetUserPlanets(connection, currentUserId);
                userPlanetIds = up.Select(i => i.Id).ToList();
            }

            #region Task

            var taskTab = new TabTaskOut {
                MotherJump = _motherJumpService.GetJumpTaskModel(connection, currentUserId),
                Collection = _uTaskService.GetActiveTask(connection, currentUserId, SetTaskItem, userPlanetIds)
            };


            taskTab.TaskButtons();
            TabTaskOut.InitComplexBtnCollection(taskTab.Collection);

            #endregion

            #region Report

            var reportTab = new TabReportOut {
                Collection = _getReportItemsList(connection, currentUserId),
                TotalItems = _uReportService.GetTotalUserReports(connection, currentUserId),
            };
            TabReportOut.InitComplexBtnCollection(reportTab.Collection);

            #endregion

            #region Spy

            var spyCollection = _getSpyItemsList(connection, currentUserId);
            var spyTab        = new TabSpyOut {
                Collection = spyCollection,
                TotalItems = _uSpyService.GetTotalUserSpyReports(connection, currentUserId),
                Buttons    = new List <IButtonsView> {
                    ButtonsView.NewSpyItemFromSerch()
                }
            };
            TabSpyOut.InitComplexBtnCollection(spyTab.Collection);

            #endregion

            return(JournalOut.InitialTabs(taskTab, reportTab, spyTab, _localizer));
        }
Example #3
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);
        }