public ActionResult Edit(HomeBox homeBox) { try { homeBox.LastUpdate = DateTime.Now; ViewBag.Success = true; if (homeBox.ID == -1) { HomeBoxes.Insert(homeBox); UserNotifications.Send(UserID, String.Format("جدید - باکس های محصولات '{0}'", homeBox.Title), "/Admin/HomeBoxes/Edit/" + homeBox.ID, NotificationType.Success); homeBox = new HomeBox(); } else { HomeBoxes.Update(homeBox); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(homeBox)); }
private void OnTriggerExit2D(Collider2D coll) { //A pickup left on the ground if (coll.gameObject.CompareTag("Pickup")) { if (coll.transform.parent.GetComponent <PickupObject>() == intersectedPickup) { intersectedPickup = null; } } //Stepping away from a homebox if (coll.gameObject.CompareTag("HomeBox")) { if (coll.transform.parent.GetComponent <HomeBox>().playerId == playerId) { intersectedHomeBox = null; } } if (coll.gameObject.CompareTag("MovingPlatform")) { if (coll.gameObject.transform == movingPlatform) { movingPlatform = null; platformOffset = Vector2.zero; } } }
/// <summary> /// add the textbox info to pirates collection by clicking add button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Add_Click_1(object sender, RoutedEventArgs e) { if ((InsertBox.Text == String.Empty || ShipBox.Text == String.Empty || HomeBox.Text == String.Empty)) { MessageBox.Show("Enter Pirate Name Please.", "Error"); } else { ((MainViewModel)DataContext).AddPirates((InsertBox.Text), (ShipBox.Text), HomeBox.Text); InsertBox.Clear(); ShipBox.Clear(); HomeBox.Clear(); } }
public void Respawn(Vector3 newPos) { if (carriedPickup != null) { DropPickup(); } intersectedPickup = null; intersectedHomeBox = null; movingPlatform = null; movingPlatformLastPos = Vector2.zero; rigidbody2D.MovePosition(newPos); }
public ActionResult Edit(int?id) { HomeBox homeBox; if (id.HasValue) { homeBox = HomeBoxes.GetByID(id.Value); } else { homeBox = new HomeBox(); } return(View(homeBox)); }
/// <summary> /// checks textbox for being empty and inputs pirate information if not /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void HomeBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if ((InsertBox.Text == String.Empty || ShipBox.Text == String.Empty || HomeBox.Text == String.Empty)) { MessageBox.Show("Enter Pirate Information Please.", "Error"); } else { ((MainViewModel)DataContext).AddPirates((InsertBox.Text), ShipBox.Text, HomeBox.Text); } InsertBox.Clear(); ShipBox.Clear(); HomeBox.Clear(); } }
private void OnTriggerEnter2D(Collider2D coll) { //Any pickup is in the vicinity if (coll.gameObject.CompareTag("Pickup")) { intersectedPickup = coll.transform.parent.GetComponent <PickupObject>(); } //Stepping on a homebox if (coll.gameObject.CompareTag("HomeBox")) { if (coll.transform.parent.GetComponent <HomeBox>().playerId == playerId) { intersectedHomeBox = coll.transform.parent.GetComponent <HomeBox>(); } } if (coll.gameObject.CompareTag("MovingPlatform")) { movingPlatform = coll.transform; movingPlatformLastPos = movingPlatform.position; } }