Пример #1
0
        public static bool GetConfig(string fieldName, object fieldValue, out ConfDropOut2 config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_DropOut2", 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("DropOut2 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
Пример #2
0
        public static List <DropOutJsonData> GetFixedDropOuts(long drop_id_)
        {
            ConfDropOut2 drop_all = ConfDropOut2.Get(drop_id_);

            string fix_drop = drop_all.fixed2;
            List <DropOutJsonData> fix_datas = new List <DropOutJsonData>();

            if (IsStringValid(fix_drop))
            {
                fix_datas = CommonHelper.ParseDropOut(fix_drop);
            }

            return(fix_datas);
        }
Пример #3
0
        public static List <long> GetDropOuts(long drop_id_)
        {
            ConfDropOut2 drop_all = ConfDropOut2.Get(drop_id_);

            if (null == drop_all)
            {
                return(new List <long>());
            }

            string rdm_drop = drop_all.merge;
            List <DropOutJsonData> rdm_datas = new List <DropOutJsonData>();

            if (IsStringValid(rdm_drop))
            {
                rdm_datas = CommonHelper.ParseDropOut(rdm_drop);
            }

            HashSet <DropOutJsonData> rdm_set = new HashSet <DropOutJsonData>(rdm_datas);


            string fix_drop = drop_all.fixed2;
            List <DropOutJsonData> fix_datas = new List <DropOutJsonData>();

            if (IsStringValid(fix_drop))
            {
                fix_datas = CommonHelper.ParseDropOut(fix_drop);
            }

            HashSet <DropOutJsonData> fixed_set = new HashSet <DropOutJsonData>(fix_datas);

            rdm_set.ExceptWith(fixed_set);

            List <DropOutJsonData> all_datas = new List <DropOutJsonData>();

            all_datas.AddRange(rdm_set);

            List <long> ids = new List <long>();

            int counter = 0;

            int[] idx = CommonUtils.GetRandomList(all_datas.Count);

            while (counter < all_datas.Count && counter < 6)
            {
                ids.Add(all_datas[idx[counter]].value);
                ++counter;
            }

            return(ids);
        }
Пример #4
0
        private static ConfDropOut2 GetConfByDic(DataTable reader)
        {
            long   id      = reader.GetInt64(0);
            string numRate = reader.GetString(1);
            string merge   = reader.GetString(2);
            string fixed2  = reader.GetString(3);

            ConfDropOut2 new_obj_ConfDropOut2 = new ConfDropOut2(id,
                                                                 numRate,
                                                                 merge,
                                                                 fixed2
                                                                 );

            return(new_obj_ConfDropOut2);
        }
Пример #5
0
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_DropOut2");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfDropOut2 _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.id] = _conf;
             }
             resLoaded = true;
         }
     }
 }
Пример #6
0
        public static bool GetConfig(long id, out ConfDropOut2 config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_DropOut2", 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("DropOut2 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }
Пример #7
0
 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();
 }