private void GetGiftSuccess(ReceiveFreeTriggerGiftRes res) { LoadingOverlay.Instance.Hide(); RewardUtil.AddReward(res.Award); AwardWindow awardWindow = PopupManager.ShowWindow <AwardWindow>("GameMain/Prefabs/AwardWindow/AwardWindow"); awardWindow.SetData(res.Award); awardWindow.WindowActionCallback = evt => { RandomEventManager.ShowGiftWindow(_currentIndex); }; GlobalData.RandomEventModel.UpdateDate(res.UserTriggerGift); Close(); }
private void ShowTriggerGift() { RandomEventManager.ShowGiftWindow(); }
private void ShowGift() { ClientData.LoadItemDescData(null); ClientData.LoadSpecialItemDescData(null); var npcId = GlobalData.PlayerModel.PlayerVo.NpcId; var npcImg = transform.GetRawImage("window/RoleImage" + npcId); npcImg.texture = ResourceManager.Load <Texture>("Background/PersonIcon/Npc" + npcId, null, true); npcImg.gameObject.Show(); _triggerGiftVo = _list[_currentIndex]; _titleText.text = _triggerGiftVo.Rule.MallName; _desc.text = _triggerGiftVo.Rule.MallDesc; List <RewardVo> rewardList = _triggerGiftVo.GetRewardList(); for (int i = 0; i < _content.childCount; i++) { Transform child = _content.GetChild(i); if (i < rewardList.Count) { child.GetRawImage("Image").texture = ResourceManager.Load <Texture>(rewardList[i].IconPath, null, true); child.GetText("NumText").text = rewardList[i].Num.ToString(); } if (i < rewardList.Count) { RewardVo vo = rewardList[i]; PointerClickListener.Get(child.gameObject).onClick = go => { FlowText.ShowMessage(ClientData.GetItemDescById(vo.Id, vo.Resource).ItemDesc); }; } child.gameObject.SetActive(i < rewardList.Count); } // RectTransform rect = _buyBtnText.transform.GetRectTransform(); if (_triggerGiftVo.IsFree) { _buyBtnText.gameObject.Hide(); _freeBtnText.gameObject.Show(); _freeBtnText.text = I18NManager.Get("RandowEventWindow_Free"); _originalPriceText.gameObject.Hide(); // rect.sizeDelta = new Vector2(920, rect.sizeDelta.y); } else { ProductVo product = GlobalData.PayModel.GetProduct(_triggerGiftVo.MallId); _buyBtnText.text = product.AreaPrice;//product.Curreny + " " + _buyBtnText.gameObject.Show(); _freeBtnText.gameObject.Hide(); _originalPriceText.gameObject.Show(); if (AppConfig.Instance.isChinese == "true" || product?.Curreny == Constants.CHINACURRENCY) { _originalPriceText.text = I18NManager.Get("RandowEventWindow_OriginalPrice") + _triggerGiftVo.Rule.OriginalPrice + "元"; } else { _originalPriceText.text = I18NManager.Get("RandowEventWindow_OriginalPrice") + product.Curreny + " " + product.GetOriginalPrice(_triggerGiftVo.Rule.OriginalPrice); } // rect.sizeDelta = new Vector2(920-100, rect.sizeDelta.y); } ClientTimer.Instance.RemoveCountDown(_countName); _timeText.text = I18NManager.Get("RandowEventWindow_Time", DateUtil.GetTimeFormat4(_triggerGiftVo.MaturityTime - ClientTimer.Instance.GetCurrentTimeStamp())) + I18NManager.Get("RandowEventWindow_Later"); ClientTimer.Instance.AddCountDown(_countName, long.MaxValue, 1, tick => { if (_triggerGiftVo.MaturityTime - ClientTimer.Instance.GetCurrentTimeStamp() <= 0) { Close(); GlobalData.RandomEventModel.Delete(new RepeatedField <long>() { _triggerGiftVo.Id }); RandomEventManager.ShowGiftWindow(_currentIndex); return; } _timeText.text = I18NManager.Get("RandowEventWindow_Time", DateUtil.GetTimeFormat4( _triggerGiftVo.MaturityTime - ClientTimer.Instance.GetCurrentTimeStamp())) + I18NManager.Get("RandowEventWindow_Later"); }, null); _leftBtn.gameObject.SetActive(_list.Count > 1); _rightBtn.gameObject.SetActive(_list.Count > 1); }