Example #1
0
    // 加载所有表格;
    public static bool LoadAll()
    {
        if (Encoding == null)
        {
            Encoding = Encoding.Unicode; // default encoding
        }

        if (initialized)
        {
            return(false);
        }

        ExcelFactory.InitializeFactory();

        string filePath = ExcelRootDirectory + "index.txt";

        TextAsset textAsset = Resources.Load <TextAsset>(filePath);

        if (textAsset == null)
        {
            Debug.LogError("index.txt加载失败");
            return(false);
        }
        string indexContent = textAsset.text;

        if (string.IsNullOrEmpty(indexContent))
        {
            Debug.LogError("Index.txt表为空");
            return(false);
        }

        ParseIndex(indexContent);

        ExcelFactory.UninitializeFactory();

        initialized = true;

        return(true);
    }