예제 #1
0
        public DBGuildBossStatisticItem GetOneStatisticItem(uint boss_type)
        {
            DBGuildBossStatisticItem find_item = mSortStatisticArray.Find((a) =>
            {
                return(a.BossType == boss_type);
            });

            return(find_item);
        }
예제 #2
0
        protected override void ParseData(SqliteDataReader reader)
        {
            mInfos.Clear();
            mSortStatisticArray.Clear();
            DBGuildBossItem info;

            if (reader != null)
            {
                if (reader.HasRows == true)
                {
                    while (reader.Read())
                    {
                        info              = new DBGuildBossItem();
                        info.BossType     = DBTextResource.ParseUI_s(GetReaderString(reader, "type"), 0);      //类型ID
                        info.Star         = DBTextResource.ParseUI_s(GetReaderString(reader, "star"), 0);      //星级
                        info.TypeName     = GetReaderString(reader, "type_name");                              //类型名字
                        info.Name         = GetReaderString(reader, "name");                                   //名字
                        info.DungeonId    = DBTextResource.ParseUI_s(GetReaderString(reader, "dgn_id"), 0);    //副本ID
                        info.OpenCond     = DBTextResource.ParseUI_s(GetReaderString(reader, "open_cond"), 0); //开启条件(世界等级)
                        info.OpenCost     = DBTextResource.ParseUI_s(GetReaderString(reader, "open_cost"), 0); //开启需要的帮派资金
                        info.BossRewardId = DBTextResource.ParseUI_s(GetReaderString(reader, "reward_id"), 0); //帮派boss奖励显示data_guild_boss_gift 表的id
                        //info.RewardItemArray = new List<DBGuildBossRewardItem>();
                        //for(int index = 1; index <= 5; ++index)
                        //{
                        //    string tmp_reward_col_name = string.Format("reward_{0}", index);
                        //    string tmp_reward_str = GetReaderString(reader, tmp_reward_col_name);
                        //    if(tmp_reward_str != null && tmp_reward_str.Length > 0)
                        //    {
                        //        List<string> parse_array = DBTextResource.ParseArrayString(tmp_reward_str, ",", false);
                        //        if(parse_array != null && parse_array.Count >= 4)
                        //        {
                        //            uint goods_id = 0;
                        //            if(uint.TryParse(parse_array[0], out goods_id))
                        //            {
                        //                DBGuildBossRewardItem tmp_item = new DBGuildBossRewardItem();
                        //                tmp_item.GoodsId = goods_id;
                        //                tmp_item.RewardType = parse_array[1];
                        //                tmp_item.RewardDesc1 = parse_array[2];
                        //                tmp_item.RewardDesc2 = parse_array[3];
                        //                info.RewardItemArray.Add(tmp_item);
                        //            }
                        //        }
                        //    }
                        //}

                        if (mInfos.ContainsKey(info.BossType) == false)
                        {
                            mInfos.Add(info.BossType, new Dictionary <uint, DBGuildBossItem>());
                        }
                        if (mInfos[info.BossType].ContainsKey(info.Star) == false)
                        {
                            mInfos[info.BossType].Add(info.Star, info);
                        }
                        else
                        {
                            GameDebug.LogError(string.Format("has repeat id {0}-{1}", info.BossType, info.Star));
                        }

                        DBGuildBossStatisticItem find_item = mSortStatisticArray.Find((a) =>
                        {
                            return(a.BossType == info.BossType);
                        });
                        if (find_item == null)
                        {
                            find_item                   = new DBGuildBossStatisticItem();
                            find_item.BossType          = info.BossType;
                            find_item.MaxStar           = info.Star;
                            find_item.TypeName          = info.TypeName;
                            find_item.BossItemSortArray = new List <DBGuildBossItem>();
                            find_item.BossItemSortArray.Add(info);
                            mSortStatisticArray.Add(find_item);
                        }
                        else
                        {
                            if (find_item.MaxStar < info.Star)
                            {
                                find_item.MaxStar = info.Star;
                            }
                            find_item.BossItemSortArray.Add(info);
                        }
                    }
                }
            }

            mSortStatisticArray.Sort((a, b) =>
            {
                if (a.BossType < b.BossType)
                {
                    return(-1);
                }
                else if (a.BossType > b.BossType)
                {
                    return(1);
                }
                return(0);
            });
            for (int index = 0; index < mSortStatisticArray.Count; ++index)
            {
                mSortStatisticArray[index].BossItemSortArray.Sort((a, b) =>
                {
                    if (a.Star < b.Star)
                    {
                        return(-1);
                    }
                    else if (a.Star > b.Star)
                    {
                        return(1);
                    }
                    return(0);
                });
            }
        }