예제 #1
0
        private void DrawImages(List <Data.ImgNode> images, Scrollbar scrollbar, UGUINode node)
        {
            for (int i = 0; i < images.Count; i++)
            {
                Data.ImgNode         image = images[i];
                UnityEngine.UI.Image graph = null;

                if (MatchAddress(image.Name, backgroundAddress))
                {
                    graph = scrollbar.GetComponent <UnityEngine.UI.Image>();
                    SetRectTransform(image.rect, scrollbar.GetComponent <RectTransform>());
                }
                else if (MatchAddress(image.Name, handleAddress))
                {
                    graph = scrollbar.handleRect.GetComponent <UnityEngine.UI.Image>();
                }
                else
                {
                    ctrl.DrawImage(image, node);
                }

                if (graph != null)
                {
                    PSDImporterUtility.SetPictureOrLoadColor(image, graph);
                }
            }
        }
예제 #2
0
    IEnumerator TimerReduction()
    {
        while (timerSlider.size > 0)
        {
            timerSlider.size -= sliderValueReduction;

            //showing danger sign
            if (timerSlider.size < 0.45f)
            {
                sliderHandle.color = dangerColor;
                timerSlider.GetComponent <Animator>().SetBool("DangerSign", true);
            }
            else
            {
                sliderHandle.color = defaultColor;
                timerSlider.GetComponent <Animator>().SetBool("DangerSign", false);
            }

            if (timerSlider.size <= 0)
            {
                timerSlider.GetComponent <Animator>().SetBool("DangerSign", false);

                gameManager.FinishedARun();

                StopCoroutine("TimerReduction");
            }
            yield return(new WaitForSeconds(reductionWaitingTime));
        }
    }
예제 #3
0
        public UINode DrawLayer(Layer layer, UINode parent)
        {
            UINode    node      = PSDImportUtility.InstantiateItem(PSDImporterConst.PREFAB_PATH_SCROLLBAR, layer.name, parent);
            Scrollbar scrollBar = node.InitComponent <Scrollbar>();

            string type = layer.arguments[0].ToUpper();

            switch (type)
            {
            case "R":
                scrollBar.direction = Scrollbar.Direction.RightToLeft;
                break;

            case "L":
                scrollBar.direction = Scrollbar.Direction.LeftToRight;
                break;

            case "T":
                scrollBar.direction = Scrollbar.Direction.TopToBottom;
                break;

            case "B":
                scrollBar.direction = Scrollbar.Direction.BottomToTop;
                break;

            default:
                break;
            }

            for (int i = 0; i < layer.images.Length; i++)
            {
                Image  image               = layer.images[i];
                string lowerName           = image.name.ToLower();
                UnityEngine.UI.Image graph = null;

                if (lowerName.StartsWith("b_"))
                {
                    graph = scrollBar.GetComponent <UnityEngine.UI.Image>();
                    PSDImportUtility.SetRectTransform(image, scrollBar.GetComponent <RectTransform>());
                    scrollBar.name = layer.name;
                }
                else if (lowerName.StartsWith("h_"))
                {
                    graph = scrollBar.handleRect.GetComponent <UnityEngine.UI.Image>();
                }

                if (graph == null)
                {
                    //忽略Scorllbar其他的artLayer
                    continue;
                }

                PSDImportUtility.SetPictureOrLoadColor(image, graph);
            }
            return(node);
        }
예제 #4
0
    protected virtual void Awake()
    {
        scrollbar.gameObject.SetActive(false);

        showScrollbar.onClick.AddListener(ShowTimeUI);
        hideScrollbar.onClick.AddListener(HideTimeUI);

        scrollbar.GetComponent <Scrollbar>().size = 0.05f;

        api = FindObjectOfType(typeof(GetAPIData)) as GetAPIData;
    }
예제 #5
0
        public UGUINode DrawLayer(GroupNode layer, UGUINode parent)
        {
            UGUINode  node      = PSDImportUtility.InstantiateItem(GroupType.SCROLLBAR, layer.Name, parent);
            Scrollbar scrollBar = node.InitComponent <Scrollbar>();

            switch (layer.direction)
            {
            case Direction.LeftToRight:
                scrollBar.direction = Scrollbar.Direction.LeftToRight;
                break;

            case Direction.BottomToTop:
                scrollBar.direction = Scrollbar.Direction.BottomToTop;
                break;

            case Direction.TopToBottom:
                scrollBar.direction = Scrollbar.Direction.TopToBottom;
                break;

            case Direction.RightToLeft:
                scrollBar.direction = Scrollbar.Direction.RightToLeft;
                break;

            default:
                break;
            }

            for (int i = 0; i < layer.images.Count; i++)
            {
                ImgNode image              = layer.images[i];
                string  lowerName          = image.Name.ToLower();
                UnityEngine.UI.Image graph = null;

                if (lowerName.StartsWith("b_"))
                {
                    graph = scrollBar.GetComponent <UnityEngine.UI.Image>();
                    PSDImportUtility.SetRectTransform(image, scrollBar.GetComponent <RectTransform>());
                    scrollBar.name = layer.Name;
                }
                else if (lowerName.StartsWith("h_"))
                {
                    graph = scrollBar.handleRect.GetComponent <UnityEngine.UI.Image>();
                }

                if (graph == null)
                {
                    //忽略Scorllbar其他的artLayer
                    continue;
                }

                PSDImportUtility.SetPictureOrLoadColor(image, graph);
            }
            return(node);
        }
예제 #6
0
    private IEnumerator MeterFill()
    {
        PowerDispSize = 0;
        PowerDisplay.GetComponent <Scrollbar>().size = 0;

        while (PowerDisplay.GetComponent <Scrollbar>().size < 1)
        {
            PowerDispSize += Time.deltaTime;
            PowerDisplay.GetComponent <Scrollbar>().size = PowerDispSize / 5;
            yield return(null);
        }
    }
 private void SettingsTrue()
 {
     /*メニュー表示*/
     MapFrame.SetActive(true);
     BGMButton.GetComponent <Text>().enabled    = true;
     SEButton.GetComponent <Text>().enabled     = true;
     ReturnButton.GetComponent <Text>().enabled = true;
     Setting01.enabled = true;
     BGMScrollbar.GetComponent <Image>().enabled = true;
     SEScrollbar.GetComponent <Image>().enabled  = true;
     BGMScrollbar03Handle.enabled = true;
     SEScrollbar04Handle.enabled  = true;
 }
예제 #8
0
    void Update()
    {
        Timer();

        sliderNumber += 1f;
        sliderProgress.GetComponent <Slider>().value = timeLeft;
        PlayerWins.GetComponent <Text>();

        if (Input.GetButtonDown("Jump"))
        {
            Player1MeterNumber += 0.1f;
            Player1Meter.GetComponent <Scrollbar>().size = Player1MeterNumber;
        }

        else if (Input.GetButtonDown("Fire1"))
        {
            Debug.Log("Player 1");
            PlayerWins.text  = "Player 1 Wins";
            PlayerWins.color = Color.red;
        }

        else if (Input.GetButtonDown("Fire2"))
        {
            Debug.Log("Player 2");
            PlayerWins.text  = "Player 2 Wins";
            PlayerWins.color = Color.blue;
        }
    }
예제 #9
0
 public void Start()
 {
     _scrollbar1       = transform.Find("Scrollbar Vertical").GetComponent <Scrollbar>();
     _scrollbar2       = transform.Find("ScrollbarTwo").GetComponent <Scrollbar>();
     _Image            = _scrollbar2.GetComponent <Image>();
     _scrollbar2.value = _scrollbar1.value;
 }
예제 #10
0
        public void SetScrollbar(Sprite background, Sprite handleNormal, Sprite handleHighlight, Sprite handleActive, Sprite handleInactive)
        {
            //The scrollbar handle is the selectable component
            SetSelectable(handleNormal, handleHighlight, handleActive, handleInactive);

            if (background == null)
            {
                return;
            }

            Scrollbar scrollbar = GetComponent <Scrollbar>();

            if (scrollbar == null)
            {
                return;
            }

            Image back = scrollbar.GetComponent <Image>();

            if (back == null)
            {
                return;
            }

            back.sprite = background;
            back.type   = Image.Type.Sliced;
        }
예제 #11
0
    public void set_start_position()
    {
        int max_quest_length   = quest.Length;
        int clear_quest_length = 0;

        for (int i = 0; i < quest.Length - 1; i++)
        {
            if (UiManager.GetBool("QuestPurchased" + i) == true)
            {
                clear_quest_length++;
            }
        }
        questProgress = (float)clear_quest_length / max_quest_length;
        scrollbarr.GetComponent <Scrollbar>().value = 0;
        scrollbarr.GetComponent <Scrollbar>().value = questProgress;
    }
    void Update()
    {
        if (rb.velocity.magnitude <= 1)
        {
            rb.velocity        = Vector3.zero;
            rb.angularVelocity = Vector3.zero;
            if (isStill)
            {
                transform.rotation = (new Quaternion(0, 0, 0, 0));
                isStill            = false;
            }
            if (Input.GetMouseButtonDown(0))
            {
                strength = 0;
            }
            if (Input.GetMouseButton(0))
            {
                ballStrength();
            }
            if (Input.GetMouseButtonUp(0))
            {
                shotBall();
                aimLine.SetActive(false);
            }
            else
            {
                aimLine.SetActive(true);
            }
        }

        strengthBar.GetComponent <Scrollbar>().size = strength / 60;
    }
예제 #13
0
        void Start()
        {
            //if (maxNeighborsToSnapToRegardlessOfSpeed < 0)
            //	maxNeighborsToSnapToRegardlessOfSpeed = 0;
            if (minSpeedToAllowSnapToNext < 0)
            {
                minSpeedToAllowSnapToNext = float.MaxValue;
            }
            _SnapToNextOnlyEnabled = minSpeedToAllowSnapToNext != float.MaxValue;

            if (scrollbar)
            {
                _ScrollbarFixer = scrollbar.GetComponent <ScrollbarFixer8>();
                if (!_ScrollbarFixer)
                {
                    throw new UnityException("ScrollbarFixer8 should be attached to Scrollbar");
                }
            }

            if (scrollbar)
            {
                scrollbar.onValueChanged.AddListener(OnScrollbarValueChanged);
            }
            _StartCalled = true;
        }
예제 #14
0
    public void TakeDamage(float damage)
    {
        if (hpCurrent == 100 && damage < 0)
        {
            return;
        }

        hpCurrent -= damage;
        SetPanelFade();

        if (hpCurrent >= 0)
        {
            if (!animatorManager.animator.GetBool("isInteracting"))
            {
                animatorManager.PlayTargetAnimation("Idle Hurt", false);
            }
        }
        else
        {
            hpBar.enabled = false;
            hpBar.GetComponent <CanvasGroup>().alpha = 0;
            animatorManager.PlayTargetAnimation("Death", true);

            StartCoroutine(DeathTimer());

            //hpPanel.color = Color.black;
            //hpPanel.CrossFadeAlpha(100, 0.01f, false);
        }
    }
예제 #15
0
    void Awake()
    {
        timeCounter = GameObject.FindGameObjectWithTag("TimeCounter").GetComponent <Text>();
        restart     = GameObject.FindGameObjectWithTag("Respawn").GetComponent <Button>();
        pause       = GameObject.FindGameObjectWithTag("Pause").GetComponent <Button>();
        play        = GameObject.FindGameObjectWithTag("Play").GetComponent <Button>();
        timeBar     = GameObject.FindGameObjectWithTag("ScrollBar").GetComponent <Scrollbar>();

        play.gameObject.SetActive(false);
        timeBar.gameObject.SetActive(false);

        restart.onClick.AddListener(OnRestart);
        pause.onClick.AddListener(OnPause);
        play.onClick.AddListener(OnPlay);

        // does OnTimeBarChangeValue EVERY FRAME :)
        // disable for lags
        // timeBar.onValueChanged.AddListener(OnTimeBarChangeValue);

        // Must have event trigger component on the scrollbar
        EventTrigger trigger = timeBar.GetComponent <EventTrigger>();

        EventTrigger.Entry entry = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerUp;
        entry.callback.AddListener((data) => { OnTimeBarChangeValue(timeBar.value); });
        trigger.triggers.Add(entry);
    }
    // Update is called once per frame
    new void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            clickPosition = Input.mousePosition;
        }

        if (Input.GetMouseButton(0))
        {
            Vector2 currentPos = Input.mousePosition;

            deltaY = currentPos.y - clickPosition.y;

            dialogueController.setScroll(lastScroll + deltaY);
        }

        if (Input.GetMouseButtonUp(0))
        {
            lastScroll += deltaY;
            if (lastScroll > dialogueController.getMaxScroll())
            {
                lastScroll = dialogueController.getMaxScroll();
            }
            if (lastScroll < dialogueController.getMinScroll())
            {
                lastScroll = dialogueController.getMinScroll();
            }
        }

        if (status == AlphabetState.exitting)
        {
            if (!isWaitingForActionToComplete)
            {
                if (mcRef == null)
                {
                    return;
                }

                DataStorage ds          = mcRef.getStorage();
                string      returnLevel = ds.retrieveStringValue("ReturnLocation");
                if (!returnLevel.Equals(""))
                {
                    SceneManager.LoadScene(returnLevel);
                }
            }
        }

        if (scrollbar.gameObject.activeSelf)
        {
            float   viewportHeight = container.GetComponent <RectTransform> ().rect.height - 106;
            float   maxHeight      = conversationList.Count * 100;
            float   scrollvalue    = scrollbar.GetComponent <Scrollbar> ().value;
            float   yPos           = scrollvalue * (maxHeight - viewportHeight);
            Vector3 pos            = container.transform.position;
            pos.y = Screen.height / 2 + yPos;
            container.transform.position = pos;
        }
    }
예제 #17
0
        private void Awake()
        {
            m_scrollbar = GetComponentInParent <Scrollbar>();


            m_scrollbarRect = m_scrollbar.GetComponent <RectTransform>();
            m_other         = m_scrollbar.GetComponentsInChildren <ScrollbarResizer>(true).Where(r => r != this).First();
            m_scrollView    = GetComponentInParent <ScrollRect>();
        }
예제 #18
0
    // Изменение состояния progress bar
    public void LoadProgress(float progress)
    {
        Scrollbar progressBar = FindObjectOfType <Scrollbar>();

        if (progressBar != null)
        {
            progressBar.GetComponent <Scrollbar>().size = progress;
        }
    }
예제 #19
0
        //初始化布局
        private void InitView()
        {
            RectTransform fullRect = ScrollRect.transform as RectTransform;
            RectTransform viewRect = ViewPort.transform as RectTransform;

            if (Type == ListType.Vertical)
            {
                //初始化滑动界面
                ScrollRect.horizontal = false;
                ScrollRect.vertical   = true;
                scrollbar             = ScrollRect.verticalScrollbar;

                //初始化显示窗口
                if (fullRect != null && viewRect != null)
                {
                    viewRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, fullRect.rect.height);
                    scrollbar.GetComponent <RectTransform>()
                    .SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, fullRect.rect.height);
                }
            }
            else
            {
                //初始化滑动界面
                ScrollRect.vertical   = false;
                ScrollRect.horizontal = true;
                scrollbar             = ScrollRect.horizontalScrollbar;

                //初始化显示窗口
                if (fullRect != null && viewRect != null)
                {
                    viewRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, fullRect.rect.width);
                    scrollbar.GetComponent <RectTransform>()
                    .SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, fullRect.rect.width);
                }
            }

            if (!ShowScrollBar)
            {
                var canvasGroup = scrollbar.GetComponent <CanvasGroup>();
                canvasGroup.alpha          = 0;
                canvasGroup.interactable   = false;
                canvasGroup.blocksRaycasts = false;
            }
        }
예제 #20
0
    void SetBarData()
    {
        scrollbar.GetComponent <Scrollbar>().interactable = false;
        float iValue = myIndex.Value;

        nameText.text  = myIndex.Name;
        idText.text    = myIndex.ID.ToString();
        valueText.text = iValue.ToString();
        scrollbar.GetComponent <Scrollbar>().size = iValue;
        ColorBlock cb = scrollbar.GetComponent <Scrollbar>().colors;

        switch (myIndex.GetIndexState())
        {
        case Index.STATE.MIN:
            cb.disabledColor = minColor;
            break;

        case Index.STATE.VERY_LOW:
            cb.disabledColor = veryLowColor;
            break;

        case Index.STATE.LOW:
            cb.disabledColor = lowColor;
            break;

        case Index.STATE.MEDIUM:
            cb.disabledColor = mediumColor;
            break;

        case Index.STATE.HIGH:
            cb.disabledColor = highColor;
            break;

        case Index.STATE.VERY_HIGH:
            cb.disabledColor = veryHighColor;
            break;

        default:
        case Index.STATE.MAX:
            cb.disabledColor = maxColor;
            break;
        }
        scrollbar.GetComponent <Scrollbar>().colors = cb;
    }
예제 #21
0
 void MudaValor(float valor)
 {
     if (ScriptTools.bmove == true)
     {
         if (ScriptTools.scrXYZ == "x")
         {
             x.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value - 0.5f) * 500f).ToString();
         }
         else if (ScriptTools.scrXYZ == "y")
         {
             y.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value - 0.5f) * 500f).ToString();
         }
         else
         {
             z.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value - 0.5f) * 500f).ToString();
         }
     }
     else if (ScriptTools.broda == true)
     {
         if (ScriptTools.scrXYZ == "x")
         {
             x.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value - 0.5f) * 180f + 360).ToString();
         }
         else if (ScriptTools.scrXYZ == "y")
         {
             y.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value) * 360f).ToString();
         }
         else
         {
             z.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value) * 360f).ToString();
         }
     }
     else if (ScriptTools.besca == true)
     {
         if (ScriptTools.scrXYZ == "x")
         {
             x.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value) * 500f).ToString();
         }
         else if (ScriptTools.scrXYZ == "y")
         {
             y.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value) * 500f).ToString();
         }
         else
         {
             z.GetComponent <InputField>().text = ((scr.GetComponent <Scrollbar>().value) * 500f).ToString();
         }
     }
 }
예제 #22
0
 public static void DeleteEventChange(this Scrollbar target)
 {
     if (target != null)
     {
         XUScrollbarListener listener = target.GetComponent <XUScrollbarListener>();
         if (listener != null)
         {
             listener.RemoveEventChange();
         }
     }
 }
예제 #23
0
    void Update()
    {
        PrintMessages();
        if ((Input.GetKeyDown(KeyCode.DownArrow) || Input.GetAxis("Mouse ScrollWheel") < 0) && Manager.CurrentType == Type.T_DecisionBox)
        {
            DecisionDelta += 1;
            DecisionDelta  = Mathf.Min(DecisionDelta, Manager.DecisionList.Count - 3);
            DecisionDelta  = Mathf.Max(DecisionDelta, 0);
        }
        if ((Input.GetKeyDown(KeyCode.UpArrow) || Input.GetAxis("Mouse ScrollWheel") > 0) && Manager.CurrentType == Type.T_DecisionBox)
        {
            DecisionDelta -= 1;
            DecisionDelta  = Mathf.Max(DecisionDelta, 0);
        }

        float Ratio = 1.0f / Mathf.Max(Manager.DecisionList.Count - 2.0f, 1.0f);

        scrlbar.GetComponent <Scrollbar>().size  = Ratio;
        scrlbar.GetComponent <Scrollbar>().value = ((float)DecisionDelta / (Manager.DecisionList.Count - 3));
    }
예제 #24
0
    void Update()
    {
        if (scoreText != "")
        {
            scoreObject.text = scoreText;
        }

        if (hp > 0)
        {
            if (enemyHpObject.GetComponent <CanvasGroup>().alpha < 1)
            {
                enemyHpObject.GetComponent <CanvasGroup>().alpha = 1f;
            }

            enemyHpObject.size = hp;
        }
        else
        {
            enemyHpObject.GetComponent <CanvasGroup>().alpha = 0;
        }
    }
예제 #25
0
            protected override void SetScrollBar()
            {
                Scrollbar scrollbar = m_ExtendScroll.m_ScrollRect.horizontalScrollbar;

                if (scrollbar != null)
                {
                    m_ScrollBar = scrollbar.GetComponent <ExtendUGUIScrollBar>();
                    if (m_ScrollBar == null)
                    {
                        m_ScrollBar = scrollbar.gameObject.AddComponent <ExtendUGUIScrollBar>();
                    }
                }
            }
예제 #26
0
        /// <summary>
        /// Apply style for the specified scrollbar.
        /// </summary>
        /// <param name="component">Scrollbar.</param>
        public virtual void ApplyTo(Scrollbar component)
        {
            if (component == null)
            {
                return;
            }

            var style_support = component.GetComponent <StyleSupportScrollbar>();

            if (style_support != null)
            {
                style_support.SetStyle(this);
            }
            else
            {
                MainBackground.ApplyTo(component.GetComponent <Image>());

                Background.ApplyTo(component.transform.Find("Background"));

                Handle.ApplyTo(component.targetGraphic as Image);
            }
        }
예제 #27
0
    // Start is called before the first frame update
    void Start()
    {
        _scoreText.text = "Score: " + 0;
        _gameOverText.gameObject.SetActive(false);
        _pressRkeyText.gameObject.SetActive(false);
        _gameManager   = GameObject.Find("Game_Manager").GetComponent <GameManager>();
        _thrusterValue = _thrusters.GetComponent <Scrollbar>();

        if (_gameManager == null)
        {
            Debug.LogError("GameManager is NULL");
        }
    }
예제 #28
0
 void Update()
 {
     time += Time.deltaTime;
     if (time < timer)
     {
         scrollbar.GetComponent <Scrollbar>().size = (float)time / 3;
     }
     else if (isfrist)
     {
         isfrist = false;
         loadApp();
         return;
     }
 }
예제 #29
0
 public override void Init(BaseScrollRect scrollRect)
 {
     base.Init(scrollRect);
     m_ScrollRect = scrollRect.GetComponent <ScrollRect>();
     m_ScrollBar  = m_ScrollRect.horizontalScrollbar;
     if (m_ScrollBar != null)
     {
         IconState m_IconState = m_ScrollBar.GetComponent <IconState>();
         if (m_IconState == null)
         {
             m_IconState = m_ScrollBar.gameObject.AddComponent <IconState>();
         }
     }
 }
예제 #30
0
 private void Apply(Scrollbar item)
 {
     if (item == null)
     {
         return;
     }
     if (this._handleImageSettings != null)
     {
         this._handleImageSettings.CopyTo(item.targetGraphic as Image);
     }
     if (this._backgroundImageSettings != null)
     {
         this._backgroundImageSettings.CopyTo(item.GetComponent <Image>());
     }
 }
예제 #31
0
 private void Apply(Scrollbar item) {
     if(item == null) return;
     
     if(_handleImageSettings != null) _handleImageSettings.CopyTo(item.targetGraphic as Image);
     if(_backgroundImageSettings != null) _backgroundImageSettings.CopyTo(item.GetComponent<Image>());
 }