Exemple #1
0
 private void Start()
 {
     if (Image == null)
     {
         Image = GetComponent <PropImage>();
     }
 }
Exemple #2
0
    private void SetType(PropType type)
    {
                #if UNITY_EDITOR
        if (Image == null)
        {
            Image = GetComponent <PropImage>();
        }

        Type            = type;
        _currentImgType = type;

        var imgName        = type.ToString().ToLower();
        var imgAssetAtPath = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Sprites/props/" + imgName + ".png");
        Image.texture = imgAssetAtPath;
        Image.enabled = true;

        if (transform.parent == null && transform.childCount > 0)
        {
            foreach (Transform t in transform)
            {
                if (t.tag == "Prop")
                {
                    t.GetComponent <ArchetypeProp>().SetType(type);
                }
            }
        }
                #endif
    }
 public void UpdatePropImage(PropImage PropImageToUpdate, PropImage model)
 {
     PropImageToUpdate.Status     = model.Status;
     PropImageToUpdate.PropertyId = model.PropertyId;
     PropImageToUpdate.Photo      = model.Photo;
     PropImageToUpdate.ModifiedBy = model.ModifiedBy;
     PropImageToUpdate.ModifiedAt = DateTime.Now;
     _context.SaveChanges();
 }
 public IActionResult Create(PropImage PropImage)
 {
     if (ModelState.IsValid)
     {
         PropImage.CreatedBy = _admin.Fullname;
         _PropImageRepository.CreatePropImage(PropImage);
         return(RedirectToAction("index"));
     }
     return(View(PropImage));
 }
        public IActionResult Delete(int id)
        {
            PropImage abs = _PropImageRepository.GetPropImageById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            _PropImageRepository.DeletePropImage(abs);
            return(RedirectToAction("index"));
        }
        public IActionResult Edit(int id)
        {
            ViewBag.Properties = _propertyRepository.GetAllProperties();
            PropImage abs = _PropImageRepository.GetPropImageById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            return(View(abs));
        }
 public IActionResult Edit(PropImage abs)
 {
     if (ModelState.IsValid)
     {
         abs.ModifiedBy = _admin.Fullname;
         PropImage PropImageToUpdate = _PropImageRepository.GetPropImageById(abs.Id);
         if (PropImageToUpdate == null)
         {
             return(NotFound());
         }
         _PropImageRepository.UpdatePropImage(PropImageToUpdate, abs);
         return(RedirectToAction("index"));
     }
     ViewBag.Properties = _propertyRepository.GetAllProperties();
     return(View(abs));
 }
 public void DeletePropImage(PropImage PropImage)
 {
     _context.PropImages.Remove(PropImage);
     _context.SaveChanges();
 }
 public void CreatePropImage(PropImage model)
 {
     model.CreatedAt = DateTime.Now;
     _context.PropImages.Add(model);
     _context.SaveChanges();
 }