예제 #1
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);
        }
예제 #2
0
        public BuildItemUnitView GetMotherViewModel(bool premiumIsActive, StorageResources resources = null)
        {
            //if (resources == null) throw new Exception(Error.UserResourceNotSetInInstance);

            var description = new LangField(Resource.MotherEnergyConverter, Resource.MotherEnergyConverterDescription);

            var images = new SpriteImages().BuildImages(MotherCssNativename);

            var model = new BuildItemUnitView
            {
                TranslateName = description.Name,
                NativeName    = NativeName,
                IconSelf      = images.Icon,
                Info          = new BuildDropItemInfo
                {
                    Description = description.Name,
                    DropImage   = images.Detail
                },
                Action = new BuildDropItemAction
                {
                    ViewPath = BuildEnergyConverterActions.ViewPath,
                    Data     = new BuildEnergyConverterActions
                    {
                        StorageResources = null,
                        ConvertLoses     = GameMathStats.BaseConvertLosses
                    }
                },
                IsBuildItem = true
            };

            model.SetComplexButtonView();
            model.Action.SetButtons();
            return(model);
        }
예제 #3
0
        public UnitModel(UnitModel other)
        {
            Key   = other.Key;
            Count = other.Count;

            BasePrice    = other.BasePrice.CreateNewFromThis();
            UnitStats    = other.UnitStats.CreateNewFromThis();
            SpriteImages = other.SpriteImages.CreateNewFromThis();
            if (other.BattleTechCondidion != null)
            {
                BattleTechCondidion = other.BattleTechCondidion.ToDictionary(i => i.Key, i => i.Value);
            }
        }
예제 #4
0
        public static IButtonsView LefMenuNavChannels()
        {
            const string cssItemSelector = "interface-icon-message";
            var          cssResulClases  = new SpriteImages().InterfaseBaseControlIcons(cssItemSelector).Icon;

            return(new ButtonsView
            {
                IsCssImage = true,
                CssImage = cssResulClases,
                TranslateName = Modules.Localize.Game.UserChannels.Resource.Messages,
                CssClass = CssSmall,
                ShowName = false
            });
        }
예제 #5
0
        public BuildItemUnitView GetMotherViewModel(bool premiumIsActive, StorageResources resources = null)
        {
            if (resources?.Current == null)
            {
                throw new Exception(Error.ProportionNotSetInModel);
            }


            var description = new LangField(Resource.MotherExtractionModule, Resource.MotherStorageDescription);

            var images = new SpriteImages().BuildImages(MotherCssNativename);

            //todo  временно
            // var power = GetPower(1, premiumIsActive);
            var power      = GetPower(22, premiumIsActive);
            var extraction = new ExtractionResource();

            extraction.SetAndCalcEmpFromProportion(resources.Current, power, BaseProportion.Ir, BaseProportion.Dm);


            var model = new BuildItemUnitView
            {
                TranslateName = description.Name,
                NativeName    = NativeName,
                IconSelf      = images.Icon,
                Info          = new BuildDropItemInfo
                {
                    Description = description.Name,
                    DropImage   = images.Detail
                },
                Action = new BuildDropItemAction
                {
                    ViewPath = BuildExtractionModuleActions.ViewPath,
                    Data     = new BuildExtractionModuleActions
                    {
                        //todo  реализовать
                        Power             = power,
                        Percent           = extraction.ExtractionProportin,
                        ExtractionPerHour = extraction.ExtractionPerHour
                    }
                },
                IsBuildItem = true
            };

            model.SetComplexButtonView();
            model.Action.SetButtons();

            return(model);
        }
예제 #6
0
        public void DontSpriteWhenDebugging()
        {
            var bundle = new StylesheetBundle("~");
            var asset = new StubAsset(
                "~/asset.css",
                ".a { background-image:url(image-a.png);width:20px;height:20px }\n" +
                ".b { background-image:url(image-b.png);width:20px;height:20px }"
            );
            bundle.Assets.Add(asset);

            var settings = new CassetteSettings
            {
                IsDebuggingEnabled = true,
                CacheDirectory = new FakeFileSystem()
            };

            var processor = new SpriteImages(settings, () => null);
            processor.Process(bundle);
            // Would throw exception if it tried to sprite the CSS.
        }
예제 #7
0
        public BuildItemUnitView GetMotherViewModel(bool premiumIsActive, StorageResources resources = null)
        {
            if (resources == null)
            {
                resources = new StorageResources();
                resources.InitializeField();
            }
            var description = new LangField(Resource.MotherStorage, Resource.MotherStorageDescription);
            var images      = new SpriteImages().BuildImages(MotherCssNativename);

            var model = new BuildItemUnitView
            {
                TranslateName = description.Name,
                NativeName    = NativeName,
                IconSelf      = images.Icon,
                Info          = new BuildDropItemInfo
                {
                    Description = description.Name,
                    DropImage   = images.Detail
                },
                Action = new BuildDropItemAction
                {
                    ViewPath = BuildStorageActions.ViewPath,
                    Data     = new BuildStorageActions
                    {
                        StorageResources = resources,
                        Losses           = GetTransferLossesMod(1, premiumIsActive)
                    }
                },
                IsBuildItem = true
            };


            SetRequiredButtons(model);

            return(model);
        }
예제 #8
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);
        }
예제 #9
0
        private SectionContentViewData _complexBtnInit()
        {
            MapTypes type;

            Enum.TryParse(TypeNativeName, true, out type);
            var name = NativeName;

            var bokmarkJumpAction = $"GameServices.bookmarkService.bookmarkJump({GalaxyId},{SectorId},{SystemId},{Id},{TextureTypeId},'{TypeNativeName}')";

            var infoIcon = SpriteImages.Icon;
            var jumpIcon = SpriteImages.Icon;

            //Planet
            if (type == MapTypes.Planet)
            {
                infoIcon = new SpriteImages().MapControlIcons("planetinfo").Icon;
                jumpIcon = new SpriteImages().MapControlIcons("jumptoplanetoid").Icon;
            }
            //Star
            else if (type == MapTypes.Star)
            {
                infoIcon = new SpriteImages().MapControlIcons("starinfo").Icon;
                jumpIcon = new SpriteImages().MapControlIcons("jumptostar").Icon;
            }
            //Sector
            else if (type == MapTypes.Sector)
            {
                infoIcon = new SpriteImages().MapControlIcons("sectorinfo").Icon;
                jumpIcon = new SpriteImages().MapControlIcons("jumpinsector").Icon;
            }
            //Galaxy
            else if (type == MapTypes.Sector)
            {
                infoIcon          = new SpriteImages().MapControlIcons("galaxyinfo").Icon;
                jumpIcon          = "";
                bokmarkJumpAction = "";
            }


            return(new SectionContentViewData
            {
                Left = new SectionItem
                {
                    //todo tmp imgCss
                    // Data = ImageView.Img(SpriteImages.Icon, Name),

                    Data = ImageView.Img(infoIcon, NativeName)
                },
                Centr = new SectionItem
                {
                    Data = new { Head = name },
                    //Path = SimpleBtnCentr.SimpleBtnCentrViewPath,
                    ItemId = GameHtmlAtributes.Action
                },
                Right = new SectionItem
                {
                    //todo tmp imgCss
                    Data = ImageView.Img(jumpIcon, "delete after Go to..."),
                    ItemId = GameHtmlAtributes.Jump,
                    JsFunction = bokmarkJumpAction
                }
            });
        }