コード例 #1
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;
                    }
                }
            }
        }
コード例 #2
0
 private void OnResponse(object obj)
 {
     if (obj == null)
     {
         return;
     }
     if (obj is LottoResponse)
     {
         m_ChooseEffect.Visible = false;
         LottoResponse res = obj as LottoResponse;
         m_lottoRes = res;
         m_curLucky = m_lottoRes.Lucky;
         m_lottoID  = res.LottoId;
         InitSlots(res);
     }
     else if (obj is LottoBuyResponse)
     {
         OnLottoBuyResponse(obj as LottoBuyResponse);
     }
 }