Пример #1
0
    public void SaveData()
    {
        string             completePath = Application.streamingAssetsPath + CompleteDataPath;
        DataPairContainter data         = new DataPairContainter()
        {
            Keys = new List <int>(), values = new List <TransformValues>()
        };

        foreach (var pair in ColliderTransformKeyFrame)
        {
            data.Keys.Add(pair.Key);
            data.values.Add(pair.Value);
        }

        data.Serialize(completePath, false);
    }
Пример #2
0
    public void loadData(string dataPath)
    {
        if (ColliderTransformKeyFrame == null)
        {
            ColliderTransformKeyFrame = new Dictionary <int, TransformValues>();
        }

        ColliderTransformKeyFrame.Clear();

        string             completePath = Application.streamingAssetsPath + CompleteDataPath;
        DataPairContainter data         = FullSerialization.Deserialize <DataPairContainter>(completePath, false);

        for (int i = 0; i < data.Keys.Count; i++)
        {
            ColliderTransformKeyFrame.Add(data.Keys[i], data.values[i]);
        }
    }