コード例 #1
0
        private void RescanPackages()
        {
            _assetTool.SetRootHapticsFolder(_path);

            try
            {
                _packages = _assetTool.TryGetPackageInfo();
            } catch (System.ComponentModel.Win32Exception e)
            {
                Debug.LogError("[NSVR] Problem communicating with HapticAssetTools.exe");
            }
            catch (InvalidOperationException e)
            {
                //The filename was not set. This could be if the registry key was not found
                Debug.LogError("[NSVR] Could not locate the HapticAssetTools.exe program, make sure the NSVR Service was installed. Try reinstalling if the problem persists.");
                return;
            }
        }
コード例 #2
0
        public void SetupLibraries()
        {
            //Base for the path - has ALL the folders
            string path = Application.streamingAssetsPath;

            assetTool.SetRootHapticsFolder(path + "/Haptics/");
            var packages = assetTool.TryGetPackageInfo();



            for (int i = 0; i < packages.Count; i++)
            {
                //Debug.Log("Directory: " + folders[i] + "\n");
                //A library element represents either a folder or a haptic file. It will configure it's appearance based on its name (if it has .seq/.exp/.pat in its name, it'll adjust accordingly)
                LibraryElement libEle = FolderContainer.AddPrefabToContainerReturn().GetComponent <LibraryElement>();
                libEle.Init(packages[i], assetTool);
                libEle.playButton.transform.localScale = Vector3.one;
                libEle.playButton.name = Path.GetFileName(packages[i].path);
                string folderName           = packages[i].path;
                AssetTool.PackageInfo tempP = packages[i];
                libEle.playButton.onClick.AddListener(
                    () => { SelectDirectory(tempP, libEle.playButton); }
                    );
                tempRef = libEle.gameObject;

                //Debug.Log(Selection == null);
                //string lastAccessed = LastOpened;

                //If we have something that we last accessed
                var found = packages.Find(item => item.path == LastPackageAccessed);
                if (LastPackageAccessed.Length > 0 && found != null)
                {
                    if (folderName == LastPackageAccessed)
                    {
                        SelectDirectory(packages[i], libEle.playButton);
                    }
                }
                else if (packages.Count > 0)
                {
                    //Select the first folder
                    SelectDirectory(packages[i], libEle.playButton);
                }
            }
        }
コード例 #3
0
ファイル: PackageWindow.cs プロジェクト: laiqiqi/MissileMania
        private void RescanPackages()
        {
            Debug.Log("Using root folder " + _path);
            _assetTool.SetRootHapticsFolder(_path);

            try
            {
                if (_assetTool == null)
                {
                    Debug.Log("AssetTool is null");
                }
                Debug.Assert(_assetTool != null);
                _packages = _assetTool.TryGetPackageInfo();
                _uniqueCompanies.Clear();
                foreach (var p in _packages)
                {
                    if (!_uniqueCompanies.ContainsKey(p.studio))
                    {
                        _uniqueCompanies[p.studio] = new List <AssetTool.PackageInfo>();
                    }
                    _uniqueCompanies[p.studio].Add(p);
                }

                foreach (var company in _uniqueCompanies)
                {
                    _packageSelectionIndices[company.Key] = 0;
                }

                _status = string.Format("Found {0} packages.", _packages.Count);
            }
            catch (System.ComponentModel.Win32Exception)
            {
                Debug.LogError("[NSVR] Problem communicating with HapticAssetTools.exe");
                _status = "Problem communicating with HapticAssetTools.exe";
            }
            catch (InvalidOperationException)
            {
                //The filename was not set. This could be if the registry key was not found
                Debug.LogError("[NSVR] Could not locate the HapticAssetTools.exe program, make sure the NSVR Service was installed. Try reinstalling if the problem persists.");
                _status = "Could not locate the HapticAssetTools.exe program, make sure the NSVR Service was installed. Try reinstalling if the problem persists.";
                return;
            }
        }