Esempio n. 1
0
        public CRW_Level(int levelNo, int argsCRWTypeID)
        {
            this.CRWTypeID = argsCRWTypeID;
            this.LevelNo   = levelNo;

            this.SuDa = this.LevelNo / 2 + this.LevelNo % 2;

            if (this.LevelNo % 2 == 0)
            {
                this.LevelName          = "快速{0}溯答".FormatWith(this.SuDa);
                this.LevelTTSName       = "快速{0}溯答".FormatWith(CRWBll.ToChineseNumber(this.SuDa));
                this.LevelTTS_SleepTime = 3500;
            }
            else
            {
                this.LevelName          = "{0}溯答".FormatWith(this.SuDa);
                this.LevelTTSName       = "{0}溯答".FormatWith(CRWBll.ToChineseNumber(this.SuDa));
                this.LevelTTS_SleepTime = 2000;
            }

            this.QuestionCount = 20 + this.SuDa * 2;
            // ****** 测试模式减少题目数量 ******
            // this.QuestionCount = 2 + this.SuDa * 2;

            this.MaxIndex = this.QuestionCount + this.SuDa - 1;

            if (this.LevelNo % 2 == 0)
            {
                switch (Common.StaticInfo.DeviceInfo_Platform)
                {
                case "ANDROID": this.SpeechRate = 0.5f; break;

                case "IOS": this.SpeechRate = 0.5f; break;
                }
            }
            else
            {
                switch (Common.StaticInfo.DeviceInfo_Platform)
                {
                case "ANDROID": this.SpeechRate = 1f; break;

                case "IOS": this.SpeechRate = 0.55f; break;
                }
            }


            if (this.LevelNo % 2 == 0) // 快速
            {
                this.AnswerTime = 3 * 1000;
            }
            else // 常速
            {
                this.AnswerTime = 4 * 1000;
            }

            this.AnswerStartIndex = this.SuDa;
            this.RememberEndIndex = this.QuestionCount - 1;
        }
Esempio n. 2
0
        /// <summary>
        /// 根据正确率 判断下一局的等级
        /// </summary>
        public Tuple <CRW_Level, string> CalcLevel(CRW_Level level, List <CRW_Question> args)
        {
            // 语音
            string ttsMsg         = string.Empty;
            string levelChangeMsg = string.Empty;

            if (level == null)
            {
                throw new BusinessException("level is null");
            }

            if (level.LevelNo <= 0)
            {
                throw new BusinessException("levelNo 少于 0");
            }

            decimal correctPercentage = this.CheckCorrectPercentage(args);

            int tmpLevelNo = -9876;

            if (correctPercentage <= 65m) // 降级
            {
                tmpLevelNo     = level.LevelNo - 1;
                levelChangeMsg = "下降";
            }
            else if (correctPercentage > 85m) // 升级
            {
                tmpLevelNo     = level.LevelNo + 1;
                levelChangeMsg = "上升";
            }
            else // 等级不变
            {
                tmpLevelNo     = level.LevelNo;
                levelChangeMsg = "不变";
            }

            if (tmpLevelNo <= 0)
            {
                tmpLevelNo = 1;
            }

            ttsMsg = "答题完毕, 正确率百分之{0}".FormatWith(CRWBll.ToChineseNumber(correctPercentage));

            switch (levelChangeMsg)
            {
            case "上升": ttsMsg += "由于超过百分之{0}等级{1}".FormatWith(CRWBll.ToChineseNumber(85), levelChangeMsg); break;

            case "不变": ttsMsg += "由于是百分之{0}等级{1}".FormatWith(CRWBll.ToChineseNumber(correctPercentage), levelChangeMsg); break;

            case "下降": ttsMsg += "由于低于百分之{0}等级{1}".FormatWith(CRWBll.ToChineseNumber(65), levelChangeMsg); break;
            }

            return(new Tuple <CRW_Level, string>(new CRW_Level(tmpLevelNo, level.CRWTypeID), ttsMsg));
        }