// public static void ShowMessage(string msg, float duration = 1.5f) // { // // Text msgTxt = _instance.transform.Find("Text").GetComponent<Text>(); // Image img = _instance.transform.GetComponent<Image>(); // //canvas = instance.transform.Find("Canvas").GetComponent<CanvasGroup>(); // Image star1 = _instance.transform.Find("Text/StarImage").GetComponent<Image>(); // Image star2=_instance.transform.Find("Text/StarImage2").GetComponent<Image>(); // // msgTxt.color = new Color(msgTxt.color.r, msgTxt.color.g, msgTxt.color.b, 1); // img.color = new Color(img.color.r, img.color.g, img.color.b, 1); // star1.color = new Color(star1.color.r, star1.color.g, star1.color.b, 1); // star2.color=new Color(star2.color.r,star2.color.g,star2.color.b,1); // msgTxt.text = msg; // // _instance.transform.DOKill(); // _instance.gameObject.SetActive(true); // // _instance.transform.localPosition = new Vector3(_instance.transform.localPosition.x, 50); // // Tweener move1 = _instance.transform.DOLocalMoveY(100, 0.3f).SetEase(DG.Tweening.Ease.OutSine); // Tweener move2 = _instance.transform.DOLocalMoveY(200, 0.3f).SetEase(DG.Tweening.Ease.OutSine); // // Tweener alpha1 = img.DOColor(new Color(img.color.r, img.color.g, img.color.b, 0), 0.3f); // Tweener alpha2 = msgTxt.DOColor(new Color(msgTxt.color.r, msgTxt.color.g, msgTxt.color.b, 0), 0.3f); // Tweener alpha3 = star1.DOFade(0f, 0.3f); // Tweener alpha4 = star2.DOFade(0f, 0.3f); // // DOTween.Sequence() // .Append(move1) // .AppendInterval(duration) // .Append(move2) // .Join(alpha1) // .Join(alpha2) // .Join(alpha3) // .Join(alpha4); // } public static void ShowMessage(string msg, float duration = 0.5f) { if (_instance._messageQueue.Contains(msg)) { return; } _instance._messageQueue.Enqueue(msg); //入队 if (!_instance._isPlaying) { _instance.ShowTextAni(duration); } }