| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 | 
							- using FairyGUI;
 
- using UI.ActivityMain;
 
- using UI.CommonGame;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using ET;
 
- using static GFGGame.ShopSProxy;
 
- namespace GFGGame
 
- {
 
-     public class PearRebateTipsView : BaseWindow
 
-     {
 
-         private UI_PearlRebateTipsUI _ui;
 
-         private EffectUI _effectUI1;
 
-         private EffectUI _effectUI2;
 
-         private int indexNum = 0;
 
-         public override void Dispose()
 
-         {
 
-             EffectUIPool.Recycle(_effectUI1);
 
-             _effectUI1 = null;
 
-             EffectUIPool.Recycle(_effectUI2);
 
-             _effectUI2 = null;
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_PearlRebateTipsUI.PACKAGE_NAME;
 
-             _ui = UI_PearlRebateTipsUI.Create();
 
-             this.viewCom = _ui.target;
 
-             this.modal = true;
 
-             this.viewCom.Center();
 
-             viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
 
-             _ui.m_buyBtn.target.onClick.Add(OnClickGetReward);
 
-             _ui.m_backBtn.onClick.Add(OnClickChange);
 
-             _ui.m_one.target.onClick.Add(UpdateIndex1);
 
-             _ui.m_two.target.onClick.Add(UpdateIndex2);
 
-             _ui.m_three.target.onClick.Add(UpdateIndex3);
 
-             _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_effectBtn, "ui_Activity", "");
 
-             _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_effectBG, "ui_Activity", "");
 
-            
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             UpdateIndex1();
 
-             Timers.inst.Add(1, 0, UpdateTime);
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             Timers.inst.Remove(UpdateTime);
 
-             base.OnHide();
 
-         }
 
-         private void UpdateListItem(int giftId)
 
-         { 
 
-             ItemCfg item = ItemCfgArray.Instance.GetCfg(giftId);
 
-             int index = item.itemsArr.Length;
 
-             _ui.m_c1.selectedIndex = index;
 
-             switch (index)
 
-             {
 
-                 case 1:
 
-                     int id = item.itemsArr[0][0];
 
-                     int count = item.itemsArr[0][1];
 
-                     ItemData itemDate = ItemUtil.createItemData(id, count);
 
-                     ItemView itemView = new ItemView(_ui.m_item1);
 
-                     itemView.SetData(itemDate);
 
-                     break;
 
-                 case 2:
 
-                     int id0 = item.itemsArr[0][0];
 
-                     int count0 = item.itemsArr[0][1];
 
-                     ItemData itemDate0 = ItemUtil.createItemData(id0, count0);
 
-                     ItemView itemView0 = new ItemView(_ui.m_item0);
 
-                     itemView0.SetData(itemDate0);
 
-                     id0 = item.itemsArr[1][0];
 
-                     count0 = item.itemsArr[1][1];
 
-                     itemDate0 = ItemUtil.createItemData(id0, count0);
 
-                     itemView0 = new ItemView(_ui.m_item2);
 
-                     itemView0.SetData(itemDate0);
 
-                     break;
 
-                 case 3:
 
-                     for(int i = 0;i<PearlGiftCfgArray.Instance.dataArray[indexNum].bonusArr.Length;i++)
 
-                     {
 
-                         int id3 = item.itemsArr[i][0];
 
-                         int count3 = item.itemsArr[i][1];
 
-                         ItemData itemDate3 = ItemUtil.createItemData(id3, count3);
 
-                         ItemView itemView3 = new ItemView(_ui.target.GetChild(string.Format("item{0}",i)) as GComponent);
 
-                         itemView3.SetData(itemDate3);
 
-                     }
 
-                     break;
 
-                 default:
 
-                     break;
 
-             }
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             int discount;
 
-             ActivityOpenCfg activityCfg = ActivityOpenCfgArray.Instance.GetCfg(6000);
 
-             ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(activityCfg.paramsArr[indexNum]);
 
-             ItemCfg item = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
 
-             if (shopCfg.Price == 0) discount =  0;
 
-             discount =  (int)(((double)shopCfg.originalPrice / (double)shopCfg.configPrice) * 100);
 
-             int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
 
-             if (shopCfg.maxBuyNum == 0 || buyNum < shopCfg.maxBuyNum)
 
-             {
 
-                 _ui.m_buyBtn.target.visible = true ;
 
-                 _ui.m_gotbtn.target.visible = false;
 
-                 _ui.m_buyBtn.m_Number.text = string.Format("{0}元", shopCfg.configPrice.ToString());
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_buyBtn.target.visible = false;
 
-                 _ui.m_gotbtn.target.visible = true;
 
-             }
 
-                 
 
-             UpdateListItem(item.id);
 
-         }
 
-         private void UpdateIndex1()
 
-         {
 
-             indexNum = 0;
 
-             _ui.m_one.m_c1.selectedIndex = 1;
 
-             _ui.m_two.m_c1.selectedIndex = 0;
 
-             _ui.m_three.m_c1.selectedIndex = 0;
 
-             UpdateView();
 
-         }
 
-         private void UpdateIndex2()
 
-         {
 
-             indexNum = 1;
 
-             _ui.m_one.m_c1.selectedIndex = 0;
 
-             _ui.m_two.m_c1.selectedIndex = 1;
 
-             _ui.m_three.m_c1.selectedIndex = 0;
 
-             UpdateView();
 
-         }
 
-         private void UpdateIndex3()
 
-         {
 
-             indexNum = 2;
 
-             _ui.m_one.m_c1.selectedIndex = 0;
 
-             _ui.m_two.m_c1.selectedIndex = 0;
 
-             _ui.m_three.m_c1.selectedIndex = 1;
 
-             UpdateView();
 
-         }
 
-         private void OnClickGetReward()
 
-         {
 
-                 var activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(6000);
 
-                 if (activityInfo != null)
 
-                 {
 
-                     var cfg = ActivityOpenCfgArray.Instance.GetCfg(6000);
 
-                     if (cfg.paramsArr != null && cfg.paramsArr.Length > 0)
 
-                     {
 
-                         int id = cfg.paramsArr[indexNum];
 
-                         
 
-                         ReqShopBuy(id).Coroutine();
 
-                     }
 
-                 }
 
-                 return;
 
-         }
 
-         private void OnClickChange()
 
-         {
 
-             this.Hide();
 
-         }
 
-         private void UpdateTime(object param)
 
-         {
 
-             var activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(6000);
 
-             long endTime = 0;
 
-             if( activityInfo!= null)
 
-             {
 
-                 endTime = activityInfo.EndTime;
 
-             } 
 
-             var leftTime = endTime - TimeHelper.ServerNow();
 
-             if (leftTime <= 0)
 
-             {
 
-                 _ui.m_timeText.text = "";
 
-                 _ui.m_buyBtn.target.visible = false;
 
-                 Timers.inst.Remove(UpdateTime);
 
-                 return;
 
-             }
 
-             _ui.m_timeText.text = TimeUtil.FormattingTimeTo_DDHHmm((int)leftTime);
 
-         }
 
-     }
 
- }
 
 
  |