예제 #1
0
    private void Save()
    {
        Dictionary<AxisType, int>[] cubeItems = new Dictionary<AxisType, int>[s_MagicCube.num];
        for (int i = s_MagicCube.maxLayer + 1; --i >= 0;)
        {
            List<CubeItem> cubeList = s_MagicCube[i];
            for (int j = cubeList.Count; --j >= 0;)
            {
                CubeItem cube = cubeList[j];
                cubeItems[cube.id] = new Dictionary<AxisType, int>();
                foreach (KeyValuePair<AxisType, ItemData> itemInfo in cube.itemDict)
                {
                    cubeItems[cube.id][itemInfo.Key] = itemInfo.Value.id;
                }
            }
        }

        Dictionary<string, object> dataDict = new Dictionary<string, object>();
        dataDict[MapData.FIELD_ID] = s_MagicCube.id;
        dataDict[MapData.FIELD_STEP] = s_MagicCube.step;
        dataDict[MapData.FIELD_SIZE] = s_MagicCube.size;
        dataDict[MapData.FIELD_SPACE] = s_MagicCube.space;
        dataDict[MapData.FIELD_DEST] = s_DestCube.id;
        dataDict[MapData.FIELD_SPAWN] = MapData.ParseSpawn(s_SpawnInfo);
        dataDict[MapData.FIELD_CUBE] = MapData.ParseCube(cubeItems);

        MapData data = new MapData();
        data.Parse(dataDict);

        mapDatabase.Set(data);
    }