예제 #1
0
    /// <summary>
    /// Load using different methods of loading
    /// </summary>
    /// <typeparam name="T">Type of object to load</typeparam>
    /// <param name="path">path of the loading</param>
    /// <param name="typesave">Type of loading method</param>
    /// <returns></returns>
    protected T Load <T>(string path, TypeSave typesave)
    {
        T res = default(T);

        switch (typesave)
        {
        case TypeSave.Binary:
            res = DataWriteRead_Unity.ReadFromBinaryFile <T>(Application.persistentDataPath + "/" + path);
            break;

        case TypeSave.Json:
            res = DataWriteRead_Unity.ReadFromJsonFile <T>(Application.persistentDataPath + "/" + path);
            break;

        case TypeSave.XML:
            res = DataWriteRead_Unity.ReadFromXmlFile <T>(Application.persistentDataPath + "/" + path);
            break;
        }

        return(res);
    }