//创建一般操作按钮 void createNoGroupBtn(Vector2 minpos, Vector2 maxpos, string name, Operation.SChandle handle) { CustomView.SCButton btn = new CustomView.SCButton(5, name, parentDialogBtn.transform, delegate() { gameObject.GetComponent <AudioSource>().Play(); //教学模式中判断本操作是否是当前要求的操作并对要求操作做更新 if (isTeacher) { gameObject.GetComponent <SCTeacher>().isAccord(handle); } //查询这个操作是否在次序表中有,如果有则去状态转换表查看是否需要状态转换 int nextstate = handle.stateChange(currentState); //如果转换结果没有则说明本操作错误,将操作及其正确与否进行存储 if (nextstate != 0) { stateGetAndShow(nextstate); //将此正确操作存储 operationList.Add(handle.h_name + ":√"); } else { //将此错误操作存储 operationList.Add(handle.h_name + ":×"); } }, btnImagetwo, minpos, maxpos, new Vector2(0, 0), new Vector2(0, 0)// new Vector2(0, 0.92f), new Vector2(0.166f, 1.0f) ); CustomView.SCText text = new CustomView.SCText(5, "text", btn._btn.transform, handle.h_name, textFont, FontStyle.Normal, new Color(0, 0, 0, 1), TextAnchor.MiddleCenter, new Vector2(0, 0), new Vector2(1, 1), new Vector2(0, 0), new Vector2(0, 0)); currentDialogBtnArry.Add(btn._btn); }
//判断用户的点击是否是当前教程提示的步骤如果是则index++ public void isAccord(Operation.SChandle customOperation) { if (customOperation.h_id == ordersArry[index].o_handleId) { object lockThis = new object(); lock (lockThis) { index++; } if (voice != null) { Debug.Log("声音暂停"); voice.Pause(); teacherText.active = false; } //Stop(); } }
//点击组按钮时读取数据库得到相对应组的操作 void getOperation(string groupId) { DbAccess db = new DbAccess("data source = " + Application.dataPath + "/ModelData/NDtreatmentnew.db"); string sqlstr = "select * from NT_operation where NC_groupid = '" + groupId + "'"; SqliteDataReader result = db.ExecuteQuery(sqlstr); float i = 0.03f, j = 0.93f; int k = 0; while (result.Read()) { string tempname = result.GetString(result.GetOrdinal("NC_name")); string tempid = result.GetString(result.GetOrdinal("NC_id")); string tempgid = result.GetString(result.GetOrdinal("NC_groupid")); string tempgname = result.GetString(result.GetOrdinal("NC_groupname")); string tempdescribe = result.GetString(result.GetOrdinal("NC_oprationdescribe")); string temporgan = result.GetString(result.GetOrdinal("NC_organ")); string tempdrug = result.GetString(6); string tempother = result.GetString(result.GetOrdinal("NC_other")); Operation.SChandle temp = new Operation.SChandle(tempid, tempname, tempgid, tempgname, tempdescribe, temporgan, tempdrug, tempother); if (k < 3) { createNoGroupBtn(new Vector2(i, j - 0.05f), new Vector2(i + 0.27f, j), "btnDialog", temp); i = i + 0.3f; k++; } else { k = 0; i = 0.03f; j = j - 0.05f; createNoGroupBtn(new Vector2(i, j - 0.05f), new Vector2(i + 0.27f, j), "btnDialog", temp); i = i + 0.3f; k++; } } result.Close(); db.CloseSqlConnection(); }
void onSubmitBtn(string groupId, string groupName) { gameObject.GetComponent <AudioSource>().Play(); string drugstr = ""; string drugnamestr = ""; currentDrugArry.Sort(); for (int ii = 0; ii < currentDrugArry.Count; ii++) { Operation.Drugs it = currentDrugArry[ii]; if (ii != currentDrugArry.Count - 1) { drugstr = drugstr + it.d_id + "|"; drugnamestr = drugnamestr + it.d_name + "、"; } else { drugstr = drugstr + it.d_id; drugnamestr = drugnamestr + it.d_name; } } DbAccess db2 = new DbAccess("data source = " + Application.dataPath + "/ModelData/NDtreatmentnew.db"); string sqlstr2 = "select * from NT_operation where NC_drug like '" + drugstr + "'" + "AND NC_groupid = '" + groupId + "'"; SqliteDataReader result2 = db2.ExecuteQuery(sqlstr2); if (!result2.HasRows) { result2.Close(); db2.CloseSqlConnection(); Debug.Log("没有此药品"); operationList.Add(groupName + drugnamestr + ":×"); return; } else { result2.Read(); string tempname = result2.GetString(result2.GetOrdinal("NC_name")); string tempid = result2.GetString(result2.GetOrdinal("NC_id")); string tempgid = result2.GetString(result2.GetOrdinal("NC_groupid")); string tempgname = result2.GetString(result2.GetOrdinal("NC_groupname")); string tempdescribe = result2.GetString(result2.GetOrdinal("NC_oprationdescribe")); string temporgan = result2.GetString(result2.GetOrdinal("NC_organ")); string tempdrug = result2.GetString(6); string tempother = result2.GetString(result2.GetOrdinal("NC_other")); Operation.SChandle temp = new Operation.SChandle(tempid, tempname, tempgid, tempgname, tempdescribe, temporgan, tempdrug, tempother); //教学模式中判断本操作是否是当前要求的操作并对要求操作做更新 if (isTeacher) { gameObject.GetComponent <SCTeacher>().isAccord(temp); } int nextstate = temp.stateChange(currentState); if (nextstate != 0) { operationList.Add(temp.h_name + drugnamestr + ":√"); stateGetAndShow(nextstate); } else { operationList.Add(temp.h_name + drugnamestr + ":×"); } result2.Close(); db2.CloseSqlConnection(); } }