示例#1
0
 public void FloatSlider(ref JSONStorableFloat output, string name, float start,
                         JSONStorableFloat.SetFloatCallback callback, float min, float max, bool right = false, bool constraint = false)
 {
     output = new JSONStorableFloat(name, start, callback, min, max, constraint, true)
     {
         storeType = JSONStorableParam.StoreType.Full
     };
     script.RegisterFloat(output);
     script.CreateSlider(output, right);
 }
示例#2
0
        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);
            }
        }