Example #1
0
        ///// <summary>
        ///// Sends currently held mesh to the master client
        ///// </summary>
        //public override void SendMesh()
        //{
        //    if (File.Exists(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename())))
        //    {
        //        photonView.RPC("ReceiveRoomPrefabBundle", PhotonTargets.MasterClient, PhotonNetwork.player.ID);
        //    }
        //    else if (Database.GetMeshAsBytes() != null)
        //    {
        //        photonView.RPC("ReceiveMesh", PhotonTargets.MasterClient, PhotonNetwork.player.ID);
        //    }
        //}

        ///// <summary>
        ///// Send mesh to add to the mesh held in the database and will then be forwarded to all
        ///// clients
        ///// </summary>
        //public override void SendAddMesh()
        //{
        //    if (Database.GetMeshAsBytes() != null)
        //    {
        //        photonView.RPC("ReceiveAddMesh", PhotonTargets.MasterClient, PhotonNetwork.player.ID);
        //    }
        //}

        /// <summary>
        /// This will send a call to delete all meshes held by the clients
        /// This is a RPC method that will be called by ReceivingClient
        /// </summary>
        public void UpdateRoomInfoImmediately(string roomName)
        {
            //if (File.Exists(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename())))
            //{
            //    photonView.RPC("DeleteLocalRoomModelInfo", PhotonTargets.MasterClient);
            //    SendRoomModel(PhotonNetwork.player.ID);
            //}
            ////if (Database.GetMeshAsBytes() != null)
            ////{
            ////    photonView.RPC("DeleteMesh", PhotonTargets.MasterClient);
            ////}

            //string filepath = Config.AssetBundle.Current.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
            string filepath = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());

            if (!PhotonNetwork.isMasterClient &&
                File.Exists(filepath))
            {
                photonView.RPC("DeleteLocalRoomModelInfo", PhotonTargets.MasterClient, roomName);
                int roomBundlePort = Config.Ports.RoomBundle_ClientToServer;
#if !UNITY_WSA_10_0
                SocketClient_PC.SendFile(ServerFinder.serverIP, roomBundlePort, filepath);
#endif
            }
        }
        public void RequestRoomBundles()
        {
            // Generate temp bundle storage directory
            string roomBundleStorageDirectory = Config.Current.Room.CompileAbsoluteAssetDirectory() + "/temp";

            AbnormalDirectoryHandler.CreateDirectory(roomBundleStorageDirectory);
            //Directory.CreateDirectory(roomBundleStorageDirectory);

            Debug.debugging = true;
            Debug.Log("Testing whether room bundle was created at " + roomBundleStorageDirectory);
            if (Directory.Exists(roomBundleStorageDirectory))
            {
                Debug.Log("Room bundle storage directory exists!");
            }
            else
            {
                Debug.Log("Room bundle storage directory does NOT exist!");
            }
            Debug.debugging = false;

            Debug.Log("Room bundle storage directory = " + roomBundleStorageDirectory);
#if UNITY_ANDROID
            SocketClient_PC.RequestFiles(ServerFinder.serverIP, Config.Ports.AndroidRoomBundle, roomBundleStorageDirectory);
#else
            SocketClient_PC.RequestFiles(ServerFinder.serverIP, Config.Ports.RoomBundle, roomBundleStorageDirectory);
#endif

            InvokeRepeating("CopyRoomBundles", 3, 1);
        }
Example #3
0
        public virtual void RequestRoomModel()
        {
            string roomName = UWB_Texturing.Config.RoomObject.GameObjectName;
            //string roomBundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
            string roomBundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();
            int    roomBundlePort      = Config.Ports.RoomBundle;

#if !UNITY_WSA_10_0
            SocketClient_PC.RequestFiles(roomBundlePort, roomBundleDirectory);
#elif !UNITY_EDITOR && UNITY_WSA_10_0
            SocketClient_Hololens.RequestFiles(roomBundlePort, roomBundleDirectory);
#endif
            RoomManager.UpdateRoomBundle(roomName);
        }
        public override void OnJoinedRoom()
        {
            base.OnJoinedRoom();

            //string roomBundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();
            //string roomBundleStorageDirectory = Config.Current.Room.CompileAbsoluteAssetDirectory();
            //SocketClient_PC.RequestFiles(ServerFinder.serverIP, Config.Ports.RoomBundle, roomBundleStorageDirectory);
            RequestRoomBundles();
            //string rawRoomBundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();
            //SocketClient_PC.RequestFiles(ServerFinder.serverIP, Config.Ports.RoomResourceBundle, rawRoomBundleDirectory);
            string assetBundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();

            SocketClient_PC.RequestFiles(ServerFinder.serverIP, Config.Ports.Bundle, assetBundleDirectory);
        }
Example #5
0
        public static void ExportRoom(int targetID)
        {
            //Debug.Log("Export Room entered");
            ////string destinationDirectory = Config.AssetBundle.PC.CompileAbsoluteBundleDirectory();

            ////UWB_Texturing.BundleHandler.PackFinalRoomBundle(destinationDirectory, BuildTarget.StandaloneWindows);  // MUST INCORPORATE CODE THAT WILL ANALYZE TARGET ID/TARGET AND SET CORRECT BUILDTARGET FOR PACKING AND SENDING ASSET BUNDLE
            //string bundleName = UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename();
            //string bundlePath = Config.AssetBundle.PC.CompileAbsoluteBundlePath(Config.AssetBundle.PC.CompileFilename(bundleName)); // MUST INCORPORATE CODE THAT WILL ANALYZE TARGET ID/TARGET AND SET CORRECT BUILDTARGET FOR PACKING AND SENDING ASSET BUNDLE

            //Debug.Log("bundlename = " + bundleName);
            //Debug.Log("bundle path = " + bundlePath);

            //int finalRoomBundlePort = Config.Ports.RoomBundle;
            //////Launcher.SendAssetBundle(targetID, bundlePath, finalRoomBundlePort);
            ////Launcher launcher = Launcher.GetLauncherInstance();
            ////launcher.SendRoomModel(targetID);

            //////Debug.Log("bundle sent");

            //////PhotonPlayer.Find(targetID);

            //////Debug.Log("Photon Player found");

            //////photonView.RPC("ReceiveRoomModel", PhotonPlayer.Find(targetID), IPManager.CompileNetworkConfigString(finalRoomBundlePort));


            //string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
            string filepath       = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
            int    roomBundlePort = Config.Ports.RoomBundle_ClientToServer;

#if !UNITY_WSA_10_0
            SocketClient_PC.SendFile(ServerFinder.serverIP, roomBundlePort, filepath);
            Debug.Log("Exporting raw room resources not currently implemented correctly! Doesn't consider target ID and just sends to master");
#elif !UNITY_EDITOR && UNITY_WSA_10_0
            SocketClient_Hololens.SendFile(ServerFinder.serverIP, roomBundlePort, filepath);
#endif
        }