コード例 #1
0
        public void SaveMap()
        {
            EditorMapData mapData = tileManager.RegenerateMapData();

            MapEditorUtility.SaveMap(editedMapName, mapData);
            creatorManager.UpdateSavedMap(referenceSaveData);
            mapEditorMenu.ShowMessage();
        }
コード例 #2
0
        public void LoadAndDisplayMap(MapEditorSaveData saveData)
        {
            string saveName = saveData.saveName;

            try
            {
                EditorMapData mapData = MapEditorUtility.LoadMap(saveName);
                tileManager.GenerateMap(mapData);
                mapWidth  = mapData.width;
                mapHeight = mapData.height;
                creatorManager.gameObject.SetActive(false);
                mapEditorMenu.ShowMainMenu(mapData.mapName);
                editedMapName     = saveName;
                referenceSaveData = saveData;
                isMapLoaded       = true;
            }
            catch (System.Exception e)
            {
                Debug.Log("Unable to load map " + e.StackTrace);
            }
        }
コード例 #3
0
        public void CreateMap(string name, int width, int height)
        {
            MapEditorSaveData data = new MapEditorSaveData();

            data.mapName = name;
            data.width   = width;
            data.height  = height;
            string currentTime = DateTime.Now.ToString("yyyyMMddHHmmss");

            data.saveName          = name + "_" + currentTime + ".json";
            data.modifiedTimeStamp = currentTime;
            data.createdDate       = DateTime.Now.ToString("yyyy-MM-dd");
            data.modifiedDate      = data.createdDate;
            savedMaps.Add(data);
            SaveMaps();
            //Create default map and save it with the save name
            EditorMapData basicMap = MapEditorUtility.CreateDefaultMap(data);

            MapEditorUtility.SaveMap(data.saveName, basicMap);

            DisplaySavedMaps();
        }