/// <summary>
        /// 通关记录排序
        /// </summary>
        private void SortPlayRecordsOrder()
        {
            if (playRecords == null || playRecords.Count == 0)
            {
                return;
            }

            for (int i = 0; i < playRecords.Count - 1; i++)
            {
                for (int j = i; j < playRecords.Count - 1; j++)
                {
                    PlayRecord formerRecord = playRecords[j];
                    PlayRecord laterRecord  = playRecords[j + 1];

                    if (laterRecord.maxExploreLevel > formerRecord.maxExploreLevel)
                    {
                        playRecords[j] = laterRecord;

                        playRecords[j + 1] = formerRecord;
                    }
                    else if (laterRecord.maxExploreLevel == formerRecord.maxExploreLevel)
                    {
                        if (laterRecord.evaluatePoint > formerRecord.evaluatePoint)
                        {
                            playRecords[j] = laterRecord;

                            playRecords[j + 1] = formerRecord;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 初始化简易通关记录界面
        /// </summary>
        /// <param name="playRecord">Play record.</param>
        /// <param name="recordIndex">Record index.</param>
        /// <param name="clickDetailCallBack">Click detail call back.</param>
        public void SetUpPlayRecordSimpleCell(PlayRecord playRecord, int recordIndex, CallBack clickDetailCallBack)
        {
            recordIndexText.text = (recordIndex + 1).ToString();

            if (playRecord.finishGame)
            {
                exploreEndAt.text = "获得艾尔文的宝藏";
            }
            else
            {
                exploreEndAt.text = string.Format("失败于: {0}", playRecord.dieFrom);
            }

            exploreMaxLevelText.text = string.Format("探索至: {0}层", playRecord.maxExploreLevel);


            evaluateText.text = string.Format("综合评级: {0}", playRecord.evaluateString);

            detailInfoButton.onClick.RemoveAllListeners();

            detailInfoButton.onClick.AddListener(delegate {
                if (clickDetailCallBack != null)
                {
                    clickDetailCallBack();
                }
            });
        }
Esempio n. 3
0
        private void LoadPlayRecords()
        {
            if (mAllPlayRecords.Count > 0)
            {
                return;
            }

            PlayRecord[] playRecords = DataHandler.LoadDataToModelsWithPath <PlayRecord>(CommonData.playRecordsFilePath);

            if (playRecords == null)
            {
                return;
            }

            for (int i = 0; i < playRecords.Length; i++)
            {
                PlayRecord playRecord = playRecords[i];
                mAllPlayRecords.Add(playRecord);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 初始化通关记录界面【初始化UI】
        /// </summary>
        /// <param name="pageIndex">Page index.</param>
        /// <param name="maxPageIndex">Max page index.</param>
        /// <param name="minRecordIndex">Minimum record index.</param>
        /// <param name="maxRecordIndex">Max record index.</param>
        public void SetUpPlayerRecordView(int pageIndex, int maxPageIndex, int minRecordIndex, int maxRecordIndex)
        {
            if (playRecords == null || playRecords.Count == 0)
            {
                noDataHintText.enabled = true;
                nextPageButton.gameObject.SetActive(false);
                lastPageButton.gameObject.SetActive(false);
                pageText.enabled = false;
                return;
            }

            noDataHintText.enabled = false;
            nextPageButton.gameObject.SetActive(true);
            lastPageButton.gameObject.SetActive(true);
            pageText.enabled = true;

            pageText.text = string.Format("{0} / {1}", pageIndex + 1, maxPageIndex + 1);

            simpleRecordCellPool.AddChildInstancesToPool(simpleRecordCellContainer);

            for (int i = minRecordIndex; i <= maxRecordIndex; i++)
            {
                if (i < 0 || i >= playRecords.Count)
                {
                    continue;
                }

                PlayRecord           playRecord           = playRecords[i];
                PlayRecordSimpleCell playRecordSimpleCell = simpleRecordCellPool.GetInstance <PlayRecordSimpleCell>(simpleCellModel.gameObject, simpleRecordCellContainer);

                int recordIndex = i;

                playRecordSimpleCell.SetUpPlayRecordSimpleCell(playRecord, recordIndex, delegate
                {
                    playRecordDetailHUD.SetUpPlayRecordDetailHUD(playRecord);
                });
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 初始化通关记录详细页面
        /// </summary>
        /// <param name="playRecord">Play record.</param>
        public void SetUpPlayRecordDetailHUD(PlayRecord playRecord)
        {
            //if(playRecord.finishGame){
            exploreEndAt.text = "获得艾尔文的宝藏";
            //}else{
            //	exploreEndAt.text = string.Format("失败于: {0}", playRecord.dieFrom);
            //}

            exploreMaxLevelText.text = string.Format("最大探索层数: {0}", playRecord.maxExploreLevel);

            totalExploreTimeText.text = string.Format("探索时间: {0}天", playRecord.totalExploreDays);

            totalLearnedWordCountText.text = string.Format("学习单词总数: {0}", playRecord.totalLearnedWordCount);

            correctPercentageText.text = string.Format("总正确率: {0}%", playRecord.learnCorrectPercentageX100);

            totalDefeatMonsterCount.text = string.Format("总计击败怪物: {0}", playRecord.totalDefeatMonsterCount);

            evaluateStringText.text = string.Format("综合评分: <color=orange>{0}</color>", playRecord.evaluateString);

            maxHealtRecordText.text = playRecord.maxHealth.ToString();

            maxManaRecordText.text = playRecord.maxMana.ToString();

            attackRecordText.text = playRecord.attack.ToString();

            magicAttackRecordText.text = playRecord.magicAttack.ToString();

            armorRecordText.text = playRecord.armor.ToString();

            magicResistRecordText.text = playRecord.magicResist.ToString();

            armorDecreaseRecordText.text = playRecord.armorDecrease.ToString();

            magicResistDecreaseRecordText.text = playRecord.magicResistDecrease.ToString();

            dodgeRecordText.text = string.Format("{0}%", (playRecord.dodge * 100).ToString("0.0"));

            critRecordText.text = string.Format("{0}%", (playRecord.crit * 100).ToString("0.0"));

            extraGoldRecordText.text = playRecord.extraGold.ToString();

            extraExperienceRecordText.text = playRecord.extraExperience.ToString();

            healthRecoveryRecordText.text = playRecord.healthRecovery.ToString();

            magicRecoveryRecordText.text = playRecord.magicRecovery.ToString();

            int equipmentCellIndex = 0;


            // 重置所有装备槽
            for (int i = 0; i < equipmentCells.Length; i++)
            {
                EquipmentCellInRecord cellInRecord = equipmentCells[i];

                cellInRecord.Reset();
            }

            // 根据通关时的装备创建装备槽
            if (playRecord.equipedEquipments != null)
            {
                for (int i = 0; i < playRecord.equipedEquipments.Count; i++)
                {
                    Equipment equipment = playRecord.equipedEquipments[i];

                    if (equipment.itemId < 0)
                    {
                        continue;
                    }

                    EquipmentCellInRecord cellInRecord = equipmentCells[equipmentCellIndex];

                    // 初始化装备槽
                    cellInRecord.SetUpEquipmentCellInRecord(equipment);

                    equipmentCellIndex++;
                }
            }


            // 重置所有的技能槽
            for (int i = 0; i < skillCells.Length; i++)
            {
                SkillCellInRecord cellInRecord = skillCells[i];
                cellInRecord.Reset();
            }

            // 根据通关时的技能创建技能槽
            if (playRecord.learnedSkillRecords != null)
            {
                for (int i = 0; i < playRecord.learnedSkillRecords.Count; i++)
                {
                    SkillModel skillModel = playRecord.learnedSkillRecords[i];

                    int skillLevel = skillModel.skillLevel;

                    Skill skill = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj)
                    {
                        return(obj.skillId == skillModel.skillId);
                    });

                    if (skill == null)
                    {
                        continue;
                    }


                    SkillCellInRecord cellInRecord = skillCells[i];
                    // 初始化技能槽
                    cellInRecord.SetUpSkillCellInRecord(skill, skillLevel);
                }
            }

            this.gameObject.SetActive(true);

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

            zoomCoroutine = HUDZoomIn();

            StartCoroutine(zoomCoroutine);
        }
        private IEnumerator PlayTransition(string[] transitionStrings, CallBack finishTransitionCallBack)
        {
            if (transitionType != TransitionType.None && transitionType != TransitionType.VersionUpdate)
            {
                transitionPlaneMask.enabled = true;
                yield return(new WaitForSeconds(1.0f));

                transitionPlaneMask.enabled = false;
            }

            Transform loadingCanvas = TransformManager.FindTransform("LoadingCanvas");

            while (loadingCanvas != null)
            {
                yield return(null);
            }

            if (transitionType == TransitionType.ResetGameHint)
            {
                resetGameDataHintText.enabled = true;
            }
            else
            {
                resetGameDataHintText.enabled = false;
            }

            if (transitionStrings != null)
            {
                int totalSentenceCount = transitionStrings.Length;

                transitionTextContainer.localPosition = new Vector3(0, totalSentenceCount * heightBase / 2, 0);

                transitionPlaneMask.enabled = false;

                clickTintText.enabled = false;

                float alphaChangeSpeed = 1.0f / fadeInTime;

                float alpha = 0;

                for (int i = 0; i < totalSentenceCount; i++)
                {
                    Text t = Instantiate(transitionTextModel.gameObject, transitionTextContainer).GetComponent <Text>();

                    t.text = transitionStrings[i];

                    alpha = 0;


                    while (alpha < 1)
                    {
                        t.color = new Color(1, 1, 1, alpha);

                        //alpha += alphaChangeSpeed * Time.unscaledDeltaTime;
                        alpha += alphaChangeSpeed * Time.deltaTime;

                        yield return(null);
                    }

                    //yield return new WaitForSecondsRealtime(sentenceInterval);

                    yield return(new WaitForSeconds(sentenceInterval));
                }

                bool clickContinue = false;

                switch (transitionType)
                {
                case TransitionType.Introduce:
                    transitionPlaneMask.enabled       = true;
                    transitionPlaneMask.color         = new Color(0, 0, 0, 0);
                    transitionPlaneMask.raycastTarget = true;
                    clickTintText.text    = "点击屏幕继续";
                    clickTintText.enabled = true;
                    alpha         = 0.5f;
                    clickContinue = true;
                    break;

                case TransitionType.None:
                case TransitionType.VersionUpdate:
                case TransitionType.Death:
                    break;

                case TransitionType.End:
                    transitionPlaneMask.enabled       = true;
                    transitionPlaneMask.color         = new Color(0, 0, 0, 0);
                    transitionPlaneMask.raycastTarget = true;
                    clickTintText.text    = "点击屏幕重置进度";
                    clickTintText.enabled = true;
                    alpha         = 0.5f;
                    clickContinue = true;
                    break;

                case TransitionType.ResetGameHint:
                    transitionPlaneMask.enabled       = true;
                    transitionPlaneMask.color         = new Color(0, 0, 0, 0);
                    transitionPlaneMask.raycastTarget = true;
                    clickTintText.text    = "点击屏幕继续";
                    clickTintText.enabled = true;
                    alpha         = 0.5f;
                    clickContinue = true;
                    break;
                }

                // 如果需要点击屏幕才可以继续的情况
                if (clickContinue)
                {
                    while (!hasUserClick)
                    {
                        while (alpha < 1f)
                        {
                            clickTintText.color = new Color(1, 1, 1, alpha);

                            //alpha += alphaChangeSpeed * Time.unscaledDeltaTime / 2;

                            alpha += alphaChangeSpeed * Time.deltaTime / 2;

                            if (hasUserClick)
                            {
                                break;
                            }

                            yield return(null);
                        }

                        while (alpha > 0.5f)
                        {
                            clickTintText.color = new Color(1, 1, 1, alpha);

                            alpha -= alphaChangeSpeed * Time.deltaTime / 2;

                            if (hasUserClick)
                            {
                                break;
                            }

                            yield return(null);
                        }
                    }
                }

                alpha = 0;

                while (alpha < 1)
                {
                    transitionPlaneMask.color = new Color(0, 0, 0, alpha);

                    //alpha += alphaChangeSpeed * Time.unscaledDeltaTime;
                    alpha += alphaChangeSpeed * Time.deltaTime;

                    yield return(null);
                }
            }

            switch (transitionType)
            {
            case TransitionType.Introduce:
            case TransitionType.VersionUpdate:
                GameManager.Instance.soundManager.PlayBgmAudioClip(CommonData.exploreBgmName);
                Player.mainPlayer.isNewPlayer = false;
                GameManager.Instance.persistDataManager.SaveCompletePlayerData();
                break;

            case TransitionType.None:
            case TransitionType.Death:
                break;

            case TransitionType.End:
                PlayRecord        playRecord  = new PlayRecord();
                List <PlayRecord> playRecords = GameManager.Instance.gameDataCenter.allPlayRecords;
                playRecords.Add(playRecord);
                GameManager.Instance.persistDataManager.SavePlayRecords(playRecords);
                break;

            case TransitionType.ResetGameHint:
                break;
            }

            if (finishTransitionCallBack != null)
            {
                finishTransitionCallBack();
            }


            this.gameObject.SetActive(false);

            for (int i = 0; i < transitionTextContainer.childCount; i++)
            {
                Destroy(transitionTextContainer.GetChild(i).gameObject, 0.3f);
            }
        }