protected override void ReadData(RdmBinaryReader data) { Slots.Clear(); for (int n = 0; n < Header.ParameterDataLength / 5; n++) { SlotInformation slot = new SlotInformation(); slot.Offset = data.ReadNetwork16(); slot.Type = (SlotTypes)data.ReadByte(); slot.SlotLink = (int)data.ReadNetwork16(); Slots.Add(slot); } }
/// <summary> /// Handles collision between this asteroid and a trigger in the scene /// </summary> /// <param name="collider">The collider that triggered this</param> private void OnTriggerDetected(Collider2D collider) { if (collider.gameObject.tag == "item") { Vector2 slot; Item item = collider.gameObject.GetComponent <ItemDrop>().m_Item; // First, see if the item already exists if ((slot = PlayerInventory.FindItemSlot(inv, item)) != new Vector2(-1, -1)) { SlotInformation atSlot = inv.Inventory[slot]; atSlot.Amount += 1; inv.Inventory[slot] = atSlot; Destroy(collider.gameObject); } else if ((slot = PlayerInventory.NextEmptySlot(inv)) != new Vector2(-1, -1)) { inv.Inventory.Add(slot, new SlotInformation(collider.gameObject.GetComponent <ItemDrop>().m_Item, 1)); Destroy(collider.gameObject); } } }
/* On selecting a Radio Button we Book the Slot */ protected void RowSelector_CheckedChanged(object sender, EventArgs e) { for (int i = 0; i < GridView1.Rows.Count; i++) { RadioButton rb = (RadioButton)(GridView1.Rows[i].Cells[0].FindControl("radioButton1")); /* We Check among all the Grid Rows which is checked */ if (rb.Checked == true) { /* We fetch the values from the Grid and insert in the SlotInformation Table and update slot Table */ var _slotId = GridView1.Rows[i].Cells[1].Text; var _trainerName = GridView1.Rows[i].Cells[5].Text.Trim(); var _acivityName = GridView1.Rows[i].Cells[2].Text.Trim(); rb.Checked = false; PlanetFitnessDataContext _dataContext = new PlanetFitnessDataContext(); UserAccount _userAccount = new UserAccount(); SlotInformation slotInformation = new SlotInformation(); Trainer trainer = new Trainer(); int _userID = Convert.ToInt32(Session["UserId"]); var _member = (from member in _dataContext.Members where member.FK_UserAccount_Member_in.Equals(_userID) select member).FirstOrDefault(); var _query = (from user in _dataContext.UserAccounts where user.UserName_vc.Equals(_trainerName) select user).FirstOrDefault().UserAccountID_in; var _queryActivity = (from activity in _dataContext.Activities where activity.Activity_vc.Equals(_acivityName) select activity).FirstOrDefault().ActivityID_in; var _querySlot = (from slot in _dataContext.Slots where slot.SlotID_in.Equals(_slotId) select slot).FirstOrDefault(); _querySlot.AvailableSlots_in = _querySlot.AvailableSlots_in - 1; _member.BillAmount_de = _member.BillAmount_de + Decimal.Parse("20.55"); slotInformation.FK_Slot_SlotInformation_in = Convert.ToInt32(_slotId); slotInformation.FK_Member_SlotInformation_in = _member.MemberID_in; slotInformation.FK_Activity_SlotInformation_in = _queryActivity; try { _dataContext.SlotInformations.InsertOnSubmit(slotInformation); _dataContext.SubmitChanges(); Response.Redirect("/Member/BookingInformation?bookingStatus=true"); } catch (Exception exception) { ErrorMessage.Text = "Something went wrong..Please try again."; Console.WriteLine(exception.InnerException); } } } }