private void button1_Click(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: Screw s = screwSizes[screwDiams.SelectedIndex]; s.Length = screwLen[screwLength.SelectedIndex]; s.Draw(UFSession.GetUFSession(), path + "screw" + System.IO.Directory.EnumerateFiles(path).Where(f => f.Contains("screw")).ToList().Count); break; case 1: PushScrew ps = pScrewSizes[pScrewDiams.SelectedIndex]; ps.Length = pScrewLen[pScrewLength.SelectedIndex]; ps.Draw(UFSession.GetUFSession(), path + "p_screw" + System.IO.Directory.EnumerateFiles(path).Where(f => f.Contains("p_screw")).ToList().Count); break; case 2: Nut n = nutSizes[nutDiams.SelectedIndex]; n.Draw(UFSession.GetUFSession(), path + "nut" + System.IO.Directory.EnumerateFiles(path).Where(f => f.Contains("nut")).ToList().Count); break; default: break; } }
public ActionResult AllSettings(DataSourceRequest command, Nut.Web.Framework.Kendoui.Filter filter = null, IEnumerable<Sort> sort = null) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); var settings = _settingService .GetAllSettings() .Select(x => { string storeName; if (x.StoreId == 0) { storeName = _localizationService.GetResource("Admin.Configuration.Settings.AllSettings.Fields.StoreName.AllStores"); } else { var store = _storeService.GetStoreById(x.StoreId); storeName = store != null ? store.Name : "Unknown"; } var settingModel = new SettingModel { Id = x.Id, Name = x.Name, Value = x.Value, Store = storeName, StoreId = x.StoreId }; return settingModel; }) .AsQueryable() .Filter(filter) .Sort(sort); var gridModel = new DataSourceResult { Data = settings.PagedForCommand(command).ToList(), Total = settings.Count() }; return Json(gridModel); }
private void button1_Click(object sender, EventArgs e) { nut = new Nut(POLL_PERIOD); nut.update += Nut_update; nut.Init(true, "nas2", 3493, "upsmon", "secret", "ups"); }
void IShootable.Shoot() { if (MyInputManager.instance.GetAxis("Shoot") > 0 && PlayerBrain.instance.HasBullet("Nut") && canShoot) { canShoot = false; // Vector3 sp = Camera.main.WorldToScreenPoint(transform.position + offsetShoot); // Vector3 dir = (Input.mousePosition - sp).normalized; // dir.z = transform.position.z; print(PlayerBrain.instance.shootZone.position); if (prefabNut == null) { print("Che es null"); } Nut nut = Instantiate(prefabNut, PlayerBrain.instance.shootZone.position, PlayerBrain.instance.shootZone.rotation); if (nut == null) { print("Che es null nut"); } nut.addImpulse(nutShootVelocity); PlayerBrain.instance.RemoveBullet("Nut"); //listLinearNut.RemoveAt(0); } if (MyInputManager.instance.GetAxis("Shoot") == 0) { canShoot = true; } }
private void AddNut() { var elements = ReadElements(); Nut nut = new Nut(elements[0], elements[1], decimal.Parse(elements[2]), int.Parse(elements[3])); nutController.Add(nut); Console.WriteLine("The product was successfully added!"); }
public Nut AddNut(int x, int y) { var Nut = new Nut(new Vector2(x, y)); DrawScene.Push(Nut); Nuts.Add(Nut); return(Nut); }
public void CarPartGetsExpectedID() { //Arrange CarPart a = new Nut(125, 0); //Assert Assert.AreEqual("N-D125", a.Id); }
/// <summary> /// Adds a Nut. /// </summary> /// <param name="nut">the nut that will be added</param> public void Add(Nut nut) { using (context = new ShopContext()) { context.Nuts.Add(nut); context.SaveChanges(); } }
public ActionResult DeleteConfirmed(int id) { Nut nut = db.Nuts.Find(id); db.Nuts.Remove(nut); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "NutID,Image,Name,Protein,Carbohydrates,Fat,Energy")] Nut nut) { if (ModelState.IsValid) { db.Entry(nut).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nut)); }
/// <summary> /// Updates a Nut. /// </summary> /// <param name="nut">the nut that will be updated</param> public void Update(Nut nut) { var item = context.Drinks.FirstOrDefault(m => m.Id == nut.Id); if (item != null) { context.Entry(item).CurrentValues.SetValues(nut); context.SaveChanges(); } }
public ActionResult Create([Bind(Include = "NutID,Image,Name,Protein,Carbohydrates,Fat,Energy")] Nut nut) { if (ModelState.IsValid) { db.Nuts.Add(nut); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nut)); }
/// <summary> /// Returns the first nut in the watch area /// </summary> /// <returns>null if there is none</returns> public Nut GetNutInWatchArea() { foreach (var Nut in Nuts) { if (Nut.Placed && Tree.Basement.MouseHole.WatchArea.Contains(Nut.Get <Transform>().Position)) { return(Nut); } } return(null); }
/// <summary> /// Updates a Nut. /// </summary> /// <param name="nut">the nut that will be updated</param> public void Update(Nut nut) { using (context = new ShopContext()) { var item = context.Drinks.Find(nut.Id); if (item != null) { context.Entry(item).CurrentValues.SetValues(nut); context.SaveChanges(); } } }
void launchNut(float direction) { playMusicOnAttack(); if (direction != 0) { GameObject obj = GameObject.Instantiate(this.Nut); obj.transform.position = this.transform.position; obj.transform.position += new Vector3(0.0f, 1.0f, 0.0f); Nut nut = obj.GetComponent <Nut>(); nut.launch(direction); } }
void pickupNut(Nut nut) { if (nutShieldState == 2) { return; } nutShieldState++; setNutShieldSprite(); Destroy(nut.gameObject); }
private void ShouldShootNut() { // if (listNut.Count > 0 && Input.GetMouseButtonDown(0)) if (listLinearNut.Count > 0 && MyInputManager.instance.GetButtonDown("Shoot")) { // Vector3 sp = Camera.main.WorldToScreenPoint(transform.position + offsetShoot); // Vector3 dir = (Input.mousePosition - sp).normalized; // dir.z = transform.position.z; Nut h = listLinearNut[0]; // h.addImpulse(shootZone.position, this.transform.forward, velocityLinearNut); listLinearNut.RemoveAt(0); } }
public Match(Nut _nut, Screw _screw) { Nut = _nut; Screw = _screw; if (_nut.Diameter == _screw.Diameter) { Diameter = _nut.Diameter; } else { throw new Exception("Error"); } }
// GET: Nut/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Nut nut = db.Nuts.Find(id); if (nut == null) { return(HttpNotFound()); } return(View(nut)); }
public void Initializer() { //TODO: CREATE THIS BETTER Nuts = new Nut[NutsQuantity]; Screws = new Screw[ScrewQuantity]; for (var a = 0; a < NutsQuantity; a++) { Nuts[a] = new Nut(new Random().Next(minDiameterSize, maxDiameterSize)); } for (var a = 0; a < ScrewQuantity; a++) { Screws[a] = new Screw(new Random().Next(minDiameterSize, maxDiameterSize)); } }
public void AddNut_Add_A_Nut() { var mockSet = new Mock <DbSet <Nut> >(); var nut = new Nut(); var mockContext = new Mock <ShopContext>(); mockContext.Setup(m => m.Nuts).Returns(mockSet.Object); var controller = new NutController(mockContext.Object); controller.Add(nut); mockSet.Verify(m => m.Add(It.IsAny <Nut>()), Times.Once()); mockContext.Verify(m => m.SaveChanges(), Times.Once()); }
public BoltProblemSolver(int size) { this.Size = size; this.ProblemBolts = new Bolt[Size]; this.ProblemNuts = new Nut[Size]; this.rand = new Random(); for (int i=0; i<Size;i++) { ProblemBolts[i] = new Bolt(i); ProblemNuts[i] = new Nut(i); } // Randomize Lists ProblemNuts = ProblemNuts.OrderBy(x => rand.Next()).ToArray(); ProblemBolts = ProblemBolts.OrderBy(x => rand.Next()).ToArray(); }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer == 13) //NUt { Nut nut = collision.gameObject.GetComponent <Nut>(); TakeNut(nut); // TODO: event manager y pool object nut.gameObject.SetActive(false); } if (collision.gameObject.layer == 14) //HazleNUt { HazelNut Hazelnut = collision.gameObject.GetComponent <HazelNut>(); TakeHazelNut(Hazelnut); // TODO: event manager y pool object Hazelnut.gameObject.SetActive(false); } }
static void Main(string[] args) { Warehouse w = Warehouse.Get_Warehouse(); Console.WriteLine("Intento agregar una lista de 3 partes al warehouse."); w.AddParts(new List <CarPart>() { new Nut(10, 5), new Cog(10, 5), new BallBearing(20, 2) }); Console.WriteLine("Total de partes en la lista: " + w.GetParts().Count.ToString()); Console.WriteLine("\n\nCompruebo que el warehose guarde el archivo de manera correcta."); w.Save(Environment.CurrentDirectory + "\\Warehouse.xml"); Console.WriteLine("Resultado: " + File.Exists(Environment.CurrentDirectory + "\\Warehouse.xml").ToString()); Console.WriteLine("\n\nReduzco el Stock de una de las partes en 3"); Console.WriteLine("Stock antes de realizar el pedido: " + w.GetParts()[0].Stock.ToString()); w.ReceiveRequest(new List <CarPart>() { new Nut(10, 3) }); Console.WriteLine("Stock despues de realizar el pedido: " + w.GetParts()[0].Stock.ToString()); Console.WriteLine("\n\nCompruebo que el warehose se cargue correctamente desde un archivo."); w.GetParts().Clear(); w.Load(Environment.CurrentDirectory + "\\Warehouse.xml"); Console.WriteLine("Total de elementos en el warehouse: " + w.GetParts().Count.ToString()); Console.WriteLine("\n\nComparo dos parte de con las mismas caracteristicas para ver si comparan bien."); CarPart a = new Nut(10, 5); CarPart b = new Nut(10, 20); Console.WriteLine("Resultado de la comparacion: " + (a == b).ToString()); Console.WriteLine("\n\nComparo dos parte de con diferentes caracteristicas para ver si comparan bien."); CarPart c = new Nut(5, 5); CarPart d = new Nut(10, 20); Console.WriteLine("Resultado de la comparacion: " + (c == d).ToString()); Console.ReadKey(); }
/// <summary> /// Gets the closest nut to the given position. /// </summary> /// <param name="position"></param> /// <param name="withinDistance">if != -1 only the given distance is considered</param> /// <returns></returns> public Nut GetClosestNut(Vector2 position, float withinDistance = -1) { Nut Result = null; var ClosestDistance = float.MaxValue; foreach (var Nut in Nuts) { if (Nut.Placed) { var Distance = (Nut.Get <Transform>().Position - position).Length(); if (Distance < ClosestDistance && (withinDistance == -1 || Distance <= withinDistance)) { Result = Nut; ClosestDistance = Distance; } } } return(Result); }
void pickupNut(Nut nut) { if (nutShieldState == 2) return; nutShieldState++; setNutShieldSprite (); Destroy (nut.gameObject); }
public void RemoveNut(Nut nut) { DrawScene.Pop(nut); Nuts.Remove(nut); }
void OnTriggerEnter2D(Collider2D collider) { Sprinkle sprinkle = collider.gameObject.GetComponent <Sprinkle>(); if (sprinkle != null) { GameObject.Find("GUI").BroadcastMessage("addScore", sprinkle.getPointWorth()); AudioSource noise = GetComponents <AudioSource>()[0]; noise.Play(); var sprinkleSprite = sprinkle.gameObject.GetComponent <SpriteRenderer>().sprite; gameObject.BroadcastMessage("addSprinklesToDonut", sprinkleSprite); Destroy(sprinkle.gameObject); } /* * Sugarpile sugarpile = collider.gameObject.GetComponent<Sugarpile>(); * if (sugarpile != null) { * //AudioSource noise = GetComponents<AudioSource>()[0]; * //noise.Play(); * * //var sugarpileSprite = sugarpile.gameObject.GetComponent<SpriteRenderer>().sprite; * //gameObject.BroadcastMessage("addSugarPileToDonut", sugarpileSprite); * * Debug.Log("Hit sugarpile"); * slowedDownAmount = slowedDownAmountTotal = sugarpile.getSlowDownModifier(); * slowedDownCooldown = slowedDownTimeTotal = sugarpile.getSlowDownTimeLength(); * Destroy(sugarpile.gameObject); * } */ Nut nut = collider.gameObject.GetComponent <Nut> (); if (nut != null) { pickupNut(nut); } CreamFilling creamFilling = collider.gameObject.GetComponent <CreamFilling>(); if (creamFilling) { pickupCreamFilling(creamFilling); } DonutEnemy de = collider.gameObject.GetComponent <DonutEnemy>(); if (de != null) { getHitByDonutEnemy(de); //if (de.getSize() > transform.localScale.x) { // its bigger, player loses //GameObject.Find("GUI").GetComponentInChildren<InGameStates>().loseGame(); //GetComponent<Controls>().setGameOver(); /*} else { // its smaller, player gets bigger * float newSize = transform.localScale.x + sizePerEat; * transform.localScale = new Vector3(newSize, newSize, 1.0f); * GameObject.Find("GUI").BroadcastMessage("addScore", 10); * Destroy(de.gameObject); * }*/ } }
const int POLL_PERIOD = 15000; // 15 sec public Form1() { nut = null; InitializeComponent(); }
public BoltNode(Bolt bolt , Nut nut) { this.bolt = bolt; this.nut = nut; }
public ActionResult Resources(int languageId, DataSourceRequest command, Nut.Web.Framework.Kendoui.Filter filter = null, IEnumerable<Sort> sort = null) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages)) return AccessDeniedView(); var language = _languageService.GetLanguageById(languageId); var resources = _localizationService .GetAllResourceValues(languageId) .OrderBy(x => x.Key) .Select(x => new LanguageResourceModel { LanguageId = languageId, LanguageName = language.Name, Id = x.Value.Key, Name = x.Key, Value = x.Value.Value, }) .AsQueryable() .Filter(filter) .Sort(sort); var gridModel = new DataSourceResult { Data = resources.PagedForCommand(command), Total = resources.Count() }; return Json(gridModel); }
internal void TakeNut(Nut pn) { listLinearNut.Add(pn); }
/// <summary> /// Construct a tree object with an identifying noun. /// </summary> public Tree(string noun, Nut nut) : base(id, noun) { this.nut = nut; }
/// <summary> /// Adds a Nut. /// </summary> /// <param name="nut">the nut that will be added</param> public void Add(Nut nut) { context.Nuts.Add(nut); context.SaveChanges(); }
public CandyBarBuilder SetNutType(Nut nutType) { Confection.NutType = nutType; return(this); }