public WarshipDto GetWarshipModel(WarshipTypeEnum warshipTypeEnum) { if (warships.TryGetValue(warshipTypeEnum, out var warshipDto)) { return(warshipDto); } throw new Exception("Такого корабля нет. " + warshipTypeEnum); }
public string GetSkinName(WarshipTypeEnum modelWarshipTypeEnum) { WarshipDto warshipDto = contexts.lobbyUi .GetGroup(LobbyUiMatcher.Warship) .AsEnumerable() .Select(entity => entity.warship.warshipDto) .Single(item => item.WarshipTypeEnum == modelWarshipTypeEnum); return(warshipDto.GetCurrentSkinName()); }
public int GetWarshipPowerPoints(WarshipTypeEnum modelWarshipTypeEnum) { WarshipDto warshipDto = contexts.lobbyUi .GetGroup(LobbyUiMatcher.Warship) .AsEnumerable() .Select(entity => entity.warship.warshipDto) .Single(item => item.WarshipTypeEnum == modelWarshipTypeEnum); return(warshipDto.PowerPoints); }
public WarshipCharacteristics GetWarshipCharacteristics(WarshipTypeEnum warshipTypeEnum) { if (warshipParameters.TryGetValue(warshipTypeEnum, out var result)) { return(result); } else { throw new ArgumentOutOfRangeException(nameof(warshipTypeEnum)); } }
public int GetCurrentWarshipId() { WarshipTypeEnum warshipTypeEnum = lobbyUiContext.currentWarshipTypeEnum.value; WarshipComponent currentWarshipComponent = lobbyUiContext .GetGroup(LobbyUiMatcher.Warship) .AsEnumerable() .Single(entity => entity.warship.warshipDto.WarshipTypeEnum == warshipTypeEnum).warship; int id = currentWarshipComponent.warshipDto.Id; return(id); }
protected override void Execute(List <LobbyUiEntity> entities) { WarshipTypeEnum warshipTypeEnum = entities.Last().currentWarshipTypeEnum.value; foreach (var lobbyUiEntity in warshipsGroup.GetEntities()) { bool enable = warshipTypeEnum == lobbyUiEntity.warship.warshipDto.WarshipTypeEnum; lobbyUiEntity.view.gameObject.SetActive(enable); // if (enable) // { // log.Debug("Включение корабля "+lobbyUiEntity.warship.warshipDto.WarshipTypeEnum.ToString()); // } } }
public void Execute() { if (hasNewValue) { lobbyUiContext.ReplaceUsername(accountData.Username); lobbyUiContext.ReplaceAccountRating(accountData.AccountRating); lobbyUiContext.ReplaceHardCurrency(accountData.HardCurrency); lobbyUiContext.ReplaceSoftCurrency(accountData.SoftCurrency); WarshipTypeEnum warshipTypeEnum = CurrentWarshipTypeStorage.ReadWarshipType(); lobbyUiContext.ReplaceCurrentWarshipTypeEnum(warshipTypeEnum); lobbyUiContext.ReplacePointsForSmallLootbox(accountData.SmallLootboxPoints); CreateWarshipComponents(accountData.Warships, lobbyUiContext); hasNewValue = false; } }
protected override void Execute(List <LobbyUiEntity> entities) { //получить данные о корабле WarshipTypeEnum warshipTypeEnum = entities.Last().currentWarshipTypeEnum.value; var currentWarshipComponent = lobbyUiContext .GetGroup(LobbyUiMatcher.Warship) .AsEnumerable() .Single(entity => entity.warship.warshipDto.WarshipTypeEnum == warshipTypeEnum).warship; int rating = currentWarshipComponent.warshipDto.Rating; WarshipRankModel rankModel = WarshipRatingScaleStorage.Instance.GetRankModel(rating); //вставить значения rankText.text = rankModel.currentRank.ToString(); ratingText.text = rankModel.ToString(); slider.value = rankModel.rankProgress; }
public ProductModel Create(int cost, string previewImagePath, int increment, int warshipId, WarshipTypeEnum warshipTypeEnum) { if (warshipId == 0) { throw new Exception("warshipId is empty"); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Создание очков силы для корабля:"); Console.WriteLine($"{nameof(warshipId)} {warshipId} " + $"{nameof(increment)} {increment} " + $"{nameof(warshipTypeEnum)} {warshipTypeEnum}"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); return(new ProductModel { ResourceTypeEnum = ResourceTypeEnum.WarshipPowerPoints, CostModel = new CostModel() { CostTypeEnum = CostTypeEnum.SoftCurrency, SerializedCostModel = ZeroFormatterSerializer.Serialize( new InGameCurrencyCostModel() { Cost = cost }) }, PreviewImagePath = previewImagePath, SerializedModel = ZeroFormatterSerializer.Serialize(new WarshipPowerPointsProductModel { WarshipId = warshipId, Increment = increment, WarshipTypeEnum = warshipTypeEnum, SupportClientModel = null }), ProductSizeEnum = ProductSizeEnum.Small }); }
/// <summary> /// Создаёт продукты, которые содержат улучшения для кораблей, которые есть в наличии у аккаунта /// </summary> /// <param name="accountDbDto"></param> /// <returns></returns> public List <ProductModel> CreateWarshipPowerPointProducts(AccountDbDto accountDbDto) { List <TmpWarshipDich> warshipIds = GetWarshipModels(accountDbDto); List <ProductModel> warshipPowerPoints = new List <ProductModel>(); for (int index = 0; index < NumberOfProducts; index++) { int warshipId = warshipIds[index].warshipId; WarshipTypeEnum warshipType = warshipIds[index].warshipType; WarshipDbDto warshipDbDto = accountDbDto.Warships .Single(dto => dto.Id == warshipId); string previewPath = warshipDbDto.WarshipType.Name.ToLower(); ProductModel wpp = factory.Create(140, previewPath, 42, warshipId, warshipType); warshipPowerPoints.Add(wpp); } foreach (var productModel in warshipPowerPoints) { WarshipPowerPointsProductModel model = productModel; } return(warshipPowerPoints); }
public static void WriteWarshipType(WarshipTypeEnum warshipTypeEnum) { // Log.Debug($"Установка типа корабля {warshipTypeEnum.ToString()}"); PlayerPrefs.SetInt(Key, (int)warshipTypeEnum); PlayerPrefs.Save(); }
public void AddOrUpdate(WarshipTypeEnum warshipTypeEnum, WarshipDto warshipDto) { warships.AddOrUpdate(warshipTypeEnum, warshipDto, (key, oldValue) => warshipDto); }