private void cmdAdd_Click(object sender, System.EventArgs e) { if (ViewState["id"].ToString() != "") { objKey.id = System.Convert.ToInt32(ViewState["id"]); objKey.populate(); } objKey.keyName = "" + txtKeyName.Text; objKey.keyValue = "" + txtKeyValue.Text; objKey.description = "" + txtDescription.Text; if (ViewState["id"].ToString() == "") { objKey.add(); } else { objKey.update(); } selectRefreshType(); panelNew_reset(); panelNew.Visible = false; }
void control() { // save old tilestate int tilePosXnew = tilePosX; int tilePosYnew = tilePosY; int tileRotnew = tileRot; // check the keys and get new tilestate if (down.checkSignal()) { tilePosYnew = tilePosY - 1; autofalling_timer = 0; } if (left.checkSignal()) { tilePosXnew = tilePosX + 1; } if (right.checkSignal()) { tilePosXnew = tilePosX - 1; } if (up.checkSignal()) { tileRotnew = (tileRot + 1) % tile.GetLength(0); } // update keys float delta = Time.deltaTime; down.update(delta); left.update(delta); right.update(delta); up.update(delta); // auto-falling-down if (tilePosYnew == tilePosY) { if (autofalling_timer >= autofalling_speed) { tilePosYnew = tilePosY - 1; autofalling_timer -= autofalling_speed; } } else { autofalling_timer = 0.0f; } autofalling_timer += Time.deltaTime; // if tilestate has changed, do something if (tilePosXnew != tilePosX || tilePosYnew != tilePosY || tileRotnew != tileRot) { setTile(0); // clear the actual tile from the playfield if (tileRotnew != tileRot) { if (checkCollisions(tilePosXnew, tilePosYnew, tileRotnew) == CollisionTypes.none) { tileRot = tileRotnew; } } if (tilePosXnew != tilePosX || tilePosYnew != tilePosY) { switch (checkCollisions(tilePosXnew, tilePosYnew, tileRot)) { case CollisionTypes.none: { setTile(0); // clear the actual tile from the playfield tilePosX = tilePosXnew; tilePosY = tilePosYnew; } break; case CollisionTypes.wall: { } break; case CollisionTypes.stone: { setTile(tileColor); newTile(false); } break; } } setTile(tileColor); } }