Browse Source

词牌筛选

zhaoyang 2 years ago
parent
commit
af1cdd658f

+ 4 - 4
FGUIProject/assets/Card/CardFilterUI.xml

@@ -4,7 +4,7 @@
     <image id="n0_pq5x" name="n0" src="lwri5u" fileName="imagesExport/hc_kuang_6.png" pkg="mk0fwx0x" xy="0,0" size="936,938">
       <relation target="" sidePair="center-center,middle-middle"/>
     </image>
-    <component id="n1_pq5x" name="n1" src="ih7596" fileName="components/ComFilterType.xml" xy="45,72" group="n4_pq5x" pkg="eg2y0ldp">
+    <component id="n1_pq5x" name="n1" src="ih7596" fileName="components/ComFilterType.xml" pkg="eg2y0ldp" xy="45,72" group="n4_pq5x">
       <property target="txtName" propertyId="0" value="人物"/>
     </component>
     <list id="n3_pq5x" name="list0" xy="79,132" size="781,146" group="n4_pq5x" layout="flow_hz" selectionMode="multipleSingleClick" lineGap="21" colGap="20" defaultItem="ui://eg2y0ldppq5x6e" autoClearItems="true">
@@ -14,8 +14,8 @@
       <item/>
     </list>
     <group id="n4_pq5x" name="grp0" xy="45,72" size="815,206"/>
-    <component id="n5_pq5x" name="n5" src="ih7596" fileName="components/ComFilterType.xml" xy="48,315" group="n7_pq5x" pkg="eg2y0ldp">
-      <property target="txtName" propertyId="0" value="突出属性"/>
+    <component id="n5_pq5x" name="n5" src="ih7596" fileName="components/ComFilterType.xml" pkg="eg2y0ldp" xy="48,315" group="n7_pq5x">
+      <property target="txtName" propertyId="0" value="稀有度"/>
     </component>
     <list id="n6_pq5x" name="list1" xy="82,375" size="781,146" group="n7_pq5x" layout="flow_hz" selectionMode="multipleSingleClick" lineGap="21" colGap="20" defaultItem="ui://eg2y0ldppq5x6e" autoClearItems="true">
       <item/>
@@ -24,7 +24,7 @@
       <item/>
     </list>
     <group id="n7_pq5x" name="grp1" xy="48,315" size="815,206"/>
-    <component id="n8_pq5x" name="n8" src="ih7596" fileName="components/ComFilterType.xml" xy="48,558" group="n10_pq5x" pkg="eg2y0ldp">
+    <component id="n8_pq5x" name="n8" src="ih7596" fileName="components/ComFilterType.xml" pkg="eg2y0ldp" xy="48,558" group="n10_pq5x">
       <property target="txtName" propertyId="0" value="进化"/>
     </component>
     <list id="n9_pq5x" name="list2" xy="82,618" size="781,146" group="n10_pq5x" layout="flow_hz" selectionMode="multipleSingleClick" lineGap="21" colGap="20" defaultItem="ui://eg2y0ldppq5x6e" autoClearItems="true">

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -24,6 +24,7 @@ namespace GFGGame
         public const string CARD_CHOOSE = "CARD_CHOOSE";
         public const string CARD_SKILL = "CARD_SKILL";
         public const string CARD_REFRESH = "CARD_REFRESH";
+        public const string CARD_FILTER = "CARD_FILTER";
 
         public const string PLAT_CARDFOSTER_T1 = "PLAT_CARDFOSTER_T0";
         public const string CLOSE_PHOTOGRAPHVIEW = "CLOSE_PHOTOGRAPHVIEW";

+ 19 - 61
GameClient/Assets/Game/HotUpdate/Data/CardDataManager.cs

@@ -14,6 +14,10 @@ namespace GFGGame
         private static Dictionary<int, Dictionary<int, CardData>> _cardDicByType = new Dictionary<int, Dictionary<int, CardData>>();
 
         public static Dictionary<int, Dictionary<int, int>> _selectList = new Dictionary<int, Dictionary<int, int>>();
+        public static List<int> _selectRoleList = new List<int>();
+        public static List<int> _selectRarityList = new List<int>();
+        public static List<int> _selectFosterList = new List<int>();
+        public static bool isFilter = false;//是否筛选中
 
         private static Dictionary<int, List<CardStoryCfg>> _cardStoryCfgDic = new Dictionary<int, List<CardStoryCfg>>();
 
@@ -179,72 +183,26 @@ namespace GFGGame
             }
         }
 
-        public static List<CardData> FilterCardList(List<CardData> cardList, Dictionary<int, Dictionary<int, int>> selectList)
+        public static List<CardData> FilterCardList(List<CardData> cardList)
         {
             List<CardData> _cardList = new List<CardData>();
-            if (selectList.ContainsKey((int)EnumCardFilterType.SubType) == true && selectList[(int)EnumCardFilterType.SubType].Keys.Count > 0)
-            {
-                for (int i = cardList.Count - 1; i >= 0; i--)
-                {
-
-                    if (selectList[(int)EnumCardFilterType.SubType].ContainsKey(cardList[i].itemCfg.subType) == false)
-                    {
-                        //稀有度
-                        cardList.RemoveAt(i);
-                        continue;
-                    }
-                }
-            }
-            if (selectList.ContainsKey((int)EnumCardFilterType.PROPERTY) == true && selectList[(int)EnumCardFilterType.PROPERTY].Keys.Count > 0)
-            {
-                for (int i = cardList.Count - 1; i >= 0; i--)
-                {
-
-                    if (selectList[(int)EnumCardFilterType.PROPERTY].ContainsKey(cardList[i].mainScore) == false)
-                    {
-                        cardList.RemoveAt(i);
-
-                        continue;
-                    }
-                }
-            }
-
-            //属性
-            if (selectList.ContainsKey((int)EnumCardFilterType.FOSTER) == true && selectList[(int)EnumCardFilterType.FOSTER].Keys.Count > 0)
-            {
-                for (int i = 0; i < cardList.Count; i++)
+            for (int i = 0; i < cardList.Count; i++)
+            {
+                CardData cardData = cardList[i];
+                bool isRole = _selectRoleList.Count == 0 || _selectRoleList.IndexOf(cardData.itemCfg.subType) >= 0;
+                bool isRarity = _selectRarityList.Count == 0 || _selectRarityList.IndexOf(cardData.itemCfg.rarity) >= 0;
+                int maxLv = CardRarityCfgArray.Instance.GetCfg(cardList[i].itemCfg.rarity).maxCardLvl;
+                bool isFoster = _selectFosterList.Count == 0 ||
+                _selectFosterList.IndexOf(ConstCardState.STATE_FULL_LV) >= 0 && cardList[i].lv == maxLv ||
+                _selectFosterList.IndexOf(ConstCardState.STATE_LV) >= 0 && cardList[i].lv < maxLv ||
+                _selectFosterList.IndexOf(ConstCardState.STATE_FULL_STAR) >= 0 && isFullStar(cardList[i].id, cardList[i].star, false) ||
+                _selectFosterList.IndexOf(ConstCardState.STATE_STAR) >= 0 && !isFullStar(cardList[i].id, cardList[i].star, false);
+                if (isRole && isRarity && isFoster)
                 {
-
-                    //培养度
-                    int maxLv = CardRarityCfgArray.Instance.GetCfg(cardList[i].itemCfg.rarity).maxCardLvl;
-                    ICollection keys = selectList[(int)EnumCardFilterType.FOSTER].Keys;
-                    foreach (int key in keys)
-                    {
-                        if (key == ConstCardState.STATE_FULL_LV && cardList[i].lv == maxLv ||
-                            key == ConstCardState.STATE_LV && cardList[i].lv < maxLv ||
-                            key == ConstCardState.STATE_FULL_STAR && isFullStar(cardList[i].id, cardList[i].star, false) ||
-                            key == ConstCardState.STATE_STAR && !isFullStar(cardList[i].id, cardList[i].star, false))
-                        {
-                            if (_cardList.IndexOf(cardList[i]) >= 0) continue;//一张卡片同时满足星级和等级条件时,不能重复添加
-                            _cardList.Add(cardList[i]);
-
-                            continue;
-                        }
-
-
-                        //if ()
-                        //{
-                        //技能相关留空
-                        //}
-                    }
+                    _cardList.Add(cardData);
                 }
-                return _cardList;
             }
-            else
-            {
-                return cardList;
-            }
-
+            return _cardList;
         }
 
 

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

@@ -9,8 +9,9 @@ namespace GFGGame
 {
     public class CardDetailView : BaseView
     {
-        private const int listRoleCount = 5;
         private UI_CardDetailUI _ui;
+        private const int listRoleCount = 5;
+        private int _mainScore = 0;
         public override void Dispose()
         {
             if (_ui != null)
@@ -46,7 +47,11 @@ namespace GFGGame
             //     UpdateCardList(_ui.m_listRole.selectedIndex);
             // });
         }
-
+        protected override void AddEventListener()
+        {
+            base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.CARD_FILTER, UpdateCardList);
+        }
         protected override void OnShown()
         {
             base.OnShown();
@@ -56,18 +61,30 @@ namespace GFGGame
             int listRoleSelect = this.viewData != null ? (int)this.viewData : 0;
             _ui.m_listRole.selectedIndex = listRoleSelect;
             _ui.m_listRole.numItems = listRoleCount;
-            this.UpdateCardList((int)_ui.m_listRole.GetChildAt(_ui.m_listRole.selectedIndex).data);
+            this.UpdateCardList();
 
             Timers.inst.AddUpdate(CheckGuide);
         }
-        private void UpdateCardList(int mainScore = 0)
+        protected override void OnHide()
+        {
+            base.OnHide();
+            this.Clear();
+            Timers.inst.Remove(CheckGuide);
+        }
+        protected override void RemoveEventListener()
         {
+            base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.CARD_FILTER, UpdateCardList);
 
-            List<CardData> cardList = CardDataManager.GetCardListByRarity(mainScore);
-            if (CardDataManager._selectList.Keys.Count > 0)
+        }
+        private void UpdateCardList()
+        {
+
+            List<CardData> cardList = CardDataManager.GetCardListByRarity(_ui.m_listRole.selectedIndex);
+            if (CardDataManager.isFilter == true)
             {
                 //筛选
-                cardList = CardDataManager.FilterCardList(cardList, CardDataManager._selectList as Dictionary<int, Dictionary<int, int>>);
+                cardList = CardDataManager.FilterCardList(cardList);
             }
             _ui.m_listCard.data = cardList;
             _ui.m_listCard.numItems = cardList.Count;
@@ -106,7 +123,7 @@ namespace GFGGame
         private void OnClickListRoleItem(EventContext context)
         {
             int index = (int)(context.data as GObject).data;
-            this.UpdateCardList(index);
+            this.UpdateCardList();
 
         }
 
@@ -125,7 +142,6 @@ namespace GFGGame
         private void OnClickBtnHome()
         {
             GameController.GoBackToMainView();
-
         }
         private void Clear()
         {
@@ -136,12 +152,7 @@ namespace GFGGame
 
         }
 
-        protected override void OnHide()
-        {
-            base.OnHide();
-            this.Clear();
-            Timers.inst.Remove(CheckGuide);
-        }
+
 
         private void CheckGuide(object param)
         {

+ 101 - 40
GameClient/Assets/Game/HotUpdate/Views/Card/CardFilterView.cs

@@ -18,7 +18,9 @@ namespace GFGGame
     {
         private UI_CardFilterUI _ui;
 
-        private SortedList[] _dataList = { ConstCardSubType.CardSubTypeList(), ConstDressUpScoreType.scoreTypeList(), ConstCardState.CardStateList() };
+        private SortedList _list0Datas = ConstCardSubType.CardSubTypeList();
+        private SortedList _list1RarityDatas = ConstDressRarity.DressRarityList();
+        private SortedList _list2Datas = ConstCardState.CardStateList();
         public override void Dispose()
         {
             if (_ui != null)
@@ -39,89 +41,148 @@ namespace GFGGame
             viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
 
             _ui.m_btnGo.onClick.Add(OnClickBtnGo);
-            _ui.m_btnChoose.onClick.Add(UpdateList);
+            // _ui._selectRoleList.onClick.Add(UpdateList);
 
-            _ui.m_list0.itemRenderer = RenderListItem;
-            _ui.m_list0.onClickItem.Add(OnClickListItem);
+            _ui.m_list0.itemRenderer = RenderListRoleItem;
+            _ui.m_list0.onClickItem.Add(OnClickListRoleItem);
             _ui.m_list0.data = EnumCardFilterType.SubType;
 
-            _ui.m_list1.itemRenderer = RenderListItem;
-            _ui.m_list1.onClickItem.Add(OnClickListItem);
+            _ui.m_list1.itemRenderer = RenderListRarityItem;
+            _ui.m_list1.onClickItem.Add(OnClickListRarityItem);
             _ui.m_list1.data = EnumCardFilterType.PROPERTY;
 
-            _ui.m_list2.itemRenderer = RenderListItem;
-            _ui.m_list2.onClickItem.Add(OnClickListItem);
+            _ui.m_list2.itemRenderer = RenderListFosterItem;
+            _ui.m_list2.onClickItem.Add(OnClickListRarityItem);
             _ui.m_list2.data = EnumCardFilterType.FOSTER;
 
+            _ui.m_btnChoose.onClick.Add(UpdateSelectAll);
         }
 
         protected override void OnShown()
         {
             base.OnShown();
-            _ui.m_btnChoose.selected = false;
-            CardDataManager._selectList.Clear();
-            this.UpdateList();
 
+            this.UpdateList();
+            if (!CardDataManager.isFilter)
+            {
+                _ui.m_btnChoose.selected = true;
+                UpdateSelectAll();
+            }
+            CardDataManager.isFilter = true;
         }
         private void UpdateList()
         {
             _ui.m_list0.numItems = ConstCardSubType.CardSubTypeList().Count;
-            _ui.m_list1.numItems = ConstDressUpScoreType.scoreTypeList().Count;
+            _ui.m_list1.numItems = ConstDressRarity.DressRarityList().Count;
             _ui.m_list2.numItems = ConstCardState.CardStateList().Count;
         }
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="filterType">筛选大类型:人物,属性,培养度</param>
-        /// <param name="value">筛选小类型:天地玄黄,宫商角徵羽,满级满星满技能升级升星升技能</param>
-        /// <param name="select">是否筛选</param>
-        private void UpdateSelectList(int filterType, int value, bool select)
+        private void UpdateSelectAll()
         {
-            Dictionary<int, int> typeDic;
-            if (CardDataManager._selectList.ContainsKey(filterType) == false)
+            CardDataManager._selectRoleList.Clear();
+            CardDataManager._selectRarityList.Clear();
+            CardDataManager._selectFosterList.Clear();
+            if (_ui.m_btnChoose.selected)
             {
-                typeDic = new Dictionary<int, int>();
-                CardDataManager._selectList.Add(filterType, typeDic);
+                for (int i = 0; i < ConstCardSubType.CardSubTypeList().Keys.Count; i++)
+                {
+                    CardDataManager._selectRoleList.Add((int)ConstCardSubType.CardSubTypeList().GetKey(i));
+                }
+                for (int i = 0; i < ConstDressRarity.DressRarityList().Keys.Count; i++)
+                {
+                    CardDataManager._selectRarityList.Add((int)ConstDressRarity.DressRarityList().GetKey(i));
+                }
+                for (int i = 0; i < ConstCardState.CardStateList().Keys.Count; i++)
+                {
+                    CardDataManager._selectFosterList.Add((int)ConstCardState.CardStateList().GetKey(i));
+                }
             }
-            typeDic = CardDataManager._selectList[filterType];
-            if (select == true && typeDic.ContainsKey(value) == false)
+
+            UpdateList();
+        }
+        private void RenderListRoleItem(int index, GObject item)
+        {
+            GButton btn = item as GButton;
+            int key = index + 1;
+            btn.title = _list0Datas[key].ToString();
+            btn.data = key;
+
+            btn.selected = CardDataManager._selectRoleList.IndexOf(key) >= 0 || _ui.m_btnChoose.selected;
+        }
+        private void RenderListRarityItem(int index, GObject item)
+        {
+            GButton btn = item as GButton;
+            int key = index + 1;
+            btn.title = _list1RarityDatas[key].ToString();
+            btn.data = key;
+            btn.selected = CardDataManager._selectRarityList.IndexOf(key) >= 0 || _ui.m_btnChoose.selected;
+        }
+        private void RenderListFosterItem(int index, GObject item)
+        {
+            GButton btn = item as GButton;
+            int key = index + 1;
+            btn.title = _list2Datas[key].ToString();
+            btn.data = key;
+            btn.selected = CardDataManager._selectFosterList.IndexOf(key) >= 0 || _ui.m_btnChoose.selected;
+        }
+
+        private void OnClickListRoleItem(EventContext context)
+        {
+            GButton btn = context.data as GButton;
+            int key = (int)btn.data;
+            int index = CardDataManager._selectRoleList.IndexOf(key);
+            if (index < 0)
             {
-                typeDic.Add(value, value);
+                btn.selected = true;
+                CardDataManager._selectRoleList.Add(key);
             }
-            else if (select == false && typeDic.ContainsKey(value) == true)
+            else
             {
-                typeDic.Remove(value);
+                _ui.m_btnChoose.selected = false;
+                btn.selected = false;
+                CardDataManager._selectRoleList.Remove(key);
             }
         }
-        private void RenderListItem(int index, GObject item)
+        private void OnClickListRarityItem(EventContext context)
         {
-            GButton btn = item as GButton;
-            string name = this._dataList[(int)btn.parent.data][index + 1].ToString();
-            btn.title = name;
-            btn.data = index + 1;
-            if (_ui.m_btnChoose.selected == true)
+            GButton btn = context.data as GButton;
+            int key = (int)btn.data;
+            int index = CardDataManager._selectRarityList.IndexOf(key);
+            if (index < 0)
             {
                 btn.selected = true;
+                CardDataManager._selectRarityList.Add(key);
             }
             else
             {
+                _ui.m_btnChoose.selected = false;
                 btn.selected = false;
+                CardDataManager._selectRarityList.Remove(key);
             }
-            this.UpdateSelectList((int)btn.parent.data, index + 1, btn.selected);
         }
-
-        private void OnClickListItem(EventContext context)
+        private void OnClickListFosterItem(EventContext context)
         {
             GButton btn = context.data as GButton;
-            this.UpdateSelectList((int)btn.parent.data, (int)btn.data, btn.selected);
-            if (_ui.m_btnChoose.selected == true && btn.selected == false)
+            int key = (int)btn.data;
+            int index = CardDataManager._selectFosterList.IndexOf(key);
+            if (index < 0)
+            {
+                btn.selected = true;
+                CardDataManager._selectFosterList.Add(key);
+            }
+            else
             {
                 _ui.m_btnChoose.selected = false;
+                btn.selected = false;
+                CardDataManager._selectFosterList.Remove(key);
             }
         }
+
+
         private void OnClickBtnGo()
         {
-            ViewManager.GoBackFrom(ViewName.CARD_FILTER_VIEW);
+            // ViewManager.GoBackFrom(ViewName.CARD_FILTER_VIEW);
+            EventAgent.DispatchEvent(ConstMessage.CARD_FILTER);
+            this.Hide();
         }
         protected override void OnHide()
         {

+ 23 - 22
GameClient/Assets/Game/HotUpdate/Views/CommonGame/ApproachView.cs

@@ -170,28 +170,8 @@ namespace GFGGame
                     var levelCfgId = int.Parse(value);
                     var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
                     isJump = false;
-                    if (levelCfg.type == ConstInstanceZonesType.Story)
-                    {
-                        if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ViewName.STORY_CHAPTER_VIEW))
-                        {
-                            break;
-                        }
-                        if (!MainStoryDataManager.CheckLevelUnlock(levelCfgId))
-                        {
-                            PromptController.Instance.ShowFloatTextPrompt("关卡未开启");
-                            break;
-                        }
 
-                        if ((string)_fromeViewDatas[0] == ViewName.DRESS_UP_FIGHT_VIEW)
-                        {
-                            //从战斗换装必需品来源跳转到剧情界面,在剧情界面点返回后直接返回章节界面,无需返回换装界面
-                            _fromeViewDatas = null;
-                        }
-                        isJump = ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, levelCfg.chapterId, _fromeViewDatas, true);
-                        InstanceZonesController.ShowLevelView(levelCfgId, StudioDataManager.Instance.OnFinishStoryLevel, _itemId, _needCount);
-                        break;
-                    }
-                    else if (levelCfg.type == ConstInstanceZonesType.Studio)
+                    if (levelCfg.type == ConstInstanceZonesType.Studio)
                     {
                         StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
 
@@ -237,8 +217,29 @@ namespace GFGGame
                         isJump = true;
                         break;
                     }
+                    else
+                    {
+                        // if (levelCfg.type == ConstInstanceZonesType.Story)
+                        // {
+                        if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ViewName.STORY_CHAPTER_VIEW))
+                        {
+                            break;
+                        }
+                        if (!MainStoryDataManager.CheckLevelUnlock(levelCfgId))
+                        {
+                            PromptController.Instance.ShowFloatTextPrompt("关卡未开启");
+                            break;
+                        }
 
-                    break;
+                        if ((string)_fromeViewDatas[0] == ViewName.DRESS_UP_FIGHT_VIEW)
+                        {
+                            //从战斗换装必需品来源跳转到剧情界面,在剧情界面点返回后直接返回章节界面,无需返回换装界面
+                            _fromeViewDatas = null;
+                        }
+                        isJump = ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, levelCfg.chapterId, _fromeViewDatas, true);
+                        StoryController.ShowLevelView(levelCfgId);
+                        break;
+                    }
                 case ConstFunctionId.FU_ZHUANG_HE_CHENG:
 
                     isJump = false;

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -228,7 +228,7 @@ namespace GFGGame
                 else
                 {
                     // ViewManager.GoBackFrom(ViewName.STORY_CHAPTER_VIEW);
-                    ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, _levelCfg.chapterId, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW });
+                    ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, _levelCfg.chapterId);//, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW }
                 }
                 EquipDataCache.cacher.TakeOffAll();
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -19,7 +19,7 @@ namespace GFGGame
 
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                GameObject.DestroyImmediate(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -126,6 +126,8 @@ namespace GFGGame
                 _ui.m_c1.selectedIndex = 1;
                 // _ui.m_btnAutoPlay.selected = true;
                 OnClickBtnAutoPlay();
+                _speedAutoPlay = 1;
+                EquipDataCache.cacher.dialogSpeed = _speedAutoPlay;
             }
         }
 

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

@@ -315,6 +315,7 @@ namespace GFGGame
             {
                 _ui.m_btnCiPai.m_holder1.visible = false;
 
+                CardDataManager.isFilter = false;
                 ViewManager.Show(ViewName.CARD_DETAIL_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
                 isOpen = false;
 

BIN
GameClient/Assets/ResIn/UI/Card/Card_fui.bytes