コード例 #1
0
 /// <summary>
 /// 移动邮件
 /// </summary>
 /// <param name="tages"></param>
 /// <param name="x"></param>
 /// <param name="isRecover"></param>
 /// <param name="endAction"></param>
 /// <param name="index"></param>
 void MoveMail(List <Transform> tages, float x, bool isRecover, Action endAction, int index)
 {
     if (index < tages.Count - 1)
     {
         StartCoroutine(MailboxTool.MoveUITwo(tages[index], new Vector3(x, tages[index].localPosition.y), () =>
         {
             index = index + 1;
             MoveMail(tages, x, isRecover, endAction, index);
         }, _animationSpeed, 150f));
     }
     else if (index == tages.Count - 1)
     {
         StartCoroutine(MailboxTool.MoveUI(tages[index], new Vector3(x, tages[index].localPosition.y), () =>
         {
             Transform cont = _contentRectTra.Find("Content");
             ContentSizeFitter contentSizeFitter     = cont.GetComponent <ContentSizeFitter>();
             VerticalLayoutGroup verticalLayoutGroup = cont.GetComponent <VerticalLayoutGroup>();
             if (isRecover)
             {
                 cont.localPosition          = new Vector3(0, cont.localPosition.y);
                 contentSizeFitter.enabled   = true;
                 verticalLayoutGroup.enabled = true;
             }
             endAction?.Invoke();
         }, _animationSpeed));
         Debug.Log("最后一封");
     }
 }
コード例 #2
0
    /// <summary>
    /// 移动附件item
    /// </summary>
    /// <param name="items"></param>
    /// <param name="index"></param>
    void GatherMoveItem(List <Transform> items, int index, Action endAction)
    {
        if (index >= items.Count)
        {
            Debug.Log("附件移动完毕");
            endAction?.Invoke();
            return;
        }

        StartCoroutine(MailboxTool.MoveUITwo(items[index], _gatherTraDown.localPosition, () =>
        {
            int indexTwo = index + 1;
            GatherMoveItem(items, indexTwo, endAction);
        }, 4000, 100));
    }