// Creates a empty map that is only stored in temp memory. public static void MapDataCreateEmptyMap(string mapName = "New Map") { GlobalToolManager.DisabelTools(); MapDataQuery.DeleteMapQuery(); SessionManager.SessionManagerClearRefs(); if (XCPManager.currentXCP.xpcMaps == null) { XCPManager.currentXCP.xpcMaps = new MapData[1]; XCPManager.currentXCP.xpcMaps[0] = new MapData().CreateEmptyMapData(mapName, EditorPrimer.editorVersionNumberInternal, "Derelictus"); mapDataXCPIndex = 0; } else { Array.Resize(ref XCPManager.currentXCP.xpcMaps, XCPManager.currentXCP.xpcMaps.Length + 1); XCPManager.currentXCP.xpcMaps[XCPManager.currentXCP.xpcMaps.Length - 1] = new MapData().CreateEmptyMapData(mapName, EditorPrimer.editorVersionNumberInternal, "Derelictus");; mapDataXCPIndex = XCPManager.currentXCP.xpcMaps.Length - 1; } mapDataFileName = mapName; mapDataTileSize = 0.32f; SessionManager.CreateMapLayer("Layer 0", true, true); ScenePrimer.curPrimerComponent.PrimerMapUpdate(); UiManager.DestroyAllFocus(); MapDataCreateMapObj(); }
// Tries to open and load a map file on users computer /* * public static void MapDataOpenMap(string mapName = "", string mapPath = "") * { * switch (MapDataPrepForChange()) * { * case -1: * break; * case 0: * MapDataSaveMap(); * MapDataQuery.DeleteMapQuery(); * goto case 1; * case 1: * GlobalToolManager.disabelTools(); * MapDataQuery.DeleteMapQuery(); * SessionManager.SessionManagerClearRefs(); * * mapData = MapDataImportFromFile(mapPath, mapName + ".berrymap"); * * mapDataFileName = mapName; * mapDataTileSize = 0.32f; * UiManager.DestroyAllFocus(); * * if(mapData == null){ Debug.LogError("WOOOPSI"); } * MapDataCreateMapObj(); * * break; * } * } */ public static void MapDataOpenXCPMap(int mapIndex) { if (XCPManager.currentXCP.xpcMaps[mapIndex] == null) { Debug.LogError("WWWWWNWOWPWEWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"); } //if(mapIndex == mapDataXCPIndex) {UiManager.DestroyAllFocus(); Debug.Log("Sorry Dave but i can't let you do that."); return;} GlobalToolManager.DisabelTools(); MapDataQuery.DeleteMapQuery(); SessionManager.SessionManagerClearRefs(); mapDataXCPIndex = mapIndex; mapDataFileName = XCPManager.currentXCP.xpcMaps[mapIndex].map; mapDataTileSize = 0.32f; ScenePrimer.curPrimerComponent.PrimerMapUpdate(); UiManager.DestroyAllFocus(); if (XCPManager.currentXCP.xpcMaps[mapDataXCPIndex] == null) { Debug.LogError("WOOOPSI"); } MapDataCreateMapObj(); }
private static void MapDataSave(string mapName = "", string mapPath = "") { mapDataFilePath = mapPath; mapDataFileName = mapName; XCPManager.currentXCP.xpcMaps[mapDataXCPIndex] = MapDataQuery.QueryMapData(); MapDataExportToFile(XCPManager.currentXCP.xpcMaps[mapDataXCPIndex], mapPath, mapDataFileName + ".berrymap"); UiManager.ShowNotification("Map Saved", 0); ScenePrimer.curPrimerComponent.PrimerMapUpdate(); mapDataIsSaved = true; }