static Question GetQuestionInfoWeapon() { string[] eids = { "atf", "skill", "star", "attr" }; string[] cids = { "初始攻/防", "技能", "星级", "属性" }; int type = MathTool.GetRandom(eids.Length); int weaponId = WeaponBook.GetRandWeaponId(); Question question = new Question(); question.info = string.Format("|以下哪一个武器的{0}是|Yellow|{1}||?", cids[type], WeaponBook.GetAttrByString(weaponId, eids[type])); question.ans = new string[4]; question.ans[MathTool.GetRandom(4)] = ConfigData.GetWeaponConfig(weaponId).Name; int idx = 0; SimpleSet <string> set = new SimpleSet <string>(); set.Add(WeaponBook.GetAttrByString(weaponId, eids[type])); while (idx < 4) { if (question.ans[idx] != null) { idx++; continue; } int guessId = WeaponBook.GetRandWeaponId(); if (!set.Has(ConfigData.GetWeaponConfig(guessId).Name) && WeaponBook.GetAttrByString(guessId, eids[type]) != WeaponBook.GetAttrByString(weaponId, eids[type])) { question.ans[idx] = ConfigData.GetWeaponConfig(guessId).Name; set.Add(ConfigData.GetWeaponConfig(guessId).Name); idx++; } } question.result = ConfigData.GetWeaponConfig(weaponId).Name; return(question); }
static Question GetQuestionWeaponInfo() { string[] eids = { "atf", "skill", "star", "attr" }; string[] cids = { "初始攻/防", "技能", "星级", "属性" }; int type = MathTool.GetRandom(eids.Length); int weaponId = WeaponBook.GetRandWeaponId(); Question question = new Question(); question.info = string.Format("|武器|Green|{0}||的{1}是?", ConfigData.GetWeaponConfig(weaponId).Name, cids[type]); question.ans = new string[4]; string weaponStr = WeaponBook.GetAttrByString(weaponId, eids[type]); question.ans[MathTool.GetRandom(4)] = weaponStr; int idx = 0; SimpleSet <string> set = new SimpleSet <string>(); set.Add(weaponStr); while (idx < 4) { if (question.ans[idx] != null) { idx++; continue; } int guessId = WeaponBook.GetRandWeaponId(); string guessStr = WeaponBook.GetAttrByString(guessId, eids[type]); if (!set.Has(guessStr)) { question.ans[idx] = guessStr; set.Add(guessStr); idx++; } } question.result = weaponStr; return(question); }