Exemple #1
0
        public void ShopBuy(long marketID, int market_count, int prop_count, ShopType type, int cost, CostType costType)
        {
            if (costType == CostType.CostCash)
            {
                EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.shop_buycash.ToString());
                if (GlobalInfo.MY_PLAYER_INFO.Cash < cost)
                {
                    //PopUpManager.OpenCashBuyError();
                    PopUpManager.OpenGoToCashShop();
                    return;
                }

                if (GlobalInfo.Enable_Purchase)
                {
                    PopUpBuyConfirm(marketID, market_count, prop_count, type, cost);
                    return;
                }
            }
            else if (costType == CostType.CostCoin)
            {
                EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.shop_buycoin.ToString());
                if (GlobalInfo.MY_PLAYER_INFO.Coin < cost)
                {
                    //PopUpManager.OpenCoinBuyError();
                    //PopUpManager.OpenGoToCoinShop();
                    PushGiftManager.Instance.TurnOn(ENUM_PUSH_GIFT_BLOCK_TYPE.E_COIN);
                    return;
                }
            }
            GameEvents.BuyEvent.OnShopReq.SafeInvoke(marketID, market_count, market_count * prop_count, type);
#if Test
            MarkeBuyResponse res = new global::MarkeBuyResponse();
            res.ResponseStatus      = new ResponseStatus();
            res.ResponseStatus.Code = 0;
            MarkeBuyResponse(res);
#else
            MarkeBuyRequest req = new MarkeBuyRequest();
            req.MarketItemId = (int)marketID;
            req.Count        = market_count;
            GameEvents.NetWorkEvents.SendMsg.SafeInvoke(req);
#endif
        }
Exemple #2
0
        private void OnLottoBuyResponse(LottoBuyResponse res)
        {
            m_chooseItemIndex = -1;
            if (res.ResponseStatus != null || m_lottoRes == null)
            {
                if (m_CurrentPage == SlotPageType.PageCash)
                {
                    //PopUpManager.OpenCashBuyError();
                    PopUpManager.OpenGoToCashShop();
                }
                else if (m_CurrentPage == SlotPageType.PageCoin)
                {
                    //PopUpManager.OpenCoinBuyError();
                    //PopUpManager.OpenGoToCoinShop();
                    PushGiftManager.Instance.TurnOn(ENUM_PUSH_GIFT_BLOCK_TYPE.E_COIN);
                }
                //PopUpManager.OpenNormalOnePop(res.ResponseStatus.Msg);
                return;
            }
            for (int i = 0; i < m_lottoRes.Items.Count; i++)
            {
                if (m_lottoRes.Items[i].Id == res.Id) //mmp
                {
                    m_chooseItemIndex = i;
                    Debug.Log("chooseItemIdex " + m_chooseItemIndex + "  " + res.Id);
                    break;
                }
            }
            if (m_chooseItemIndex >= 0)
            {
                EngineCoreEvents.AudioEvents.PlayAndGetAudio.SafeInvoke(Audio.AudioType.Sound, GameCustomAudioKey.lotto_playing.ToString(), (audio) =>
                {
                    m_playingAudio = audio;
                });

                if (m_lottoRes.CostType == CostType.CostCoin)
                {
                    GlobalInfo.MY_PLAYER_INFO.ChangeCoin(-m_lottoRes.CostValue);
                    SetBuyContent(m_lottoRes.CostValue, GlobalInfo.MY_PLAYER_INFO.Coin);
                    //m_buyCount_lab.Text = string.Format("{0}/{1}", m_lottoRes.CostValue, GlobalInfo.MY_PLAYER_INFO.Coin);
                }
                else if (m_lottoRes.CostType == CostType.CostCash)
                {
                    GlobalInfo.MY_PLAYER_INFO.ChangeCash(-m_lottoRes.CostValue);
                    SetBuyContent(m_lottoRes.CostValue, GlobalInfo.MY_PLAYER_INFO.Cash);
                    //m_buyCount_lab.Text = string.Format("{0}/{1}", m_lottoRes.CostValue, GlobalInfo.MY_PLAYER_INFO.Cash);
                }

                Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                {
                    { UBSParamKeyName.ContentType, m_CurrentPage },
                    { UBSParamKeyName.Currency, m_lottoRes.CostType },
                    { UBSParamKeyName.ContentID, res.Props[0].PropId },
                    { UBSParamKeyName.NumItems, res.LottoCount },
                };
                UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.lotto_play, 1f, _params);

                SetPageState(false);

                m_startBuy        = true;
                m_canClose        = false;
                m_CanBuy          = false;
                m_totalTime       = m_slotValue.m_totalTime;
                m_curEffect       = 0;
                m_buy_btn.Visible = false;
                //m_effect_img[0].Visible = true;
            }
            else
            {
                Debug.LogError("No chooseItemIdex ");
            }
        }