| 
					
				 | 
			
			
				@@ -0,0 +1,229 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Collections; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using UnityEngine; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using UI.MatchingCompetition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using FairyGUI; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Collections.Generic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public class MatchingCompetitionRewardView : BaseWindow 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private UI_MatchingCompetitionRewardUI _ui; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private List<ItemData> _listItemDatas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private Action onSuccess = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private List<EffectUI> _effects = new List<EffectUI>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private const int maxHeight = 1030; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private EffectUI _effectUI1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private EffectUI _effectUI2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private int counTime = 0;  //定时器计数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public override void Dispose() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_ui != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            base.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        protected override void OnInit() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            base.OnInit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui = UI_MatchingCompetitionRewardUI.Create(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.viewCom = _ui.target; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //this.viewCom.Center(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //this.modal = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //viewAnimationType = EnumViewAnimationType.ZOOM_CENTER; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            isfullScreen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_comList.m_listReward.itemRenderer = RenderListRewardItem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_mask.onClick.Add(this.Hide); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        protected override void OnShown() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            base.OnShown(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_mask.touchable = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ((this.viewData as object[]).Length > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _listItemDatas = (this.viewData as object[])[0] as List<ItemData>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                onSuccess = (this.viewData as object[])[1] as Action; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _listItemDatas = this.viewData as List<ItemData>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ItemData> suitPart = new List<ItemData>(); ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = _listItemDatas.Count - 1; i >= 0; i--) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_listItemDatas[i].id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (suitCfg != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int j = 0; j < suitCfg.partsArr.Length; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        suitPart.Add(ItemUtil.createItemData(suitCfg.partsArr[j], _listItemDatas[i].num)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _listItemDatas.RemoveAt(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _listItemDatas.AddRange(suitPart); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //_ui.m_listReward.SetVirtual();  //有虚拟列表的时候,没有办法居中显示列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_downTipsText.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_comList.m_listReward.numItems = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            counTime = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Timers.inst.Add(0.1f, 3, OnTimerUpdate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Timers.inst.Add(0.5f, 1, OnTimerClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void OnTimerClick(object param) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_mask.touchable = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void OnTimerUpdate(object param) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            counTime += 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (counTime == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderTitle, "ui_hd", "GXHD_Text"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderBgCom, "ui_hd", "TC_Quad_ALL"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else if (counTime == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.m_comList.m_listReward.numItems = _listItemDatas.Count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.m_comList.m_listReward.ResizeToFit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (_ui.m_comList.m_listReward.height > maxHeight) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _ui.m_comList.m_listReward.height = maxHeight; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else if (counTime == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.m_downTipsText.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Timers.inst.Remove(OnTimerUpdate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        protected override void OnHide() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            EffectUIPool.Recycle(_effectUI1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _effectUI1 = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            EffectUIPool.Recycle(_effectUI2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _effectUI2 = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Timers.inst.Remove(OnTimerUpdate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Timers.inst.Remove(OnTimerClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_mask.touchable = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = 0; i < _effects.Count; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (_effects[i] != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    EffectUIPool.Recycle(_effects[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _effects[i] = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _effects.Clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (onSuccess != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                onSuccess(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            base.OnHide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //_effects.Clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            EventAgent.DispatchEvent(ConstMessage.REWARDVIEW_CLOTHER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            GetSuitItemController.TryShow(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void RenderListRewardItem(int index, GObject obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // obj.data = _listItemDatas[index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            UI.CommonGame.UI_ComItem item = UI.CommonGame.UI_ComItem.Proxy(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string name = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string iconRes = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string ext = "png"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int rarity = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int id = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bool isSuit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_listItemDatas[index].id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_listItemDatas[index].id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (suitCfg != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                name = suitCfg.name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iconRes = suitCfg.res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rarity = suitCfg.rarity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                id = suitCfg.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                isSuit = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                name = itemCfg.name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iconRes = itemCfg.res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                id = itemCfg.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                isSuit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //if (itemCfg.itemType == ConstItemType.DRESS_UP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rarity = itemCfg.rarity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.m_txtName.text = name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // item.m_txtCount.text = _listItemDatas[index].num==1?"": string.Format("{0}", _listItemDatas[index].num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.m_txtCount.text = string.Format("{0}", _listItemDatas[index].num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.m_loaIcon.url = ResPathUtil.GetIconPath(iconRes, ext); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (rarity > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                item.m_QualityType.selectedIndex = rarity - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                item.m_QualityType.selectedIndex = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RarityIconController.UpdateRarityIcon(item.m_loaRarity, id, false, isSuit); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.m_imgOnceBonus.visible = _listItemDatas[index].isOnceBonus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //特效("ui_ck", "ui_ck_zl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int childIndex = _ui.m_comList.m_listReward.ItemIndexToChildIndex(index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_effects.Count <= childIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                EffectUI _effectUI = EffectUIPool.CreateEffectUI(item.m_holderReware, "ui_hd", "GXHD_WuPin", 120); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _effects.Add(_effectUI); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (item.target.data == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                item.target.onClick.Add(OnClickListReward); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.target.data = _listItemDatas[index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            UI.CommonGame.UI_ComItem.ProxyEnd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void OnClickListReward(EventContext context) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (this.ShowTips) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ItemData data = (context.sender as GObject).data as ItemData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                GoodsItemTipsController.ShowItemTips(data.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private bool _showTips = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 是否展示物品详情,默认展示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private bool ShowTips 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            get { return _showTips; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            set { _showTips = value; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |