public FloatSelector( MVRScript plug, bool insideRestore, CallbackAction call, string startAtom = null, AtomStorableSelector _storableSelected = null) { try { currentValue = new JSONStorableFloat("current value", 0f, setValue, -1f, 1f, false); plug.RegisterFloat(currentValue); currentValueSlider = plug.CreateSlider(currentValue, true); currentValueSlider.gameObject.SetActive(false); this.insideRestore = insideRestore; if (_storableSelected == null) { storableSelected = new AtomStorableSelector(plug, SyncStorable, startAtom); } else { storableSelected = _storableSelected; storableSelected.Add(SyncStorable); } floatChooser = new JSONStorableStringChooser("floatTarget", null, null, "Value", SyncfloatTarget); UIDynamicPopup dp = plug.CreateScrollablePopup(floatChooser); dp.popupPanelHeight = 820f; plug.RegisterStringChooser(floatChooser); } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } }
public void Init(MVRScript script, CallbackAction call, string filter = "", string startVal = "None", string name = "atom", bool right = false) { this.filter = filter; atomChoices = new JSONStorableStringChooser(name, atomsUIDList, startVal, name, SyncAtom); script.RegisterStringChooser(atomChoices); popup = script.CreateScrollablePopup(atomChoices, right); popup.popupPanelHeight = System.String.IsNullOrEmpty(filter) ? 800f : 250f; popup.popup.onOpenPopupHandlers += SyncAtomChoices; }
public AtomStorableSelector( MVRScript plug, CallbackAction call, string startAtom = "None") : base(call) { try { atomSelected = new AtomSelector(plug, this.SyncAtom, startAtom); storableChooser = new JSONStorableStringChooser("element", null, null, "Element", SyncStorable); plug.RegisterStringChooser(storableChooser); UIDynamicPopup dp = plug.CreateScrollablePopup(storableChooser); dp.popupPanelHeight = 960f; } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } }
private void CreateActionWithChoice(string jssName, Action <string> fn, Func <List <string> > genChoices) { var choices = genChoices(); var jss = new JSONStorableStringChooser(jssName, choices, null, jssName) { isStorable = false, isRestorable = false }; _script.RegisterStringChooser(jss); jss.setCallbackFunction = val => { fn(val); jss.valNoCallback = null; }; jss.popupOpenCallback += () => jss.choices = genChoices(); }
public ActionSelector( MVRScript plug, CallbackAction call = null, string name = "action", string startAtom = null, AtomStorableSelector _storableSelected = null) : base(call) { try { actionButton = plug.CreateButton(null, true); actionButton.button.onClick.AddListener(CallAction); //actionButton.button.gameObject.SetActive(false); actionButton.button.enabled = false; skipSaveRestore = new JSONStorableBool("skip saverestore", false); plug.RegisterBool(skipSaveRestore); if (_storableSelected == null) { storableSelected = new AtomStorableSelector(plug, SyncStorable, startAtom); } else { SuperController.LogMessage("..."); storableSelected = _storableSelected; storableSelected.Add(SyncStorable); } actionChooser = new JSONStorableStringChooser(name, null, null, name, SyncActionTarget); plug.RegisterStringChooser(actionChooser); UIDynamicPopup dp = plug.CreateScrollablePopup(actionChooser); dp.popupPanelHeight = 820f; plug.CreateToggle(skipSaveRestore).toggle.onValueChanged.AddListener( b => { if (storableSelected.storable != null && storableSelected.storable.name != "None") { SyncStorable(storableSelected.storable.name); } }); } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } }
public void InitUI(MVRScript script, List <NamedAudioClip> nacs, JSONStorableString folderpath) { filetype = new JSONStorableStringChooser("File type", new List <string>(supportedFileTypes), ".wav", "File type", s => audiofilefilter.val = s); script.RegisterStringChooser(filetype); audiofilefilter = new JSONStorableString("audiofilefilter", ".wav"); lastLoadPath = DEFAULT_PATH; _path = folderpath; UIDynamicPopup popup = script.CreateScrollablePopup(filetype, false); popup.labelTextColor = Color.yellow; popup.popup.selectColor = Color.yellow; /*script.CreateButton("Load Audio (Folder)").button.onClick.AddListener( * () => OpenLoadFolder(nacs, lastLoadPath));*/ script.CreateButton("Remove all clips from scene audio").button.onClick.AddListener( () => URLAudioClipManager.singleton.RemoveAllClips()); // do it URLAudioClipManager.singleton.RemoveAllClips(); }