public List <Push_Info> GetPushInfosByTurnOnType(ENUM_PUSH_GIFT_BLOCK_TYPE type_, bool bought = false) { if (ENUM_PUSH_GIFT_BLOCK_TYPE.E_LOGIN == type_) { if (null != this.m_login_push_infos) { var boughts = this.m_login_push_infos.FindAll((item) => bought == item.Buyed); if (null == boughts || 0 == boughts.Count) { return(null); } } return(this.m_login_push_infos); } else if (ENUM_PUSH_GIFT_BLOCK_TYPE.E_LVL == type_) { return(this.m_level_up_push_infos); } else { List <Push_Info> cur_infos = new List <Push_Info>(); this.m_block_push_infos.ForEach((item) => { if ((byte)type_ == ConfPush.Get(item.PushId).bolckType) { cur_infos.Add(item); } }); return(cur_infos.Count > 0 ? cur_infos : null); } }
public void DisableItem(long charge_id) { //m_datas.ForEach((item) => { if (item.m_charge_desc == charge_desc_ && 0 == ConfPush.Get(item.m_push_gift_id).bolckType) item.m_bought = true; }); Debug.Log("gift view cur finish charge id = " + charge_id); PushGiftManager.Instance.BoughtLoginGift(charge_id); foreach (var item in m_datas) { Debug.Log("gift view cur item push id = " + item.m_push_gift_id); Debug.Log("gift view cur item charge id = " + item.m_charge_id); Debug.Log("gift view cur item block type = " + ConfPush.Get(item.m_push_gift_id).bolckType); if (item.m_charge_id == charge_id && 0 == ConfPush.Get(item.m_push_gift_id).bolckType) { item.m_bought = true; } } Debug.Log("cur idx = " + m_cur_idx); Debug.Log("cur selected desc = " + m_datas[m_cur_idx].m_charge_id); if (m_datas[m_cur_idx].m_charge_id == charge_id && m_datas[m_cur_idx].m_bought) { m_buy_btn.Visible = false; m_bought_img.Visible = true; } }
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 DisableItem(long charge_id_) { if (m_data.m_charge_id != charge_id_) { return; } if (0 == ConfPush.Get(m_data.m_push_gift_id).bolckType) { m_data.m_bought = true; } m_buy_btn.Visible = false; m_bought_img.Visible = true; }
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; } }
public void BoughtLoginGift(long charge_id_) { if (null != this.m_login_push_infos) { foreach (var info in m_login_push_infos) { if (info.Buyed) { continue; } ConfPush push = ConfPush.Get(info.PushId); if (push.chargeid == charge_id_) { info.Buyed = true; } } } }
private void OnPushGiftRsp(object s) { if (s is SCGetPushResponse) { var rsp = s as SCGetPushResponse; List <Push_Info> infos = new List <Push_Info>(); if (null == rsp.Infos || 0 == rsp.Infos.Count) { m_login_push_infos = null; return; } infos.AddRange(rsp.Infos); PushGiftManager.Instance.RefreshLoginPush(infos); } else if (s is SCBuyPushResponse) { var rsp = s as SCBuyPushResponse; if (!MsgStatusCodeUtil.OnError(rsp.ReponseStatus)) { #if UNITY_IOS && PLATFORM_ID GameEvents.IAPEvents.Sys_BuyProductIOSEvent.SafeInvoke(ConfCharge.Get(ConfPush.Get(rsp.PushId).chargeid).chargeSouceId); #else GameEvents.IAPEvents.Sys_BuyProductEvent.SafeInvoke(ConfCharge.Get(ConfPush.Get(rsp.PushId).chargeid).id); #endif } } }
private void OnDetailClicked(GameObject obj) { m_detail_root.Visible = !m_detail_root.Visible; m_detail_txt.Text = LocalizeModule.Instance.GetString(ConfPush.Get(m_datas[m_cur_idx].m_push_gift_id).descs); }
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); }