Ejemplo n.º 1
0
        public void SetUpAchievementView(LearnTitleQualification qualification)
        {
            ExploreManager.Instance.MapWalkableEventsStopAction();

            currentQulification = qualification;

            achievementText.text = qualification.title;

            qualificaitonText.text = qualification.qualificationNeed;

            rewardText.text = "x" + qualification.rewardGold.ToString();

            shareHintText.text = string.Format("分享后可获得额外{0}金币奖励", qualification.rewardGold);

            Player.mainPlayer.totalGold += qualification.rewardGold;

            this.gameObject.SetActive(true);

            if (zoomCoroutine != null)
            {
                StopCoroutine(zoomCoroutine);
            }

            zoomCoroutine = HUDZoomIn();

            StartCoroutine(zoomCoroutine);
        }
Ejemplo n.º 2
0
        private void ChooseAnswerInWordHUDCallBack(bool isChooseCorrect)
        {
            if (!isChooseCorrect)
            {
                bool showWordDetail = ExploreManager.Instance.NeedShowFullWordDetailWhenChooseWrong();

                if (showWordDetail)
                {
                    bool controlMoveWhenQuit = true;

                    bool pushRecommend = false;

                    pushRecommend = CheckPushCommentRecommend();

                    if (pushRecommend)
                    {
                        controlMoveWhenQuit = false;
                    }

                    int qualificationIndex = LearnTitleQualification.CheckLearnTitleQualification();

                    if (qualificationIndex != -1)
                    {
                        controlMoveWhenQuit = false;
                    }

                    SetUpWordDetailHUD(controlMoveWhenQuit, delegate
                    {
                        if (pushRecommend)
                        {
                            commentRecommendHUD.SetUpCommentRecommendHUD();
                        }
                        if (qualificationIndex != -1)
                        {
                            LearnTitleQualification qualification = CommonData.learnTitleQualifications[qualificationIndex];

                            achievementView.SetUpAchievementView(qualification);

                            UpdateTitleQualification(qualificationIndex);
                        }
                    });
                }
            }
            else
            {
                bool pushRecommend = CheckPushCommentRecommend();

                if (pushRecommend)
                {
                    commentRecommendHUD.SetUpCommentRecommendHUD();
                }


                int qualificationIndex = LearnTitleQualification.CheckLearnTitleQualification();

                if (qualificationIndex != -1)
                {
                    LearnTitleQualification qualification = CommonData.learnTitleQualifications[qualificationIndex];

                    achievementView.SetUpAchievementView(qualification);

                    UpdateTitleQualification(qualificationIndex);
                }
            }

            ExploreManager.Instance.ChooseAnswerInWordHUD(isChooseCorrect);

            ExploreManager.Instance.MapWalkableEventsStartAction();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 检查是否达成称号
        /// 如果没有新的称号达成,返回-1
        /// 如果有新的称号达成,返回称号序号
        /// </summary>
        public static int CheckLearnTitleQualification()
        {
            int qualificationIndex = -1;

            int totalLearnedWordCount = Player.mainPlayer.totalLearnedWordCount;

            int totalUngraspWordCount = Player.mainPlayer.totalUngraspWordCount;

            int continuousCorrectWordCount = 0;

            switch (LearningInfo.Instance.currentWordType)
            {
            case WordType.Simple:
                continuousCorrectWordCount = Player.mainPlayer.maxSimpleWordContinuousRightRecord;
                break;

            case WordType.Medium:
                continuousCorrectWordCount = Player.mainPlayer.maxMediumWordContinuousRightRecord;
                break;

            case WordType.Master:
                continuousCorrectWordCount = Player.mainPlayer.maxMasterWordContinuousRightRecord;
                break;
            }


            float correctPercentage = totalLearnedWordCount == 0 ? 0 : (float)(totalLearnedWordCount - totalUngraspWordCount) / totalLearnedWordCount;

            for (int i = 0; i < CommonData.learnTitleQualifications.Length; i++)
            {
                bool titleQualified = false;
                switch (LearningInfo.Instance.currentWordType)
                {
                case WordType.Simple:
                    if (Player.mainPlayer.titleQualificationsOfSimple != null)
                    {
                        titleQualified = Player.mainPlayer.titleQualificationsOfSimple[i];
                    }
                    break;

                case WordType.Medium:
                    if (Player.mainPlayer.titleQualificationsOfMedium != null)
                    {
                        titleQualified = Player.mainPlayer.titleQualificationsOfMedium[i];
                    }
                    break;

                case WordType.Master:
                    if (Player.mainPlayer.titleQualificationsOfMaster != null)
                    {
                        titleQualified = Player.mainPlayer.titleQualificationsOfMaster[i];
                    }
                    break;
                }

                if (titleQualified)
                {
                    continue;
                }

                LearnTitleQualification qualification = CommonData.learnTitleQualifications[i];

                titleQualified = totalLearnedWordCount >= qualification.totalWordsCount &&
                                 correctPercentage >= qualification.totalCorrectPercentage - float.Epsilon &&
                                 continuousCorrectWordCount >= qualification.continuousCorrectWordCount;

                bool dataCorrect = false;

                if (titleQualified)
                {
                    ExploreManager.Instance.UpdateWordDataBase();

                    int learnWordCountFromDB   = LearningInfo.Instance.learnedWordCount;
                    int ungraspWordCountFromDB = LearningInfo.Instance.ungraspedWordCount;
                    dataCorrect = learnWordCountFromDB == totalLearnedWordCount && ungraspWordCountFromDB == totalUngraspWordCount;

                    if (dataCorrect)
                    {
                        switch (LearningInfo.Instance.currentWordType)
                        {
                        case WordType.Simple:
                            if (Player.mainPlayer.titleQualificationsOfSimple != null)
                            {
                                Player.mainPlayer.titleQualificationsOfSimple[i] = true;
                                qualificationIndex = i;
                            }
                            break;

                        case WordType.Medium:
                            if (Player.mainPlayer.titleQualificationsOfMedium != null)
                            {
                                Player.mainPlayer.titleQualificationsOfMedium[i] = true;
                                qualificationIndex = i;
                            }
                            qualificationIndex = i;
                            break;

                        case WordType.Master:
                            if (Player.mainPlayer.titleQualificationsOfMaster != null)
                            {
                                Player.mainPlayer.titleQualificationsOfMaster[i] = true;
                                qualificationIndex = i;
                            }
                            break;
                        }
                        break;
                    }
                    else
                    {
                        Player.mainPlayer.totalLearnedWordCount = learnWordCountFromDB;
                        Player.mainPlayer.totalUngraspWordCount = ungraspWordCountFromDB;

                        return(CheckLearnTitleQualification());
                    }
                }
            }
            return(qualificationIndex);
        }