public static RecordTable GetData(string RecordName)
    {
        if (s_RecordCache.ContainsKey(RecordName))
        {
            return(s_RecordCache[RecordName]);
        }

        RecordTable record = null;

        string dataJson = "";

        string fullPath = Utility.Path.GetCombinePath(UnityUtility.Path.PersistentDataPath, Constant.DevicePlatform.GetCurDevicePlatformPath(), c_directoryName, RecordName + "." + c_expandName);

        if (File.Exists(fullPath))
        {
            dataJson = IOTool.ReadStringByFile(fullPath);
        }

        if (dataJson == "")
        {
            record = new RecordTable();
        }
        else
        {
            record = RecordTable.Analysis(dataJson);
        }

        s_RecordCache.Add(RecordName, record);

        return(record);
    }
Пример #2
0
    //获取数据
    public RecordTable GetData(string recordName)
    {
        if (m_recordCache.ContainsKey(recordName))
        {
            return(m_recordCache[recordName]);
        }

        RecordTable record = null;

        var dataJson = string.Empty;

        var path = PathTool.GetRelativelyPath(m_directoryName, recordName, m_expandName);

        var fullPath = PathTool.GetAbsolutePath(ResLoadLocation.Persistent, path);

        if (File.Exists(fullPath))
        {
            //记录永远从沙盒路径读取
            dataJson = ResourceIOTool.ReadStringByFile(fullPath);
        }

        if (string.IsNullOrEmpty(dataJson))
        {
            record = new RecordTable();
        }
        else
        {
            record = RecordTable.Analysis(dataJson);
        }

        m_recordCache.Add(recordName, record);

        return(record);
    }
 static int Analysis(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         string      arg0 = ToLua.CheckString(L, 1);
         RecordTable o    = RecordTable.Analysis(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #4
0
    public static RecordTable GetData(string RecordName)
    {
        string dataJson = "";

        dataJson = ResourceIOTool.ReadStringByFile(
            PathTool.GetAbsolutePath(ResLoadType.Persistent,
                                     PathTool.GetRelativelyPath(c_directoryName,
                                                                RecordName,
                                                                c_expandName)));
        if (dataJson == "")
        {
            return(new RecordTable());
        }
        else
        {
            return(RecordTable.Analysis(dataJson));
        }
    }
    public static RecordTable GetData(string RecordName)
    {
        if (s_RecordCatch.ContainsKey(RecordName))
        {
            return(s_RecordCatch[RecordName]);
        }

        RecordTable record = null;

        string dataJson = "";

        string fullPath = PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
                                                   PathTool.GetRelativelyPath(c_directoryName,
                                                                              RecordName,
                                                                              c_expandName));

        Debug.Log("持久化数据路径:" + fullPath);
        if (File.Exists(fullPath))
        {
            //记录永远从沙盒路径读取
            dataJson = ResourceIOTool.ReadStringByFile(fullPath);
        }

        //Debug.Log(RecordName + " dataJson: " + dataJson);

        if (dataJson == "")
        {
            record = new RecordTable();
        }
        else
        {
            record = RecordTable.Analysis(dataJson);
        }

        s_RecordCatch.Add(RecordName, record);

        return(record);
    }