| | |
| | | [SerializeField] Image stateImg;
|
| | | [SerializeField] Button flashSaleBtn;
|
| | | [SerializeField] Text btnStateText;
|
| | | [SerializeField] Text fullServerRemainNum;
|
| | |
|
| | | public const int RefreshFullServerBuyType = 8;
|
| | |
|
| | |
| | | {
|
| | | battleModel.RefreshGameRecInfoAct += UpdateFullServerBuy;
|
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
|
| | | rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointmentInfo;
|
| | | rushToBuyModel.UpdateAppointmentEvent += UpdateAppointmentInfo;
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
|
| | | battleModel.RefreshGameRecInfoAct -= UpdateFullServerBuy;
|
| | | rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointmentInfo;
|
| | | rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointmentInfo;
|
| | | }
|
| | |
|
| | | public override void Refresh(CellView cell)
|
| | | {
|
| | | if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
|
| | | if (rushToBuyModel.presentFlashShop == null) return;
|
| | |
|
| | | saleItem = rushToBuyModel.presentFlashShop.items[cell.index];
|
| | | ItemCellModel cellModel = new ItemCellModel(saleItem.itemId,true,(ulong)saleItem.itemCount,saleItem.isBind);
|
| | |
| | | }
|
| | |
|
| | |
|
| | | private void UpdateAppointmentInfo()
|
| | | private void UpdateAllAppointmentInfo()
|
| | | {
|
| | | UpdateSaleItem();
|
| | | }
|
| | |
|
| | | private void UpdateAppointmentInfo(int shopGuid)
|
| | | {
|
| | | if (saleItem == null || shopGuid != saleItem.shopGuid) return;
|
| | | UpdateSaleItem();
|
| | | }
|
| | |
|
| | | private void UpdateSaleItem()
|
| | | {
|
| | | if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
|
| | | if (rushToBuyModel.presentFlashShop == null) return;
|
| | |
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(saleItem.shopId);
|
| | | flashSaleBtn.RemoveAllListeners();
|
| | |
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,rushToBuyModel.presentFlashShop.dayIndex,
|
| | | rushToBuyModel.presentFlashShop.timeIndex,out seconds);
|
| | |
|
| | | switch(buyState)
|
| | | {
|
| | | case -1:
|
| | |
| | |
|
| | | private void UpdateSaleItemSellState()
|
| | | {
|
| | | int sellState = GetSellSate();
|
| | | int fullSeverRemain = 0;
|
| | | int sellState = GetSellSate(out fullSeverRemain);
|
| | | fullServerRemainNum.text = fullSeverRemain.ToString();
|
| | | switch (sellState)
|
| | | {
|
| | | case 0:
|
| | |
| | | /// 0 秒杀 1 已买到 2 已抢光
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private int GetSellSate()
|
| | | private int GetSellSate(out int fullRemainNum)
|
| | | {
|
| | | var buyInfo = storeModel.GetBuyShopLimit((uint)saleItem.shopId);
|
| | | var buyCount = 0;
|
| | | var fullServerInfo = rushToBuyModel.GetFullServerInfo();
|
| | | fullRemainNum = 0;
|
| | | if (fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId)
|
| | | {
|
| | | fullRemainNum = saleItem.fullServerLimitNum - fullServerInfo.Value2;
|
| | | }
|
| | | else
|
| | | {
|
| | | fullRemainNum = saleItem.fullServerLimitNum;
|
| | | }
|
| | | if (buyInfo != null)
|
| | | {
|
| | | buyCount = buyInfo.BuyCnt;
|
| | |
| | | return 1;
|
| | | }
|
| | |
|
| | | var fullServerInfo = rushToBuyModel.GetFullServerInfo();
|
| | | if(fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId
|
| | | && fullServerInfo.Value2 >= saleItem.fullServerLimitNum)
|
| | | if (fullRemainNum <= 0)
|
| | | {
|
| | | return 2;
|
| | | }
|