private void AddButtons() { for (int i = 0; i < ItemsList.Count; i++) { ShopSkill item = ItemsList[i]; GameObject newPanel = Instantiate(Prefab, ParentPanel); ShopScrollSkillPrefab panelShopSkillPrefab = newPanel.GetComponent <ShopScrollSkillPrefab>(); panelShopSkillPrefab.SetupPanelShopSkillPrefab(item, this); } }
public void SetupPanelShopSkillPrefab(ShopSkill currentItem, ShopScrollList shopScrollList) { _shopSkill = currentItem; _shopScrollList = shopScrollList; ShopSkillID = _shopSkill.ShopSkillID; SkillImg.sprite = _shopSkill.SkillImg; BgPriceImg.sprite = _shopSkill.BgPriceImg; SkillDescriptionText.text = _shopSkill.ItemDescription; PriceText.text = $"{_shopSkill.Price}"; AvailableOrNotText.text = _shopSkill.AvailableOrNotText; }
public static bool ToShopSkillDTO(ShopSkill input, ShopSkillDTO output) { if (input == null) { return(false); } output.ShopId = input.ShopId; output.ShopSkillId = input.ShopSkillId; output.SkillVNum = input.SkillVNum; output.Slot = input.Slot; output.Type = input.Type; return(true); }
public void Insert(List <ShopSkillDTO> skills) { try { using (OpenNosContext context = DataAccessHelper.CreateContext()) { context.Configuration.AutoDetectChangesEnabled = false; foreach (ShopSkillDTO Skill in skills) { ShopSkill entity = new ShopSkill(); Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkill(Skill, entity); context.ShopSkill.Add(entity); } context.Configuration.AutoDetectChangesEnabled = true; context.SaveChanges(); } } catch (Exception e) { Logger.Error(e); } }
public ShopSkillDTO Insert(ShopSkillDTO shopSkill) { try { using (OpenNosContext context = DataAccessHelper.CreateContext()) { ShopSkill entity = new ShopSkill(); Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkill(shopSkill, entity); context.ShopSkill.Add(entity); context.SaveChanges(); if (Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkillDTO(entity, shopSkill)) { return(shopSkill); } return(null); } } catch (Exception e) { Logger.Error(e); return(null); } }