/// <summary> /// Goes through the list of directories and determines if the save directory already exists /// If the directory does not exist, it creates it /// Goes through each room game object and writes it to the directory /// </summary> /// <param name="roomList"></param> /// <param name="Dir"></param> public void SaveRooms(List <GameObject> roomList, List <DirectoryInfo> Dir) { //bool directoryExists = false; //if(RoomName == "") //{ // RoomName = "Room"; //} //foreach(DirectoryInfo d in Dir) //{ // if (d.Name == RoomName) // { // directoryExists = true; // } //} //if(directoryExists == false) //{ // Directory.CreateDirectory(root.FullName + '\\' + RoomName); //} foreach (GameObject room in roomList) { byte[] b = TangoDatabase.GetMeshAsBytes(TangoDatabase.GetRoomByName(room.name)); string roomFolder = Path.Combine(root.FullName, RoomName); SetRoomFolder(roomFolder); string filename = room.name + Config.Current.Room.TangoFileExtension; string filepath = Path.Combine(RoomFolder, filename); //UnityEngine.Debug.Log(root.FullName + '\\' + RoomName + '\\' + room.name); //File.WriteAllBytes(root.FullName + '\\' + RoomName + '\\' + room.name, b); File.WriteAllBytes(filepath, b); #if UNITY_EDITOR UnityEditor.AssetDatabase.Refresh(); #endif } }
/// <summary> /// Reads the room game object from the file path and sends it to the TangoDatabase with it's name /// </summary> /// <param name="filePath"></param> /// <param name="name"></param> private void ReadRoom(string filePath, string name) { byte[] b = File.ReadAllBytes(filePath); TangoDatabase.UpdateMesh(b, name); }
/// <summary> /// Reads the room game object from the file path and sends it to the TangoDatabase with it's name /// </summary> /// <param name="filePath"></param> /// <param name="name"></param> private void ReadRoom(string filePath, string name) { byte[] b = File.ReadAllBytes(filePath); TangoDatabase.UpdateMesh(b, name, parent.GetComponent <PhotonView>().viewID); }