Example #1
0
        public FieldPairTable makeFieldPairTable(TableItem _item)
        {
            if (fieldPairTable == null)
            {
                fieldPairTable = new FieldPairTable();
                _item.CollectFields(fieldPairTable);
                fieldPairTable.catchField();
                _item.CollectFields(fieldPairTable);
            }
            else
            {
                fieldPairTable.clear();
                _item.CollectFields(fieldPairTable);
            }
            if (!hasCatchColume)
            {
                if (nameToColume.Count != 0)
                {
                    for (int i = 0; i < fieldPairTable.mFields.Length; ++i)
                    {
                        int iColumn = fieldPairTable.getCatchColume(i);
                        if (iColumn < 0)
                        {
                            iColumn = getColumIndex(fieldPairTable.mFields[i].name);
                            fieldPairTable.setCatchColume(i, iColumn);
                            if (iColumn < 0)
                            {
                                Debug.LogError("table[" + fileName + "]load error:not find [" + fieldPairTable.mFields[i].name + "]");
                            }
                        }
                    }
                    foreach (KeyValuePair <string, int> item in nameToColume)
                    {
                        int iColumn = fieldPairTable.getFiledIndexByName(item.Key);
                        if (iColumn < 0)
                        {
                            Debug.LogWarningFormat("table[{0}] column:[{1}] Has not been used!", fileName, item.Key);
                        }
                    }
                    hasCatchColume = true;
                }
            }

            return(fieldPairTable);
        }