示例#1
0
 public void Awake()
 {
     useGUILayout = false;
     string[] str_arr  = OTHER_EXTENSIONS.Split(',');
     string[] name_arr = EXT_NAMES.Split(',');
     ef = new SFB.ExtensionFilter[str_arr.Length];
     for (int i = 0; i != str_arr.Length; i++)
     {
         ef[i] = new SFB.ExtensionFilter(name_arr[i], str_arr[i]);
     }
 }
示例#2
0
    public void OnImportButtonClick()
    {
        SFB.ExtensionFilter[] extensionFilters =
            new SFB.ExtensionFilter[2];
        extensionFilters[0] = new SFB.ExtensionFilter(
            "Supported files", new string[] {
            "wav",
            "ogg",
            "jpg",
            "png",
            "mp4",
            "wmv"
        });
        extensionFilters[1] = new SFB.ExtensionFilter(
            "All files", new string[] { "*" });
        string[] sources = SFB.StandaloneFileBrowser.OpenFilePanel(
            "Select resource to import", "",
            extensionFilters, multiselect: true);
        string trackFolder = EditorContext.trackFolder;

        List <Tuple <string, string> > pairs = new List <Tuple <string, string> >();
        List <string> filesToBeOverwritten   = new List <string>();

        foreach (string source in sources)
        {
            FileInfo fileInfo = new FileInfo(source);
            if (fileInfo.DirectoryName == trackFolder)
            {
                continue;
            }
            string destination = $"{trackFolder}\\{fileInfo.Name}";

            if (File.Exists(destination))
            {
                filesToBeOverwritten.Add(fileInfo.Name);
            }
            pairs.Add(new Tuple <string, string>(source, destination));
        }

        if (filesToBeOverwritten.Count > 0)
        {
            string fileList = "";
            for (int i = 0; i < filesToBeOverwritten.Count; i++)
            {
                if (i == 10)
                {
                    fileList += $"... and {filesToBeOverwritten.Count - 10} more.\n";
                    break;
                }
                else
                {
                    fileList += filesToBeOverwritten[i] + "\n";
                }
            }
            confirmDialog.Show(
                $"The following files will be overwritten. Continue?\n\n{fileList}\nIf you choose to cancel, no file will be copied.",
                "overwrite", "cancel", () =>
            {
                StartCopy(pairs);
            });
        }
        else
        {
            StartCopy(pairs);
        }
    }
示例#3
0
    void Update()
    {
        if (decoder.getDecoderState() == ViveMediaDecoder.DecoderState.PAUSE || decoder.getDecoderState() == ViveMediaDecoder.DecoderState.EOF)
        {
            pauseResume.texture = playTexture;
        }
        else
        {
            pauseResume.texture = pauseTexture;
        }
        ColorBlock current = loop.colors;

        current.normalColor      = decoder.loop ? Color.black : Color.gray;
        current.highlightedColor = decoder.loop ? Color.black : Color.gray;
        loop.colors = current;

        if (Input.mousePosition.y > seekbarTop.position.y)
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                if (Time.time < lastMouseClick + 0.5)
                {
                    Fullscreen();
                }
                lastMouseClick = Time.time;
            }
        }
        if (Input.GetKeyDown(KeyCode.F) || XInput.GetButtonDown(0, XInput.Button.X))
        {
            Fullscreen();
            Notification.instance.Show(Notification.NotificationType.Fullscreen);
        }
        if (Input.GetKeyDown(KeyCode.C) || XInput.GetButtonDown(0, XInput.Button.Y))
        {
            subs.currentSub++;
            subs.Load();
            Notification.instance.Show(subs.subtitleNames[subs.currentSub]);
        }
        if (Input.GetKeyDown(KeyCode.L) || XInput.GetButtonDown(0, XInput.Button.B))
        {
            SetLoop();
            Notification.instance.Show(Notification.NotificationType.Loop);
        }
        if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.D))
        {
            Debug.SetActive(Debug.activeSelf ? false : true);
        }
        if (Input.GetKeyDown(KeyCode.U))
        {
            Url.SetActive(!Url.activeSelf);
        }
        if (Input.GetKeyDown(KeyCode.O) || XInput.GetButtonDown(0, XInput.Button.Start))
        {
            string start = null;
            try             //get current file directory if exists
            {
                System.IO.FileInfo f = new System.IO.FileInfo(decoder.mediaPath);
                if (f.Exists)
                {
                    System.IO.DirectoryInfo d = f.Directory;
                    start = d.FullName;
                }
            }
            catch (System.Exception)
            {
                //can go wrong in many ways
            }
            Cursor.visible = true;
            SFB.ExtensionFilter[] filter = new SFB.ExtensionFilter[] { new SFB.ExtensionFilter("Supported Files", Loader.acceptedFileNames) };
            string[] file = SFB.StandaloneFileBrowser.OpenFilePanel("Select File", start, filter, false);
            if (file.Length > 0)
            {
                Loader.customUrl = file[0];
                UnityEngine.SceneManagement.SceneManager.LoadScene(0);
            }
        }
        Help.SetActive(Input.GetKey(KeyCode.H));
        if (Input.GetAxis("Mouse ScrollWheel") != 0 || XInput.GetAxis(0, XInput.Axis.RY) != 0)
        {
            if (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl))
            {
                float volumeJump = 0.1f;
                if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                {
                    volumeJump = 1f;
                }
                decoder.setVolume(Mathf.Clamp01(decoder.getVolume() + ((Input.GetAxis("Mouse ScrollWheel") + (XInput.GetAxis(0, XInput.Axis.RY) * 0.1f)) * volumeJump)));
                Notification.instance.Show("♫ " + Mathf.RoundToInt(decoder.getVolume() * 100f).ToString());
            }
        }
        if (Input.GetKeyDown(KeyCode.M) || XInput.GetButtonDown(0, XInput.Button.RS))
        {
            if (decoder.getVolume() == 0)
            {
                decoder.setVolume(volumeBeforeMute);
            }
            else
            {
                volumeBeforeMute = decoder.getVolume();
                decoder.setVolume(0);
            }
            Notification.instance.Show("♫ " + Mathf.RoundToInt(decoder.getVolume() * 100f).ToString());
        }

        if (Input.GetKeyDown(KeyCode.Space) || XInput.GetButtonDown(0, XInput.Button.A))
        {
            if (decoder.getDecoderState() == ViveMediaDecoder.DecoderState.PAUSE)
            {
                Notification.instance.Show(Notification.NotificationType.Play);
            }
            else
            {
                Notification.instance.Show(Notification.NotificationType.Pause);
            }
            PauseResume();
        }
        float jump = 20;

        if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
        {
            jump = 10;
        }
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            jump = 60;
        }
        if (Input.GetKeyDown(KeyCode.RightArrow) || XInput.GetButtonDown(0, XInput.Button.DPAD_Right))
        {
            Notification.instance.Show(Notification.NotificationType.Forward);
            Forward(jump);
        }
        if (Input.GetKeyDown(KeyCode.LeftArrow) || XInput.GetButtonDown(0, XInput.Button.DPAD_Left))
        {
            Notification.instance.Show(Notification.NotificationType.Backward);
            Backwards(jump);
        }
    }