Beispiel #1
0
        // Token: 0x060010FD RID: 4349 RVA: 0x00063C00 File Offset: 0x00061E00
        public virtual void UpdateText(VRTK_ControllerTooltips.TooltipButtons element, string newText)
        {
            switch (element)
            {
            case VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip:
                this.triggerText = newText;
                break;

            case VRTK_ControllerTooltips.TooltipButtons.GripTooltip:
                this.gripText = newText;
                break;

            case VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip:
                this.touchpadText = newText;
                break;

            case VRTK_ControllerTooltips.TooltipButtons.ButtonOneTooltip:
                this.buttonOneText = newText;
                break;

            case VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip:
                this.buttonTwoText = newText;
                break;

            case VRTK_ControllerTooltips.TooltipButtons.StartMenuTooltip:
                this.startMenuText = newText;
                break;
            }
            this.ResetTooltip();
        }
Beispiel #2
0
        // Token: 0x06001103 RID: 4355 RVA: 0x00063DE4 File Offset: 0x00061FE4
        protected virtual void EmitEvent(bool state, VRTK_ControllerTooltips.TooltipButtons element)
        {
            ControllerTooltipsEventArgs e;

            e.element = element;
            if (state)
            {
                this.OnControllerTooltipOn(e);
                return;
            }
            this.OnControllerTooltipOff(e);
        }
        /*    void CheckAction<T>(AudioRef audio, Func<T> currentState, T state)
         *   {
         *       bool isPlaying = audio.Value.isPlaying;
         *       while (isPlaying)
         *       {
         *           if (currentState().Equals(state))
         *           {
         *               Debug.Log(currentState());
         *               stepFinished = true;
         *               return;
         *           }
         *           isPlaying = audio.Value.isPlaying;
         *       }
         *   }
         *
         *   IEnumerator CheckAction<T> (Func<T> currentState, T state)
         *   {
         *       if (!stepFinished)
         *       {
         *           Debug.Log(currentState());
         *           yield return new WaitUntil(() => currentState().Equals(state));
         *       }
         *       stepFinished = false;
         *   }
         */

        /// <summary>
        /// Plays the audio of the tutorial step, and shows the tooltip of the corresponding button and additional givin tooltip if there is one.
        /// Waits until does the task mentioned in the tutorial step.
        /// </summary>
        /// <param name="audio">The audio to play for the tutorial step</param>
        /// <param name="button">The button that is required for the tutorial step, of which its tooltip should show</param>
        /// <param name="tooltip">Additional tooltip object that should show if needed for the tutorial step, null if only one tooltip is needed.</param>
        /// <param name="controller">If controller is -1 then left only, 0 then both, 1 then right controller only</param>
        /// <returns></returns>
        IEnumerator TutorialStep(AudioSource audio, VRTK_ControllerTooltips.TooltipButtons button, VRTK_ObjectTooltip tooltip, int controller)
        {
            audio.Play();

            //change tooltip colors to the color during tutorial step
            if (controller <= 0)
            {
                ChangeTooltipColorDuringTutorialStep(leftToggling, leftToggling.ChangeButtonToTooltip(button));
                leftTooltips.ToggleTips(true, button);
            }
            if (controller >= 0)
            {
                if (tooltip != null)
                {
                    ChangeTooltipColorDuringTutorialStep(rightToggling, tooltip);
                    rightTooltips.ToggleTips(true, rightToggling.ChangeTooltipToButton(tooltip));
                }
                ChangeTooltipColorDuringTutorialStep(rightToggling, rightToggling.ChangeButtonToTooltip(button));
                rightTooltips.ToggleTips(true, button);
            }
            //CheckAction(audio, currentState, state);
            yield return(new WaitForSecondsRealtime(audio.clip.length));

            //yield return StartCoroutine(CheckAction(currentState, state));

            yield return(new WaitUntil(() => stepFinished)); //wait until step is finished before continuing tutorial

            //change tooltip colors once step is finished
            if (controller <= 0)
            {
                ChangeTooltipColorAfterTutorialStep(leftToggling, leftToggling.ChangeButtonToTooltip(button));
                leftTooltips.ToggleTips(false, button);
            }
            if (controller >= 0)
            {
                if (tooltip != null)
                {
                    ChangeTooltipColorAfterTutorialStep(rightToggling, tooltip);
                    rightTooltips.ToggleTips(false, rightToggling.ChangeTooltipToButton(tooltip));
                }
                ChangeTooltipColorAfterTutorialStep(rightToggling, rightToggling.ChangeButtonToTooltip(button));
                rightTooltips.ToggleTips(false, button);
            }

            //set it back to false for the next step
            stepFinished = false;
        }
Beispiel #4
0
        /// <summary>
        /// This function determines the behavior of the tooltip when the corresponding button is released
        /// </summary>
        /// <param name="tooltip">The tooltip which should have its behavior changed</param>
        /// <param name="tooltipButton">The button that corresponds to the tooltip</param>
        private void DoTooltipReleased(VRTK_ObjectTooltip tooltip, VRTK_ControllerTooltips.TooltipButtons tooltipButton)
        {
            Debug.Log("1" + tooltip.containerColor);
            Debug.Log("2" + tutorial.tipBackgroundColor_DuringTutorialStep);
            if (tooltip.containerColor != tutorial.tipBackgroundColor_DuringTutorialStep)
            {
                tooltips.ToggleTips(false, tooltipButton);
            }

            /*
             * switch (tooltipButton)
             * {
             *  case VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip:
             *      if (gameObject.name == "LeftController" || (Tutorial.currentTutorialState != Tutorial.TutorialState.GRABZONE
             *              && Tutorial.currentTutorialState != Tutorial.TutorialState.PRIMARYPLACEMENT
             *              && Tutorial.currentTutorialState != Tutorial.TutorialState.SECONDARYPLACEMENT))
             *      {
             *          tooltips.ToggleTips(false, tooltipButton);
             *      }
             *      break;
             *  case VRTK_ControllerTooltips.TooltipButtons.GripTooltip:
             *      if ((gameObject.name == "LeftController" && Tutorial.currentTutorialState != Tutorial.TutorialState.SCALINGMAP)
             || (Tutorial.currentTutorialState != Tutorial.TutorialState.SELECTIONPOINTER
             ||         && Tutorial.currentTutorialState != Tutorial.TutorialState.SECONDARYPLACEMENT
             ||         && Tutorial.currentTutorialState != Tutorial.TutorialState.SCALINGMAP))
             ||     {
             ||         tooltips.ToggleTips(false, tooltipButton);
             ||     }
             ||     break;
             || case VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip:
             ||     if ((gameObject.name == "LeftController" && Tutorial.currentTutorialState != Tutorial.TutorialState.MOVINGMAP)
             || (gameObject.name == "RightController" && Tutorial.currentTutorialState != Tutorial.TutorialState.ROTATINGMAP))
             ||     {
             ||         tooltips.ToggleTips(false, tooltipButton);
             ||     }
             ||     break;
             || case VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip:
             ||     if (gameObject.name == "LeftController"
             || (gameObject.name == "RightController" && Tutorial.currentTutorialState != Tutorial.TutorialState.UNDOANDDELETE))
             ||     {
             ||         tooltips.ToggleTips(false, tooltipButton);
             ||     }
             ||     break;
             ||}*/
        }
Beispiel #5
0
 // Token: 0x060010FE RID: 4350 RVA: 0x00063C6C File Offset: 0x00061E6C
 public virtual void ToggleTips(bool state, VRTK_ControllerTooltips.TooltipButtons element = VRTK_ControllerTooltips.TooltipButtons.None)
 {
     if (element == VRTK_ControllerTooltips.TooltipButtons.None)
     {
         for (int i = 1; i < this.buttonTooltips.Length; i++)
         {
             if (this.buttonTooltips[i].displayText.Length > 0)
             {
                 this.buttonTooltips[i].gameObject.SetActive(state);
             }
         }
     }
     else if (this.buttonTooltips[(int)element].displayText.Length > 0)
     {
         this.buttonTooltips[(int)element].gameObject.SetActive(state);
     }
     this.EmitEvent(state, element);
 }
Beispiel #6
0
        /// <summary>
        /// This function is used as a helper to get a tooltip object given a button of the TooltipButtons enum type
        /// </summary>
        /// <param name="button">this is the button that we want the corresponding tooltip of</param>
        /// <returns>This is the corresponding tooltip object</returns>
        public VRTK_ObjectTooltip ChangeButtonToTooltip(VRTK_ControllerTooltips.TooltipButtons button)
        {
            switch (button)
            {
            case VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip:
                return(triggerTooltip);

            case VRTK_ControllerTooltips.TooltipButtons.GripTooltip:
                return(gripTooltip);

            case VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip:
                return(touchpadTooltip);

            case VRTK_ControllerTooltips.TooltipButtons.ButtonOneTooltip:
                return(buttonOne);

            case VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip:
                return(buttonTwo);
            }
            throw new System.ArgumentException("Parameter must be a valid tooltip button");
        }
Beispiel #7
0
 /// <summary>
 /// This function determines the behavior of the tooltip when the corresponding button is pressed
 /// </summary>
 /// <param name="tooltip">The tooltip which should have its behavior changed</param>
 /// <param name="tooltipButton">The button that corresponds to the tooltip</param>
 private void DoTooltipPressed(VRTK_ObjectTooltip tooltip, VRTK_ControllerTooltips.TooltipButtons tooltipButton)
 {
     tooltips.ToggleTips(true, tooltipButton);
 }
Beispiel #8
0
 /// <summary>
 /// 关闭某按键提示
 /// </summary>
 public void TooltipOff(VRTK_ControllerTooltips.TooltipButtons button)
 {
     tooltip.UpdateText(button, "");
 }
Beispiel #9
0
 /// <summary>
 /// 打开某按键提示
 /// </summary>
 /// <param name="button"></param>
 /// <param name="text"></param>
 public void TooltipOn(VRTK_ControllerTooltips.TooltipButtons button, string text)
 {
     tooltip.UpdateText(button, text);
 }