Example #1
0
        public void SetData(LottoItemProto itemProto, CostType costType, float costValue)
        {
            this.m_normalEffect.Visible = !itemProto.Special;
            this.m_effect.Visible       = itemProto.Special;
            if (itemProto.Special)
            {
            }

            ConfProp prop = ConfProp.Get(itemProto.PropId);

            if (prop == null)
            {
                return;
            }
            m_icon_img.Sprite    = prop.icon;
            m_itemCount_lab.Text = string.Format("x{0}", itemProto.Count);
            m_itemName_lab.Text  = LocalizeModule.Instance.GetString(prop.name);
            if (costType == CostType.CostCash)
            {
                m_costType_img.Sprite = "icon_mainpanel_cash_2.png";
            }
            else if (costType == CostType.CostCoin)
            {
                m_costType_img.Sprite = "icon_mainpanel_coin_2.png";
            }
            m_costValue_lab.Text = costValue.ToString();
            GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(itemProto.PropId, itemProto.Count);

            GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke();
        }
Example #2
0
        private void AnimOver()
        {
            totoalTimeSection = 0f;
            timesection       = 0f;
            if (m_chooseItemIndex < m_lottoRes.Items.Count)
            {
                LottoItemProto itemProto = m_lottoRes.Items[m_chooseItemIndex];
                if (itemProto.Special)
                {
                    m_curLucky = 0;
                }
                else
                {
                    m_curLucky += itemProto.Lucky;
                }
                ConfProp rewardProp = ConfProp.Get(itemProto.PropId);
                if (rewardProp != null)
                {
                    if (rewardProp.type == (int)GamePropType.Cash)
                    {
                        GlobalInfo.MY_PLAYER_INFO.ChangeCash(itemProto.Count);
                        if (m_cost_type == CostType.CostCash)
                        {
                            SetBuyContent(m_lottoRes.CostValue, GlobalInfo.MY_PLAYER_INFO.Cash);
                        }
                    }
                    else if (rewardProp.type == (int)GamePropType.Coin)
                    {
                        GlobalInfo.MY_PLAYER_INFO.ChangeCoin(itemProto.Count);
                        if (m_cost_type == CostType.CostCoin)
                        {
                            SetBuyContent(m_lottoRes.CostValue, GlobalInfo.MY_PLAYER_INFO.Coin);
                        }
                    }
                    else if (rewardProp.type == (int)GamePropType.BindingEnergy)
                    {
                        GlobalInfo.MY_PLAYER_INFO.ChangeVit(itemProto.Count);
                    }
                }
                m_luckValue_lab.Text = m_curLucky.ToString();
                if (m_playingAudio != null)
                {
                    m_playingAudio.Stop();
                }

                //EngineCoreEvents.AudioEvents.s(GameCustomAudioKey.shop_buycoin.ToString(), null);
                TimeModule.Instance.SetTimeout(() =>
                {
                    m_buy_btn.Visible = true;
                    m_canClose        = true;
                    OnActiveAllEffect(false);
                    m_slotResult_com.Visible = true;
                    m_slotResult_com.SetData(itemProto, m_lottoRes.CostType, m_lottoRes.CostValue);
                }, 1.2f);
            }
            m_startBuy  = false;
            m_startSure = false;
            SetPageState(true);
        }
Example #3
0
        private void InitSlots(LottoResponse res)
        {
            m_luckValue_lab.Text = res.Lucky.ToString();
            m_cost_type          = res.CostType;

            if (res.CostType == CostType.CostCoin)
            {
                m_moneyIcon_img.Sprite = "icon_mainpanel_coin_2.png";
                SetBuyContent(res.CostValue, GlobalInfo.MY_PLAYER_INFO.Coin);
            }
            else if (res.CostType == CostType.CostCash)
            {
                m_moneyIcon_img.Sprite = "icon_mainpanel_cash_2.png";
                SetBuyContent(res.CostValue, GlobalInfo.MY_PLAYER_INFO.Cash);
            }
            if (res.Items.Count != ITEMMAXSIZE)
            {
                Debug.Log("item 太少了");
            }

            for (int i = 0; i < ITEMMAXSIZE; i++)
            {
                if (res.Items.Count > i)
                {
                    LottoItemProto lottoItem = res.Items[i];
                    if (lottoItem == null)
                    {
                        continue;
                    }
                    ConfProp prop = ConfProp.Get(lottoItem.PropId);
                    if (prop == null)
                    {
                        continue;
                    }
                    m_itemIcon_img[i].Sprite = prop.icon;
                    //m_itemName_lab[i].Text = LocalizeModule.Instance.GetString(prop.name);
                    m_itemCount_lab[i].Text   = string.Format("x{0}", lottoItem.Count);
                    m_special_root[i].Visible = lottoItem.Special;
                    if (lottoItem.Special)
                    {
                        m_itemBg_img[i].Sprite = m_SpecialBG_Str;
                        m_SpecialEffect.gameObject.transform.SetParent(m_itemBg_img[i].gameObject.transform, false);
                        m_SpecialEffect.Visible = true;
                    }
                    else
                    {
                        m_itemBg_img[i].Sprite = m_NormalBG_Str;
                    }
                }
            }
        }