Exemplo n.º 1
0
        static Question GetQuestionSkillInfo()
        {
            string[] eids = { "type", "des" };
            string[] cids = { "类型", "描述" };
            int      type = MathTool.GetRandom(eids.Length);

            SkillConfig luk      = ConfigData.GetSkillConfig(SkillBook.GetRandSkillId());
            Question    question = new Question();

            question.info = string.Format("|技能|Gold|{0}||的{1}是?", luk.Name, cids[type]);
            question.ans  = new string[4];
            string attrType = SkillBook.GetAttrByString(luk.Id, eids[type]);

            question.ans[MathTool.GetRandom(4)] = attrType;
            int idx = 0;
            SimpleSet <string> set = new SimpleSet <string>();

            set.Add(SkillBook.GetAttrByString(luk.Id, eids[type]));
            while (idx < 4)
            {
                if (question.ans[idx] != null)
                {
                    idx++;
                    continue;
                }

                SkillConfig guess     = ConfigData.GetSkillConfig(SkillBook.GetRandSkillId());
                string      guessType = SkillBook.GetAttrByString(guess.Id, eids[type]);
                if (!set.Has(guessType))
                {
                    question.ans[idx] = guessType;
                    set.Add(guessType);
                    idx++;
                }
            }
            question.result = attrType;
            return(question);
        }
Exemplo n.º 2
0
 public void AddRandSkill()
 {
     SkillManager.AddSkill(SkillBook.GetRandSkillId(), Level, 100, SkillSourceTypes.Skill);
 }