예제 #1
0
    /*
     *
     * private void Awake() {
     * //Convert offset to screen space
     *  tooltipOffset = new Vector2(ScreenSpace.Convert(tooltipOffset.x), ScreenSpace.Convert(tooltipOffset.y));
     * }
     * //*/

    private void Update()
    {
        if (!xImageSine.durationElapsed)
        {
            xImageSine.Increment();
            if (xImageSine.durationElapsed)
            {
                xImage.rectTransform.localScale = Vector2.one;
            }
            else
            {
                float _val = 1f + xImageSine.GetSineDuration();
                xImage.rectTransform.localScale = new Vector2(_val, _val);
            }
        }
    }
예제 #2
0
 private void Update()
 {
     //Handle click events
     if (isExpanded && !mouseIsOver && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)))
     {
         Toggle(-1);
     }
     //Effect handling
     if (!mySine.durationElapsed)
     {
         if (isExpanded)
         {
             mySine.Increment();
         }
         else
         {
             mySine.Decrement();
         }
         if (mySine.durationElapsed)
         {
             //arrowRect.rotation = Quaternion.Euler(new Vector3(0f, 0f, isExpanded ? 90f : 270f));
             background.SetActive(isExpanded);
             //scrollBar.SetActive(isExpanded); //Unhide the Bar graphic
             backgroundRect.sizeDelta = isExpanded ? sizeExpanded : sizeRetracted;
             if (doChangePosition)
             {
                 myRect.anchoredPosition = isExpanded ? new Vector2(originPosition.x, originPosition.y - deltaHeight) : originPosition;
             }
         }
         else
         {
             if (doChangePosition)
             {
                 myRect.anchoredPosition = new Vector2(originPosition.x, originPosition.y - deltaHeight * mySine.GetSine()); //Handle sizing
             }
             backgroundRect.sizeDelta = new Vector2(sizeExpanded.x, sizeRetracted.y + (sizeExpanded.y - sizeRetracted.y) * mySine.GetSine());
         }
     }
 }