| | |
| | | [SerializeField] DragItem dragItem;
|
| | | [SerializeField] Text activityDayText;
|
| | | [SerializeField] Text totalDayText;
|
| | | [SerializeField] Text dayRemainTime;
|
| | | [SerializeField] Button lookAllBtn;
|
| | | [SerializeField] Button refreshWishBtn;
|
| | | [SerializeField] Button freeRefreshWishBtn;
|
| | | [SerializeField] Button moneyRefreshWishBtn;
|
| | | [SerializeField] Text moneyValueText;
|
| | | [SerializeField] Text freeWishCoolText;
|
| | | [SerializeField] List<PoolItemCell> poolItemCells = new List<PoolItemCell>();
|
| | | [SerializeField] List<WishingCell> wishingCells = new List<WishingCell>();
|
| | | [SerializeField] List<WishItemCell> wishingCells = new List<WishItemCell>();
|
| | | [SerializeField] GameObject activityOpenObj;
|
| | | [SerializeField] GameObject activityCloseObj;
|
| | |
|
| | |
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | refreshWishBtn.AddListener(ClickRefreshWish);
|
| | | freeRefreshWishBtn.AddListener(ClickFreeRefreshWish);
|
| | | moneyRefreshWishBtn.AddListener(ClickMoneyRefreshWish);
|
| | | lookAllBtn.AddListener(ClickLook);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | Display();
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | wishingModel.UpdatePoolDataEvent += UpdatePoolItemByIndex;
|
| | | wishingModel.UpdateWishingDataEvent += UpdateWishItemByIndex;
|
| | | GlobalTimeEvent.Instance.hourEvent += UpdateFreeWishCool;
|
| | | Display();
|
| | | GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | {
|
| | | wishingModel.UpdatePoolDataEvent -= UpdatePoolItemByIndex;
|
| | | wishingModel.UpdateWishingDataEvent -= UpdateWishItemByIndex;
|
| | | GlobalTimeEvent.Instance.hourEvent -= UpdateFreeWishCool;
|
| | | GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
|
| | | OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | |
| | | dragItem.dragItemRect.gameObject.SetActive(false);
|
| | | UpdateFreeWishCool();
|
| | | UpdateActivityState();
|
| | | activityDayText.text = Language.Get("SignIn_4", Language.Get(StringUtility.Contact("Num_CHS_", operation.GetActivityDay())));
|
| | | totalDayText.text = StringUtility.Contact("活动持续", Language.Get(StringUtility.Contact("Num_CHS_",operation.totalDays + 1)), "天");
|
| | | UpdateDayRemainTime();
|
| | | activityDayText.text = Language.Get("WishingPool103", Language.Get(StringUtility.Contact("Num_CHS_", operation.GetActivityDay())));
|
| | | totalDayText.text = Language.Get("WishingPool101", Language.Get(StringUtility.Contact("Num_CHS_", operation.totalDays + 1)));
|
| | | }
|
| | |
|
| | | #region 许愿逻辑
|
| | |
| | | {
|
| | | for(int i = 0; i < wishingCells.Count; i++)
|
| | | {
|
| | | var rect = wishingCells[i].wishRect;
|
| | | var rect = wishingCells[i].transform as RectTransform;
|
| | | var des = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, rect);
|
| | | var src = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, dragItem.dragItemRect);
|
| | | var dis = Vector3.Distance(des.center, src.center);
|
| | |
| | |
|
| | | private void UpdateWishItemByIndex(int index)
|
| | | {
|
| | | WishingPoolModel.WishingWellItem wellItem = null;
|
| | | var wishCell = wishingCells[index];
|
| | | bool isWishData = wishingModel.TryGetWishDataByIndex(index, out wellItem);
|
| | | if (isWishData)
|
| | | {
|
| | | wishCell.itemBaisc.gameObject.SetActive(true);
|
| | | wishCell.noneItemObj.gameObject.SetActive(false);
|
| | | ItemCellModel cellModel = new ItemCellModel(wellItem.itemId, false, (ulong)wellItem.itemCount, wellItem.isBind);
|
| | | wishCell.itemBaisc.Init(cellModel);
|
| | | wishCell.itemBaisc.cellBtn.RemoveAllListeners();
|
| | | wishCell.itemBaisc.cellBtn.AddListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(wellItem.itemId, true, (ulong)wellItem.itemCount,-1,wellItem.isBind);
|
| | | tipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | wishCell.itemBaisc.gameObject.SetActive(false);
|
| | | wishCell.noneItemObj.gameObject.SetActive(true);
|
| | | }
|
| | | }
|
| | |
|
| | | [Serializable]
|
| | | public class WishingCell
|
| | | {
|
| | | public RectTransform wishRect;
|
| | | public CommonItemBaisc itemBaisc;
|
| | | public GameObject noneItemObj;
|
| | | public Button noneItemBtn;
|
| | | wishCell.Display(index);
|
| | | }
|
| | |
|
| | | [Serializable]
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void UpdateSecond()
|
| | | {
|
| | | if (operation == null) return;
|
| | | UpdateFreeWishCool();
|
| | | UpdateDayRemainTime();
|
| | | }
|
| | |
|
| | | private void UpdateDayRemainTime()
|
| | | {
|
| | | dayRemainTime.text = Language.Get("WishingPool104", TimeUtility.SecondsToHMS(operation.GetResetSurplusTime()));
|
| | | }
|
| | |
|
| | | private void UpdateFreeWishCool()
|
| | | {
|
| | | int second = 0;
|
| | | bool isCool = wishingModel.TryGetFreeWishCoolTime(out second);
|
| | | if (isCool)
|
| | | {
|
| | | freeRefreshWishBtn.gameObject.SetActive(false);
|
| | | freeWishCoolText.gameObject.SetActive(true);
|
| | | freeWishCoolText.text = TimeUtility.SecondsToHMS(second);
|
| | | moneyRefreshWishBtn.gameObject.SetActive(true);
|
| | | moneyValueText.text = "100";
|
| | | freeWishCoolText.text = Language.Get("WishingPool102", TimeUtility.SecondsToHMS(second));
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | freeRefreshWishBtn.gameObject.SetActive(true);
|
| | | freeWishCoolText.gameObject.SetActive(false);
|
| | | moneyRefreshWishBtn.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | WindowCenter.Instance.Open<WishingWarehouseWin>();
|
| | | }
|
| | |
|
| | | private void ClickRefreshWish()
|
| | | private void ClickMoneyRefreshWish()
|
| | | {
|
| | | int second = 0;
|
| | | bool isCool = wishingModel.TryGetFreeWishCoolTime(out second);
|
| | | if(isCool)
|
| | | {
|
| | | wishingModel.SendRefreshPoolInfo(0);
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | }
|
| | | private void ClickFreeRefreshWish()
|
| | | {
|
| | | wishingModel.SendRefreshPoolInfo(1);
|
| | | }
|
| | | #endregion
|
| | |
|