Exemplo n.º 1
0
    public void MoveScroll(bool right)
    {
        float x;

        if (right)
        {
            LeftArrow.SetActive(true);
            Vector3 newPos = Grid.GetComponent <RectTransform>().localPosition;
            newPos.x -= ScrollbarSeparateValue;
            Grid.GetComponent <RectTransform>().localPosition = newPos;
            CurrentScrollbarValue++;
            if (CurrentScrollbarValue >= CurrentGridChild)
            {
                RightArrow.SetActive(false);
            }
        }
        else
        {
            RightArrow.SetActive(true);
            Vector3 newPos = Grid.GetComponent <RectTransform>().localPosition;
            newPos.x += ScrollbarSeparateValue;
            Grid.GetComponent <RectTransform>().localPosition = newPos;
            CurrentScrollbarValue--;
            if (CurrentScrollbarValue <= 4)
            {
                LeftArrow.SetActive(false);
            }
        }
    }
 void Start()
 {
     anim = PlayerObject.GetComponent <Animator>();
     PlayerHeadRot.RotationAbility = true;
     LeftLooked  = false;
     RightLooked = false;
     LeftArrow.SetActive(true);
     RightArrow.SetActive(true);
     time = 0;
 }
    void Update()
    {
        if (Time.timeScale == 0)
        {
            return;
        }

        if (!GlobalAudioSrc.Instance.audioSrc.isPlaying)
        {
            time += Time.deltaTime;
            if (time >= MsgInterval)
            {
                PlayVoice();
            }
        }
        else
        {
            time = 0;
        }

        if (MainCamera.localRotation.y < -0.2 && !LeftLooked)
        {
            LeftLooked = true;
            time       = 0;
            StopVoice();
            LeftArrow.SetActive(false);
        }
        if (MainCamera.localRotation.y > 0.2 && !RightLooked)
        {
            RightLooked = true;
            time        = 0;
            StopVoice();
            RightArrow.SetActive(false);
        }

        if (LeftLooked == true && RightLooked == true)
        {
            time = 0;
            PlayerHeadRot.RotationAbility = false;
            anim.SetTrigger("WellDone");
        }
    }
Exemplo n.º 4
0
 public void Update()
 {
     //Update UI
     if (currentModel > 1)
     {
         //Arrows
         LeftArrow.SetActive(true);
         if (currentModel == models.Count)
         {
             RightArrow.SetActive(false);
         }
         else
         {
             RightArrow.SetActive(true);
         }
     }
     else
     {
         LeftArrow.SetActive(false);
         RightArrow.SetActive(true);
     }
 }
Exemplo n.º 5
0
 public void HandleOptions()
 {
     if (m_Input.InteractInput)
     {
         //select an option and set everything back to normal
         dialogueUI.SetIsInOptions(false);
         IsInOptions = false;
         RightArrow.SetActive(false);
         LeftArrow.SetActive(false);
         dialogueUI.SelectOption(optionSelected);
         dialogueUI.CallOnOptionsEnd();
     }
     else if (Input.GetKeyDown("right") && optionSelected < optionsAvailable.Options.Length - 1 && TimeBetweenLinesTimer <= 0)
     {
         //allows to use the option arrows for the dialogue
         optionSelected++;
         dialogueUI.MarkLineComplete();
         dialogueRunner.HandleLine(optionsAvailable.Options[optionSelected].Line);
         LeftArrow.SetActive(true);
         if (optionSelected == optionsAvailable.Options.Length - 1)
         {
             RightArrow.SetActive(false);
         }
         TimeBetweenLinesTimer = TimebetweenLinesCooldown;
     }
     else if (Input.GetKeyDown("left") && optionSelected > 0 && TimeBetweenLinesTimer <= 0)
     {
         //allows to use the option arrows for the dialogue
         optionSelected--;
         dialogueUI.MarkLineComplete();
         dialogueRunner.HandleLine(optionsAvailable.Options[optionSelected].Line);
         RightArrow.SetActive(true);
         if (optionSelected == 0)
         {
             LeftArrow.SetActive(false);
         }
         TimeBetweenLinesTimer = TimebetweenLinesCooldown;
     }
 }
Exemplo n.º 6
0
    public void SetupOptions(Yarn.OptionSet optionsCollection, IDictionary <string, string> strings, System.Action <int> selectOption)
    {
        //Do the initial setup for the options
        IsInOptions      = true;
        optionSelected   = 0;
        optionsAvailable = optionsCollection;
        RightArrow.SetActive(true);
        dialogueUI.SetIsInOptions(true);
        dialogueUI.SetWaitingForOptionSelection(true);
        dialogueUI.SetcurrentOptionSelectionHandler(selectOption);
        dialogueUI.CallOnOptionsStart();

        //This is to handle localisation, but I'm not doing that yet

        /*
         * if (strings.TryGetValue(optionsCollection.Options[0].Line.ID, out var optionText) == false)
         * {
         *  Debug.LogWarning($"Option {optionsCollection.Options[0].Line.ID} doesn't have any localised text");
         *  optionText = optionsCollection.Options[0].Line.ID;
         * }
         */
        //Show the first option
        dialogueRunner.HandleLine(optionsCollection.Options[0].Line);
    }
Exemplo n.º 7
0
    public void PrintGroupBtn(GroupType type = GroupType.Return_MaxGroupType)
    {
        ClearGrid();
        if (type == GroupType.Return_MaxGroupType)
        {
            for (int i = 0; i < (int)GroupType.Return_MaxGroupType; i++)
            {
                switch ((GroupType)i)
                {
                case GroupType.Pictures:
                    PrintNewBtn(GroupType.Pictures, "Imagenes");
                    break;

                case GroupType.Videos:
                    PrintNewBtn(GroupType.Videos, "Videos");
                    break;

                case GroupType.Pictures360:
                    PrintNewBtn(GroupType.Pictures360, "Imagenes 360º");
                    break;

                case GroupType.Videos360:
                    PrintNewBtn(GroupType.Videos360, "Videos 360º");
                    break;

                case GroupType.Return_MaxGroupType:
                    break;
                }
            }
        }
        else
        {
            switch (type)
            {
            case GroupType.Pictures:
            case GroupType.Pictures360:
                for (int i = 0; i < allPicture.Count; i++)
                {
                    if (allPicture[i].Type == type)
                    {
                        PrintNewBtn(allPicture[i].Type, allPicture[i].Name, i);
                    }
                }
                break;

            case GroupType.Videos:
            case GroupType.Videos360:
                for (int i = 0; i < allFilms.Count; i++)
                {
                    if (allFilms[i].Type == type)
                    {
                        PrintNewBtn(allFilms[i].Type, allFilms[i].Name, i);
                    }
                }
                break;
            }
            PrintNewBtn(GroupType.Return_MaxGroupType, "Return");
        }
        if (CurrentGridChild == 0)
        {
            CurrentGridChild = Grid.transform.childCount;
        }
        else
        {
            CurrentGridChild = Grid.transform.childCount - CurrentGridChild;
        }

        if (CurrentScrollbarValue < CurrentGridChild)
        {
            RightArrow.SetActive(true);
        }
        else
        {
            RightArrow.SetActive(false);
        }
        LeftArrow.SetActive(false);
    }