少年修仙传客户端代码仓库
client_linchunjie
2018-08-18 f4f07847775c12b338d8bccedbbabc067dc1ae2c
System/Treasure/TreasureNewGotWin.cs
@@ -39,22 +39,7 @@
        [SerializeField] RectTransform m_ContainerFuncUnLock;
        [SerializeField] Slider m_FuncUnLockSlider;
        [SerializeField] Text m_UnlockTip;
        [SerializeField] RectTransform m_ContainerFunc;
        [SerializeField] UIAlphaTween m_FadeInFunc;
        [SerializeField] Image m_FuncIcon;
        [SerializeField] Text m_FuncName;
        [SerializeField] RectTransform m_ContainerSkill;
        [SerializeField] UIAlphaTween m_FadeInSkill;
        [SerializeField] Image m_SkillIcon;
        [SerializeField] Text m_SKillName;
        [SerializeField] Text m_SkillDescription;
        [SerializeField] RectTransform m_ContainerSpecial;
        [SerializeField] UIAlphaTween m_FadeInSpecial;
        [SerializeField] Image m_SpecialIcon;
        [SerializeField] Text m_SpecialName;
        [SerializeField] Text m_SpecialDescription;
        [SerializeField] TreasureNewGotBehaviour[] m_TreasureNewGots;
        [SerializeField] RectTransform m_ContianerStory;
        [SerializeField] UIAlphaTween m_FadeInStory;
@@ -73,6 +58,8 @@
        Treasure treasure;
        TreasureStage treasureStage;
        int displayStageCount = 0;
        float stageTime = 0.7f;
        public static event Action CloseTreasureNewGotWinEvent;
        ShowStep m_ShowStep = ShowStep.None;
@@ -99,20 +86,14 @@
                        case ShowStep.ShowNameAndSliderUnlock:
                            OnEnterShowNameAndSliderUnlock();
                            break;
                        case ShowStep.ShowFunc:
                        case ShowStep.ShowUnlock:
                            OnEnterShowFuncUnlock();
                            break;
                        case ShowStep.ShowSkill:
                            OnEnterShowSkill();
                            break;
                        case ShowStep.ShowSpecialEffect:
                            OnEnterShowSpecialEffect();
                            break;
                        case ShowStep.ShowStory:
                            OnEnterShowStory();
                            break;
                        case ShowStep.ShowUnlock:
                            OnEnterShowUnlock();
                        case ShowStep.ShowComplete:
                            OnEnterShowComplete();
                            break;
                        case ShowStep.FadeOut:
                            OnEnterFadeOut();
@@ -126,7 +107,6 @@
            }
        }
        float beforeSliderTime = 0;
        #region Built-in
        protected override void BindController()
        {
@@ -147,14 +127,16 @@
            m_ContainerMask.gameObject.SetActive(false);
            m_ContainerDescription.gameObject.SetActive(false);
            m_ContainerTreasureName.gameObject.SetActive(false);
            m_ContainerSkill.gameObject.SetActive(false);
            m_ContianerStory.gameObject.SetActive(false);
            m_ContainerFuncUnLock.gameObject.SetActive(false);
            m_ContainerFunc.gameObject.SetActive(false);
            m_ContainerSpecial.gameObject.SetActive(false);
            m_UnlockTip.gameObject.SetActive(false);
            m_ContainerFinishShow.gameObject.SetActive(false);
            m_ContainerFightPower.gameObject.SetActive(false);
            for (int i = 0; i < m_TreasureNewGots.Length; i++)
            {
                m_TreasureNewGots[i].gameObject.SetActive(false);
            }
            model.TryGetTreasure(model.newGotTreasureId, out treasure);
            treasureStage = treasure.treasureStages.Find((x) =>
@@ -250,54 +232,35 @@
                    }
                    break;
                case ShowStep.ShowNameAndSliderUnlock:
                    m_FuncUnLockSlider.value = timer / 2.8f;
                    m_FuncUnLockSlider.value = 0;
                    if (timer > 0.7f)
                    {
                        beforeSliderTime += 0.7f;
                        timer = 0f;
                        showStep = ShowStep.ShowFunc;
                    }
                    break;
                case ShowStep.ShowFunc:
                    m_FuncUnLockSlider.value = (timer + beforeSliderTime) / 2.8f;
                    if (timer > 0.7f)
                    {
                        beforeSliderTime += 0.7f;
                        timer = 0f;
                        showStep = ShowStep.ShowSkill;
                    }
                    break;
                case ShowStep.ShowSkill:
                    m_FuncUnLockSlider.value = (timer + beforeSliderTime) / 2.8f;
                    if (timer > 0.7f)
                    {
                        beforeSliderTime += 0.7f;
                        timer = 0f;
                        showStep = ShowStep.ShowSpecialEffect;
                    }
                    break;
                case ShowStep.ShowSpecialEffect:
                    m_FuncUnLockSlider.value = (timer + beforeSliderTime) / 2.8f;
                    if (timer > 0.7f)
                    {
                        beforeSliderTime += 0.7f;
                        timer = 0f;
                        showStep = ShowStep.ShowUnlock;
                    }
                    break;
                case ShowStep.ShowStory:
                    if (timer > 0.7f)
                    {
                        beforeSliderTime = 3f;
                        timer = 0f;
                        showStep = ShowStep.ShowUnlock;
                    }
                    break;
                case ShowStep.ShowUnlock:
                    if (timer + beforeSliderTime <= 2.8f)
                    m_FuncUnLockSlider.value = timer / (3 * stageTime);
                    if (timer > 3 * stageTime)
                    {
                        m_FuncUnLockSlider.value = (timer + beforeSliderTime) / 2.8f;
                        timer = 0f;
                        showStep = ShowStep.ShowComplete;
                    }
                    var index = (int)(timer / stageTime);
                    if (index < displayStageCount && index < m_TreasureNewGots.Length
                        && !m_TreasureNewGots[index].gameObject.activeSelf)
                    {
                        m_TreasureNewGots[index].Show();
                    }
                    break;
                case ShowStep.ShowStory:
                    if (timer > 0.7f)
                    {
                        timer = 0f;
                        showStep = ShowStep.ShowComplete;
                    }
                    break;
                case ShowStep.ShowComplete:
                    if (timer > 10f)
                    {
                        timer = 0f;
@@ -321,7 +284,6 @@
        {
            showStep = ShowStep.ShowModel;
            timer = 0f;
            beforeSliderTime = 0;
            var config = ConfigManager.Instance.GetTemplate<TreasureConfig>(treasure.id);
            m_TreasureName.text = config.Name;
@@ -342,34 +304,27 @@
            var _flyObjectPoint = m_FlyObjectPoint2;
            if (treasure.unLockSkill > 0)
            var index = 0;
            displayStageCount = 0;
            for (int i = 0; i < m_TreasureNewGots.Length; i++)
            {
                var skillConfig = ConfigManager.Instance.GetTemplate<SkillConfig>(treasure.unLockSkill);
                m_SkillIcon.SetSprite(skillConfig.IconName);
                m_SKillName.text = skillConfig.SkillName;
                m_SkillDescription.text = skillConfig.Description;
                m_ContainerSkill.gameObject.SetActive(true);
                m_FadeInSkill.SetStartState();
            }
            if (treasure.unLockFunc > 0)
            {
                var funcConfig = ConfigManager.Instance.GetTemplate<FuncOpenLVConfig>(treasure.unLockFunc);
                m_FuncIcon.SetSprite(funcConfig.Icon);
                m_FuncName.text = funcConfig.Remark;
                m_ContainerFunc.gameObject.SetActive(true);
                m_FadeInFunc.SetStartState();
                _flyObjectPoint = m_FlyObjectPoint3;
            }
            if (treasure.unLockPrivilege > 0)
            {
                var privilegeConfig = ConfigManager.Instance.GetTemplate<TreasurePrivilegeConfig>(treasure.unLockPrivilege);
                m_SpecialIcon.SetSprite(privilegeConfig.Icon);
                m_SpecialName.text = privilegeConfig.Name;
                m_SpecialDescription.text = privilegeConfig.Description;
                m_ContainerSpecial.gameObject.SetActive(true);
                m_FadeInSpecial.SetStartState();
                TreasureStage _stage = null;
                for (int k = index; k < treasure.treasureStages.Count; k++)
                {
                    index++;
                    if (treasure.treasureStages[k].unlockType == TreasureStageUnlock.Func ||
                        treasure.treasureStages[k].unlockType == TreasureStageUnlock.Skill ||
                        treasure.treasureStages[k].unlockType == TreasureStageUnlock.Treasure)
                    {
                        _stage = treasure.treasureStages[k];
                        displayStageCount++;
                        break;
                    }
                }
                if (_stage != null)
                {
                    m_TreasureNewGots[i].Display(treasure.id, _stage.stage);
                }
            }
            if (treasureStage != null && (TreasureCategory)config.Category != TreasureCategory.Fairy
@@ -407,15 +362,15 @@
                            m_Story.text = string.Format(config.Verse[0], killNpcConfig.MaxAtk);
                        }
                        break;
                    case 304:
                        var _specialData = treasure.specialData;
                        if (_specialData != null)
                        {
                            var _keyValue = _specialData.propertyDict.First();
                            var _propertyConfig = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(_keyValue.Key);
                            m_Story.text = string.Format(config.Verse[0], _keyValue.Value, _propertyConfig.Name);
                        }
                        break;
                    //case 304://签到相关配置移到功能配置表
                    //    var _specialData = treasure.specialData;
                    //    if (_specialData != null)
                    //    {
                    //        var _keyValue = _specialData.propertyDict.First();
                    //        var _propertyConfig = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(_keyValue.Key);
                    //        m_Story.text = string.Format(config.Verse[0], _keyValue.Value, _propertyConfig.Name);
                    //    }
                    //    break;
                }
                flyObject = unlockFlyObject1;
            }
@@ -423,7 +378,7 @@
        private void FinishShow()
        {
            if (showStep == ShowStep.ShowUnlock)
            if (showStep == ShowStep.ShowComplete)
            {
                timer = 0f;
                showStep = ShowStep.FadeOut;
@@ -482,28 +437,9 @@
                showStep = ShowStep.ShowStory;
                return;
            }
            if (treasure.unLockFunc > 0)
            if (displayStageCount == 0)
            {
                m_FadeInFunc.SetStartState();
                m_FadeInFunc.Play();
            }
            else
            {
                showStep = ShowStep.ShowSkill;
            }
        }
        private void OnEnterShowSkill()
        {
            if (treasure.unLockSkill > 0)
            {
                m_ContainerSkill.gameObject.SetActive(true);
                m_FadeInSkill.SetStartState();
                m_FadeInSkill.Play();
            }
            else
            {
                showStep = ShowStep.ShowSpecialEffect;
                showStep = ShowStep.ShowComplete;
            }
        }
@@ -516,22 +452,6 @@
            m_UnlockTip.gameObject.SetActive(true);
        }
        private void OnEnterShowSpecialEffect()
        {
            m_ContainerSkill.gameObject.SetActive(treasure.unLockSkill > 0);
            if (treasure.unLockPrivilege > 0)
            {
                m_ContainerSpecial.gameObject.SetActive(true);
                m_FadeInSpecial.SetStartState();
                m_FadeInSpecial.Play();
            }
            else
            {
                showStep = ShowStep.ShowUnlock;
            }
        }
        private void OnEnterShowStory()
        {
            m_ContianerStory.gameObject.SetActive(true);
@@ -539,7 +459,7 @@
            m_FadeInStory.Play();
        }
        private void OnEnterShowUnlock()
        private void OnEnterShowComplete()
        {
            m_ContainerFinishShow.gameObject.SetActive(true);
        }
@@ -566,11 +486,9 @@
            ShowModel,
            SliderName,
            ShowNameAndSliderUnlock,
            ShowFunc,
            ShowSkill,
            ShowSpecialEffect,
            ShowStory,
            ShowUnlock,
            ShowStory,
            ShowComplete,
            FadeOut,
            FlyTo,
        }