少年修仙传客户端代码仓库
client_linchunjie
2018-09-25 78bfe524ea4776c47f6314e56e97f39970b00fce
System/Treasure/TreasurePotentialPanel.cs
@@ -84,7 +84,8 @@
                    var level = potential.level;
                    var isMax = level >= config.SkillMaxLV;
                    m_PotentialMaxLevelTip.gameObject.SetActive(isMax);
                    m_ContainerUpgrade.gameObject.SetActive(!isMax && FuncOpen.Instance.IsFuncOpen(82));
                    m_ContainerUpgrade.gameObject.SetActive(!isMax &&
                        FuncOpen.Instance.IsFuncOpen(82) && model.IsPotentialUnlock(m_Treasure.id, selectedPotential));
                    m_ContainerRequirement.gameObject.SetActive(!isMax);
                    if (!isMax)
@@ -93,7 +94,6 @@
                        DisplayUpgradeCost();
                        DisplayGetSkill();
                        DisplaySuccessRatio();
                        m_UpgradeImage.gray = !TestPotentialLevelUp();
                    }
                    else
                    {
@@ -526,13 +526,18 @@
            {
                return;
            }
            if (config.InitialRate >= 100)
            {
                model.selectedPotentialBook = 0;
                return;
            }
            var itemId = config.Meterial2ID.Length > 0 ? config.Meterial2ID[0] : 0;
            if (itemId != 0)
            {
                var own = playerPack.GetItemCountByID(PackType.rptItem, itemId);
                var need = config.MeterialNum2[0];
                //var own = playerPack.GetItemCountByID(PackType.rptItem, itemId);
                //var need = config.MeterialNum2[0];
                var rate = config.Rate[0];
                if (rate >= 60 && own >= need)
                if (rate >= 60)
                {
                    model.selectedPotentialBook = itemId;
                }
@@ -550,7 +555,6 @@
            m_SPOwn.text = UIHelper.ReplaceLargeNum(spOwn);
            m_SPNeed.text = StringUtility.Contact("/", UIHelper.ReplaceLargeNum(spNeed));
            m_SPOwn.color = spOwn >= spNeed ? UIHelper.GetUIColor(TextColType.DarkGreen) : UIHelper.GetUIColor(TextColType.Red);
            m_UpgradeImage.gray = spOwn < spNeed;
        }
        private void DisplayGetSkill(bool _levelUp = false)
@@ -591,9 +595,11 @@
        {
            var levelUpConfig = GetPotentialLevelUpConfig();
            m_SuccessRatio.text = StringUtility.Contact((levelUpConfig.rate * 0.01f).ToString("f0"), "%");
            m_RatioUp.gameObject.SetActive(model.selectedPotentialBook != 0);
            m_SuccessRatio.color = UIHelper.GetUIColor(model.selectedPotentialBook != 0 ? TextColType.DarkGreen : TextColType.LightYellow);
            m_UpgradeImage.gray = !TestPotentialLevelUp();
            m_RatioUp.gameObject.SetActive(model.selectedPotentialBook != 0 && levelUpConfig.rate > 0 && levelUpConfig.materilaKind > 1);
            m_SuccessRatio.color = UIHelper.GetUIColor(model.selectedPotentialBook != 0 && levelUpConfig.rate > 0
                ? TextColType.DarkGreen : TextColType.LightYellow);
            m_UpgradeImage.gray = levelUpConfig.rate == 0 && model.selectedPotentialBook == 0;
            m_Upgrade.interactable = levelUpConfig.rate != 0 || model.selectedPotentialBook != 0;
        }
        private void DisplayAddBookRedpoint()
@@ -616,14 +622,25 @@
        private void OnSpNeedItem()
        {
            var levelUpConfig = GetPotentialLevelUpConfig();
            if (levelUpConfig.rate < 10000 || model.selectedPotentialBook != 0)
            if (levelUpConfig.rate >= 10000)
            {
                SysNotifyMgr.Instance.ShowTip("SPSuccessHint");
                return;
            }
            if (model.selectedPotentialBook == 0)
            {
                WindowCenter.Instance.Open<PotentialItemUseWin>();
            }
            else
            {
                SysNotifyMgr.Instance.ShowTip("SPSuccessHint");
                //DesignDebug.Log("成功率已经够高了,不需要再增加概率了!");
                if (levelUpConfig.materilaKind > 1)
                {
                    WindowCenter.Instance.Open<PotentialItemUseWin>();
                }
                else
                {
                    ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(model.selectedPotentialBook);
                }
            }
        }
@@ -636,7 +653,7 @@
        {
            m_PotentialBook.gameObject.SetActive(_potentialBookId != 0);
            m_PotentialCount.gameObject.SetActive(_potentialBookId != 0);
            m_RemoveBook.gameObject.SetActive(_potentialBookId != 0);
            m_RemoveBook.gameObject.SetActive(false);
            m_AddBookSign.gameObject.SetActive(_potentialBookId == 0);
            if (_potentialBookId != 0)
            {
@@ -644,7 +661,10 @@
                m_PotentialBook.SetItem(_potentialBookId, 1);
                var levelUpConfig = GetPotentialLevelUpConfig();
                m_PotentialCount.text = StringUtility.Contact(levelUpConfig.own, "/", levelUpConfig.need);
                bool satisfy = levelUpConfig.own >= levelUpConfig.need;
                m_PotentialCount.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(satisfy ?
                    TextColType.LightYellow : TextColType.Red, levelUpConfig.own.ToString()), "/", levelUpConfig.need);
                m_RemoveBook.gameObject.SetActive(levelUpConfig.materilaKind > 1);
            }
            DisplaySuccessRatio();
@@ -657,10 +677,14 @@
            if (packType == PackType.rptItem && config != null && config.Type == 6)
            {
                var levelUpConfig = GetPotentialLevelUpConfig();
                if (levelUpConfig.own < levelUpConfig.need)
                if (_id == model.selectedPotentialBook)
                {
                    model.selectedPotentialBook = 0;
                    DisplayPotentialBook(model.selectedPotentialBook);
                }
                //if (levelUpConfig.own < levelUpConfig.need)
                //{
                //    model.selectedPotentialBook = 0;
                //}
            }
        }
@@ -687,13 +711,21 @@
                        }
                        break;
                    case 3:
                        MessageWin.Inst.ShowFixedTip(Language.Get("Hallows_SpUnEnough"));
                        ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(148);
                        //MessageWin.Inst.ShowFixedTip(Language.Get("Hallows_SpUnEnough"));
                        break;
                    case 4:
                        SysNotifyMgr.Instance.ShowTip("TreasureUnsealed");
                        break;
                    case 6:
                        SysNotifyMgr.Instance.ShowTip("LevelUpZeroRate");
                        if (model.selectedPotentialBook != 0)
                        {
                            ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(model.selectedPotentialBook);
                        }
                        else
                        {
                            SysNotifyMgr.Instance.ShowTip("LevelUpZeroRate");
                        }
                        break;
                }
@@ -742,11 +774,11 @@
            var config = Config.Instance.Get<TreasureSkillConfig>(levelupId);
            if (config == null)
            {
                return new PotentialLevelUpConfig(0, 0, 0, 0);
                return new PotentialLevelUpConfig(0, 0, 0, 0, 0);
            }
            if (model.selectedPotentialBook == 0)
            {
                return new PotentialLevelUpConfig(config.InitialRate, 0, 0, 0);
                return new PotentialLevelUpConfig(config.InitialRate, 0, 0, 0, 0);
            }
            else
            {
@@ -764,7 +796,7 @@
                var need = config.MeterialNum2[index];
                var ratio = own >= need ? config.Rate[index] : config.InitialRate;
                return new PotentialLevelUpConfig(ratio, index + 1, own, need);
                return new PotentialLevelUpConfig(ratio, index + 1, own, need, config.Meterial2ID.Length);
            }
        }
@@ -840,9 +872,10 @@
            }
            var levelUpConfig = GetPotentialLevelUpConfig();
            if (levelUpConfig.own < levelUpConfig.need || !ContainsPotentialBook(model.selectedPotentialBook))
            if (!ContainsPotentialBook(model.selectedPotentialBook))
            {
                model.selectedPotentialBook = 0;
                AutoSelectPotentialBook();
                //model.selectedPotentialBook = 0;
            }
            var curconfig = Config.Instance.Get<SkillConfig>(potential.id);
@@ -924,7 +957,6 @@
                    m_SPOwn.text = UIHelper.ReplaceLargeNum(spOwn);
                    m_SPNeed.text = StringUtility.Contact("/", UIHelper.ReplaceLargeNum(spNeed));
                    m_SPOwn.color = spOwn >= spNeed ? UIHelper.GetUIColor(TextColType.DarkGreen) : UIHelper.GetUIColor(TextColType.Red);
                    m_UpgradeImage.gray = !TestPotentialLevelUp();
                    break;
            }
        }
@@ -1030,13 +1062,15 @@
            public int rate;
            public int need;
            public int own;
            public int materilaKind;
            public PotentialLevelUpConfig(int _rate, int _materilaIndex, int _own, int _need)
            public PotentialLevelUpConfig(int _rate, int _materilaIndex, int _own, int _need,int materilaKind)
            {
                this.rate = _rate;
                this.materilaIndex = _materilaIndex;
                this.need = _need;
                this.own = _own;
                this.materilaKind = materilaKind;
            }
        }
        [Serializable]