none
About the TweenPositiond. RRS feed

  • Question

  • I wonder what's wrong with it?

    private void PlayPoem(bool isPlay, params object[] args)
    {
    RefreshPoemList();
    if (args.Length > 0)
    {
    poemGo = args[0] as GameObject;
    }
    var index = curPoemList.IndexOf(poemGo);
    indexPoem = curPoemList.IndexOf(poemGo);
    for (int i = 0; i < curPoemList.Count; i++)
    {
    var tween = curPoemList[i].transform.GetComponent<TweenPosition>();
    var localPosition = curPoemList[i].transform.localPosition;
    curPoemList[i].transform.GetComponent<TweenPosition>().from = localPosition;
    if (isPlay)
    {
    if (i >= index)
    {
    curPoemList[i].transform.GetComponent<TweenPosition>().to = new Vector3((curPoemList[11].transform.localPosition.x + 10), -276, 0);
    tween.duration = (curPoemList.Count - index) * 0.1f;
    tween.delay = (i - index) * 0.1f;
    }
    if (i < index)
    {
    var a = curPoemList[0].transform.localPosition.x;
    var b = curPoemList[0].transform.localPosition.y;
    curPoemList[i].transform.GetComponent<TweenPosition>().to = new Vector3((curPoemList[0].transform.localPosition.x - 85), -276, 0);
    tween.delay = (index - 1 - i) * 0.1f;
    tween.duration = (i + 1) * 0.1f;
    }
    tween.PlayForward();
    }
    else
    tween.PlayReverse();
    }

    }

    private void RefreshPoemList()
    {
    if (curPoemList.Count > 0)
    curPoemList.Clear();
    for (int i = 0; i < poemTween.childCount; i++)
    {
    var item = poemTween.GetChild(i).gameObject;
    item.AddComponent<TweenPosition>();
    item.transform.GetComponent<TweenPosition>().enabled = false;
    curPoemList.Add(item);
    curPoemList.Sort((x1, x2) =>
    {
    if (x1.transform.localPosition.x > x2.transform.localPosition.x)
    return 1;
    else
    return -1;
    });
    }
    }

    • Moved by CoolDadTx Friday, July 5, 2019 1:55 PM Third party product
    Thursday, July 4, 2019 3:14 AM

All replies

  • Hi 牙耳,

    Thank you for posting here.

    Based on my search, the TweenPositiond is related to unity. MSDN doesn't support third-party product. Therefore, I suggest that you could post in the following forum.

    https://forum.unity.com/

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Note:This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 4, 2019 6:48 AM
  • Thanks!
    Thursday, July 4, 2019 12:51 PM