Example #1
0
    public void HideActionPopup(bool saveValues)
    {
        if (!actionPopupRef.activeSelf)
        {
            return;
        }

        ActionPopup actionPopup = actionPopupRef.GetComponent <ActionPopup>();

        if (saveValues)
        {
            // Save values in action object
            actionPopup.SaveValues();
        }

        // Reverse iteration, clear parameter objects
        if (actionPopup.parametersRef.transform.childCount > 0)
        {
            for (int i = actionPopup.parametersRef.transform.childCount - 1; i >= 0; i--)
            {
                DestroyItem(actionPopup.parametersRef.transform.GetChild(i).gameObject);
            }
        }

        actionPopupRef.SetActive(false);
    }
Example #2
0
        public static async Task <bool> CheckToken()
        {
            if (CloudStreamCore.UnixTime >= Settings.AniListTokenUnixTime)
            {
                App.RemoveFolder("AniListAccount");
                var acc = await ActionPopup.DisplayActionSheet("AniList token has expired", "Login", "Cancel");

                if (acc == "Login")
                {
                    Authenticate();
                }
                return(true);
            }
            return(false);
        }
        public static SettingsHolder TimeSettings = new SettingsHolder()
        {
            header   = "Time",
            settings = new SettingsItem[] {
                new SettingsList("baseline_fast_forward_white_48dp.png", "App Videoplayer fast forward", "", () => { return($"{Settings.VideoPlayerSkipTime}s"); }, async() => {
                    string skip = await ActionPopup.DisplayActionSheet("Videoplayer skip", SkipTimes.IndexOf(Settings.VideoPlayerSkipTime + "s"), SkipTimes);
                    if (skip == "Cancel" || skip == "")
                    {
                        return;
                    }

                    if (int.TryParse(skip.Replace("s", ""), out int res))
                    {
                        Settings.VideoPlayerSkipTime = res;
                    }
                }),
Example #4
0
    public void OpenActionPopup()
    {
        // If there is an action
        if (GetPseudoAction())
        {
            PseudoAction pa = GetPseudoAction();
            ActionPopup  ap = recipeManager.ShowActionPopup(pa.GetActionType().ToString(), pa.GetParameterNames(), pa.GetParameterValues(), pa.GetParameterMins(), pa.GetParameterMaxs());

            // If ap is not available, return
            if (ap == null)
            {
                return;
            }

            ap.SetPseudoActionRef(pa);
        }
    }
Example #5
0
    // Show action settings popup
    public ActionPopup ShowActionPopup(string actionName, List <string> paramNames, List <int> paramValues, List <int> paramMins, List <int> paramMaxs)
    {
        // Reset action popup first
        HideActionPopup(false);

        actionPopupRef.GetComponent <ActionPopup>().headerRef.text = actionName;
        ActionPopup actionPopup = actionPopupRef.GetComponent <ActionPopup>();

        // Add parameter settings for this action type
        for (int i = 0; i < paramValues.Count; i++)
        {
            GameObject newParamObj = GameObject.Instantiate(actionPopup.parameterPrefab);
            newParamObj.transform.SetParent(actionPopup.parametersRef.transform, false);
            Vector3 pos = newParamObj.GetComponent <RectTransform>().anchoredPosition3D;
            pos.y = actionPopup.paramStartY + (i * actionPopup.paramIntervalY);
            newParamObj.GetComponent <RectTransform>().anchoredPosition3D = pos;

            ActionParameter ap = newParamObj.GetComponent <ActionParameter>();
            ap.SetParamIndex(i);
            ap.paramName = paramNames[i];

            // Set limits of value
            ap.sliderRef.minValue = paramMins[i];
            ap.sliderRef.maxValue = paramMaxs[i];

            // Set value and update header
            ap.sliderRef.value = paramValues[i];
            ap.UpdateHeader();
        }

        actionPopupRef.SetActive(true);

        actionPopupRef.AddComponent <VRTK.VRTK_UIGraphicRaycaster>();

        return(actionPopup);
    }
Example #6
0
 void Start()
 {
     popup = GetComponentInParent <ActionPopup>();
     image = GetComponent <Image>();
 }