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);
     }
 }
Example #2
0
 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;
 }
Example #3
0
 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);
 }
Example #4
0
 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);
     }
 }
Example #5
0
        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);
            }
        }