Ejemplo n.º 1
0
 public void BoolCheckbox(ref JSONStorableBool output, string name, bool start,
                          JSONStorableBool.SetBoolCallback callback = null, bool right = false)
 {
     output = new JSONStorableBool(name, start, callback);
     script.RegisterBool(output);
     script.CreateToggle(output, right);
 }
Ejemplo n.º 2
0
        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);
            }
        }