示例#1
0
        IEnumerator ShowNew()
        {
            yield return(new WaitForSeconds(1));

            parserParams.EmitEvent("show-new");
            Plugin.config.SetBool("New", "seenMenuButton", true);
        }
 internal void ShowModal()
 {
     Parse();
     parserParams.EmitEvent("close-modal");
     parserParams.EmitEvent("open-modal");
     ShowPlaylistsForManager(PlaylistLibUtils.playlistManager);
 }
示例#3
0
 internal void ShowModal(RectTransform parent, bool addButtonActive = true)
 {
     Parse(parent, addButtonActive);
     parserParams.EmitEvent("close-modal");
     parserParams.EmitEvent("open-modal");
     ShowPresets();
 }
 internal void ShowModal(BeatSaberPlaylistsLib.Types.IPlaylist playlist)
 {
     Parse();
     parserParams.EmitEvent("close-modal");
     parserParams.EmitEvent("open-modal");
     ShowImages(playlist);
 }
示例#5
0
        public void SetupText()
        {
            readyText = Plugin.ReadyText;
            setText   = Plugin.SetText;
            goText    = Plugin.GoText;

            parserParams.EmitEvent("ready-get-event");
            parserParams.EmitEvent("set-get-event");
            parserParams.EmitEvent("go-get-event");
        }
示例#6
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            base.DidActivate(firstActivation, activationType);

            if (firstActivation)
            {
                _roomName     = $"{GetUserInfo.GetUserName()}'s room".ToUpper();
                _roomPassword = "";
            }

            _createRoomButton.interactable = PluginUI.instance.roomCreationFlowCoordinator.CheckRequirements();
            parserParams.EmitEvent("cancel");
        }
示例#7
0
        internal void ShowModal(RectTransform parent, Type callingType, List <CustomListTableData.CustomCellInfo> customCellInfos)
        {
            Parse(parent);
            this.callingType = callingType;

            dropDownListSetting.values = buttonOptions.Except(customCellInfos.Select(c => c.text)).ToList();
            dropDownListSetting.UpdateChoices();
            dropDownListSetting.dropdown.SelectCellWithIdx(0);
            ButtonToAddChanged(buttonToAdd);

            parserParams.EmitEvent("close-modal");
            parserParams.EmitEvent("open-modal");
        }
示例#8
0
        public void ShowModal(Transform parent)
        {
            hitscoreColor = new HitscoreColor();
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(type)));
            UpdateSliderRange();
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(notUseMiss)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(min)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(max)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(color)));

            Parse(parent);
            parserParams.EmitEvent("closeModal");
            parserParams.EmitEvent("openModal");
        }
 private void SetBackground(TableView table, int selectedrow)
 {
     if (ARCompanion.xrcamBehaviour != null)
     {
         string chosencam = webcamList.data[selectedrow].text;
         Settings.instance.SelectedWebcam = chosencam;
         if (chosencam == "SteamVR")
         {
             Settings.instance.UndistortRawFeed = true;
             FindObjectOfType <CameraOffsetMenu>().SetProperty("DefaultPreset", "OpenVR Projection");
             FindObjectOfType <CameraOffsetMenu>().SetPreset("OpenVR Projection");
         }
         if (chosencam.StartsWith("OBS-Camera"))
         {
             WebCamTexture wctex = new WebCamTexture();
             wctex.deviceName = "OBS-Camera";
             wctex.Play();
             if (!wctex.isPlaying)
             {
                 parserParams.EmitEvent("obs-nodriver");
                 Destroy(wctex);
             }
             wctex.Stop();
         }
         ARCompanion.xrcamBehaviour.InitCameraPlane(chosencam);
         Logger.Log("Set camera to " + chosencam);
     }
 }
 protected virtual void RefreshValues()
 {
     if (_viewGameObject != null)
     {
         _parserParams.EmitEvent(RefreshValuesEvent);
     }
 }
示例#11
0
        public void SelectionChanged(IPreviewBeatmapLevel beatmap)
        {
            if (_levelCollectionTableView == null)
            {
                _levelCollectionTableView = Resources.FindObjectsOfTypeAll <LevelCollectionTableView>().FirstOrDefault();
            }
            if (_database == null)
            {
                _database = SongDataCore.Plugin.Songs;
            }
            var hash = beatmap == null ? "" : beatmap.levelID.Replace("custom_level_", "").ToLower();

            if (SongDataCore.Plugin.Songs.IsDataAvailable() && _database.Data.Songs.ContainsKey(hash))
            {
                var song = _database.Data.Songs[hash];
                MapActive    = true;
                MapNotActive = false;

                Key       = song.key;
                Rating    = song.rating.ToString();
                Downloads = song.downloadCount.ToString();
                Upvotes   = song.upVotes.ToString();
                Downvotes = song.downVotes.ToString();
            }
            else
            {
                MapActive    = false;
                MapNotActive = true;
                parserParams.EmitEvent("close-desc");
            }
        }
示例#12
0
        public override void HandleType(ComponentTypeWithData componentType, BSMLParserParams parserParams)
        {
            base.HandleType(componentType, parserParams);
            ClickableImage clickableImage = componentType.component as ClickableImage;

            if (componentType.data.TryGetValue("onClick", out string onClick))
            {
                clickableImage.OnClickEvent += delegate
                {
                    if (!parserParams.actions.TryGetValue(onClick, out BSMLAction onClickAction))
                    {
                        throw new Exception("on-click action '" + onClick + "' not found");
                    }

                    onClickAction.Invoke();
                };
            }

            if (componentType.data.TryGetValue("clickEvent", out string clickEvent))
            {
                clickableImage.OnClickEvent += delegate
                {
                    parserParams.EmitEvent(clickEvent);
                };
            }
        }
        internal void ShowDetails()
        {
            Parse();
            parserParams.EmitEvent("close-modal");
            parserParams.EmitEvent("open-modal");

            // Update values
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PlaylistName)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NameHint)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PlaylistAuthor)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AuthorHint)));
            UpdateReadOnly();
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PlaylistAllowDuplicates)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PlaylistDescription)));
            playlistCoverView.sprite = selectedPlaylist.Sprite;
            descriptionTextPage.ScrollTo(0, true);
        }
示例#14
0
 protected void FAQ()
 {
     SetModal("" +
              "<b><u>How do I add new sounds?</u></b>\n" +
              "- Add the files into Beat Saber/UserData/Di/Sounds/ and place them into the respective folder\n" +
              "\n" +
              "<b><u>What file types are supported?</u></b>\n" +
              "- Only .ogg files are supported for all audio files.\n"
              , delegate() { parserParams.EmitEvent("hide-yn"); }, TextAlignmentOptions.TopLeft);
     parserParams.EmitEvent("show-yn");
 }
        private void OpenLink(string url, string title)
        {
            CurrentLinkUrl   = url;
            CurrentLinkTitle = title ?? "";
            NotifyPropertyChanged(nameof(CurrentLinkUrl));
            NotifyPropertyChanged(nameof(CurrentLinkTitle));
            NotifyPropertyChanged(nameof(HasLinkTitle));

            ParserParams.EmitEvent("ShowLinkModal");
        }
示例#16
0
        public BSMLParserParams Parse(XmlNode parentNode, GameObject parent, object host = null)
        {
            BSMLParserParams parserParams = new BSMLParserParams();

            parserParams.host = host;
            if (host != null)
            {
                foreach (MethodInfo methodInfo in host.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    UIAction uiaction = methodInfo.GetCustomAttributes(typeof(UIAction), true).FirstOrDefault() as UIAction;
                    if (uiaction != null)
                    {
                        parserParams.actions.Add(uiaction.id, new BSMLAction(host, methodInfo));
                    }
                }

                foreach (FieldInfo fieldInfo in host.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    UIValue uivalue = fieldInfo.GetCustomAttributes(typeof(UIValue), true).FirstOrDefault() as UIValue;
                    if (uivalue != null)
                    {
                        parserParams.values.Add(uivalue.id, new BSMLFieldValue(host, fieldInfo));
                    }

                    UIParams uiParams = fieldInfo.GetCustomAttributes(typeof(UIParams), true).FirstOrDefault() as UIParams;
                    if (uiParams != null)
                    {
                        fieldInfo.SetValue(host, parserParams);
                    }
                }

                foreach (PropertyInfo propertyInfo in host.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    UIValue uivalue = propertyInfo.GetCustomAttributes(typeof(UIValue), true).FirstOrDefault() as UIValue;
                    if (uivalue != null)
                    {
                        parserParams.values.Add(uivalue.id, new BSMLPropertyValue(host, propertyInfo));
                    }
                }
            }

            foreach (XmlNode node in parentNode.ChildNodes)
            {
                HandleNode(node, parent, parserParams);
            }

            foreach (KeyValuePair <string, BSMLAction> action in parserParams.actions.Where(x => x.Key.StartsWith(SUBSCRIVE_EVENT_ACTION_PREFIX)))
            {
                parserParams.AddEvent(action.Key.Substring(1), delegate { action.Value.Invoke(); });
            }

            parserParams.EmitEvent("post-parse");

            return(parserParams);
        }
示例#17
0
            public void ReplaceModInstance(DiscordInstance instance)
            {
                modInstance = instance;
                enableMod   = modInstance.activityEnabled;

                if (modIcon != null && modName != null)
                {
                    Refresh(false, false);
                    parserParams.EmitEvent("cancel");
                }
            }
示例#18
0
        // Methods

        internal void ShowYesNoModal(Transform parent, string text, ButtonPressed yesButtonPressedCallback, string yesButtonText = "Yes", string noButtonText = "No", ButtonPressed noButtonPressedCallback = null, bool animateParentCanvas = true, string checkboxText = "")
        {
            Parse();
            yesNoModalTransform.position = yesNoModalPosition;
            keyboardTransform.transform.SetParent(rootTransform);
            yesNoModalTransform.transform.SetParent(parent);

            YesNoText     = text;
            YesButtonText = yesButtonText;
            NoButtonText  = noButtonText;

            yesButtonPressed = yesButtonPressedCallback;
            noButtonPressed  = noButtonPressedCallback;

            CheckboxText   = checkboxText;
            CheckboxValue  = false;
            CheckboxActive = !string.IsNullOrEmpty(checkboxText);

            yesNoModalView.SetField("_animateParentCanvas", animateParentCanvas);

            parserParams.EmitEvent("close-yes-no");
            parserParams.EmitEvent("open-yes-no");
        }
示例#19
0
 private void Refresh(bool reset = false)
 {
     parserParams.EmitEvent("cancel");
 }
 internal void ShowModal(RectTransform parent)
 {
     Parse(parent);
     parserParams.EmitEvent("close-modal");
     parserParams.EmitEvent("open-modal");
 }
示例#21
0
 public void RefreshConfigList()
 {
     _ddlsConfigs.values = ConfigLister();
     _ddlsConfigs.UpdateChoices();
     _parserParams.EmitEvent("EmitRefreshConfigList");
 }
示例#22
0
 public void DeactivateModals() => parserParams.EmitEvent("on-deactivate");
示例#23
0
 protected override void DidDeactivate(DeactivationType deactivationType)
 {
     _parserParams.EmitEvent("closeAllMPModals");
     base.DidDeactivate(deactivationType);
 }
示例#24
0
 private void OnCurrentClick()
 {
     ReadCurrentSettings();
     parserParams.EmitEvent("cancel");
 }
 private void OverrideSelect(TableView ignored1, int idx)
 {
     EnvOr = (EnvOverrideMode)idx;
     parserParams.EmitEvent("close-OverrideModal");
 }
        public void ToggleMenuVisible(string menuId, bool isVisible)
        {
            switch (menuId.ToLower())
            {
            case "spn":
                if (isVisible)
                {
                    parserParams.EmitEvent("show-spn");
                }
                else
                {
                    parserParams.EmitEvent("hide-spn");
                }
                break;

            case "mpn":
                if (isVisible)
                {
                    parserParams.EmitEvent("show-mpn");
                }
                else
                {
                    parserParams.EmitEvent("hide-mpn");
                }
                break;

            case "if":
                if (isVisible)
                {
                    parserParams.EmitEvent("show-if");
                }
                else
                {
                    parserParams.EmitEvent("hide-if");
                }
                break;

            case "is":
                if (isVisible)
                {
                    parserParams.EmitEvent("show-is");
                }
                else
                {
                    parserParams.EmitEvent("hide-is");
                }
                break;
            }
        }
示例#27
0
 private void LoadAcc()
 {
     _accuracy = AccLoader.instance.GetAcc(_id);
     _parserParams.EmitEvent("setAcc");
 }
示例#28
0
 public void updateUI()
 {
     parserParams.EmitEvent("cancel");
 }
示例#29
0
        public BSMLParserParams Parse(XmlNode parentNode, GameObject parent, object host = null)
        {
            BSMLParserParams parserParams = new BSMLParserParams();

            parserParams.host = host;
            FieldAccessOption    fieldAccessOptions    = FieldAccessOption.Auto;
            PropertyAccessOption propertyAccessOptions = PropertyAccessOption.Auto;
            MethodAccessOption   methodAccessOptions   = MethodAccessOption.Auto;
            HostOptionsAttribute hostOptions           = host?.GetType().GetCustomAttribute <HostOptionsAttribute>();

            if (hostOptions != null)
            {
                fieldAccessOptions    = hostOptions.FieldAccessOption;
                propertyAccessOptions = hostOptions.PropertyAccessOption;
                methodAccessOptions   = hostOptions.MethodAccessOption;
            }
            if (host != null)
            {
                foreach (MethodInfo methodInfo in host.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    UIAction uiaction     = methodInfo.GetCustomAttributes(typeof(UIAction), true).FirstOrDefault() as UIAction;
                    string   methodName   = methodInfo.Name;
                    string   uiActionName = null;
                    if (uiaction != null)
                    {
                        uiActionName = uiaction.id;
                        if (parserParams.actions.TryGetValue(uiActionName, out BSMLAction existing))
                        {
                            if (existing.FromUIAction)
                            {
                                throw new InvalidOperationException($"UIAction '{uiActionName}' is already used by member '{existing.MemberName}'.");
                            }
                            existing.methodInfo   = methodInfo;
                            existing.FromUIAction = true;
                        }
                        else
                        {
                            parserParams.actions.Add(uiActionName, new BSMLAction(host, methodInfo, true));
                        }
                        if (methodAccessOptions == MethodAccessOption.AllowBoth && methodName != uiActionName)
                        {
                            if (!parserParams.actions.ContainsKey(methodName))
                            {
                                parserParams.actions.Add(methodName, new BSMLAction(host, methodInfo, false));
                            }
                        }
                    }
                    else if (methodAccessOptions != MethodAccessOption.OptIn)
                    {
                        if (!parserParams.actions.ContainsKey(methodName))
                        {
                            parserParams.actions.Add(methodName, new BSMLAction(host, methodInfo));
                        }
                    }
                }

                foreach (FieldInfo fieldInfo in host.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    UIValue uivalue     = fieldInfo.GetCustomAttributes(typeof(UIValue), true).FirstOrDefault() as UIValue;
                    string  fieldName   = fieldInfo.Name;
                    string  uiValueName = null;
                    if (uivalue != null)
                    {
                        uiValueName = uivalue.id;
                        if (parserParams.values.TryGetValue(uiValueName, out BSMLValue existing))
                        {
                            if (existing.FromUIValue)
                            {
                                throw new InvalidOperationException($"UIValue '{uiValueName}' is already used by member '{existing.MemberName}'.");
                            }
                            if (existing is BSMLFieldValue existingField)
                            {
                                existingField.fieldInfo   = fieldInfo;
                                existingField.FromUIValue = true;
                            }
                        }
                        else
                        {
                            parserParams.values.Add(uiValueName, new BSMLFieldValue(host, fieldInfo));
                        }
                        if (fieldAccessOptions == FieldAccessOption.AllowBoth && fieldName != uiValueName)
                        {
                            if (!parserParams.values.ContainsKey(fieldName))
                            {
                                parserParams.values.Add(fieldName, new BSMLFieldValue(host, fieldInfo, false));
                            }
                        }
                    }
                    else if (fieldAccessOptions != FieldAccessOption.OptIn)
                    {
                        if (!parserParams.values.ContainsKey(fieldName))
                        {
                            parserParams.values.Add(fieldName, new BSMLFieldValue(host, fieldInfo, false));
                        }
                    }

                    UIParams uiParams = fieldInfo.GetCustomAttributes(typeof(UIParams), true).FirstOrDefault() as UIParams;
                    if (uiParams != null)
                    {
                        fieldInfo.SetValue(host, parserParams);
                    }
                }

                foreach (PropertyInfo propertyInfo in host.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    UIValue uivalue     = Attribute.GetCustomAttributes(propertyInfo, typeof(UIValue), true).FirstOrDefault() as UIValue;
                    string  propName    = propertyInfo.Name;
                    string  uiValueName = null;
                    if (uivalue != null)
                    {
                        uiValueName = uivalue.id;
                        if (parserParams.values.TryGetValue(uiValueName, out BSMLValue existing))
                        {
                            if (existing.FromUIValue)
                            {
                                throw new InvalidOperationException($"UIValue '{uiValueName}' is already used by member '{existing.MemberName}'.");
                            }
                            if (existing is BSMLPropertyValue existingProp)
                            {
                                existingProp.propertyInfo = propertyInfo;
                                existingProp.FromUIValue  = true;
                            }
                        }
                        else
                        {
                            parserParams.values.Add(uiValueName, new BSMLPropertyValue(host, propertyInfo));
                        }
                        if (propertyAccessOptions == PropertyAccessOption.AllowBoth && propName != uiValueName)
                        {
                            if (!parserParams.values.ContainsKey(propName))
                            {
                                parserParams.values.Add(propName, new BSMLPropertyValue(host, propertyInfo, false));
                            }
                        }
                    }
                    else if (propertyAccessOptions != PropertyAccessOption.OptIn)
                    {
                        if (!parserParams.values.ContainsKey(propName))
                        {
                            parserParams.values.Add(propName, new BSMLPropertyValue(host, propertyInfo, false));
                        }
                    }
                }
            }

            IEnumerable <ComponentTypeWithData> componentInfo = Enumerable.Empty <ComponentTypeWithData>();

            foreach (XmlNode node in parentNode.ChildNodes)
            {
                HandleNode(node, parent, parserParams, out IEnumerable <ComponentTypeWithData> components);
                componentInfo = componentInfo.Concat(components);
            }

            foreach (KeyValuePair <string, BSMLAction> action in parserParams.actions.Where(x => x.Key.StartsWith(SUBSCRIVE_EVENT_ACTION_PREFIX)))
            {
                parserParams.AddEvent(action.Key.Substring(1), delegate { action.Value.Invoke(); });
            }

            foreach (ComponentTypeWithData component in componentInfo)
            {
                component.typeHandler.HandleTypeAfterParse(component, parserParams);
            }

            parserParams.EmitEvent("post-parse");

            return(parserParams);
        }
示例#30
0
 private void NotifyFilterReload()
 {
     parserParams.EmitEvent("reload");
 }