示例#1
0
    //====================================================================================================//

    public void OnInteractableButtonClick(int index)
    {
        AudioManager.Play("UI_Click");
        InteractablePreviewUI.SetPreviewAction(index);
    }
示例#2
0
    //====================================================================================================//

    public void Toggle(bool active)
    {
        if (!active)
        {
            ToggleInteractableGroup(false);

            for (int i = 0; i < 4; i++)
            {
                interactableButtons[i].onClick.RemoveAllListeners();
            }

            foreach (Button button in buttons)
            {
                button.gameObject.GetComponent <Animation>().Stop();
                button.gameObject.GetComponent <Image>().sprite = settings.interactableIcon;
                ColorBlock colors = button.gameObject.GetComponent <Button>().colors;
                colors.normalColor = Color.white;
                button.gameObject.GetComponent <Button>().colors = colors;
            }

            if (settings.useRenderTexture)
            {
                rawMap.transform.localPosition = new Vector3(0, 0, 0);
                if (settings.restrictViewport)
                {
                    rawMap.rectTransform.sizeDelta = new Vector2(980, 980);
                    slider.value = slider.minValue;
                }
            }
            else
            {
                map.transform.localPosition = new Vector3(0, 0, 0);
                if (settings.restrictViewport)
                {
                    if ((980 / settings.source.bounds.size.y * settings.source.bounds.size.x) < 880f)
                    {
                        map.rectTransform.sizeDelta = new Vector2(880, 880 / settings.source.bounds.size.x * settings.source.bounds.size.y);
                    }
                    else
                    {
                        map.rectTransform.sizeDelta = new Vector2(980 / settings.source.bounds.size.y * settings.source.bounds.size.x, 980);
                    }
                    slider.value = slider.minValue;
                }
                else
                {
                    map.rectTransform.sizeDelta = new Vector2(1000 / settings.source.bounds.size.y * settings.source.bounds.size.x, 1000);
                    slider.value = 1000;
                }
            }
            InteractablePreviewUI.ClearPreviewObject();
        }
        if (GameManager.Mode == GameMode.Recall && active && InteractablePreviewUI.Show)
        {
            InteractablePreviewUI.ToggleShow();
        }
        else if (GameManager.Mode == GameMode.Rehearsal && active && InteractableLog.Count % 3 != 0)
        {
            InteractablePreviewUI.SetPreviewObject(InteractablePath.NextInteractable, InteractablePath.Instance.actionIds[InteractablePath.Instance.nextIndex]);
            InteractablePreviewUI.SetPreviewAction(InteractablePath.Instance.actionIds[InteractablePath.Instance.nextIndex]);
        }
    }