예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            VendorTypes vendortypes = db.VendorTypes.Find(id);

            db.VendorTypes.Remove(vendortypes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        //
        // GET: /VendorTypesAdmin/Details/5

        public ActionResult Details(int id = 0)
        {
            VendorTypes vendortypes = db.VendorTypes.Find(id);

            if (vendortypes == null)
            {
                return(HttpNotFound());
            }
            return(View(vendortypes));
        }
예제 #3
0
 public ActionResult Edit(VendorTypes vendortypes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vendortypes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vendortypes));
 }
예제 #4
0
        public ActionResult Create(VendorTypes vendortypes)
        {
            if (ModelState.IsValid)
            {
                db.VendorTypes.Add(vendortypes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vendortypes));
        }
예제 #5
0
    //Function called externally from UI buttons to display the vendor screen
    public void DisplayVendor(int typeOfVendor_)
    {
        //Reference to the vendor that we're going to display
        Vendor vendorToDisplay = null;

        //Getting the vendor type enum from the int given (since unity can't have enums as variables in UnityEvents)
        VendorTypes vendorToVisit = VendorTypes.GenderalStore;

        switch (typeOfVendor_)
        {
        case 0:
            vendorToVisit = VendorTypes.GenderalStore;
            break;

        case 1:
            vendorToVisit = VendorTypes.Blacksmith;
            break;

        case 2:
            vendorToVisit = VendorTypes.Tavern;
            break;

        case 3:
            vendorToVisit = VendorTypes.MageTower;
            break;

        case 4:
            vendorToVisit = VendorTypes.Church;
            break;

        case 5:
            vendorToVisit = VendorTypes.DarkTemple;
            break;

        case 6:
            vendorToVisit = VendorTypes.Castle;
            break;

        default:
            vendorToVisit = VendorTypes.GenderalStore;
            break;
        }

        //Looping through each of the vendors on this location
        CityLocation city = this.playerTileLocation as CityLocation;

        foreach (Vendor v in city.cityVendors)
        {
            //If the current vendor's type matches the one we're looking for, it's the one we display
            if (v.type == vendorToVisit)
            {
                vendorToDisplay = v;
                break;
            }
        }

        //If the city doesn't have that type of vendor, nothing happens (this SHOULDN'T happen, but just in case)
        if (vendorToDisplay == null)
        {
            return;
        }

        //Telling the vendor panel UI which vendor we're displaying
        VendorPanelUI.globalReference.vendorToDisplay = vendorToDisplay;

        //Turning the vendor canvas object on
        this.vendorUICanvas.SetActive(true);
    }