/// <summary>
 /// Starts the timer.
 /// </summary>
 /// <param name='timeout'>Timeout duration in seconds.</param>
 /// <param name="timeoutHandler">Invoke this handler on timeout.</param>
 public virtual void StartTimer(float timeout, System.Action timeoutHandler)
 {
     if (m_timer == null)
     {
         if (timerSlider != null)
         {
             Tools.SetGameObjectActive(timerSlider, true);
             m_timer = timerSlider.GetComponent <StandardUITimer>();
             if (m_timer == null)
             {
                 m_timer = timerSlider.gameObject.AddComponent <StandardUITimer>();
             }
         }
         else
         {
             m_timer = GetComponentInChildren <StandardUITimer>();
             if (m_timer == null)
             {
                 m_timer = gameObject.AddComponent <StandardUITimer>();
             }
         }
     }
     Tools.SetGameObjectActive(m_timer, true);
     m_timer.StartCountdown(timeout, timeoutHandler);
 }
예제 #2
0
 /// <summary>
 /// Starts the timer.
 /// </summary>
 /// <param name='timeout'>
 /// Timeout duration in seconds.
 /// </param>
 public override void StartTimer(float timeout)
 {
     if (timer != null)
     {
         if (unityUITimer == null)
         {
             Tools.SetGameObjectActive(timer, true);
             unityUITimer = timer.GetComponent <UnityUITimer>();
             if (unityUITimer == null)
             {
                 unityUITimer = timer.gameObject.AddComponent <UnityUITimer>();
             }
             Tools.SetGameObjectActive(timer, false);
         }
         if (unityUITimer != null)
         {
             Tools.SetGameObjectActive(timer, true);
             unityUITimer.StartCountdown(timeout, OnTimeout);
         }
         else
         {
             if (DialogueDebug.LogWarnings)
             {
                 Debug.LogWarning(string.Format("{0}: No UnityUITimer component found on timer", DialogueDebug.Prefix));
             }
         }
     }
 }
예제 #3
0
        internal Toy(string name, string id)
        {
            this.id   = id;
            this.name = name;

            button = ButtonAPI.CreateButton(ButtonAPI.ButtonType.Default, name + "\nClick to\nSet", "Click to set controll mode", (ButtonAPI.HorizontalPosition) x ++, ButtonAPI.VerticalPosition.BottomButton, ButtonAPI.MakeEmptyPage("SubMenu_1").transform, delegate(bool a)
            {
                changeHand();
            }, Color.white, Color.magenta, null, true, false, false, false, null, true);

            toys.Add(this);

            GameObject slider    = GameObject.Find("UserInterface/QuickMenu/UserInteractMenu/User Volume/VolumeSlider");
            GameObject quickmenu = GameObject.Find("UserInterface/QuickMenu/ShortcutMenu");

            GameObject speedSliderObject = GameObject.Instantiate(slider, quickmenu.transform, true);

            speedSlider              = speedSliderObject.GetComponent <UnityEngine.UI.Slider>();
            speedSlider.maxValue     = 20;
            speedSlider.wholeNumbers = true;
            speedSlider.value        = 0;
            speedSliderText          = speedSlider.transform.Find("Fill Area/VolumeNumberText").GetComponent <UnityEngine.UI.Text>();
            speedSliderText.text     = name + " Speed: 0%";
            speedSliderObject.SetActive(false);

            if (name.Equals("Max"))
            {
                GameObject maxSliderObject = GameObject.Instantiate(slider, quickmenu.transform, true);
                maxSliderObject.transform.localScale = new Vector3(0.7f, 1, 1);
                maxSlider              = maxSliderObject.GetComponent <UnityEngine.UI.Slider>();
                maxSlider.maxValue     = 3;
                maxSlider.wholeNumbers = true;
                maxSlider.value        = 0;
                Transform textTransform = maxSlider.transform.Find("Fill Area/VolumeNumberText");
                textTransform.localScale = new Vector3(1, 1, 1);
                maxSliderText            = textTransform.GetComponent <UnityEngine.UI.Text>();
                maxSliderText.text       = "Max Contraction: 0";
                maxSliderObject.SetActive(false);
            }
            else if (name.Equals("Nora"))
            {
                rotateButton = ButtonAPI.CreateButton(ButtonAPI.ButtonType.Default, "Rotate", "Rotate Nora", ButtonAPI.HorizontalPosition.LeftOfMenu, ButtonAPI.VerticalPosition.BelowBottomButton, ButtonAPI.ShortcutMenuTransform, delegate(bool a)
                {
                    rotate();
                }, Color.white, Color.magenta, null, true, false, false, false, null, true);
                rotateButton.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(720, 190);
                rotateButton.gameObject.SetActive(false);
            }
            else if (name.Equals("Edge"))
            {
                speedSlider.GetComponent <RectTransform>().sizeDelta = new Vector2(850, 160);
                GameObject edgeSliderObject = GameObject.Instantiate(slider, quickmenu.transform, true);
                edgeSliderObject.GetComponent <RectTransform>().sizeDelta = new Vector2(850, 160);
                edgeSlider              = edgeSliderObject.GetComponent <UnityEngine.UI.Slider>();
                edgeSlider.maxValue     = 20;
                edgeSlider.wholeNumbers = true;
                edgeSlider.value        = 0;
                Transform textTransform = edgeSlider.transform.Find("Fill Area/VolumeNumberText");
                textTransform.localScale = new Vector3(1, 1, 1);
                edgeSliderText           = textTransform.GetComponent <UnityEngine.UI.Text>();
                edgeSliderText.text      = "Edge Speed: 0%";
                edgeSliderObject.SetActive(false);
            }
        }