// Use this for initialization void Start() { if (curInstance == null) { curInstance = this; } }
void Start() { bookCrontrol = this.GetComponent <BookControl>(); group.gameObject.SetActive(false); group2.gameObject.SetActive(false); mainButterfly.gameObject.SetActive(false); }
private void btnLoginRegister_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.txbLoginEmail.Text) && !String.IsNullOrEmpty(this.txbLoginPassword.Text)) { bool IsExists = false; foreach (var user in DatabaseSecond.Users.GetAll()) { if (user.Email == this.txbLoginEmail.Text && user.Password == this.txbLoginPassword.Text) { MessageBox.Show("Successfully Logined!"); BookControl bookControl = new BookControl(this); bookControl.ShowDialog(); IsExists = true; break; } } if (!IsExists) { MessageBox.Show("Email or password is wrong! Please try again!"); } } else { MessageBox.Show("All fields must be filled!"); } }
private void bookList_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { string id = bookList.Rows[e.Row.Index].Cells["ID"].Value.ToString(); BookControl bc = new BookControl(); bc.deleteBook(int.Parse(id)); MessageBox.Show(bc.Message); }
private void InitGameObjects() { askUserInfoCtl = askUserFlow.GetComponent <BookControl>(); #if UNITY_EDITOR Assert.raiseExceptions = true; CheckResource(); #endif }
// Start is called before the first frame update void Start() { #if UNITY_EDITOR Assert.raiseExceptions = true; CheckResource(); #endif bookToHide = transferSource.GetComponent <BookControl>(); bookToGo = transferTaget.GetComponent <BookControl>(); }
private void loadData() { BookControl bc = new BookControl(); List <Book> list = new List <Book>(); list = bc.searchBook(titleText.Text, authorText.Text, isbnText.Text); var bindingList = new BindingList <Book>(list); var source = new BindingSource(bindingList, null); bookList.DataSource = source; }
void Start() { // We need to find the book game object if (bookObject != null) { // Just store the book control so we can work with it directly. bookControl = (BookControl)bookObject.GetComponent <BookControl>(); } else { } }
private void renewBook(string id, TimeSpan ts, DateTime dueDate, string timesRenewed) { if (ts.Days > 0) { MessageBox.Show("Sorry you cannot renew the book when its due date has already passed."); return; } if (int.Parse(timesRenewed) >= maxRenewTimes) { MessageBox.Show("Sorry you can only renew a maximum of " + maxRenewTimes + " time(s)."); return; } BookControl bc = new BookControl(); bc.renewBook(int.Parse(id), LoginInfo.LoggedInId, dueDate.AddDays(dueDateExtendDays)); MessageBox.Show(bc.Message); loadData(); }
private void returnBook(string id, TimeSpan ts) { float penalty = 0; string penaltyMsg = ""; if (ts.Days > 0) { penalty = penaltyPerDay * ts.Days; } if (penalty > 0) { penaltyMsg = "You have been imposed a penality of $" + penalty + ". "; } BookControl bc = new BookControl(); bc.returnBook(int.Parse(id), LoginInfo.LoggedInId, penalty); MessageBox.Show(bc.Message + " " + penaltyMsg); loadData(); }
private void bookList_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { string id = bookList.Rows[e.RowIndex].Cells["ID"].Value.ToString(); bool available = bool.Parse(bookList.Rows[e.RowIndex].Cells["availablebool"].Value.ToString()); if (!available) { MessageBox.Show("Sorry. This book is not available"); return; } BookControl bc = new BookControl(); bc.borrowBook(int.Parse(id), LoginInfo.LoggedInId); MessageBox.Show(bc.Message); loadData(); } }
private void bookList_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string id = bookList.Rows[e.RowIndex].Cells["ID"].Value.ToString(); string title = bookList.Rows[e.RowIndex].Cells["title"].Value.ToString(); string author = bookList.Rows[e.RowIndex].Cells["author"].Value.ToString(); string isbn = bookList.Rows[e.RowIndex].Cells["isbn"].Value.ToString(); string genre = bookList.Rows[e.RowIndex].Cells["genre"].Value.ToString(); if (e.RowIndex % 2 == 0) { bookList.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = bookList.RowsDefaultCellStyle; } else { bookList.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = bookList.AlternatingRowsDefaultCellStyle; } BookControl bc = new BookControl(); bc.editBook(int.Parse(id), isbn, author, title, genre); MessageBox.Show(bc.Message); }
void Start() { bookCrontrol = this.GetComponent <BookControl>(); }
void Update() { /*if (Input.GetKeyDown("space")) * { * SaveLoad.Save(SaveCallBack); * GlobalData.loadGame = true; * * StartCoroutine("Fader"); * }*/ if (player.GetPlayer().moninv.IsEmpty()) { gameover.SetActive(true); gameObject.SetActive(false); } //use bools to make this section go off only if there's a change? bool shopisactive = (ShopMain.isActive() || MICollider.isActive() || InvCol.isActive() || BookControl.isActive()); shop.GetComponent <BoxCollider>().enabled = !shopisactive; fountain.GetComponent <BoxCollider>().enabled = !shopisactive; book.GetComponent <BoxCollider>().enabled = !shopisactive; adventure.GetComponent <BoxCollider>().enabled = !shopisactive; iteminv.GetComponent <BoxCollider>().enabled = !shopisactive; iteminv.GetComponent <SpriteRenderer>().enabled = !shopisactive; moninv.GetComponent <SpriteRenderer>().enabled = !shopisactive; moninv.GetComponent <BoxCollider>().enabled = !shopisactive; downtown.GetComponent <BoxCollider>().enabled = !shopisactive; menubut.SetActive(!shopisactive); //if (Input.GetKeyDown("space")) //print(go == go2); if (Input.touchCount == 1 && onehit) { if (!shopisactive) { // touch on screen if (Input.GetTouch(0).phase == TouchPhase.Began) { Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit = new RaycastHit(); moving = Physics.Raycast(ray, out hit); if (moving) { go = hit.transform.gameObject; //Debug.Log("Touch Detected on : " + go.name); } else { onehit = false; } } // release touch/dragging if ((Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Canceled || Input.touchCount != 1) && go != null && onehit) { Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit = new RaycastHit(); moving = Physics.Raycast(ray, out hit); if (moving) { go2 = hit.transform.gameObject; } moving = false; //Debug.Log("Touch Released from : " + go.name); if (go == shop && go == go2) { ShopMain.ShopSet(true); } else if (go == fountain && go == go2) { player.GetPlayer().moninv.HealAll(); if (canenter) { StartCoroutine("HealSprite"); } //play sound SaveLoad.Save(SaveCallBack); } else if (go == book && go == go2) { BookControl.BookSet(true); } else if (go == adventure && go == go2) { if (player.GetPlayer().moninv.HasAnActive()) { SaveLoad.Save(SaveCallBack); GlobalData.loadGame = true; //fader.color = Color.clear; //SceneManager.LoadScene("Adventure"); StartCoroutine("Fader", "Adventure"); } else { //you need at least one active monster to adventure! } } else if (go == iteminv && go == go2) { InvCol.SetActive(true); } else if (go == moninv && go == go2) { MICollider.SetActive(true); } else if (go == downtown && go == go2) { SaveLoad.Save(SaveCallBack); GlobalData.loadGame = true; StartCoroutine("Fader", "Downtown"); } } } } else { go = null; go2 = null; onehit = true; } }
// Update is called once per frame void Update() { //close.transform.position = closeplace; if (Input.touchCount == 1 && onehit) { // touch on screen if (Input.GetTouch(0).phase == TouchPhase.Began) { origpos = Input.GetTouch(0).position; //fingpos = origpos; temp3 = Camera.main.ScreenToWorldPoint(origpos); //temp2 = temp3; Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit = new RaycastHit(); moving = Physics.Raycast(ray, out hit); if (moving) { go = hit.transform.gameObject; } else { onehit = false; } } //temp1 = fingpos; fingpos = Input.GetTouch(0).position; temp2 = Camera.main.ScreenToWorldPoint(fingpos); //if (temp2.y != temp3.y) //add room for error if (go != close) { if (go == downbut) { temp1.y = Mathf.Lerp(transform.position.y, transform.position.y + 2, Time.deltaTime * 20); transform.position = temp1; } if (go == upbut) { temp1.y = Mathf.Lerp(transform.position.y, transform.position.y - 2, Time.deltaTime * 20); transform.position = temp1; } } // release touch/dragging if ((Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Canceled || Input.touchCount != 1) && go != null && onehit) { Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit = new RaycastHit(); moving = Physics.Raycast(ray, out hit); if (moving) { go2 = hit.transform.gameObject; moving = false; } if (go == close && go2 == close) { close.SetActive(false); upbut.SetActive(false); downbut.SetActive(false); BookControl.BookSet(false); } } } else { go = null; go2 = null; onehit = true; } }