Example #1
0
        public static Dictionary <int, Question> GetStaticQuestiones()
        {
            Dictionary <int, Question> dic = new Dictionary <int, Question>();

            Sqlite           sql        = new Sqlite("liantui.db");
            SqliteDataReader dataReader = sql.SelectDataBase("ExamList");

            while (dataReader.Read())
            {
                //读取ID
                int      id = dataReader.GetInt32(dataReader.GetOrdinal("ID"));
                Question qs = new Question();
                //读取Name
                int type = dataReader.GetInt32(dataReader.GetOrdinal("Type"));
                qs.isTorF = type == 1;
                int subject = dataReader.GetInt32(dataReader.GetOrdinal("Subject"));
                qs.subject = "a" + subject;
                int hard = dataReader.GetInt32(dataReader.GetOrdinal("Hardness"));
                qs.hard = hard;
                string title = dataReader.GetString(dataReader.GetOrdinal("Title"));
                qs.content = title;
                string select1 = dataReader.GetString(dataReader.GetOrdinal("Select1"));
                qs.choice.Add(select1);
                string select2 = dataReader.GetString(dataReader.GetOrdinal("Select2"));
                qs.choice.Add(select2);
                string select3 = dataReader.GetString(dataReader.GetOrdinal("Select3"));
                qs.choice.Add(select3);
                string select4 = dataReader.GetString(dataReader.GetOrdinal("Select4"));
                qs.choice.Add(select4);
                int answer = dataReader.GetInt32(dataReader.GetOrdinal("Answer"));
                qs.answer = answer;
                dic.Add(id, qs);
            }
            dataReader.Close();
            sql.CloseDataBase();

            //string path = Constants.DEBUG ? Constants.EXAM_DEBUG_PATH : Constants.EXAM_PATH;
            //TextAsset text = Resources.Load<TextAsset>(path + "exam");
            //DebugLog.Log("读取考试题库");
            //JsonData jsondata = JsonMapper.ToObject(text.text);
            //foreach (JsonData jd in jsondata)
            //{
            //    Question ee = new Question(jd);
            //    DebugLog.LogDone("读取:" + ee.UID);
            //    dic.Add(ee.UID, ee);
            //}

            return(dic);
        }
Example #2
0
        public Dictionary <string, string> GetBGMTitle()
        {
            Sqlite                      sql        = new Sqlite("liantui.db");
            SqliteDataReader            dataReader = sql.SelectDataBase("BgmList");
            Dictionary <string, string> bgmTitle   = new Dictionary <string, string>();

            while (dataReader.Read())
            {
                //读取ID
                int id = dataReader.GetInt32(dataReader.GetOrdinal("ID"));
                //读取Name
                string filename = dataReader.GetString(dataReader.GetOrdinal("FileName"));
                string title    = dataReader.GetString(dataReader.GetOrdinal("Title"));
                bgmTitle.Add(filename, title);
            }
            sql.CloseDataBase();
            return(bgmTitle);
        }