Exemple #1
0
        protected GachaTable()
        {
            TableLoader tableLoader = new TableLoader();

            // Create whole table
            try
            {
                _wholeTable = tableLoader.Load(
                    _filePath,
                    _tableName,
                    true,
                    row => Convert.ToInt32(row.Field <double>(_columnId)),
                    row => new GachaData()
                {
                    Id               = Convert.ToInt32(row.Field <double>(_columnId)),
                    Name             = row.Field <string>(_columnName),
                    TotalProbability = Convert.ToInt32(row.Field <double>(_sumOfProbability)),
                    Probability      = new Dictionary <int, int>()
                    {
                        { 1, Convert.ToInt32(row.Field <double>(_probability1)) },
                        { 2, Convert.ToInt32(row.Field <double>(_probability2)) },
                        { 3, Convert.ToInt32(row.Field <double>(_probability3)) },
                        { 4, Convert.ToInt32(row.Field <double>(_probability4)) },
                        { 5, Convert.ToInt32(row.Field <double>(_probability5)) },
                        { 6, Convert.ToInt32(row.Field <double>(_probability6)) },
                    }
                });

                NumberOfGachaIds = _wholeTable.Keys.Count;
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Exemple #2
0
        protected HeroTable()
        {
            TableLoader tableLoader = new TableLoader();

            // Create whole table
            try
            {
                _wholeTable = tableLoader.Load(
                    _filePath,
                    _tableName,
                    true,
                    row => Convert.ToInt32(row.Field <double>(_columnID)),
                    row => new HeroData()
                {
                    Id       = Convert.ToInt32(row.Field <double>(_columnID)),
                    Name     = row.Field <string>(_columnName),
                    Grade    = Convert.ToInt32(row.Field <double>(_columnGrade)),
                    Property = Convert.ToInt32(row.Field <double>(_columnProperty))
                });

                numberOfHeroes = _wholeTable.Keys.Count;
            }
            catch (Exception exception)
            {
                throw exception;
            }

            // Create table by grade(1~6)

            _heroesWithGrade = new List <Dictionary <int, HeroData> >();
            var count = GachaTable.Instance.WholeTable.Keys.Count;

            for (int i = 0; i < count; i++)
            {
                try
                {
                    var heroes = GetHeroesByGrade(i + 1);
                    _heroesWithGrade.Add(heroes);
                }
                catch (ArgumentOutOfRangeException exception)
                {
                    throw exception;
                }
            }
        }