public void Refresh(Push_Info push_gift) { if (null == push_gift) { return; } Push_Info info = push_gift; //if (CommonTools.GetCurrentTimeSecond() > info.EndTime) //{ // return; //} ConfPush push = ConfPush.Get(info.PushId); PushGiftData data = new PushGiftData() { m_push_gift_id = push.id, m_tex_name = push.icon, m_price_txt = GameEvents.IAPEvents.Sys_GetPriceEvent.SafeInvoke(push.chargeid), m_bought = info.Buyed, m_charge_id = push.chargeid, }; m_data = data; m_buy_btn.Visible = true; m_bought_img.Visible = false; m_tex.TextureName = m_data.m_tex_name; m_price_txt.Text = m_data.m_price_txt; }
public void Refresh(Push_Info push_gift) { if (null == push_gift) { return; } Push_Info info = push_gift; ConfPush push = ConfPush.Get(info.PushId); PushGiftData data = new PushGiftData() { m_push_gift_id = push.id, m_tex_name = push.icon, m_price_txt = GameEvents.IAPEvents.Sys_GetPriceEvent.SafeInvoke(push.chargeid), m_bought = info.Buyed, m_charge_id = push.chargeid, }; ConfProp gift_prop = ConfProp.Get(push.giftid); m_data = data; m_gift_name.Text = LocalizeModule.Instance.GetString(gift_prop.name); m_buy_btn.Visible = true; m_bought_img.Visible = false; m_price_txt.Text = m_data.m_price_txt; var prop_json_infos = CommonHelper.GetFixedDropOuts(gift_prop.dropout); m_gift_grid.EnsureSize <DropItemIcon>(prop_json_infos.Count); for (int i = 0; i < m_gift_grid.ChildCount; ++i) { DropItemIcon child = m_gift_grid.GetChild <DropItemIcon>(i); DropOutJsonData prop_json = prop_json_infos[i]; ConfProp prop = ConfProp.Get(prop_json.value); child.InitSprite(prop.icon, prop_json.count, prop_json.value); child.Visible = true; } }
private void EnableIdx(int idx_) { Debug.Log("cur selected idx = " + idx_); PushGiftData data = m_datas[idx_]; m_tex.TextureName = data.m_tex_name; m_price_txt.Text = data.m_price_txt; if (data.m_bought) { m_buy_btn.Visible = false; m_bought_img.Visible = true; } else { m_buy_btn.Visible = true; m_bought_img.Visible = false; } PushToggleItem item = this.m_toggle_grid.GetChild <PushToggleItem>(idx_); item.EnableItem(); }
private void Refresh(List <Push_Info> push_gifts) { var not_bought = push_gifts.FindAll((item) => false == item.Buyed); if (null == push_gifts || 0 == push_gifts.Count || null == not_bought || 0 == not_bought.Count) { ShowAll(false); return; } ShowAll(true); if (1 == push_gifts.Count) { m_left_btn.Visible = false; m_right_btn.Visible = false; } else { m_left_btn.Visible = true; m_right_btn.Visible = true; } m_datas = new List <PushGiftData>(); for (int i = 0; i < push_gifts.Count; ++i) { Push_Info info = push_gifts[i]; if (info.Buyed) { continue; } if (0 != info.EndTime && CommonTools.GetCurrentTimeSecond() > info.EndTime) { continue; } Debug.Log(string.Format("cur push id = {0}", info.PushId)); ConfPush push = ConfPush.Get(info.PushId); if (null == push) { Debug.Log(string.Format("confpush {0} is null ", info.PushId)); continue; } PushGiftData data = new PushGiftData() { m_push_gift_id = push.id, m_tex_name = push.background, m_price_txt = GameEvents.IAPEvents.Sys_GetPriceEvent.SafeInvoke(push.chargeid), m_bought = info.Buyed, m_charge_id = push.chargeid, }; m_datas.Add(data); } if (0 == m_datas.Count) { return; } m_cur_idx = 0; this.m_toggle_grid.EnsureSize <PushToggleItem>(m_datas.Count); for (int i = 0; i < m_toggle_grid.ChildCount; ++i) { var item = m_toggle_grid.GetChild <PushToggleItem>(i); item.Visible = true; } EnableIdx(m_cur_idx); }