zhangyuqian 1 жил өмнө
parent
commit
121e40ee54

+ 121 - 0
GameClient/Assets/Game/HotUpdate/Data/CollectPartDataManager.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using System.Text.RegularExpressions;
 
 namespace GFGGame
 {
@@ -130,5 +131,125 @@ namespace GFGGame
             }
             return addNum + 1;
         }
+        //判断部分是否可以升级
+        public bool CheckPartCanUP(int pardId)
+        {
+            int rankIndex = CollectPartDataDic[pardId][0];
+            int rankLv = CollectPartDataDic[pardId][1];
+            if (rankLv + 1 > CollectPartDataManager.Instance.MaxLevel)
+            {
+                rankIndex += 1;
+                rankLv = 1;
+            }
+            else
+            {
+                rankLv += 1;
+            }
+            CollegeBoostCfg collegeBoostCfg = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(pardId,rankIndex,rankLv);
+            if (collegeBoostCfg == null)
+            {
+                return false;
+            }
+            for (int i = 0; i < collegeBoostCfg.consumeArr.Length; i++)
+            {
+                ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(collegeBoostCfg.consumeArr[i][0]);
+                ItemData itemCount;
+                long count;
+                if (itemCfg.itemType == ConstItemType.DRESS_UP)
+                {
+                    count = ItemDataManager.GetItemNum(collegeBoostCfg.consumeArr[i][0]);
+                }
+                else
+                {
+                    if (BagDataManager.Instance.GetBagData().TryGetValue(collegeBoostCfg.consumeArr[i][0], out itemCount))
+                    {
+                        count = itemCount.num;
+                    }
+                    else
+                    {
+                        count = 0;
+                    }
+                }
+                if(count < collegeBoostCfg.consumeArr[i][1])
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        //判断所有已开启部位是否可以升级
+        public bool CheckAllOpenPartCanUP()
+        {
+            if(!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingSelectView).Name, false))
+            {
+                return false;
+            }
+            foreach(var item in CollectPartDataDic)
+            {
+                if(IsOpenRank(item.Key))
+                {
+                    if(CheckPartCanUP(item.Key))
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+        public bool IsOpenRank(int partIndex, int levelNum = 9)
+        {
+            List<int> openList;
+            bool isRank = false;
+            bool isLevel = false;
+            bool isPassStory = false;
+            CollegeRankOpenCfg openitem = CollegeRankOpenCfgArray.Instance.GetCfg(partIndex);
+            openList = GetOpenList(partIndex);
+            //判断段位
+            if (openitem.OpenPreconditionArr == null || openitem.OpenPreconditionArr.Length == 0)
+            {
+                isRank = true;
+            }
+            else
+            {
+                if (CollectPartDataDic[openList[0]][0] >= openList[1])
+                {
+                    if (CollectPartDataDic[openList[0]][1] >= openList[2])
+                    {
+                        isRank = true;
+                    }
+                }
+            }
+            //判断等级
+            if (RoleDataManager.lvl >= openitem.needRoleLv)
+            {
+                isLevel = true;
+            }
+            //判断关卡
+            if (openitem.needStoryLevelId == 0 || InstanceZonesDataManager.CheckLevelPass(openitem.needStoryLevelId))
+            {
+                isPassStory = true;
+            }
+            else
+            {
+                isPassStory = false;
+            }
+
+            return isRank && isLevel && isPassStory;
+        }
+        public List<int> GetOpenList(int partIndex)
+        {
+            List<int> openList = new List<int>();
+            string pattern = @"\d+";
+            CollegeRankOpenCfg openitem = CollegeRankOpenCfgArray.Instance.GetCfg(partIndex);
+            for (int i = 0; i < openitem.OpenPreconditionArr.Length; i++)
+            {
+                MatchCollection matches = Regex.Matches(openitem.OpenPreconditionArr[i], pattern);
+                foreach (Match match in matches)
+                {
+                    openList.Add(int.Parse(match.Value));
+                }
+            }
+            return openList;
+        }
     }
 }

+ 27 - 2
GameClient/Assets/Game/HotUpdate/Data/RedDotDataManager.cs

@@ -319,7 +319,7 @@ namespace GFGGame
         public bool GetCardRed(int cardId)
         {
             // GetCardUpStarRed(cardId) || GetCardUpLvRed(cardId) ||
-            return GetCardStarReward(cardId) || GetCardSkillsRed(cardId) ;
+            return GetCardStarReward(cardId) || GetCardSkillsRed(cardId) || CheckCardCanSynthetic(cardId);
         }
 
         /// <summary>
@@ -628,7 +628,32 @@ namespace GFGGame
             }
             return true;
         }
-
+        /// <summary>
+        /// 卡牌合成红点
+        /// </summary>
+        /// <param name="itemId"></param>
+        /// <param name="showTips"></param>
+        /// <returns></returns>
+        public bool CheckCardCanSynthetic(int itemId)
+        {
+            //合成材料判断
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
+            if (itemCfg == null || ItemDataManager.GetItemNum(itemCfg.syntheticCostID) < itemCfg.syntheticCostNum)
+            {
+                return false;
+            }
+            List<ItemData> materiarsOfSelectedItem = ItemUtil.CreateItemDataList(itemCfg.syntheticMateriarsArr);
+            for (int i = 0; i < materiarsOfSelectedItem.Count; i++)
+            {
+                ItemData itemData = materiarsOfSelectedItem[i];
+                long numSynthetic = ItemDataManager.GetItemNum(itemData.id);
+                if (numSynthetic < itemData.num)
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
         /// <summary>
         /// 商城
         /// </summary>

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CardSynthetic/UI_CardSyntheticUI.cs

@@ -26,6 +26,7 @@ namespace UI.CardSynthetic
         public GTextField m_skillCountText;
         public GLoader m_skillIcon;
         public GTextField m_timesText;
+        public GTextField m_descText;
         public GButton m_btnBack;
         public GButton m_btnHome;
         public GComponent m_valueBar;
@@ -97,6 +98,7 @@ namespace UI.CardSynthetic
             m_skillCountText = (GTextField)comp.GetChild("skillCountText");
             m_skillIcon = (GLoader)comp.GetChild("skillIcon");
             m_timesText = (GTextField)comp.GetChild("timesText");
+            m_descText = (GTextField)comp.GetChild("descText");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_btnHome = (GButton)comp.GetChild("btnHome");
             m_valueBar = (GComponent)comp.GetChild("valueBar");
@@ -125,6 +127,7 @@ namespace UI.CardSynthetic
             m_skillCountText = null;
             m_skillIcon = null;
             m_timesText = null;
+            m_descText = null;
             m_btnBack = null;
             m_btnHome = null;
             m_valueBar = null;

+ 2 - 2
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ClothingSynthetic/UI_ClothingSyntheticListUI.cs

@@ -8,7 +8,7 @@ namespace UI.ClothingSynthetic
     {
         public GComponent target;
         public GLoader m_loaBg;
-        public GComponent m_btnBack;
+        public GButton m_btnBack;
         public GList m_listMenu;
         public GList m_listSuit;
         public const string URL = "ui://4f294tdkj5390";
@@ -59,7 +59,7 @@ namespace UI.ClothingSynthetic
         private void Init(GComponent comp)
         {
             m_loaBg = (GLoader)comp.GetChild("loaBg");
-            m_btnBack = (GComponent)comp.GetChild("btnBack");
+            m_btnBack = (GButton)comp.GetChild("btnBack");
             m_listMenu = (GList)comp.GetChild("listMenu");
             m_listSuit = (GList)comp.GetChild("listSuit");
         }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Card/CardDetailView.cs

@@ -147,7 +147,7 @@ namespace GFGGame
             listItem.m_txtLv.text = data.lv + "级";
             listItem.m_txtName.text = data.itemCfg.name;
             RedDotController.Instance.SetComRedDot(listItem.target, RedDotDataManager.Instance.GetCardRed(data.id), "", 5, -10);
-
+            RedDotController.Instance.SetComRedDot(listItem.target, RedDotDataManager.Instance.CheckCardCanSynthetic(data.id), "", 5, -10);
             listItem.m_rarity.selectedIndex = data.itemCfg.rarity;
 
             if (data.itemCfg.rarity == 5)

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -1284,7 +1284,7 @@ namespace GFGGame
             //RedDotController.Instance.SetComRedDot(_ui.m_ComFosterBottom.m_btnLv, RedDotDataManager.Instance.GetCardUpLvRed(_cardData.id), "", 0, 0);
             //RedDotController.Instance.SetComRedDot(_ui.m_ComFosterBottom.m_btnStar, RedDotDataManager.Instance.GetCardUpStarRed(_cardData.id), "", 0, 0);
             RedDotController.Instance.SetComRedDot(_ui.m_ComFosterBottom.m_btnSkill, RedDotDataManager.Instance.GetCardSkillsRed(_cardData.id), "", 0, 0);
-
+            RedDotController.Instance.SetComRedDot(_ui.m_cardSyntheticBtn, RedDotDataManager.Instance.CheckCardCanSynthetic(_cardData.id),"",-10,10);
         }
         protected override void OnHide()
         {

+ 14 - 0
GameClient/Assets/Game/HotUpdate/Views/Card/CardSyntheticView.cs

@@ -175,6 +175,7 @@ namespace GFGGame
             }
             _ui.m_skillCountText.text = string.Format("已拥有:{0}", count.ToString());
             UpdateSelectedItemInfo();
+            RedDotController.Instance.SetComRedDot(_ui.m_btnProduction, RedDotDataManager.Instance.CheckCardCanSynthetic(_cardId),"");
         }
 
         private void UpdateSelectedItemInfo()
@@ -294,7 +295,20 @@ namespace GFGGame
             cardSyntheticCount = response;
             //这里应该是制作卡牌次数
             _ui.m_btnProduction.grayed = cardSyntheticCount > _cardItem.syntheticTimes;
+            RedDotController.Instance.SetComRedDot(_ui.m_btnProduction, RedDotDataManager.Instance.CheckCardCanSynthetic(_cardId), "");
             _ui.m_timesText.text = string.Format("合成次数:{0}/{1}", cardSyntheticCount, _cardItem.syntheticTimes);
+            ItemData itemCount;
+            long count;
+            if (BagDataManager.Instance.GetBagData().TryGetValue(_cardItem.transItem, out itemCount))
+            {
+                count = itemCount.num;
+            }
+            else
+            {
+                count = 0;
+            }
+            _ui.m_skillCountText.text = string.Format("已拥有:{0}", count.ToString());
+
         }
         private async void GetCardSyntheticCount(int cardID)
         {

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/ClothingUpgarde/ClothingSelectView.cs

@@ -96,6 +96,7 @@ namespace GFGGame
             if (IsOpenRank(partIndex2))
             {
                 listItem.target.visible = true;
+                RedDotController.Instance.SetComRedDot(listItem.target, CollectPartDataManager.Instance.CheckPartCanUP(partIndex2), "");
                 if (levelNum > 0)
                 {
                     addNum = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(partIndex2, level, levelNum).value;

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingUpgarde/ClothingUpgradeView.cs

@@ -129,7 +129,8 @@ namespace GFGGame
         private void UpdateView()
         {
             _ui.m_c1.selectedIndex = status;
-             
+            RedDotController.Instance.SetComRedDot(_ui.m_levelUpBtn, CollectPartDataManager.Instance.CheckPartCanUP(_partIndex),"");
+            RedDotController.Instance.SetComRedDot(_ui.m_upgradeBtn, CollectPartDataManager.Instance.CheckPartCanUP(_partIndex), "");
             string name = CollegeRankCfgArray.Instance.GetCfgByRankPartsIdAndSecondLevelRank(partIndexCommon, level).gradeName;
             string partName = CollectPartDataManager.Instance.partNameDic[_partIndex];
             _ui.m_desc1Text.text = string.Format("{0}{1}级", name,levelNum);

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -1098,7 +1098,7 @@ namespace GFGGame
             RedDotController.Instance.SetComRedDot(_ui.m_btnWanShiLi.target, RedDotDataManager.Instance.GetActivityWanShiLiRed(), "", -24, -9);
 
             if (redPointUpdateFrame == 13)
-                RedDotController.Instance.SetComRedDot(_ui.m_btnXiuFang.target, RedDotDataManager.Instance.GetClothingFosterRed() || RedDotDataManager.Instance.GetClothingSyntheticRed(), "icon_tanhao", -17, 24);
+                RedDotController.Instance.SetComRedDot(_ui.m_btnXiuFang.target, RedDotDataManager.Instance.GetClothingFosterRed() || RedDotDataManager.Instance.GetClothingSyntheticRed() || CollectPartDataManager.Instance.CheckAllOpenPartCanUP() , "icon_tanhao", -17, 24);
 
             if (redPointUpdateFrame == 14)
             {
@@ -1109,7 +1109,7 @@ namespace GFGGame
             if (redPointUpdateFrame == 15)
             {
                 int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy);
-                Vector2 pos = new Vector2(-50, 33);
+                Vector2 pos = new Vector2(-30, 20);
                 if (activityId > 0)
                 {
                     pos = Vector2.zero;

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/XiuFang/XiuFangView.cs

@@ -128,6 +128,7 @@ namespace GFGGame
         {
             RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnClothingUpgrade.target, RedDotDataManager.Instance.GetClothingFosterRed(), "", 0, 30);
             RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnSuitSynthetic.target, RedDotDataManager.Instance.GetClothingSyntheticRed(), "", -54, 45);
+            RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnGYP.target, CollectPartDataManager.Instance.CheckAllOpenPartCanUP(), "",-10,10);
         }
 
         protected override void UpdateToCheckGuide(object param)

BIN
GameClient/Assets/ResIn/UI/CardSynthetic/CardSynthetic_fui.bytes


BIN
GameClient/Assets/ResIn/UI/ClothingSynthetic/ClothingSynthetic_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/ClothingSynthetic/ClothingSynthetic_atlas0.png


BIN
GameClient/Assets/ResIn/UI/ClothingSynthetic/ClothingSynthetic_fui.bytes


BIN
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_fui.bytes