private void SetPos(RectTransform trans, Rtype rtype, Vector2 pos) { switch (rtype) { case Rtype.Position: trans.position = pos; break; case Rtype.LocalPosition: trans.localPosition = pos; break; case Rtype.AnchoredPosition: trans.anchoredPosition = pos; break; case Rtype.EulerAngles: trans.eulerAngles = pos; break; case Rtype.LocalEulerAngles: trans.localEulerAngles = pos; break; case Rtype.Scale: trans.localScale = pos; break; case Rtype.SizeDelta: trans.sizeDelta = pos; break; } }
IEnumerator COTransform(RectTransform trans, Rtype rtype, Vector2 aVec, Vector2 bVec, float duration, float delay, Easing.Type easingType, Action callback) { yield return(new WaitForSeconds(delay)); float countTime = 0; float perc = 0; float progress = 0; while (countTime < duration) { countTime += Time.deltaTime; if (countTime > duration) { countTime = duration; break; } perc = countTime / duration; progress = Easing.GetEasingFunction(easingType, perc); SetPos(trans, rtype, Vector2.Lerp(aVec, bVec, progress)); yield return(null); } SetPos(trans, rtype, bVec); if (callback != null) { callback(); } Destroy(this); }
public static void Transform(RectTransform rTrans, Rtype rtype, Vector2 aVec, Vector2 bVec, float duration, float delay = 0, Easing.Type easingType = Easing.Type.Linear, Action callback = null) { Tweener tweener = rTrans.gameObject.AddComponent <Tweener>(); tweener.TweenTransform(rTrans, rtype, aVec, bVec, duration, delay, easingType, callback); }
private void A_FineReader_Load(object sender, EventArgs e) { SqlConnection conn = SQLbase.getConn(); try { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); string selectStr = "select * from readers where Rstate > 0"; SqlCommand SelectCmd = new SqlCommand(selectStr, conn); SqlDataReader datareader = SelectCmd.ExecuteReader(); string Rid, Rname, Rgender, Runit, Rtype, Rstate; int rowindex = 0; this.datagridview.Rows.Clear(); while (datareader.Read()) { Rid = datareader["RID"].ToString(); Rname = datareader["Rname"].ToString(); Rgender = datareader["Rgender"].ToString(); Runit = datareader["Runit"].ToString(); Rtype = datareader["Rtype"].ToString(); Rstate = datareader["Rstate"].ToString(); rowindex = this.datagridview.Rows.Add(); //trim函数同于去除字符串两头的空格 this.datagridview.Rows[rowindex].Cells[0].Value = Rid.Trim(); this.datagridview.Rows[rowindex].Cells[1].Value = Rname.Trim(); this.datagridview.Rows[rowindex].Cells[2].Value = Rgender.Trim(); this.datagridview.Rows[rowindex].Cells[3].Value = Runit.Trim(); this.datagridview.Rows[rowindex].Cells[4].Value = Rtype.Trim(); this.datagridview.Rows[rowindex].Cells[5].Value = Rstate.Trim(); } } catch { MessageBox.Show("操作错误!"); } }
//读者查询 private void button1_Click(object sender, EventArgs e) { SqlConnection conn = SQLbase.getConn(); try { this.datagridview.Rows.Clear(); if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); string selectStr = "select * from readers"; //按读者号查询 if (comboBox_QueryStyle.SelectedIndex == 0) { string id = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from readers where RID=" + id; } //按读者名查询 else if (comboBox_QueryStyle.SelectedIndex == 1) { string name = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from readers where Rname= '" + name + "'"; } //按单位查询 else if (comboBox_QueryStyle.SelectedIndex == 2) { string unit = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from readers where Runit= '" + unit + "'"; } //按类型查询 else if (comboBox_QueryStyle.SelectedIndex == 3) { string type = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from readers where Rtype= '" + type + "'"; } //没有选择下拉框,则查询全部 SqlCommand SelectCmd = new SqlCommand(selectStr, conn); SqlDataReader datareader = SelectCmd.ExecuteReader(); string Rid, Rname, Rgender, Runit, Rtype, Rstate; int rowindex = 0; this.datagridview.Rows.Clear(); while (datareader.Read()) { Rid = datareader["RID"].ToString(); Rname = datareader["Rname"].ToString(); Rgender = datareader["Rgender"].ToString(); Runit = datareader["Runit"].ToString(); Rtype = datareader["Rtype"].ToString(); Rstate = datareader["Rstate"].ToString(); rowindex = this.datagridview.Rows.Add(); //trim函数同于去除字符串两头的空格 this.datagridview.Rows[rowindex].Cells[0].Value = Rid.Trim(); this.datagridview.Rows[rowindex].Cells[1].Value = Rname.Trim(); this.datagridview.Rows[rowindex].Cells[2].Value = Rgender.Trim(); this.datagridview.Rows[rowindex].Cells[3].Value = Runit.Trim(); this.datagridview.Rows[rowindex].Cells[4].Value = Rtype.Trim(); this.datagridview.Rows[rowindex].Cells[5].Value = Rstate.Trim(); } } catch { MessageBox.Show("查无此人!"); } SQLbase.close(conn); }
public static void TweenRectTrans(this RectTransform trans, Rtype rtype, Easing.Type easingType, Vector2 aVec, Vector2 bVec, float duration, float delay = 0, Action callback = null) { TweenExtensions.Transform(trans, rtype, aVec, bVec, duration, delay, easingType, callback); }
public void TweenTransform(RectTransform trans, Rtype rtype, Vector2 aVec, Vector2 bVec, float duration, float delay, Easing.Type easingType, Action callback) { StartCoroutine(COTransform(trans, rtype, aVec, bVec, duration, delay, easingType, callback)); }