public ActionResult Edit([Bind(Include = "ItemId,Name,Description,RequiredLevel,Price,ItemRarity,Damage,Critical")] Weapon weapon) { weapon.ItemRarity = ItemRarityDAO.Get(weapon.ItemRarity.ItemRarityId); if (ModelState.IsValid) { Weapon weaponInDataBase = WeaponDAO.Get(weapon.ItemId); weaponInDataBase.Name = weapon.Name; weaponInDataBase.ItemRarity = weapon.ItemRarity; weaponInDataBase.Price = weapon.Price; weaponInDataBase.RequiredLevel = weapon.RequiredLevel; weaponInDataBase.Description = weapon.Description; weaponInDataBase.Damage = weapon.Damage; weaponInDataBase.Critical = weapon.Critical; WeaponDAO.Update(weaponInDataBase); return(RedirectToAction("Index")); } if (weapon.ItemRarity == null) { ModelState.AddModelError("error", "Necessário selecionar a raridade do item"); } ViewBag.ItemRarity = new SelectList(ItemRarityDAO.GetAll(), "ItemRarityId", "Name"); return(View(weapon)); }
public GameObject LoadWeapon(string name) { weaponDAO = factory.GetWeaponDAO(); GameObject freshWeapon = LoadFromDAO(weaponDAO, name, "Weapon"); return(freshWeapon); }
public ActionResult DeleteConfirmed(int id) { Weapon weapon = WeaponDAO.Get(id); FileUploadHandling.RemoveFile(weapon.Image); WeaponDAO.Remove(weapon); return(RedirectToAction("Index")); }
public override void Initialize(IEventSystem eventSystem, IPoolManager poolManager, GroupFactory groupFactory, PrefabFactory prefabFactory) { base.Initialize(eventSystem, poolManager, groupFactory, prefabFactory); ShootComponents = this.Create(typeof(PlayerControlComponent), typeof(NetworkIdentityComponent), typeof(ShootComponent), typeof(Animator), typeof(ViewComponent)); Network = LockstepFactory.Create(ShootComponents); NetwrokTimeline = Network.CreateTimeline(typeof(MouseInput), typeof(KeyInput), typeof(EventInput)); BulletDAO = new BulletDAO(Bullet, NameStr); WeaponDAO = new WeaponDAO(Weapon, NameStr); }
public ObjectFactory() { factory = DAOFactory.GetFactory(); surfaceDAO = factory.GetSurfaceDAO(); subsurfaceDAO = factory.GetSubSurfaceDAO(); airDAO = factory.GetAirDAO(); marineDAO = factory.GetMarineDAO(); weaponDAO = factory.GetWeaponDAO(); environmentVariableDAO = factory.GetEvironmentVariableDAO(); }
/** * Optional constructor which takes the scenario for which * this ObjectFactory will be used as a parameter * */ public ObjectFactory(string scenarioName) { factory = DAOFactory.GetFactory(); surfaceDAO = factory.GetSurfaceDAO(); subsurfaceDAO = factory.GetSubSurfaceDAO(); airDAO = factory.GetAirDAO(); marineDAO = factory.GetMarineDAO(); weaponDAO = factory.GetWeaponDAO(); surfaceScenarioDAO = factory.GetSurfaceScenarioDAO(scenarioName); subsurfaceScenarioDAO = factory.GetSubSurfaceScenarioDAO(scenarioName); airScenarioDAO = factory.GetAirScenarioDAO(scenarioName); marineScenarioDAO = factory.GetMarineScenarioDAO(scenarioName); environmentVariableDAO = factory.GetEvironmentVariableScenarioDAO(scenarioName); }
// GET: Weapons/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Weapon weapon = WeaponDAO.Get(id); if (weapon == null) { return(HttpNotFound()); } return(View(weapon)); }
// GET: Weapons/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Weapon weapon = WeaponDAO.Get(id); if (weapon == null) { return(HttpNotFound()); } ViewBag.ItemRarity = new SelectList(ItemRarityDAO.GetAll(), "ItemRarityId", "Name"); return(View(weapon)); }
private void Awake() { this.DatabaseName = "GameCode.db"; this.isCopyDataBaseMode = false; WeaponDAO = new WeaponDAO(this); CharacterDAO = new CharacterDAO(this); try { base.Awake(); } catch (Exception e) { Debug.LogError(e.Message); } }
public ActionResult Create(HttpPostedFileBase image, [Bind(Include = "ItemId,Name,Description,RequiredLevel,Price,ItemRarity,Damage,Critical")] Weapon weapon) { if (ModelState.IsValid) { weapon.ItemRarity = ItemRarityDAO.Get(weapon.ItemRarity.ItemRarityId); if (weapon.ItemRarity != null) { weapon = SetAnImageToNewWeapon(weapon, image); WeaponDAO.Save(weapon); return(RedirectToAction("Index")); } else { ModelState.AddModelError("error", "Necessário selecionar a raridade do item"); } } ViewBag.ItemRarity = new SelectList(ItemRarityDAO.GetAll(), "ItemRarityId", "Name"); return(View(weapon)); }
// GET: Weapons public ActionResult Index() { return(View(WeaponDAO.GetAll())); }