private void btnInfo_Click(object sender, EventArgs e) { if (flag) { Note note = NoteController.getNote(int.Parse(listView1.SelectedItems[0].Text)); string[] arr = note.NoteDescription.Split(' '); string[] arr1 = note.NoteDescription.Split('\n'); int a = arr.Count() + arr1.Count() - 1; MessageBox.Show(note.NoteDescription.Length + "character\n" + a + "words\n" + "Modified: " + note.NoteModified.Value.ToString(), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); btnDelete.Enabled = btnInfo.Enabled = btnSave.Enabled = false; } else { Trash trash = TrashConntroller.GetTrash(int.Parse(listView1.SelectedItems[0].Text)); Note note = new Note(); note.NoteID = NoteController.getID(); note.NoteTitle = trash.TrashTitle; note.NoteDescription = trash.TrashDescription; note.NoteModified = DateTime.Now; TrashConntroller.deleteTrash(int.Parse(listView1.SelectedItems[0].Text)); NoteController.addNote(note); loadNote(); reset(); btnDelete.Enabled = btnInfo.Enabled = btnSave.Enabled = false; } }
public List <Trash> GetTrashByObjectType(string objectType, string whereClause) { List <Trash> theList = new List <Trash>(); Trash theData = null; try { TrashDS.TrashDataTable theTable = theAdapter.GetTrashByObjectType(objectType, whereClause); if (theTable != null && theTable.Rows.Count > 0) { foreach (TrashDS.TrashRow theRow in theTable.Rows) { theData = FillRecord(theRow); theList.Add(theData); } } } catch (Exception exc) { log.Error("Ocurrió un error al obtener la lista de Eliminados para " + objectType, exc); throw exc; } return(theList); }
void PickUp(GameObject pickedUpObject) { const int dragMultilpier = 200; if (carriedObject) { carriedObject.rigidbody.useGravity = true; carriedObject.rigidbody.drag /= dragMultilpier; carriedObject.StopGetCarried(); carriedObject = null; } else { if (pickedUpObject && pickedUpObject.CompareTag("Carryable")) { carriedObject = pickedUpObject.GetComponent <Trash>(); carriedObject.GetCarried(); carriedObject.rigidbody.drag *= dragMultilpier; carriedObject.rigidbody.useGravity = false; } } }
/// <summary> /// Инициирует взаимодействие объектов /// </summary> public void ProcessObjects() { if (Children.Count > 0) { foreach (GameObject o in Children) { Objects.Add(o); } Children.Clear(); } if (Objects.Count > 0) { foreach (GameObject o in Objects) { o.Process(); } } if (Trash.Count > 0) { foreach (GameObject o in Trash) { Objects.Remove(o); } Trash.Clear(); } }
public void OnDrop(Trash target) { target.itemName = currentDrag.itemName; cureCheck.item = obj.name; cureCheck.Delete(); drop.Play(); }
public TrashTest() { sut = new Trash() { Name = "" }; }
public override void Init(Trash _trash) { trash = _trash as TrashA; currentStep = 1; nameText.text = trash.trashName; doneBtn.onClick.AddListener(() => { if (lockChange) { return; } trashImage.Throw(0); bin.Shake(0.75f); Finish(currentStep == trash.targetStep); }); RegisterButton(doneBtn); actionBtn.onClick.AddListener(() => { ChangeState(); }); RegisterButton(actionBtn); trashImage = CreateTrashImage(trash.GetSprite(1)); }
private void _actionInteract_performed(InputAction.CallbackContext obj) { if (CurrentTrash != null && CanDropTrash(_trashSize)) { _animator.Play("Roy_Armature_Descompactar "); _currentDebbugColorTrash = Color.clear; Vector3 offset = new Vector3(transform.right.x * _dropPositionOffset.x, transform.right.y * _dropPositionOffset.y); CurrentTrash.DropTrash(_mainCollider.bounds.center + offset); CurrentTrash = null; //AudioManager.instance.Play("roy_trash_letgo"); return; } Collider[] cols = Scan(); if (CurrentTrash == null && cols.Length > 0) { _animator.Play("Roy_Armature_coletar"); Trash trash = PickNearest(cols).gameObject.GetComponentInParent <Trash>(); _trashSize = trash.TrashCollider().bounds.size; trash.HideTrash(); CurrentTrash = trash; _currentDebbugColorTrash = _debbugDropTrashColor; //AudioManager.instance.Play("roy_trash_collect"); } }
public static bool SaveDeleteTrash(Trash note, ConfigureTrash configure) { try { fmNote._context.Notes.Add(new Note { UserID = note.UserID, NodeID = note.TrashID, Body = note.Body, Tittle = note.Title, SDate = note.SDate }); fmNote._context.ConfigureNotes.Add(new ConfigureNote { NodeID = configure.TrashID, FontNote = configure.FontTrash, SizeNote = configure.SizeTrash, Boldtxt = configure.Boldtxt, Italictxt = configure.Italictxt, Underlinwtxt = configure.Underlinetxt, Striketxt = configure.Striketxt, Colortxt = configure.Colortxt }); fmNote._context.SaveChanges(); return(true); } catch { return(false); } }
public IDisposable Enqueue(object item) { var s = new Trash(this._statck, item); _statck.Push(s); return(s); }
public override void Init(Trash _trash) { trash = _trash as TrashB; nameText.text = trash.trashName; leftBtn.onClick.AddListener(() => { Choice(TrashB.Choice.LEFT); }); leftBtn.GetComponentInChildren <Text>().text = trash.typeLeft.typeName; RegisterButton(leftBtn); rightBtn.onClick.AddListener(() => { Choice(TrashB.Choice.RIGHT); }); rightBtn.GetComponentInChildren <Text>().text = trash.typeRight.typeName; RegisterButton(rightBtn); trashImage = CreateTrashImage(trash.image); leftBin.Set(trash.typeLeft); rightBin.Set(trash.typeRight); }
private void updateTrainState() { for (int i = 0; i < 10; i++) { check[i] = 0; } for (int i = 0; i < this.trashCount; i++) { if (this.transform.GetChild(i).tag == "Trash") { Trash tmp = this.transform.GetChild(i).GetComponent <Trash>(); check[tmp.getOrd()]++; if (check[tmp.getOrd()] > 1) { Combine(tmp.getOrd()); } this.transform.GetChild(i).localPosition = new Vector3(-3f + i * -2f, 0, 0); if (i == 0) { this.transform.GetChild(i).GetComponent <Trash>().isHead = true; } else { this.transform.GetChild(i).GetComponent <Trash>().isHead = false; } } else { break; } } }
// Finds a new trash private void FindNewTrash() { transportingTrash = TrashManager.main.FindTrashToPickUp(); if (transportingTrash == null) { StartCoroutine(WaitToFindTrash()); return; } Waypoint target = TrashManager.main.ReturnTrashWaypoint(transportingTrash); TrashManager.main.MarkAsSelected(transportingTrash); if (target == null) { Debug.Log("Target Null in FindNewTrash in TrashHandlerAnt"); StartCoroutine(WaitToFindTrash()); return; } trashConnectedWaypoint = target; List <GameObject> path = WaypointManager.main.SearchPathKnownTarget( ant.ReturnCurrentWaypoint().GetComponent <Waypoint>(), target ); path.Add(transportingTrash.gameObject); ant.AssignWaypointList(path); }
public static void GameOver() { dead = true; Trash.SaveScore(); // Time.timeScale = 0; // Application.LoadLevel(Application.loadedLevel); }
public ActionResult DeleteConfirmed(int id) { Trash trash = this.db.Trash.FirstOrDefault(x => x.Id == id); this.db.Remove(trash); return(this.RedirectToAction("Details", "Bins", new { id = trash.BinId })); }
// GET: Trashes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Trash trash = this.db.Trash.FirstOrDefault(x => x.Id == id.Value); if (trash == null) { return(this.HttpNotFound()); } if (this.reloadUserIdentity) { this.identity = new ControllerIdentity(this.User.Identity); } string userId = this.identity.GetUserId(); this.ViewBag.BinId = new SelectList( this.db.Bins.Where(x => x.ApplicationUserId == userId), "Id", "Name", trash.BinId); return(this.View("Edit", trash)); }
public void createTrashes() { Random rn = new Random(); for (int i = 0; i < 725; i++) { Trash tr = myDb.Trashes.Find(i); if (tr == null) { tr = new Trash(); myDb.Trashes.Add(tr); } tr.Xloc = 21.406797 + rn.NextDouble() * 0.04 * (rn.NextDouble() > 0.5 ? 1 : -1); tr.Yloc = 39.879742 + rn.NextDouble() * 0.04 * (rn.NextDouble() > 0.5 ? 1 : -1); if (i < 500) { tr.Level = (int)(rn.NextDouble() * 25); } else if (i < 600) { tr.Level = (int)(rn.NextDouble() * 25) + 30; } else if (i < 700) { tr.Level = (int)(rn.NextDouble() * 30) + 70; } else { tr.Level = -1; } } myDb.SaveChanges(); }
private void btnRestoreTrash_Click(object sender, EventArgs e) { for (int i = 0; i < flpTrash.Controls.Count; i++) { if (flpTrash.Controls[i].BackColor == Color.LightGray) { TrashController.RefreshTrash(); Trash trash = TrashController.GetTrash(i); Note note = new Note(); note.ID = NoteController.GetListNote().Count; note.description = trash.description; note.dateCreated = trash.dateCreated; note.tags = trash.tags; note.isPinned = trash.isPinned; TrashController.DeleteForever(trash); TrashController.RefreshTrash(); NoteController.AddNote(note); flpTrash.Controls.Remove(flpTrash.Controls[i]); this.richTextBoxTrashDescription.Text = ""; } } }
protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) { // Dispose managed resources. this._Game = null; this._SupplyPiles = null; this._SpecialPiles = null; this._TokenPiles = null; this._SupplyKeys = null; this._Trash = null; } // Call the appropriate methods to clean up // unmanaged resources here. // If disposing is false, // only the following code is executed. // Note disposing has been done. disposed = true; } }
public void CreateAddInvalid() { var comment = new Comment { Content = "content" }; var trash4 = new Trash { Id = 3, Title = "T", AddTime = DateTime.Now, Content = "content", Comments = new List <Comment>() { comment } }; var modelBinder = new ModelBindingContext() { ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(() => trash4, trash4.GetType()), ValueProvider = new NameValueCollectionValueProvider(new NameValueCollection(), CultureInfo.InvariantCulture) }; new DefaultModelBinder().BindModel(new ControllerContext(), modelBinder); this.controller.ModelState.Clear(); this.controller.ModelState.Merge(modelBinder.ModelState); var ar = this.controller.Create(trash4) as ViewResult; Assert.AreEqual("Create", ar.ViewName); Assert.IsFalse(ar.ViewData.ModelState.IsValid); }
public void SetUp() { this.repository = new FakeRepository(); this.identity = new FakeIdentity(); var comment = new Comment { Content = "content" }; var trash = new Trash { Id = 1, Title = "Title", AddTime = DateTime.Now, Content = "content", Comments = new List <Comment>() { comment } }; var trash2 = new Trash { Id = 2, Title = "Title", AddTime = DateTime.Now, Content = "content", Comments = new List <Comment>() { comment } }; var trash3 = new Trash { Id = 3, Title = "Title", AddTime = DateTime.Now, Content = "content", Comments = new List <Comment>() { comment } }; this.repository.Add(trash); this.repository.Add(trash2); this.repository.Add(trash3); this.controller = new TrashesController(this.repository, this.identity); }
/// <exception cref="System.IO.IOException"/> protected internal override void ProcessArguments(List <PathData> args) { Trash trash = new Trash(GetConf()); trash.Expunge(); trash.Checkpoint(); }
/// <exception cref="System.IO.IOException"/> private bool MoveToTrash(PathData item) { bool success = false; if (!skipTrash) { try { success = Trash.MoveToAppropriateTrash(item.fs, item.path, GetConf()); } catch (FileNotFoundException fnfe) { throw; } catch (IOException ioe) { string msg = ioe.Message; if (ioe.InnerException != null) { msg += ": " + ioe.InnerException.Message; } throw new IOException(msg + ". Consider using -skipTrash option", ioe); } } return(success); }
private void OnTriggerEnter2D(Collider2D collider) { Trash trash = collider.gameObject.GetComponent <Trash>(); if ((collider.tag == "BlueTrash" && this.tag == "BlueDraft") || (collider.tag == "GreenTrash" && this.tag == "GreenDraft") || (collider.tag == "YellowTrash" && this.tag == "YellowDraft")) { SoundManager.Instance.PlayRight(); if (trash == null || !trash.DraftCollide) { return; } TrashManager.Instance.RemoveTrashOnScreen(collider.gameObject); trashOnDraft.Add(collider.gameObject); collider.transform.parent = this.transform; BoardManager.Instance.EcoScore(); } else if (collider.tag == "BrownTrash") { if (trash.HurtMe) { return; } SoundManager.Instance.PlayWrong(); if (trash != null) { trash.DraftCollide = false; } BoardManager.Instance.EcoReset(); trash.HurtMe = true; } }
private void SetToTrash() { float randomX = Random.Range(-1, 1); float randomY = Random.Range(-1, 1); Vector3 waypointLocation = LeafManager.main.ReturnWaypointLeafIsAt(this).transform.position; Vector3 locationToSpawn = new Vector3( waypointLocation.x + randomX, waypointLocation.y + randomY, waypointLocation.z ); GameObject trashGameObject = Instantiate( TrashManager.main.TrashPrefab(), locationToSpawn, new Quaternion(0, 0, 0, 0), TrashManager.main.gameObject.transform ); Trash trash = trashGameObject.GetComponent <Trash>(); trash.SetLayer(Trash.Layer.UNDERGROUND); FlowManager.main.AddTrashToAllConnectedRoads(LeafManager.main.ReturnWaypointLeafIsAt(this)); trash.AssignOneWaypoint(LeafManager.main.ReturnWaypointLeafIsAt(this)); TrashManager.main.CreatedNewTrash(trash); TrashManager.main.AddTrashToWaypoints(trash, LeafManager.main.ReturnWaypointLeafIsAt(this)); LeafManager.main.LeafDeath(this, LeafManager.main.ReturnWaypointLeafIsAt(this)); Destroy(gameObject); }
public override void Init(Trash _trash) { trash = _trash as TrashC; nameText.text = trash.trashName; stopBtn.onClick.AddListener(() => { trashImageAnimator.SetBool("Stop", true); handAnimator.SetBool("Stop", true); if (throwCoroutine != null) { StopCoroutine(throwCoroutine); throwCoroutine = null; } Finish(!trash.throwingIsAnswer); }); RegisterButton(stopBtn); trashImage.sprite = trash.image; bin.Set(trash.typeBottom); throwCoroutine = StartCoroutine(Throw()); //Vector2 handSize = handImage.rectTransform.sizeDelta; //handSize = new Vector2(Mathf.Lerp(500f, 850f, trash.handDepth), handSize.y); //handImage.rectTransform.sizeDelta = handSize; }
/// <summary> /// Creates an array of trash items for a free contract /// Currently it is hard coded what will go into the array /// </summary> public void FreeContract() { trashItems = new Trash[8]; contractSprites = new Sprite[8]; //Use itemSprites 0-5, 12, and 13 //These sprites correspond to the paper and plastic items for (int i = 0; i < 6; i++) { contractSprites[i] = itemSprites[i]; } contractSprites[6] = itemSprites[12]; contractSprites[7] = itemSprites[13]; //Create the Trash items for (int i = 0; i < 3; i++) { //Plastic items 3 Trash t = new Trash(1.50f, 0.05f, i, 0, contractSprites[i]); trashItems[i] = t; } for (int i = 3; i < 8; i++) { //Paper items 6 Trash t = new Trash(1.50f, 0.05f, i, 1, contractSprites[i]); trashItems[i] = t; } Debug.Log("Free contract selected"); }
private void pictureBoxTrash_Click(object sender, EventArgs e) { for (int i = 0; i < flpNote.Controls.Count; i++) { if (flpNote.Controls[i].BackColor == Color.LightGray) { Trash trash = new Trash(); Note note = NoteController.GetNote(i); trash.ID = TrashController.GetListTrash().Count; trash.description = note.description; trash.dateCreated = note.dateCreated; trash.tags = note.tags; trash.isPinned = note.isPinned; TrashController.AddTrash(trash); NoteController.RemoveNote(note); NoteController.RefreshNote(); flpNote.Controls.Remove(flpNote.Controls[i]); this.richTextBoxDescription.Text = ""; break; } } for (int i = this.flpTags.Controls.Count - 1; i >= 0; i--) { Control c = this.flpTags.Controls[i]; if (c.GetType() != typeof(TextBox)) { this.flpTags.Controls.RemoveAt(i); } } }
public void AddLocation_Item(int typeId, int trashId, decimal amount, string itemName, string address, decimal longitude, decimal latitude) { try { Location_Item addModel = new Location_Item() { Id = Guid.NewGuid(), Address = StringHelper.LimitLength(address, 100), Longitude = longitude, Latitude = latitude, TypeId = typeId, TrashId = trashId, Amount = amount, ItemName = StringHelper.LimitLength(itemName), LastAddTime = DateTime.Now }; if (trashId > 0) { Trash trash = db.Trashes.Where(c => c.TrashId == trashId).FirstOrDefault(); if (trash != null) { addModel.Price = trash.DefaultPrice; } else { addModel.Price = -1.0M; } } db.AddToLocation_Items(addModel); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void SetUp(Trash trash) { this.trash = trash; SetUpSubscribe(); SetUpImage(); SetUpImageAlpha(); }
public void CleanScene(Trash.ITrashable trash) { Scene sc = (Scene)trash; if (sc != null && m_Scenes.Contains(sc)) { sc.Pause(); sc.UnloadResources(); m_Scenes.Remove(sc); } }