Пример #1
0
        public void LoadData(string tierListData)
        {
            string[] tierDataSplit = tierListData.Split('\n');
            var      currentList   = new List <int>();

            foreach (var data in tierDataSplit)
            {
                if (string.IsNullOrEmpty(data))
                {
                    continue;
                }
                var newData = data.Trim();
                newData = newData.Replace("\r", "");
                if (newData[0].Equals('['))
                {
                    var commaIndex = newData.IndexOf(',');
                    var scaleData  = newData.Substring(commaIndex + 1, newData.Length - commaIndex - 2);
                    var scale      = Convert.ToDouble(scaleData);
                    TierScales.Add(scale);
                    if (currentList.Count > 0)
                    {
                        TieredBossIds.Add(currentList);
                    }
                    currentList = new List <int>();
                }
                else
                {
                    var dashIndex = newData.IndexOf('-');
                    var bossId    = Convert.ToInt32(newData.Substring(0, dashIndex));
                    currentList.Add(bossId);
                    BossToTier.Add(bossId, TieredBossIds.Count);
                    BossIds.Add(bossId);
                }
            }
            if (currentList.Count > 0)
            {
                TieredBossIds.Add(currentList);
            }
        }
        public void LoadData(string tierListData)
        {
            var tierDataSplit = tierListData.Split('\n');

            var currentList = new List <int>();

            foreach (var data in tierDataSplit)
            {
                if (string.IsNullOrEmpty(data))
                {
                    continue;
                }
                var newData = data.Trim();
                newData = newData.Replace("\r", "");
                if (newData[0].Equals('['))
                {
                    if (currentList.Count > 0)
                    {
                        TieredBossIds.Add(currentList);
                        currentList = new List <int>();
                    }
                }
                else
                {
                    var dashIndex = newData.IndexOf('-');
                    var bossId    = Convert.ToInt32(newData.Substring(0, dashIndex));
                    var areaName  = newData.Substring(dashIndex + 1, newData.Length - (dashIndex + 1));
                    IdToAreaName.Add(bossId, areaName);
                    currentList.Add(bossId);
                }
            }
            if (currentList.Count > 0)
            {
                TieredBossIds.Add(currentList);
            }
        }