示例#1
0
    public static RPGBaseTable<int> CreateIntBaseTable(string tableName, string[] content, YINDEX_TYPE yIndexType)
    {
        RPGBaseTable<int> tab;
        int height = content.Length;
        int width = content[0].Split(',').Length;
        string[,]strArr = new string[height, width];

        for(int i=0;i<content.Length;i++)
        {
            string[] tempArr = content[i].Split(',');
            if(tempArr.Length<1)
                continue;
            for(int j=0; j<tempArr.Length; j++)
                strArr[i,j] = tempArr[j];
        }

        tab = new RPGBaseTable<int>(tableName,width-1);
        tab.InitCols(width-1);
        for(int i=1; i<width; i++)
        {

            tab.AddCol(i-1,new ColumnWithLabel<int>(strArr[0,i]));
        //			Diagnostic.debLog(tab.GetColName(i));
        }

        if(yIndexType==YINDEX_TYPE.IntIndex)
        {
            ColumnWithLabel<int> yIndexInt = new ColumnWithLabel<int>(strArr[0,0],height-1);
            for(int h=1;h<height;h++)
            {
                var t = strArr[h,0];
                int n;
                int.TryParse(t,out n);
                yIndexInt.AddValue(h-1,n);
            }
            tab.AddIntYIndex(yIndexInt);
        }
        else
        {
            ColumnWithLabel<string> yIndexStr = new ColumnWithLabel<string>(strArr[0,0],height-1);
            for(int h=1;h<height;h++)
            {
                string t = strArr[h,0];
                yIndexStr.AddValue(h-1,t);
            }
            tab.AddStrYIndex(yIndexStr);
        }

        for(int i=1;i<width;i++)
        {
            int[] tempIntArr = new int[height-1];
            for(int j=1;j<height;j++)
            {
                var y = strArr[j,i];
                int n;
                int.TryParse(y,out n);
                tempIntArr[j-1] = n;
            }
            tab.rows[i-1].AddColumn(tempIntArr);

        }
        //		tab.DebugLog();
        return tab;
    }
示例#2
0
 private void buildThacoTable()
 {
     string[] lines = RPGTableReader.LoadResourceFile("OSRIC_thac0");
     _thacoTable = RPGTableReader.CreateIntBaseTable("OSRIC Attribute Table",lines, YINDEX_TYPE.StringIndex);
 }
示例#3
0
 private void buildRaceMinMaxTable()
 {
     string[] lines = RPGTableReader.LoadResourceFile("OSRIC_race_mins_maxs");
     _raceMinMax = RPGTableReader.CreateIntBaseTable("OSRIC Race Min Max",lines, YINDEX_TYPE.StringIndex);
 }
示例#4
0
 private void buildRaceClassMatrixTable()
 {
     string[] lines = RPGTableReader.LoadResourceFile("OSRIC_race_class_matrix");
     _raceClassMatrix = RPGTableReader.CreateBoolBaseTable("OSRIC Race Class Matrix",lines, YINDEX_TYPE.StringIndex);
 }
示例#5
0
 private void buildClassMinsTable()
 {
     string[] lines = RPGTableReader.LoadResourceFile("OSRIC_class_mins");
     _classMinimums = RPGTableReader.CreateIntBaseTable("OSRIC Class Minimum Attributes",lines, YINDEX_TYPE.StringIndex);
 }
示例#6
0
 private void buildAttributeTable()
 {
     string[] lines = RPGTableReader.LoadResourceFile("OSRIC_attribute_table");
     _attributeTable = RPGTableReader.CreateIntBaseTable("OSRIC Attribute Table",lines, YINDEX_TYPE.IntIndex);
 }