Пример #1
0
    void Start()
    {
        _rightObj = _rightHand.GetComponent <SteamVR_TrackedObject>();
        _leftObj  = _leftHand.GetComponent <SteamVR_TrackedObject>();
        setupRightPointer();
        setupLeftPointer();

        _annotationManager = null;

        //GameObject annotationManagerGO = GameObject.Find("AnnotationManager");
        //_annotationManager = annotationManagerGO.GetComponent<AnnotationManager>();
        //_annotationManager.SetRightHand(_rightHand);

        DisableRightPointer();
        DisableLeftPointer();
        _menu           = MenuOpened.None;
        _video          = null;
        _playSpeed      = 1;
        _slider         = GameObject.Find("Timeline");
        _controlDataset = Instantiate(Resources.Load("Prefabs/ControlDataset")) as GameObject;
        _controlDataset.SetActive(false);
        _representation          = "Full";
        annotationManagerByVideo = new Dictionary <CloudVideoPlayer, AnnotationManager>();

        itemSelected = false;
    }
Пример #2
0
    // Use this for initialization

    void Start()
    {
        _rightObj = _rightHand.GetComponent <SteamVR_TrackedObject>();
        _leftObj  = _leftHand.GetComponent <SteamVR_TrackedObject>();
        setupRightPointer();
        setupLeftPointer();

        _annotationManager = null;

        DisableRightPointer();
        DisableLeftPointer();
        _menu                    = MenuOpened.None;
        _video                   = null;
        _playSpeed               = 1;
        _slider                  = GameObject.Find("Timeline");
        _representation          = "Full";
        annotationManagerByVideo = new Dictionary <CloudVideoPlayer, AnnotationManager>();

        _annotationManager = new AnnotationManager();
        _annotationManager.init();
        itemSelected = false;

        spriteButtonSelected = (Sprite)Resources.Load("Textures/white", typeof(Sprite));
        spriteButton         = (Sprite)Resources.Load("Textures/border2", typeof(Sprite));
    }
Пример #3
0
        public override void InitializeVirtual()
        {
            InputManager = G.Sys.InputManager_;

            DisplayMenu();

            MenuOpened.Broadcast(new MenuOpened.Data(this));
        }
 private void fire_OnDropDownOpened()
 {
     if (MenuOpened != null)
     {
         try
         {
             MenuOpened.Invoke(this, new ToolStripItemClickedEventArgs(this));
         }
         catch { }
     }
 }
Пример #5
0
    void SelectDataset()
    {
        Ray        raycast = new Ray(_leftHand.transform.position, _leftHand.transform.forward);
        RaycastHit hit;
        bool       bHit = Physics.Raycast(raycast, out hit);

        if (hit.transform != null)
        {
            Button b = hit.transform.gameObject.GetComponent <Button>();
            if (b != null)
            {
                b.Select();

                if (_leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger))
                {
                    if (b.name == "PlaySpeed")
                    {
                        SetPlaybackSpeed(float.Parse(b.GetComponent <VRUIItem>().value));
                        return;
                    }
                    if (b.name == "Representation")
                    {
                        SetRepresentation(b.GetComponent <VRUIItem>().value);
                        return;
                    }
                    if (_video != null && _video.configFile == b.name)
                    {
                        return;
                    }
                    else if (_video != null && _video.configFile != b.name)
                    {
                        _video.Close();
                    }

                    _video = new CloudVideoPlayer(b.name, this);

                    if (!annotationManagerByVideo.ContainsKey(_video))
                    {
                        _annotationManager = new AnnotationManager();
                        _annotationManager.init();
                        _annotationManager.SetCloudVideo(_video);
                        annotationManagerByVideo.Add(_video, _annotationManager);
                    }
                    CloseAllMenus();
                    DisableLeftPointer();
                    _menu = MenuOpened.None;
                }
            }
        }
    }
Пример #6
0
        public void Initialize(IManager manager)
        {
            DontDestroyOnLoad(this);

            Flags.SubscribeEvents();

            Instance = this;
            Manager  = manager;
            Logger   = LogManager.GetForCurrentAssembly();
            Config   = gameObject.AddComponent <ConfigurationLogic>();

            RuntimePatcher.AutoPatch();

            MenuOpened.Subscribe(OnGUIMenuOpened);

            CreateSettingsMenu();
        }
        public ContextActionsBulbPopup(UIElement parent) : base(parent)
        {
            UseLayoutRounding = true;
            TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);

            StaysOpen          = true;
            AllowsTransparency = true;

            _headerImage = new Image();

            _mainItem = new MenuItem
            {
                ItemContainerStyle = CreateItemContainerStyle(),
                Header             = _headerImage,
                Padding            = new Thickness(0),
            };

            _mainItem.SubmenuOpened += (sender, args) =>
            {
                if (ReferenceEquals(args.OriginalSource, _mainItem))
                {
                    _isOpen = true;
                    MenuOpened?.Invoke(this, EventArgs.Empty);
                }
            };

            Closed += (sender, args) =>
            {
                if (_isOpen)
                {
                    _isOpen = false;
                    MenuClosed?.Invoke(this, EventArgs.Empty);
                }
            };

            var menu = new Menu
            {
                Background      = Brushes.Transparent,
                BorderBrush     = _mainItem.BorderBrush,
                BorderThickness = _mainItem.BorderThickness,
                Items           = { _mainItem }
            };

            Child = menu;
        }
        public ContextActionsBulbPopup(Control parent) : base(parent)
        {
            UseLayoutRounding = true;

            StaysOpen = true;
            _mainItem = new MenuItem
            {
                Styles = { CreateItemContainerStyle() },
                Header = new Image
                {
                    Source = this.FindStyleResource("Bulb") as IBitmap,
                    Width  = 16,
                    Height = 16
                }
            };

            _mainItem.SubmenuOpened += (sender, args) =>
            {
                if (ReferenceEquals(sender, _mainItem))
                {
                    _isOpen = true;
                    MenuOpened?.Invoke(this, EventArgs.Empty);
                }
            };

            Closed += (sender, args) =>
            {
                if (_isOpen)
                {
                    _isOpen = false;
                    MenuClosed?.Invoke(this, EventArgs.Empty);
                }
            };

            var menu = new Menu
            {
                Background      = Brushes.Transparent,
                BorderBrush     = _mainItem.BorderBrush,
                BorderThickness = _mainItem.BorderThickness,
                Items           = new[] { _mainItem }
            };

            Child = menu;
        }
Пример #9
0
        public ContextActionsBulbPopup(Control parent) : base(parent)
        {
            UseLayoutRounding = true;

            StaysOpen = true;

            _headerImage = new DrawingPresenter();

            _mainItem = new MenuItem
            {
                Styles = { CreateItemContainerStyle() },
                Header = _headerImage
            };

            _mainItem.SubmenuOpened += (sender, args) =>
            {
                if (ReferenceEquals(sender, _mainItem))
                {
                    _isOpen = true;
                    MenuOpened?.Invoke(this, EventArgs.Empty);
                }
            };

            Closed += (sender, args) =>
            {
                if (_isOpen)
                {
                    _isOpen = false;
                    MenuClosed?.Invoke(this, EventArgs.Empty);
                }
            };

            var menu = new Menu
            {
                Background      = Brushes.Transparent,
                BorderBrush     = _mainItem.BorderBrush,
                BorderThickness = _mainItem.BorderThickness,
                Items           = new[] { _mainItem }
            };

            Child = menu;
        }
Пример #10
0
    void EditAnnotations()
    {
        if (_rightController.GetPress(SteamVR_Controller.ButtonMask.Touchpad))
        {
            if (!_annotationManager.IsAnnotationActive)
            {
                Vector2 touchpad = _rightController.GetAxis(EVRButtonId.k_EButton_SteamVR_Touchpad);
                //Debug.Log("Axis x = " + touchpad.x + " | Axis y = " + touchpad.y);

                if (touchpad.y > 0.7f)
                {
                    _annotationManager.DisableDurationGO();
                    _annotationManager.DeleteAnnotation();
                    _annotationManager.currentAnnotationSelected = -1;
                    _menu = MenuOpened.None;
                    CloseAllMenus();
                }
                else if (touchpad.y < -0.7f)
                {
                    _annotationManager.currentAnnotationSelected = -1;
                    _annotationManager.DisableDurationGO();
                    _menu = MenuOpened.None;
                    CloseAllMenus();
                }
                else if (touchpad.x > 0.7f)
                {
                    _annotationManager.IncrementDuration();
                }
                else if (touchpad.x < -0.7f)
                {
                    _annotationManager.DecreaseDuration();
                }

                /*else
                 * {
                 *  _annotationManager.IsAnnotationActive = false;
                 *  _annotationManager.DisableAnnotations();
                 * } */
            }
        }
    }
Пример #11
0
    public void OnGUI()
    {
        //GUI.skin.font=f;

        // sorry for the if block
        if (ETGModGUI.CurrentMenu != ETGModGUI.MenuOpened.None)
        {
            if (!timeScale.HasValue && (ETGModGUI.CurrentMenu != ETGModGUI.MenuOpened.None))
            {
                timeScale      = Time.timeScale;
                Time.timeScale = 0;
            }

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
            {
                ETGModGUI.CurrentMenu = ETGModGUI.MenuOpened.None;
                ETGModGUI.UpdatePlayerState();
            }
        }

        currentMenuScript.OnGUI();
        //RandomSelector.OnGUI();
    }
Пример #12
0
        public ContextActionsBulbPopup(Control parent, Control placementTarget)
        {
            ((ISetLogicalParent)this).SetParent(parent);

            _placementTarget = placementTarget;

            UseLayoutRounding = true;

            StaysOpen = true;

            if (Application.Current.Styles.TryGetResource("Bulb", out object bulbIcon))
            {
                _headerImage = new DrawingPresenter
                {
                    Drawing = bulbIcon as Drawing,
                    Height  = 16,
                    Width   = 16
                };
            }

            _mainItem = new MenuItem
            {
                Styles  = { CreateItemContainerStyle() },
                Header  = _headerImage,
                Margin  = new Thickness(),
                Padding = new Thickness()
            };

            _mainItem.SelectionChanged += (sender, args) =>
            {
                if (!_mainItem.IsSubMenuOpen)
                {
                    Close();
                }
            };

            _mainItem.SubmenuOpened += (sender, args) =>
            {
                if (ReferenceEquals(sender, _mainItem))
                {
                    _isOpen = true;
                    MenuOpened?.Invoke(this, EventArgs.Empty);
                }
            };

            Closed += (sender, args) =>
            {
                if (_isOpen)
                {
                    _isOpen = false;
                    MenuClosed?.Invoke(this, EventArgs.Empty);
                }
            };

            _mainMenu = new Menu
            {
                Background      = Brushes.Transparent,
                BorderBrush     = _mainItem.BorderBrush,
                BorderThickness = _mainItem.BorderThickness,
                Items           = new[] { _mainItem }
            };

            Child = _mainMenu;

            TextBlock.SetFontFamily(this, new FontFamily("Segoi UI"));
            TextBlock.SetFontSize(this, 14);
            TextBlock.SetForeground(this, Application.Current.Resources["ThemeForegroundBrush"] as IBrush);
        }
Пример #13
0
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            if (CurrentMenu == MenuOpened.Loader)
            {
                CurrentMenu = MenuOpened.None;
            }
            else
            {
                CurrentMenu = MenuOpened.Loader;
            }

            UpdatePlayerState();
        }

        if (Input.GetKeyDown(KeyCode.F2) || Input.GetKeyDown(KeyCode.Slash) || Input.GetKeyDown(KeyCode.BackQuote))
        {
            if (CurrentMenu == MenuOpened.Console)
            {
                CurrentMenu = MenuOpened.None;
            }
            else
            {
                CurrentMenu = MenuOpened.Console;
            }

            UpdatePlayerState();
        }

        if (Input.GetKeyDown(KeyCode.F3))
        {
            if (CurrentMenu == MenuOpened.Logger)
            {
                CurrentMenu = MenuOpened.None;
            }
            else
            {
                CurrentMenu = MenuOpened.Logger;
            }

            UpdatePlayerState();
        }

        if (Input.GetKeyDown(KeyCode.F4))
        {
            if (CurrentMenu == MenuOpened.Inspector)
            {
                CurrentMenu = MenuOpened.None;
            }
            else
            {
                CurrentMenu = MenuOpened.Inspector;
            }

            UpdatePlayerState();
        }


        currentMenuScript.Update();
    }
Пример #14
0
    void InputOpenMenusOld()
    {
        if (_leftController.GetPressUp(SteamVR_Controller.ButtonMask.ApplicationMenu))
        {
            //GameObject menu;
            CloseAllMenus();

            if (_menu != MenuOpened.DatasetSelect)
            {
                _menuGO      = Instantiate(Resources.Load("Prefabs/CloudMenu")) as GameObject;
                _menuGO.name = "DatasetSelect";
                _menuGO.transform.position = _head.transform.position + (_head.transform.forward * 2);
                Vector3 rot = Camera.main.transform.forward;
                rot.y = 0.0f;
                _menuGO.transform.rotation = Quaternion.LookRotation(rot);
                _menuGO.transform.position = new Vector3(_menuGO.transform.position.x, 1.4f, _menuGO.transform.position.z);

                _menu = MenuOpened.DatasetSelect;
                EnableLeftPointer();
            }
            else
            {
                _menu = MenuOpened.None;
                DisableLeftPointer();
            }
        }

        if (_rightController.GetPressUp(SteamVR_Controller.ButtonMask.ApplicationMenu))
        {
            //GameObject menu;
            CloseAllMenus();

            if (_menu != MenuOpened.ColorSelect)
            {
                _menuGO      = Instantiate(Resources.Load("Prefabs/ColorMenu")) as GameObject;
                _menuGO.name = "ColorSelect";
                _menuGO.transform.position = _head.transform.position + (_head.transform.forward * 2);
                Vector3 rot = Camera.main.transform.forward;
                rot.y = 0.0f;
                _menuGO.transform.rotation = Quaternion.LookRotation(rot);
                _menuGO.transform.position = new Vector3(_menuGO.transform.position.x, 1.4f, _menuGO.transform.position.z);

                _menu = MenuOpened.ColorSelect;
                EnableRightPointer();
            }
            else
            {
                _menu = MenuOpened.None;
                DisableRightPointer();
            }
        }
        if (_rightController.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad))
        {
            //GameObject menu;
            CloseAllMenus();

            if (_menu != MenuOpened.AnnotationSelect && _menu != MenuOpened.AnnotationEdit && _annotationManager != null)
            {
                _annotationManager.Reset(); // cancel any active annotation
                _menuGO      = Instantiate(Resources.Load("Prefabs/AnnotationMenu")) as GameObject;
                _menuGO.name = "AnnotationSelect";
                _menuGO.transform.position = new Vector3(_rightHand.transform.position.x,
                                                         _rightHand.transform.position.y + 0.08f, _rightHand.transform.position.z);
                //Vector3 rot = Camera.main.transform.forward;
                Vector3 rot = _head.transform.forward;
                rot.y = 0.0f;
                _menuGO.transform.rotation = Quaternion.LookRotation(rot);
                _menu = MenuOpened.AnnotationSelect;
            }
            else
            {
                _menu = MenuOpened.None;
            }
        }
        if (_annotationManager != null && _annotationManager.currentAnnotationSelected != -1)
        {
            if (_menu != MenuOpened.AnnotationEdit)
            {
                _menuGO      = Instantiate(Resources.Load("Prefabs/EditAnnotationMenu")) as GameObject;
                _menuGO.name = "EditAnnotationMenu";
                _menuGO.transform.position = new Vector3(_rightHand.transform.position.x,
                                                         _rightHand.transform.position.y + 0.08f, _rightHand.transform.position.z);
                //Vector3 rot = Camera.main.transform.forward;
                Vector3 rot = _head.transform.forward;
                rot.y = 0.0f;
                _menuGO.transform.rotation = Quaternion.LookRotation(rot);
                _menu = MenuOpened.AnnotationEdit;
            }
        }
    }