public void Create(string url) { gameObject.transform.position = new Vector3(0f, 0f, 0f); gameObject.transform.eulerAngles = new Vector3(0f, 0f, 0f); gameObject.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f); _imageCanvas = gameObject.AddComponent <Canvas>(); _imageCanvas.renderMode = RenderMode.WorldSpace; _panelLeftG = new GameObject("GIFPanelImageLeft").AddComponent <RawImage>(); _panelLeftG.material = Utilities.Sprites.NoGlowMat; _panelLeftG.rectTransform.SetParent(_imageCanvas.transform, false); _panelLeftG.rectTransform.anchorMin = new Vector2(0.5f, 0.5f); _panelLeftG.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); _panelLeftG.rectTransform.anchoredPosition = new Vector2(4.5f, 4.5f); _panelLeftG.rectTransform.sizeDelta = new Vector2(7f, 7f); gifimage = _panelLeftG.gameObject.AddComponent <UniGifImage>(); UniGifImageAspectController ugiac = _panelLeftG.gameObject.AddComponent <UniGifImageAspectController>(); gifimage.SetPrivateField("m_imgAspectCtrl", ugiac); _panelLeftG.color = new Color(1, 1, 1, .6f); _panelLeftG.enabled = false; StartCoroutine(SetGIF(url)); }
protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling); if (firstActivation && PluginConfig.Instance.EnablePlugin && PluginConfig.Instance.ShowGIFs) { UniGif = rawImageGif.gameObject.AddComponent <UniGifImage>(); var ugiac = UniGif.gameObject.AddComponent <UniGifImageAspectController>(); UniGif.SetPrivateField("m_imgAspectCtrl", ugiac); } }
protected override void DidActivate(bool firstActivation, ActivationType type) { base.DidActivate(firstActivation, type); if (firstActivation && Plugin.config.Value.EnablePlugin && Plugin.config.Value.ShowGIFs) { UniGif = rawImageGif.gameObject.AddComponent <UniGifImage>(); var ugiac = UniGif.gameObject.AddComponent <UniGifImageAspectController>(); UniGif.SetPrivateField("m_imgAspectCtrl", ugiac); } }
private void _SetupDrinkWaterPanel() { if (_CustomMenu != null && _CustomViewController != null) { return; } _CustomMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Drink some cum!"); _CustomViewController = BeatSaberUI.CreateViewController <CustomViewController>(); _CustomViewController.name = "DrinkCumPanel"; if (_CustomMenu != null && _CustomViewController != null) { _CustomMenu.SetMainViewController(_CustomViewController, false, (firstActivation, type) => { if (firstActivation && type == VRUI.VRUIViewController.ActivationType.AddedToHierarchy) { _TextContent = _CustomViewController.CreateText("", new Vector2(0, 28f)); _TextContent.alignment = TextAlignmentOptions.Center; _TextContent.fontSize = 5; _TextContent.enableWordWrapping = false; _ContinueButton = _CustomViewController.CreateUIButton("CreditsButton", new Vector2(0, -28f), new Vector2(37f, 10f), null, "I understand!"); _ContinueButton.ToggleWordWrapping(false); _ContinueButton.SetButtonTextSize(4); _ContinueButton.onClick.AddListener(delegate() { _CustomMenu.Dismiss(); Destroy(_CustomViewController.gameObject, 1); _CustomMenu = null; _CustomViewController = null; }); _RefreshTextContent(_CurrentPanelMode); if (PluginConfig.ShowGIFs) { GameObject go = new GameObject("[BeatSaberDrinkCum] PreviewGif"); _RawImage = go.AddComponent <RawImage>(); _RawImage.material = Instantiate(Resources.FindObjectsOfTypeAll <Material>().Where(m => m.name == "UINoGlow").FirstOrDefault()); go.transform.SetParent(_CustomViewController.transform, false); go.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0); go.GetComponent <RectTransform>().sizeDelta = new Vector2(30, 30); _UniGifImage = go.AddComponent <UniGifImage>(); UniGifImageAspectController ugiac = go.AddComponent <UniGifImageAspectController>(); _UniGifImage.SetPrivateField("m_imgAspectCtrl", ugiac); StartCoroutine(_DisplayGifFromRotation()); } } }); } else { Console.WriteLine("[BeatSaberCustomExit.MainMenuUIOverload]: '_CustomMenu' or '_CustomViewController' was null."); } }