コード例 #1
0
    public void initData(NoticeWindow faWin, Notice notice)
    {
        this.faWin   = faWin;
        this.notice  = notice as QuizNotice;
        noticeSample = notice.getSample();
        buttonAnswer.fatherWindow   = faWin;
        buttonGetAward.fatherWindow = faWin;
        for (int i = 0; i < buttonAnswerKey.Length; i++)
        {
            buttonAnswerKey [i].fatherWindow = faWin;
        }

        //获取题库
        instance.getQuestions(() => {
            this.examSample = QuizManagerment.Instance.getExamSampleBySid(notice);
            if (examSample != null && examSample.getAwardType == 1 && examSample.getQuestionSid() == -1)
            {
                initAwardUI();
            }
            else
            {
                initNormalUI();
            }
        });
    }
コード例 #2
0
    void getAwardFP()
    {
        NoticeQuizFPort fport = FPortManager.Instance.getFPort("NoticeQuizFPort") as NoticeQuizFPort;

        fport.getAward(examSample.quizId, () => {
            TextTipWindow.Show(LanguageConfigManager.Instance.getLanguage("s0120"));
            instance.updateExamSampleAwardType(notice, true);
            buttonGetAward.disableButton(true);
            this.examSample = QuizManagerment.Instance.getExamSampleBySid(notice);
            initNormalUI();
        });
    }
コード例 #3
0
    /** 初始化后台题库数据 */
    public void initQuiz(ErlKVMessage message, CallBack _callback)
    {
        ErlType msg = message.getValue("msg") as ErlType;

        if (msg is ErlArray && msg != null)
        {
            ErlArray arr = msg as ErlArray;

            ErlArray arr2;
            examSamples = new List <ExamSample>();
            ExamSample sample = null;
            for (int i = 0; i < arr.Value.Length; i++)
            {
                if (arr.Value[i] is ErlArray)
                {
                    arr2                  = arr.Value[i] as ErlArray;
                    sample                = new ExamSample();
                    sample.quizId         = StringKit.toInt(arr2.Value [0].getValueString()); //题库ID
                    sample.overTime       = StringKit.toInt(arr2.Value [1].getValueString()); //答题结束时间
                    sample.getAwardType   = StringKit.toInt(arr2.Value [2].getValueString()); //是否领取奖励
                    sample.righeAnswerNum = StringKit.toInt(arr2.Value [3].getValueString()); //答对数量
                    sample.score          = StringKit.toInt(arr2.Value [4].getValueString()); //积分

                    ErlArray arr3 = arr2.Value [5] as ErlArray;                               //剩余题目sid组
//					int index;
                    int        sid;
                    List <int> sids = new List <int>(arr3.Value.Length);
                    for (int j = 0; j < arr3.Value.Length; j++)
                    {
//						index = StringKit.toInt(((arr3.Value [j] as ErlArray).Value [0] as ErlType).getValueString ());
                        sid = StringKit.toInt(((arr3.Value [j] as ErlArray).Value [1] as ErlType).getValueString());
                        sids.Add(sid);
                    }
                    sample.quizSids      = sids;
                    sample.questionCount = StringKit.toInt(arr2.Value [6].getValueString());                      //总数
                    examSamples.Add(sample);
                }
            }
        }
        else
        {
            MonoBase.print(GetType() + "==error:" + msg);
        }

        if (_callback != null)
        {
            _callback();
        }
    }
コード例 #4
0
ファイル: QuizNotice.cs プロジェクト: xiney1986/SDKProject
    /// <summary>
    /// 获得时间描述
    /// </summary>
    public string getTimeDesc()
    {
        int        nowTime    = ServerTimeKit.getSecondTime();
        ExamSample examSample = QuizManagerment.Instance.getExamSampleBySid(this);

        if (examSample == null)
        {
            return(LanguageConfigManager.Instance.getLanguage("notice_quiz01"));            //活动已经结束
        }
        SidNoticeContent content = getSample().content as SidNoticeContent;
        TimeInfoSample   tsample = TimeConfigManager.Instance.getTimeInfoSampleBySid(getSample().timeID);

        if (activeTime == null)
        {
            activeTime = ActiveTime.getActiveTimeByType(tsample);
            activeTime.initTime(ServerTimeKit.getSecondTime());
        }
        else
        {
            activeTime.doRefresh();
        }
        //具体开始时间
        int detailStartTime = activeTime.getDetailStartTime();
        //具体结束时间
        int detailEndTime = activeTime.getDetailEndTime();

        if (detailStartTime < nowTime && detailEndTime > nowTime && examSample.getAwardType == 1)
        {
            return(LanguageConfigManager.Instance.getLanguage("notice09"));            //可以答题
        }
        else if (DateKit.isInSameDay(detailStartTime, nowTime) && detailStartTime > nowTime)
        {
            return(LanguageConfigManager.Instance.getLanguage("notice08", TimeKit.dateToFormat(detailStartTime, LanguageConfigManager.Instance.getLanguage("notice05"))));              //尚未开启
        }
        else if (activeTime.getIsFinish())
        {
            return(LanguageConfigManager.Instance.getLanguage("notice_quiz01"));            //活动已经结束
        }
        else if (detailEndTime < nowTime)
        {
            return(LanguageConfigManager.Instance.getLanguage("notice_quiz01"));            //活动已经结束
        }
        else
        {
            return(LanguageConfigManager.Instance.getLanguage("notice_quiz01"));            //活动已经结束
        }
    }
コード例 #5
0
    void answerFP(int buttonId)
    {
        NoticeQuizFPort fport = FPortManager.Instance.getFPort("NoticeQuizFPort") as NoticeQuizFPort;

        fport.answer(examSample.quizId, buttonId, (int num) => {
            //系统调查没有正确答案,直接下一题
            if (num == -1)
            {
                instance.updateExamSampleScore(notice, 0, false);
                initAnswerUI();
            }
            else if (num == 1 && buttonId == quizSample.rightAnswer)
            {
                instance.updateExamSampleScore(notice, quizSample.rightScore, true);
                string str = LanguageConfigManager.Instance.getLanguage("quiz04", "\n", quizSample.rightScore.ToString());
                UiManager.Instance.createMessageWindowByOneButton(str, (MessageHandle msg) => {
                    this.examSample = QuizManagerment.Instance.getExamSampleBySid(notice);
                    initAnswerUI();
                });
            }
            else
            {
                instance.updateExamSampleScore(notice, quizSample.wrongScore, false);
                string rightAnswer = "";
                if (quizSample.rightAnswer == 1)
                {
                    rightAnswer = "A";
                }
                else if (quizSample.rightAnswer == 2)
                {
                    rightAnswer = "B";
                }
                else if (quizSample.rightAnswer == 3)
                {
                    rightAnswer = "C";
                }
                string str = LanguageConfigManager.Instance.getLanguage("quiz05", rightAnswer, "\n", quizSample.wrongScore.ToString());
                UiManager.Instance.createMessageWindowByOneButton(str, (MessageHandle msg) => {
                    this.examSample = QuizManagerment.Instance.getExamSampleBySid(notice);
                    initAnswerUI();
                });
            }
        });
    }
コード例 #6
0
ファイル: QuizNotice.cs プロジェクト: xiney1986/SDKProject
    /// <summary>
    /// 能否答题
    /// </summary>
    public bool isCanAnswer()
    {
        int              nowTime    = ServerTimeKit.getSecondTime();
        ExamSample       examSample = QuizManagerment.Instance.getExamSampleBySid(this);
        SidNoticeContent content    = getSample().content as SidNoticeContent;
        TimeInfoSample   tsample    = TimeConfigManager.Instance.getTimeInfoSampleBySid(getSample().timeID);

        if (activeTime == null)
        {
            activeTime = ActiveTime.getActiveTimeByType(tsample);
            activeTime.initTime(ServerTimeKit.getSecondTime());
        }
        else
        {
            activeTime.doRefresh();
        }
        //具体开始时间
        int detailStartTime = activeTime.getDetailStartTime();
        //具体结束时间
        int detailEndTime = activeTime.getDetailEndTime();

        if (examSample == null)
        {
            if (detailStartTime < nowTime && detailEndTime > nowTime)
            {
                return(true);               //可以答题
            }
            else
            {
                return(false);
            }
        }
        else
        {
            if (detailStartTime < nowTime && detailEndTime > nowTime && examSample.getAwardType == 1)
            {
                return(true);               //可以答题
            }
            else
            {
                return(false);
            }
        }
    }