public static bool GetConfig(string fieldName, object fieldValue, out ConfPush config) { DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_Push", fieldName, fieldValue); if (sqReader != null) { try { sqReader.Read(); if (sqReader.HasRows) { config = GetConfByDic(sqReader); } else { config = null; return(false); } return(true); } catch (Exception ex) { SqliteDriver.SQLiteHelper.OnError(string.Format("Push 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex)); } config = null; return(false); } config = null; return(false); }
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; }
private static void GetArrrayList() { if (cacheArray.Count <= 0) { DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_Push"); if (sqReader != null) { while (sqReader.Read()) { ConfPush _conf = GetConfByDic(sqReader); cacheArray.Add(_conf); dic[_conf.id] = _conf; } resLoaded = true; } } }
public static long GetGiftID(long charge_id_) { ConfCharge charge = ConfCharge.Get(charge_id_); if (null == charge) { return(-1L); } ConfPush push_gift = ConfPush.array.Find((item) => item.chargeid == charge.id); if (null == push_gift) { return(-1L); } return(push_gift.giftid); }
public static bool GetConfig(long id, out ConfPush config) { if (dic.TryGetValue(id, out config)) { return(config != null); } if (cacheLoaded) { config = null; return(false); } DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_Push", id); if (sqReader != null) { try { sqReader.Read(); if (sqReader.HasRows) { config = GetConfByDic(sqReader); } else { dic[id] = null; config = null; return(false); } dic[id] = config; return(true); } catch (Exception ex) { SqliteDriver.SQLiteHelper.OnError(string.Format("Push 表找不到SN={0} 的数据\n{1}", id, ex)); } config = null; return(false); } else { config = null; return(false); } }
private static ConfPush GetConfByDic(DataTable reader) { long id = reader.GetInt64(0); string bolckDesc = reader.GetString(1); int bolckType = reader.GetInt32(2); int manualGroup = reader.GetInt32(3); int createPlayerDays = reader.GetInt32(4); int manualType = reader.GetInt32(5); int type = reader.GetInt32(6); string background = reader.GetString(7); string icon = reader.GetString(8); int[] channel = (int[])reader.GetArrayData(9, 11); int[] ostype = (int[])reader.GetArrayData(10, 11); int activeDay = reader.GetInt32(11); string beginTime = reader.GetString(12); long chargeid = reader.GetInt64(13); long giftid = reader.GetInt64(14); string descs = reader.GetString(15); string name = reader.GetString(16); ConfPush new_obj_ConfPush = new ConfPush(id, bolckDesc, bolckType, manualGroup, createPlayerDays, manualType, type, background, icon, channel, ostype, activeDay, beginTime, chargeid, giftid, descs, name ); return(new_obj_ConfPush); }
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); }
public static void Register() { ConfAchievement.Init(); ConfActiveDrop.Init(); ConfActivityBase.Init(); ConfAssetManifest.Init(); Confbranchtask.Init(); ConfBuilding.Init(); ConfCartoonScene.Init(); ConfChapter.Init(); ConfCharge.Init(); ConfChat.Init(); ConfChatItem.Init(); ConfCheckIn.Init(); ConfCombineFormula.Init(); ConfDemoScene.Init(); ConfDropOut.Init(); ConfPropGiftItem0.Init(); ConfPropGiftItem1.Init(); ConfPropGiftItem2.Init(); ConfDropOut2.Init(); Confetl.Init(); ConfEvent.Init(); ConfEventAttribute.Init(); ConfEventPhase.Init(); Confexhibit.Init(); ConfExpToLevel.Init(); Conffailtips.Init(); ConfFeedback.Init(); ConfFind.Init(); ConfFindClue.Init(); ConfFindTypeIcon.Init(); ConfGMCMD.Init(); ConfGuid.Init(); ConfGuidArt.Init(); ConfGuidNew.Init(); ConfGuidNewFunction.Init(); Confinapppurchase.Init(); ConfJigsawScene.Init(); ConfKeyWords.Init(); ConfLanguage.Init(); ConfMsgCode.Init(); ConfNode.Init(); ConfNpc.Init(); ConfOfficer.Init(); ConfPath.Init(); ConfPoliceRankIcon.Init(); ConfProp.Init(); ConfPropGift.Init(); ConfPropGiftItem0.Init(); ConfPropGiftItem1.Init(); ConfPropGiftItem2.Init(); ConfPush.Init(); ConfReasoning.Init(); ConfScene.Init(); ConfSceneDifficulty.Init(); ConfSceneSpecial.Init(); ConfServiceConfig.Init(); ConfSkill.Init(); ConfSkyEye.Init(); ConfSound.Init(); ConfTask.Init(); ConfTitle.Init(); }