| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 | 
							- using System.Collections;
 
- using System.Collections.Generic;
 
- using FairyGUI;
 
- using UI.CommonGame;
 
- using UI.FieldGuide;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     /// <summary>
 
-     /// 词牌图鉴界面
 
-     /// </summary>
 
-     public class CardGuideView: BaseWindow
 
-     {
 
-         private UI_CardGuideUI _ui;
 
-         private List<int> _cardList;
 
-         private int _lastClickIndex;
 
-         public override void Dispose()
 
-         {
 
-             if(_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_CardGuideUI.PACKAGE_NAME;
 
-             _ui = UI_CardGuideUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("quanping_moren_bg");
 
-             _cardList = new List<int>();
 
-             _ui.m_listCard.itemRenderer = RenderCardListItem;
 
-             _ui.m_listCard.onClickItem.Add(OnClickListCardItem);
 
-             _ui.m_listRole.onClickItem.Add(OnClickRoleListItem);
 
-             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 
-             _ui.m_listRole.selectedIndex = 0;
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.CARD_FILTER, UpdateCardList);
 
-             EventAgent.AddEventListener(ConstMessage.CARD_INFO, UpdateCardList);
 
-             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateCardList);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.CARD_FILTER, UpdateCardList);
 
-             EventAgent.RemoveEventListener(ConstMessage.CARD_INFO, UpdateCardList);
 
-             EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateCardList);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             UpdateCardList();
 
-             if (backRefresh)
 
-             {
 
-                 ResetSelectedItem();
 
-                 _ui.m_listCard.scrollPane.ScrollTop();
 
-                 _ui.m_In.Play();
 
-             }
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-         }
 
-         private void RenderCardListItem(int index, GObject obj)
 
-         {
 
-             UI_ListCardItem listItem = UI_ListCardItem.Proxy(obj);
 
-             CardData data = CardDataManager.GetCardDataById(_cardList[index]);
 
-             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_cardList[index]);
 
-             listItem.m_showType.selectedIndex = 1;
 
-             // Have card
 
-             if (data != null)
 
-             {
 
-                 data.index = index;
 
-                 data.pageIndex = _ui.m_listRole.selectedIndex;
 
-                 listItem.m_unlockMask.visible = false;
 
-                 listItem.m_comCard.m_loaCard.url = ResPathUtil.GetCardIconPath(data.resources[data.resIndex]);
 
-                 int starLevelDodge = data.star / 5;
 
-                 
 
-                 listItem.m_txtLv.visible = false;
 
-                 for (int i = 0; i < 4; i++)
 
-                 {
 
-                     UI_ComDodgeStar dodgeStar = UI_ComDodgeStar.Proxy(listItem.target.GetChild("dodgeStar" + i));
 
-                     dodgeStar.m_lightType.selectedIndex = (starLevelDodge > i) ? 1 : 0;
 
-                     UI_ComDodgeStar.ProxyEnd();
 
-                 }
 
-                 listItem.target.data = data;
 
-             }
 
-             else
 
-             {
 
-                 listItem.m_comCard.m_loaCard.url = ResPathUtil.GetCardIconPath(itemCfg.res);
 
-                 listItem.m_unlockMask.visible = true;
 
-                 listItem.target.data = null;
 
-             }
 
-             RarityIconController.UpdateRarityIcon(listItem.m_loaRarity, itemCfg.id, false);// ResPathUtil.GetCommonGameResPath("kp_sxing_x_" + data.itemCfg.rarity);
 
-             listItem.m_loaMainScore.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (itemCfg.mainScore));
 
-             listItem.m_loaBorder.url = "ui://CommonGame/kp_kuang_" + itemCfg.rarity;//ResPathUtil.GetCommonGameResPath("kp_sxing_x_" + data.itemCfg.rarity);
 
-             listItem.m_txtName.text = itemCfg.name;
 
-             UI_ListCardItem.ProxyEnd();
 
-         }
 
-         private void OnClickListCardItem(EventContext context)
 
-         {
 
-             object data = (context.data as GObject).data;
 
-             int index = _ui.m_listCard.GetChildIndex(context.data as GObject);
 
-             if (data == null)
 
-             {
 
-                 object[] goBackDatas = ViewManager.GetGoBackDatas(typeof(CardGuideView).Name);
 
-                 object[] sourceDatas = new object[] { _cardList[index], goBackDatas, 1 };
 
-                 GoodsItemTipsController.ShowItemTips(_cardList[index], sourceDatas, false);
 
-             }
 
-             else
 
-             {
 
-                 CardData cardData = CardDataManager.GetCardDataById(_cardList[index]);
 
-                 cardData.fromUIType = typeof(CardGuideView).FullName;
 
-                 ViewManager.Show<CardFosterView>(cardData, false, false);
 
-             }   
 
-         }
 
-         private void OnClickRoleListItem(EventContext eventContext)
 
-         {
 
-             if (_ui.m_listRole.selectedIndex == _lastClickIndex)
 
-             {
 
-                 return;
 
-             }
 
-             _lastClickIndex = _ui.m_listRole.selectedIndex;
 
-             UpdateCardList();
 
-             _ui.m_listCard.scrollPane.ScrollTop();
 
-             _ui.m_Refresh.Play();
 
-             // 顶部选择菜单按钮的选中动画
 
-             GObject gObject = eventContext.data as GObject;
 
-             UI_Button21 button = UI_Button21.Proxy(gObject);
 
-             button.m_fadeIn.Play();
 
-             UI_Button21.ProxyEnd();
 
-         }
 
-         private void UpdateCardList()
 
-         {
 
-             UpdateCardStatusView();
 
-             _cardList = CardDataManager.GetAllCardIdListByRoleType(_ui.m_listRole.selectedIndex);
 
-             _ui.m_listCard.numItems = _cardList.Count;
 
-         }
 
-         private void UpdateCardStatusView()
 
-         {
 
-             CardDataManager.GetTotalProgress(out int haveCount, out int totalCount, _ui.m_listRole.selectedIndex);
 
-             _ui.m_progress.target.max = totalCount;
 
-             _ui.m_progress.target.value = haveCount;
 
-             _ui.m_progress.m_title1.SetVar("value", haveCount.ToString()).SetVar("max", totalCount.ToString()).FlushVars();
 
-             _ui.m_progress.m_rate.SetVar("rate", FieldGuideView.ProgressCalculate(haveCount, totalCount).ToString()).FlushVars();
 
-         }
 
-         private void OnClickBtnBack()
 
-         {
 
-             Hide();
 
-         }
 
-         private void ResetSelectedItem()
 
-         {
 
-             _ui.m_listRole.selectedIndex = 0;
 
-             _lastClickIndex = 0;
 
-         }
 
-     }
 
- }
 
 
  |