public void Refresh() { Dictionary <long, FriendGift> datas = FriendDataManager.Instance.GetGifts(); int gift_num = datas.Count; int receive_num = FriendDataManager.Instance.Receive_gift_left_num; m_receive_all_btn.Enable = gift_num > 0 && receive_num > 0; m_receive_all_btn.SetGray(!(gift_num > 0 && receive_num > 0)); //m_gift_num_text.Text = string.Format("{0}/{1}", FriendDataManager.Instance.Receive_gift_max_num - FriendDataManager.Instance.Receive_gift_left_num, FriendDataManager.Instance.Receive_gift_max_num); if (null == datas || 0 == datas.Count) { m_gift_grid.Clear(); return; } gifts = new List <FriendGift>(datas.Values); gifts.Sort((a, b) => { if (a.PlayerFriends.StatusTime > b.PlayerFriends.StatusTime) { return(-1); } else { return(1); } }); m_gift_grid.EnsureSize <GiftItemUI>(gifts.Count); //m_gift_scroll.ScrollToTop(); for (int i = 0; i < m_gift_grid.ChildCount; ++i) { m_gift_grid.GetChild <GiftItemUI>(i).Visible = false; m_gift_grid.GetChild <GiftItemUI>(i).Visible = true; m_gift_grid.GetChild <GiftItemUI>(i).Refresh(gifts[i]); } }
void RefreshCombineProp(ConfCombineFormula combine) { m_cur_mix_num = CombineDataManager.Instance.GetCurCount(m_cur_combine_id); m_progress_txt.Text = 0 == combine.mixLimit ? "" : $"{m_cur_mix_num}/{combine.mixLimit}"; int sum = 0; sum += RefreshBigStuffs(m_cur_combine_id) ? 1 : 0; sum += RefreshSmallStuffs(m_cur_combine_id) ? 1 : 0; m_stored_img.Visible = false; m_combine_btn.Visible = true; m_gift_btn.Visible = true; if (sum >= 2 && (0 == combine.mixLimit || m_cur_mix_num < combine.mixLimit)) { m_combine_btn.Enable = true; m_combine_btn.SetGray(false); } else { if ((int)ENUM_COMBINE_TYPE.COLLECTION == combine.type) { if (sum < 2) { m_combine_btn.Enable = false; m_combine_btn.SetGray(true); } else { m_stored_img.Visible = true; m_combine_btn.Visible = false; } } else { m_combine_btn.Enable = false; m_combine_btn.SetGray(true); } } }
protected override void OnInit() { // m_title_text = this.Make<GameLabel>("Panel_tipsanimate:Text_title"); // m_title_text.Text = LocalizeModule.Instance.GetString("friend_receive"); m_gift_grid = this.Make <GameUIContainer>("Panel_tipsanimate:Panel_friend:Panel_friend-received:Content"); //m_gift_scroll = this.Make<GameScrollView>("Panel_friend:Content"); m_receive_all_btn = this.Make <GameButton>("Panel_tipsanimate:btn_1"); m_receive_all_btn.SetGray(true); m_receive_all_btn_text = m_receive_all_btn.Make <GameLabel>("Text"); m_receive_all_btn_text.Text = LocalizeModule.Instance.GetString("friend_receive_all"); //m_gift_num_text = this.Make<GameLabel>("Panel_tipsanimate:Text_detail"); this.SetCloseBtnID("Panel_tipsanimate:Button_close"); }
private void SwitchButton() { if (null == m_itemdata) { return; } m_count_BG.Visible = true; if (m_is_fast_buy) { //因不足的原因,弹出快速购买 PlayerPropMsg item = GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(m_itemdata.m_prop.id); if (null != item && item.Count > 0) { m_disCount_root.Visible = false; m_oriPrice_root.Visible = false; m_buy_btn.Visible = false; m_limited_buy_btn.Visible = false; m_use_btn.Visible = true; m_count_lab.Text = string.Format("x{0}", item.Count); return; } } if (ShopType.Vit == m_curShopType && 0 == m_itemdata.m_limitNumber && !m_itemdata.m_hasDis) { //道具购买次数限制触发 PlayerPropMsg item = GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(m_itemdata.m_prop.id); if (null != item && item.Count > 0) { m_disCount_root.Visible = false; m_oriPrice_root.Visible = false; m_buy_btn.Visible = false; m_limited_buy_btn.Visible = false; m_use_btn.Visible = true; m_count_lab.Text = string.Format("x{0}", item.Count); return; } } m_use_btn.Visible = false; m_buy_btn.Visible = true; m_count_lab.Text = string.Format("x{0}", m_itemdata.m_number); if (m_itemdata.m_hasDis) { m_cost = m_itemdata.m_disPrice; m_disCount_root.Visible = true; m_oriPrice_root.Visible = true; m_disCount_lab.Text = string.Format("-{0}%", m_itemdata.m_disCount); m_oriPrice_lab.Text = m_itemdata.m_oriPrice.ToString(); m_limited_cost_lab.Text = m_cost_lab.Text = m_itemdata.m_disPrice.ToString(); } else { m_cost = m_itemdata.m_oriPrice; m_disCount_root.Visible = false; m_oriPrice_root.Visible = false; m_limited_cost_lab.Text = m_cost_lab.Text = m_itemdata.m_oriPrice.ToString(); if (ShopType.Vit == m_curShopType) { m_count_BG.Visible = false; m_count_lab.Text = ""; } } if (ShopType.Coin == m_curShopType && null == m_icon_effect) { m_icon_effect = Make <GameUIEffect>("UI_jinbi_goumai01"); } if (null != m_icon_effect) { m_icon_effect.EffectPrefabName = string.Format("UI_jinbi_goumai0{0}.prefab", m_idx + 1); } if (m_itemdata.m_maxNumber > 0) { m_limited_max_num = m_itemdata.m_maxNumber; } if (m_itemdata.m_limitNumber > 0) { m_limited_buy_btn.Visible = true; m_limited_buy_btn.SetGray(false); m_limited_buy_btn.Enable = true; m_buy_btn.Visible = false; m_limited_buy_num_txt.Text = string.Format("({0}/{1})", m_itemdata.m_limitNumber, m_limited_max_num); } else if (m_itemdata.m_limitNumber == 0) { m_limited_buy_btn.Visible = true; m_limited_buy_btn.SetGray(true); m_limited_buy_btn.Enable = false; m_buy_btn.Visible = false; m_limited_buy_num_txt.Text = string.Format("({0}/{1})", m_itemdata.m_limitNumber, m_limited_max_num); } else { m_limited_buy_btn.Visible = false; m_buy_btn.Visible = true; } }
private void setBtnEnable(GameButton btn, bool b) { btn.SetGray(!b); btn.SetGrayAndUnClick(b); }
private void CheckState() { m_reduceNum_btn.SetGray(m_curNum <= 1); m_addNum_btn.SetGray(m_curNum >= m_bagData.prop.num); m_maxNum_btn.SetGray(m_curNum >= m_bagData.prop.num); }