using FairyGUI; using UI.LuckyBox; using UI.CommonGame; using System; using System.Collections.Generic; using UnityEngine; using ET; using System.Linq; namespace GFGGame { public class LuckyBoxView : BaseView { private UI_LuckyBoxUI _ui; private ValueBarController _valueBarController; private Dictionary _lcukyBoxCtrl = new Dictionary(); private EffectUI _effectUI1; private EffectUI _effectUI2; private DressUpObjUI _dressUpObjUIXiHe; private DressUpObjUI _dressUpObjUIChangXi; private bool isActiveBoxOpen = false; private int _activeBoxId = 0; private int _curIndex = 0; public override void Dispose() { if (_valueBarController != null) { _valueBarController.Dispose(); _valueBarController = null; } foreach (int key in _lcukyBoxCtrl.Keys) { _lcukyBoxCtrl[key].Dispose(); } _lcukyBoxCtrl.Clear(); if (_dressUpObjUIXiHe != null) { _dressUpObjUIXiHe.Dispose(); _dressUpObjUIXiHe = null; } if (_dressUpObjUIChangXi != null) { _dressUpObjUIChangXi.Dispose(); _dressUpObjUIChangXi = null; } 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_LuckyBoxUI.PACKAGE_NAME; _ui = UI_LuckyBoxUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _dressUpObjUIXiHe = new DressUpObjUI("SceneDressUp"); _dressUpObjUIChangXi = new DressUpObjUI("SceneDressUp"); // _ui.m_txtRemainTimes.visible = false; _valueBarController = new ValueBarController(_ui.m_valueBar); _ui.m_btnBack.onClick.Add(OnClickBtnBack); // _ui.m_btnHome.onClick.Add(OnClickBtnHome); _ui.m_btnLeft.onClick.Add(OnBtnLeftClick); _ui.m_btnRight.onClick.Add(OnBtnRightClick); // _ui.m_listBg.SetVirtual(); _ui.m_listBg.itemRenderer = RenderListBgItem; // _ui.m_listBg.itemProvider = GetListItemResource; _ui.m_listBg.scrollPane.onScrollEnd.Add(OnListBgScroll); _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zx_bg"); } protected override void AddEventListener() { base.AddEventListener(); EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData); EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData); EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo); EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_REWARD, UpdateBtnReward); } protected override void OnShown() { base.OnShown(); Debug.Log("OnShown:LuckyBoxView"); LuckyBoxDataManager.Instance.luckyBoxIds.Clear(); LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_2); LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_3); _activeBoxId = 0; int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy); if (activityId > 0) GetWishingPoolInfo(activityId); if (LuckyBoxDataManager.Instance.RotatingId > 0) { RotatingLuckyBoxCfg rotatingLuckyBox = RotatingLuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.RotatingId); _activeBoxId = rotatingLuckyBox.luckyBoxId; LuckyBoxDataManager.Instance.endTime = TimeUtil.GetTimestamp(rotatingLuckyBox.endTime); LuckyBoxDataManager.Instance.luckyBoxIds.Insert(0, _activeBoxId); } int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[1]; if (this.viewData != null) { boxId = (int)this.viewData; } if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) boxId = LuckyBoxDataManager.BOX_ID_2; LuckyBoxDataManager.Instance.currentBoxId = boxId; if (_activeBoxId > 0 || boxId == LuckyBoxDataManager.BOX_ID_2) Timers.inst.Add(1, 0, CheckTime); _valueBarController.OnShown(); _valueBarController.Controller(4); _curIndex = LuckyBoxDataManager.Instance.luckyBoxIds.IndexOf(boxId); _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Count; _ui.m_listBg.ScrollToView(_curIndex); _ui.m_listBg.scrollPane.decelerationRate = 0.8f; LuckyBoxDataManager.Instance.luckyBoxIndex = _curIndex; OnListBgScroll(); updateBoxEffect(); Timers.inst.AddUpdate(CheckGuide); Timers.inst.Add(1f, 0, OnTimerUpdate, 1); } private async void GetWishingPoolInfo(int activityId) { bool result = await LuckyBoxSProxy.ReqGetWishingPoolInfo(); if (result) { int index = LuckyBoxDataManager.Instance.KsActivityId.IndexOf(activityId); if (index < 0 || !LuckyBoxDataManager.Instance.VsStatus[index]) ViewManager.Show(ConstLimitTimeActivityType.ActLimitTsy); } } private void OnTimerUpdate(object param) { int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex]; long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId); GObject obj = _ui.m_listBg.GetChildAt(_curIndex); UI_ComBox1 comBox = UI_ComBox1.Proxy(obj); if (freeTime > 0) { long timeDifference = freeTime - TimeHelper.ServerNow(); if (timeDifference> 0) { comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0; comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true; string strFreeTime = TimeUtil.FormattingTimeTo_HHmmss(timeDifference); comBox.m_comLuckBoxBtn.m_txtFreeTime.text = string.Format("{0}后免费", strFreeTime); } else { comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 1; comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false; } } UI_ComBox1.ProxyEnd(); } private void RenderListBgItem(int index, GObject obj) { int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[index]; } private void OnBtnLeftClick() { int index = _curIndex - 1; if (index < 0) return; _ui.m_listBg.ScrollToView(index, true); } private void OnBtnRightClick() { int index = _curIndex + 1; // if (index >= LuckyBoxDataManager.Instance.luckyBoxIds.Count) return; index = Mathf.Min(_ui.m_listBg.numItems - 1, index); _ui.m_listBg.ScrollToView(index, true); } private void OnListBgScroll() { if (_lcukyBoxCtrl.ContainsKey(LuckyBoxDataManager.Instance.currentBoxId)) _lcukyBoxCtrl[LuckyBoxDataManager.Instance.currentBoxId].OnHide(); _curIndex = _ui.m_listBg.GetFirstChildInView(); LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex]; if (LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_3) { _valueBarController.Controller(3); } else { _valueBarController.Controller(4); } _valueBarController.UpdateCJ(); UpdateListItem(); _ui.m_btnLeft.grayed = _curIndex <= 0; _ui.m_btnRight.grayed = _curIndex >= _ui.m_listBg.numItems - 1; LuckyBoxDataManager.Instance.luckyBoxIndex = _curIndex; } List _listActivityBtnObj = new List(); private void UpdateListItem() { int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex]; LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId); LuckyBoxDataManager.Instance.InitData(boxId); GObject obj = _ui.m_listBg.GetChildAt(_curIndex); UI_ComBox1 comBox = UI_ComBox1.Proxy(obj); _listActivityBtnObj.Add(obj); int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy); if (activityId > 0 && boxId == LuckyBoxDataManager.BOX_ID_2) { comBox.m_showActivityType.selectedIndex = 1; UpGiftBox(comBox); } else comBox.m_showActivityType.selectedIndex = 0; if (!_lcukyBoxCtrl.ContainsKey(boxId)) { _lcukyBoxCtrl.Add(boxId, new LuckyBoxController(comBox.m_comModel.target)); } _lcukyBoxCtrl[LuckyBoxDataManager.Instance.currentBoxId].OnShown(LuckyBoxDataManager.Instance.currentBoxId); comBox.m_comLuckBoxBtn.m_imgSpecial.visible = boxId != LuckyBoxDataManager.BOX_ID_3; //GGraph holder = comBox.m_comLuckBoxBtn.m_btnBuyTen.GetChild("holder").asGraph; //holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3; comBox.m_comLuckBoxBtn.m_holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3; //_effectUI1 = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", "Button_Glow"); _effectUI2 = EffectUIPool.CreateEffectUI(comBox.m_comLuckBoxBtn.m_holder, "ui_LuckyBox", "but_text_dc"); comBox.m_comLuckBoxBtn.m_comCostOne.m_txtCost.text = cfg.costNum.ToString(); comBox.m_comLuckBoxBtn.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res); comBox.m_comLuckBoxBtn.m_comCostTen.m_txtCost.text = cfg.costNumTen.ToString(); comBox.m_comLuckBoxBtn.m_comCostTen.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res); if (comBox.m_comLuckBoxBtn.m_btnBuyOne.data == null) { comBox.m_comLuckBoxBtn.m_btnBuyOne.onClick.Add(OnClickBtnBuyOne); } comBox.m_comLuckBoxBtn.m_btnBuyOne.data = boxId; if (comBox.m_comLuckBoxBtn.m_btnBuyTen.data == null) { comBox.m_comLuckBoxBtn.m_btnBuyTen.onClick.Add(OnClickBtnBuyTen); } comBox.m_comLuckBoxBtn.m_btnBuyTen.data = boxId; if (comBox.m_btnPreview.data == null) { comBox.m_btnPreview.onClick.Add(OnClickBtnPreview); } comBox.m_btnPreview.data = boxId; if (comBox.m_btnReward.data == null) { comBox.m_btnReward.onClick.Add(OnClikcBtnReward); comBox.m_btnShop.onClick.Add(OnClikcBtnShop); comBox.m_btnGiftBag.onClick.Add(OnClikcBtnGiftBag); } comBox.m_btnReward.data = boxId; obj.data = boxId; comBox.m_grpTime.visible = (boxId == _activeBoxId); if (boxId == _activeBoxId) { long endTime = LuckyBoxDataManager.Instance.endTime; long curTime = TimeHelper.ServerNow(); // TimeUtil.FormattingTime(curTime, endTime, out int num, out string str); long time = endTime - curTime; string strTime = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time); comBox.m_txtTime.text = string.Format("活动时间:剩余{0}", strTime); comBox.m_loaTitle.url = "ui://LuckyBox/zx_title_1"; } else { comBox.m_loaTitle.url = string.Format("ui://LuckyBox/zx_title_{0}", boxId); } UI_ComBox1.ProxyEnd(); UpdateListItemData(); UpdateFreeInfo(); UpdateBtnReward(); } private void UpdateBtnReward() { GObject obj = _ui.m_listBg.GetChildAt(1); UI_ComBox1 comBox = UI_ComBox1.Proxy(obj); RedDotController.Instance.SetComRedDot(comBox.m_btnReward, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(ConstLimitTimeActivityType.ActLimitTsy)); } private void OnClikcBtnReward() { ViewManager.Show(ConstLimitTimeActivityType.ActLimitTsy); } private void OnClikcBtnShop() { ViewManager.Show(new object[] { ConstStoreTabId.STORE_GIFT_BAG, ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY }, new object[] { typeof(LuckyBoxView).FullName }); } //刷新摘星活动期间的数据 private void UpGiftBox(UI_ComBox1 comBox) { int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex]; LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId); comBox.m_txtCount.SetVar("value", ActivityDataManager.Instance.lastTsyDrawCount.ToString()).FlushVars(); comBox.m_txtCount.SetVar("name", cfg.name).FlushVars(); var activityInfoByTypeList = ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB3); var list = activityInfoByTypeList.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList(); if (list.Count == 0) { comBox.m_comBagTime.target.visible = false; comBox.m_btnGiftBag.visible = false; } else { bool isSoldOut = true; foreach (var activityInfo in list) { ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(activityInfo.ActivityId); var paramsArr = activityOpenCfg.paramsArr; foreach (var shopCfgId in paramsArr) { var shopCfg = ShopCfgArray.Instance.GetCfg(shopCfgId); var remainBuyNum = shopCfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(shopCfgId); //只要有一个商品还能购买,就不是售罄 if (remainBuyNum > 0) { isSoldOut = false; break; } } } if (isSoldOut) { comBox.m_comBagTime.target.visible = false; comBox.m_btnGiftBag.visible = false; } else { comBox.m_comBagTime.m_txtGiftBagTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime); comBox.m_comBagTime.target.visible = true; comBox.m_btnGiftBag.visible = true; } } } //限时礼包按钮点击执行方法 private void OnClikcBtnGiftBag() { var activityInfoByTypeList = ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB3); var list = activityInfoByTypeList .Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList(); if (list.Count == 0) { PromptController.Instance.ShowFloatTextPrompt("活动已结束"); } else { ViewManager.Show(new object[] { ActivityType.XSLB3, this.viewData }); } } private void UpdateListItemData() { int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex]; LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId); GObject obj = _ui.m_listBg.GetChildAt(_curIndex); UI_ComBox1 comBox = UI_ComBox1.Proxy(obj); LuckyBoxDataManager.Instance.GetOwnedCount(boxId, out int count, out int totalCount); comBox.m_txtOwned.SetVar("v1", "" + count).FlushVars(); comBox.m_txtOwned.SetVar("v2", "" + totalCount).FlushVars(); int boughtCount = GameGlobal.myNumericComponent.GetAsInt(cfg.numericType); comBox.m_comLuckBoxBtn.m_txtRemainTimes.text = string.Format("今日剩余次数:{0}", cfg.maxCount - boughtCount); UI_ComBox1.ProxyEnd(); } private void CheckTime(object param = null) { if (LuckyBoxDataManager.Instance.currentBoxId == _activeBoxId) { if (LuckyBoxDataManager.Instance.currentBoxId != _activeBoxId) return; long endTime = LuckyBoxDataManager.Instance.endTime; long curTime = TimeHelper.ServerNow(); TimeUtil.FormattingTime(curTime, endTime, out int num, out string str); GObject item = _ui.m_listBg.GetChildAt(0); if (item == null) return; GObject textField = item.asCom.GetChild("txtTime"); if (textField == null) return; long time = endTime - curTime; string strTime = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time); textField.asTextField.text = string.Format("活动时间:剩余{0}", strTime); } else if(LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_2) { GObject item = _ui.m_listBg.GetChildAt(1); if (item == null) return; GObject textField = item.asCom.GetChild("txtTsyTime"); if (textField == null) return; int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy); var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(activityId); long endTime = TimeUtil.DateTimeToTimestamp(activityCfg.endTime); long curTime = TimeHelper.ServerNow(); if (endTime < curTime) { PromptController.Instance.ShowFloatTextPrompt("活动已结束"); Timers.inst.Remove(UpdateTime); OnClickBtnBack(); return; } TimeUtil.FormattingTime(curTime, endTime, out int num, out string str); textField.asTextField.text = "概率提升剩余: " + TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime); //=====限时礼包倒计时 //UpGiftBox(); //EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_TIME); //=====限时礼包倒计时END } } private void UpdateTime(object param = null) { } private void updateBoxEffect() { if (isActiveBoxOpen) { } } private void OnClickBtnPreview(EventContext context) { GObject obj = context.sender as GObject; int boxId = (int)obj.data; ViewManager.Show(boxId); } private void OnClickBtnBuyOne(EventContext context) { GObject obj = context.sender as GObject; int boxId = (int)obj.data; LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId); long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId); int boughtCount = GameGlobal.myNumericComponent.GetAsInt(luckyBoxCfg.numericType); if (boughtCount + LuckyBoxDataManager.ONCE_TIME > luckyBoxCfg.maxCount) { PromptController.Instance.ShowFloatTextPrompt("抽奖次数不足"); return; } LuckyBoxDataManager.Instance.CheckItemEnough(boxId, LuckyBoxDataManager.ONCE_TIME, async () => { int activityId = 0; if (boxId == LuckyBoxDataManager.BOX_ID_2) { activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy); } bool result = false; if (freeTime > 0 && freeTime < TimeHelper.ServerNow()) result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME, true, activityId); else result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME,false, activityId); if (result) { ViewManager.Show(null, new object[] { typeof(LuckyBoxView).FullName, boxId }); LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZAI_XING, 2); } }); } private void OnClickBtnBuyTen(EventContext context) { GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.LUCKY_BOX); if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0 && (GuideDataManager.currentGuideId == 0 || GuideDataManager.currentGuideIdIndex != 2)) { //防止点击太快,在引导开启前就被点击到,导致引导卡死 return; } GObject obj = context.sender as GObject; int boxId = (int)obj.data; LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId); int boughtCount = GameGlobal.myNumericComponent.GetAsInt(luckyBoxCfg.numericType); if (boughtCount + LuckyBoxDataManager.TEN_TIME > luckyBoxCfg.maxCount) { PromptController.Instance.ShowFloatTextPrompt("抽奖次数不足"); return; } LuckyBoxDataManager.Instance.CheckItemEnough(boxId, LuckyBoxDataManager.TEN_TIME, async () => { int activityId = 0; if (boxId == LuckyBoxDataManager.BOX_ID_2) { activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy); } bool result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.TEN_TIME,false, activityId); if (result) { ViewManager.Show(null, new object[] { typeof(LuckyBoxView).FullName, boxId }); LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZAI_XING, 2); UpdateBtnReward(); } }); } protected override void OnHide() { base.OnHide(); _valueBarController.OnHide(); foreach (int key in _lcukyBoxCtrl.Keys) { _lcukyBoxCtrl[key].OnHide(); } Timers.inst.Remove(OnTimerUpdate); Timers.inst.Remove(CheckTime); // Timers.inst.Remove(UpdateBg); Timers.inst.Remove(CheckGuide); // Timers.inst.Remove(UpdateTime); Debug.Log("OnHide: LuckyBoxView"); } protected override void RemoveEventListener() { base.RemoveEventListener(); EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData); EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData); EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo); EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_REWARD, UpdateBtnReward); } private void OnClickBtnBack() { Reset(); ViewManager.GoBackFrom(typeof(LuckyBoxView).FullName); } private void OnClickBtnHome() { GameController.GoBackToMainView(); } private void Reset() { LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[0]; } private void CheckGuide(object param) { if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) { UpdateToCheckGuide(null); } else { Timers.inst.Remove(CheckGuide); } } protected override void UpdateToCheckGuide(object param) { if (!ViewManager.CheckIsTopView(this.viewCom)) return; GObject gObject = _ui.m_listBg.GetChildAt(_curIndex); if (gObject == null) return; GButton btnBuyTen = gObject.asCom.GetChild("comLuckBoxBtn").asCom.GetChild("btnBuyTen").asButton; GuideController.TryGuide(null, ConstGuideId.LUCKY_BOX, 1, "“摘星”里可以通过星辰的力量获得服饰。", -1, true, _ui.target.height - 600); GuideController.TryGuide(btnBuyTen, ConstGuideId.LUCKY_BOX, 2, "点击摘取十次。"); } protected override void TryCompleteGuide() { base.TryCompleteGuide(); GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.LUCKY_BOX); GuideController.TryCompleteGuideIndex(ConstGuideId.LUCKY_BOX, 2); } private void UpdateFreeInfo() { int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex]; LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId); long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId); GObject obj = _ui.m_listBg.GetChildAt(_curIndex); UI_ComBox1 comBox = UI_ComBox1.Proxy(obj); if (freeTime > 0) { if (freeTime > TimeHelper.ServerNow()) { comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0; comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true; } else { comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 1; comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false; } } else { comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0; comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false; } } } }