예제 #1
0
        private static IEnumerator SetGoodRateChart_Process()
        {
            yield return(new WaitForEndOfFrame());

            Log.Write("SetFloatingDisplay Start");

            Vector3 ChartStandardLevelPosition = new Vector3(0, 0.25f, 2.25f); /* Original: 0, -0.4, 2.25 */
            Vector3 ChartStandardLevelRotation = new Vector3(35, 0, 0);

            var pos = ChartStandardLevelPosition;
            var rot = Quaternion.Euler(ChartStandardLevelRotation);

            floatingScreenForScore = FloatingScreen.CreateFloatingScreen(new Vector2(105, 65), false, pos, rot);

            floatingScreenForScore.SetRootViewController(BeatSaberUI.CreateViewController <GoodRateViewController>(), true);

            Image image = floatingScreenForScore.GetComponent <Image>();

            image.enabled = false;

            GraphContainer graph = floatingScreenForScore.gameObject.AddComponent <GraphContainer>();

            floatingScreenForScore.rootViewController.gameObject.SetActive(false);
            graph.gameObject.SetActive(false);
        }
예제 #2
0
 public MusicPlayer(HierarchyManager hierarchyManager)
 {
     _screenSystem    = hierarchyManager.GetField <ScreenSystem, HierarchyManager>("_screenSystem");
     _floatingScreen  = FloatingScreen.CreateFloatingScreen(new Vector2(120f, 35f), false, Vector3.zero, Quaternion.identity);
     _musicPlayerView = BeatSaberUI.CreateViewController <MusicPlayerView>();
     _floatingScreen.SetRootViewController(_musicPlayerView, true);
     _floatingScreen.transform.SetParent(_screenSystem.transform, false);
     _floatingScreen.transform.localPosition = new Vector3(-2.08f, 2.8f, 1.45f);
     _floatingScreen.transform.localRotation = Quaternion.Euler(new Vector3(335f, 300f, 0f));
 }
        public void Initialize()
        {
            floatingScreen = FloatingScreen.CreateFloatingScreen(new Vector2(75, 25), false, new Vector3(0f, 0.2f, 2.5f), new Quaternion(0, 0, 0, 0));
            floatingScreen.transform.eulerAngles = new Vector3(60, 0, 0);
            floatingScreen.transform.localScale  = new Vector3(0.03f, 0.03f, 0.03f);

            BSMLParser.instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "PlaylistManager.UI.Views.FoldersView.bsml"), floatingScreen.gameObject, this);
            rootTransform.gameObject.SetActive(false);
            rootTransform.gameObject.name = "PlaylistManagerFoldersView";

            LevelFilteringNavigationController_ShowPacksInChildController.AllPacksViewSelectedEvent += LevelFilteringNavigationController_ShowPacksInChildController_AllPacksViewSelectedEvent;
        }
예제 #4
0
        private static IEnumerator SetDiaryButton_Process()
        {
            yield return(new WaitForEndOfFrame());

            Log.Write("SetDiaryButton Start");

            var        screenSystem = Resources.FindObjectsOfTypeAll <ScreenSystem>()[0];
            Vector3    pos          = screenSystem.rightScreen.gameObject.transform.position;
            Quaternion rot          = screenSystem.rightScreen.gameObject.transform.rotation;

            floatingScreenForDiaryButton = FloatingScreen.CreateFloatingScreen(new Vector2(40, 15), false, pos + new Vector3(1.65f, -0.82f, 0f), rot);

            floatingScreenForDiaryButton.SetRootViewController(BeatSaberUI.CreateViewController <DiaryButtonController>(), true);
        }
        protected override void Awake()
        {
            if (_lockSprite == null)
            {
                _lockSprite = BSUIUtilities.LoadSpriteFromResources(LockImageResourcePath);
            }
            if (_unlockSprite == null)
            {
                _unlockSprite = BSUIUtilities.LoadSpriteFromResources(UnlockImageResourcePath);
            }

            _floatingScreen            = FloatingScreen.CreateFloatingScreen(new Vector2(120f, 64f), false, PluginConfig.FloatingSearchKeyboardPosition, PluginConfig.FloatingSearchKeyboardRotation);
            _floatingScreen.HandleSide = FloatingScreen.Side.Top;

            UIUtilities.ParseBSML("EnhancedSearchAndFilters.UI.Views.FloatingKeyboardView.bsml", _floatingScreen.gameObject, this);

            _predictionBar = new GameObject("EnhancedSearchPredictionBar").AddComponent <PredictionBar>();
            _predictionBar.Initialize(_floatingScreen.transform, 3.5f, 15f, -55f, 55f);

            var keyboardGO = new GameObject("EnhancedSearchKeyboard", typeof(FloatingSearchKeyboard), typeof(RectTransform));

            var rt = keyboardGO.GetComponent <RectTransform>();

            rt.SetParent(_floatingScreen.transform, false);
            rt.anchorMin        = Vector2.zero;
            rt.anchorMax        = new Vector2(1f, 0f);
            rt.pivot            = new Vector2(0.5f, 0f);
            rt.anchoredPosition = new Vector2(0f, 2f);
            rt.sizeDelta        = new Vector2(-10f, 40f);

            _keyboard = keyboardGO.GetComponent <FloatingSearchKeyboard>();

            _textDisplayComponent                    = BeatSaberUI.CreateText(_floatingScreen.transform as RectTransform, "", new Vector2(0f, 23.5f), Vector2.zero);
            _textDisplayComponent.fontSize           = 7f;
            _textDisplayComponent.alignment          = TextAlignmentOptions.Center;
            _textDisplayComponent.enableWordWrapping = false;

            base.Awake();
        }
        public BottomScreen()
        {
            _floatingScreen = FloatingScreen.CreateFloatingScreen(new Vector2(DefaultXSize, DefaultYSize), false, new Vector3(1.5f, 0.05f, 1.5f), Quaternion.Euler(50f, 0f, 0f));
            (_floatingScreen.transform as RectTransform).pivot = new Vector2(1f, 0f);

            // this is needed to fix HoverHint position issues that occur because of the change in pivot done to the floating screen
            var wrapperCanvasGO = new GameObject("Wrapper", typeof(RectTransform), typeof(Canvas), typeof(VRGraphicRaycaster), typeof(SetMainCameraToCanvas));
            var rt = wrapperCanvasGO.transform as RectTransform;

            rt.SetParent(_floatingScreen.transform, false);
            rt.anchorMin = Vector2.zero;
            rt.anchorMax = Vector2.one;
            rt.sizeDelta = Vector2.zero;

            var cameraSetter = wrapperCanvasGO.GetComponent <SetMainCameraToCanvas>();

            cameraSetter.SetField("_canvas", wrapperCanvasGO.GetComponent <Canvas>());
            cameraSetter.SetField("_mainCamera", Resources.FindObjectsOfTypeAll <MainCamera>().FirstOrDefault(camera => camera.camera?.stereoTargetEye != StereoTargetEyeMask.None) ?? Resources.FindObjectsOfTypeAll <MainCamera>().FirstOrDefault());

            _outlineImage                = new GameObject("Outline").AddComponent <Image>();
            _outlineImage.color          = OutlineColour;
            _outlineImage.material       = UIUtilities.NoGlowMaterial;
            _outlineImage.type           = Image.Type.Sliced;
            _outlineImage.sprite         = Resources.FindObjectsOfTypeAll <Sprite>().LastOrDefault(x => x.name == "RoundRectSmallStroke");
            _outlineImage.preserveAspect = true;

            _outlineImage.rectTransform.SetParent(wrapperCanvasGO.transform, false);
            _outlineImage.rectTransform.anchorMin = Vector2.zero;
            _outlineImage.rectTransform.anchorMax = Vector2.one;
            _outlineImage.rectTransform.sizeDelta = Vector2.zero;

            var hlg = new GameObject("HorizontalLayoutGroup").AddComponent <HorizontalLayoutGroup>();

            hlg.spacing                = 3.5f;
            hlg.padding                = new RectOffset(2, 2, 1, 1);
            hlg.childAlignment         = TextAnchor.MiddleCenter;
            hlg.childForceExpandWidth  = false;
            hlg.childForceExpandHeight = false;

            rt = hlg.transform as RectTransform;
            rt.SetParent(wrapperCanvasGO.transform, false);
            rt.anchorMin = new Vector2(1f, 0f);
            rt.anchorMax = new Vector2(1f, 0f);
            rt.pivot     = new Vector2(1f, 0f);
            rt.sizeDelta = new Vector2(DefaultXSize, DefaultYSize);

            // icon
            _iconImage                = new GameObject("Icon").AddComponent <Image>();
            _iconImage.material       = UIUtilities.NoGlowMaterial;
            _iconImage.sprite         = BSUIUtilities.LoadSpriteFromResources("EnhancedSearchAndFilters.Assets.bars.png");
            _iconImage.preserveAspect = true;

            var le = _iconImage.gameObject.AddComponent <LayoutElement>();

            le.preferredWidth  = 4.5f;
            le.preferredHeight = 4.5f;

            _iconImage.rectTransform.SetParent(rt, false);

            // text
            _text           = BeatSaberUI.CreateText(rt, "OPTIONS", Vector2.zero, Vector2.zero);
            _text.fontSize  = 4.4f;
            _text.alignment = TextAlignmentOptions.Center;

            // this needs to be the last child, otherwise the outline image will capture all the controller raycasts first
            UIUtilities.ParseBSML("EnhancedSearchAndFilters.UI.Views.BottomScreen.BottomScreenView.bsml", wrapperCanvasGO, this);

            _hoverEventHandler = _floatingScreen.gameObject.AddComponent <EnterExitEventHandler>();
            _hoverEventHandler.PointerEntered += delegate()
            {
                if (_revealAnimation != null)
                {
                    return;
                }
                else if (_contractAnimation != null)
                {
                    UnityCoroutineHelper.Stop(_contractAnimation);
                    _contractAnimation = null;
                }

                _expandAnimation = UnityCoroutineHelper.Start(ExpandAnimationCoroutine());
            };
            _hoverEventHandler.PointerExited += delegate()
            {
                if (_revealAnimation != null)
                {
                    return;
                }

                bool immediate = false;
                if (_expandAnimation != null)
                {
                    UnityCoroutineHelper.Stop(_expandAnimation);
                    _expandAnimation = null;
                    immediate        = true;
                }
                else if (_contractAnimation != null)
                {
                    UnityCoroutineHelper.Stop(_contractAnimation);
                    _contractAnimation = null;
                }

                _contractAnimation = UnityCoroutineHelper.Start(ContractAnimationCoroutine(immediate));
            };

            var sortModeTab = new SortModeTab(_container);

            sortModeTab.SortButtonPressed += () => SortButtonPressed?.Invoke();
            sortModeTab.Visible            = true;

            _currentTab = sortModeTab;
            _tabs[0]    = sortModeTab;
            Logger.log.Notice($"finished constructor, currentTab?={_currentTab == null}");

            HideScreen(true);
        }