public void saveSheet(bool instance = false)
 {
     if (instance)
     {
         sheet = gameObject.GetComponent <SheetLoader>().getSheet();
         sheet.setInstance(instanceName.GetComponent <Text>().text);
         Debug.Log("Attempting save");
         SheetFileManager.saveSheetToFile(sheet, true);
     }
     else
     {
         n = sheetName.GetComponent <Text>().text;
         if (n != "")
         {
             if (!nameSet)
             {
                 sheet.setName(n);
             }
             else if (n != sheetName.GetComponent <Text>().text)
             {
                 sheet.setName(n);
             }
             Debug.Log("Attempting save");
             SheetFileManager.saveSheetToFile(sheet);
         }
     }
 }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        InfoSheet sheet = new InfoSheet("1");

        sheet.dynamicNumericalFields.Add("Dynamic1", (1, 2, 3, 4, 5, 6));
        sheet.dynamicNumericalFields.Add("Dynamic2", (1, 2, 3, 4, 5, 6));
        sheet.dynamicNumericalFields.Add("Dynamic3", (1, 2, 3, 4, 5, 6));
        sheet.staticNumericalFields.Add("Static1", (5, 2, 3, 4, 5));
        sheet.staticNumericalFields.Add("Static2", (1, 2, 3, 4, 5));
        sheet.staticNumericalFields.Add("Static3", (1, 2, 3, 4, 5));
        sheet.textFields.Add("Name", ("Test1", 1, 2, 3, 4));
        sheet.textFields.Add("Text2", ("Test", 1, 2, 3, 4));
        sheet.textFields.Add("Text3", ("Test", 1, 2, 3, 4));

        SheetFileManager.saveSheetToFile(sheet);

        InfoSheet sheet2 = SheetFileManager.loadSheetFromFile(@"Sheets\" + "1" + ".st");

        sheet2.setName("2");
        SheetFileManager.saveSheetToFile(sheet2);
    }