예제 #1
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenPanelWidth Begin(UIPanel panel, float duration, float width)
    {
        TweenPanelWidth comp = UITweener.Begin <TweenPanelWidth>(panel.gameObject, duration);

        comp.from = (int)panel.width;
        comp.to   = (int)width;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
예제 #2
0
 void OnDragEnd()
 {
     if (isTween())
     {
         return;
     }
     if (Mathf.Abs(dragTotal.x) > Mathf.Abs(dragTotal.y))
     {
         //橫向
         if (manager.state == NoteTrackModuleManager.panelState.folded && dragTotal.x > 0)
         {
             //向右展開
             currentSizeTweener     = TweenPanelWidth.Begin(m_Panel, ConfigUtility.reactionSensitive, regularWidget.width);
             currentPositionTweener = TweenPosition.Begin(m_Panel.gameObject, ConfigUtility.reactionSensitive, regularWidget.cachedTransform.position, true);
             currentSizeTweener.AddOnFinished(GoState_Regular);
         }
         else if (manager.state == NoteTrackModuleManager.panelState.regular && dragTotal.x < 0)
         {
             //向左縮起
             currentSizeTweener     = TweenPanelWidth.Begin(m_Panel, ConfigUtility.reactionSensitive, foldedWidget.width);
             currentPositionTweener = TweenPosition.Begin(m_Panel.gameObject, ConfigUtility.reactionSensitive, foldedWidget.cachedTransform.position, true);
             currentSizeTweener.AddOnFinished(GoState_Folded);
         }
     }
     else
     {
         //直向
         if (manager.state == NoteTrackModuleManager.panelState.regular && dragTotal.y > 0)
         {
             //向上展開
             currentSizeTweener     = TweenPanelHeight.Begin(m_Panel, ConfigUtility.reactionSensitive, unfoldedWidget.height);
             currentPositionTweener = TweenPosition.Begin(m_Panel.gameObject, ConfigUtility.reactionSensitive, unfoldedWidget.cachedTransform.position, true);
             currentSizeTweener.AddOnFinished(GoState_Unfolded);
         }
         else if (manager.state == NoteTrackModuleManager.panelState.unfolded && dragTotal.y < 0)
         {
             //向下縮起
             currentSizeTweener     = TweenPanelHeight.Begin(m_Panel, ConfigUtility.reactionSensitive, regularWidget.height);
             currentPositionTweener = TweenPosition.Begin(m_Panel.gameObject, ConfigUtility.reactionSensitive, regularWidget.cachedTransform.position, true);
             currentSizeTweener.AddOnFinished(GoState_Regular);
         }
     }
 }