public void ProcessSheet()
        {
            try
            {
                // Clear any data already loaded into the GDEItemManager
                GDEItemManager.ClearAll();
                GDEItemManager.Save();

                List <string> sheetNames = GetSheetNames();
                Dictionary <string, List <FieldInfo> > allFields    = new Dictionary <string, List <FieldInfo> >();
                Dictionary <string, ExcelRange>        allSheetData = new Dictionary <string, ExcelRange>();

                // Calculate Progressbar settings
                progressMessage = GDEConstants.ImportingScehemasLbl;
                processedItems  = 0;
                totalItems      = sheetNames.Count;

                // Create all the schemas first
                foreach (string name in sheetNames)
                {
                    if (OnUpdateProgress != null)
                    {
                        OnUpdateProgress(GDEConstants.ImportingGameDataLbl, progressMessage, processedItems / totalItems);
                    }

                    ExcelRange sheetRows = GetSheetData(name);
                    allSheetData.Add(name, sheetRows);

                    List <FieldInfo> fields = GetFields(name, sheetRows);
                    allFields.Add(name, fields);

                    CreateSchema(name, fields);

                    processedItems++;
                }

                // Calculate Progressbar settings
                progressMessage = GDEConstants.ImportingItemsLbl;
                processedItems  = 0;
                totalItems      = 0;

                // Then create all the items for each schema
                foreach (string name in sheetNames)
                {
                    ExcelRange       sheetRows = allSheetData[name];
                    List <FieldInfo> fields    = allFields[name];

                    CreateItems(name, fields, sheetRows);
                }

                GDEItemManager.Save();
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }
        }
Exemple #2
0
 protected virtual void Save()
 {
     GDEItemManager.Save();
 }