public void ShowCenterMoveUpTips(string content, List <UITipsView> list, float delay, float duration, Color color) { mTipPos = TipPosType.Center; //避免由于上次使用时有重叠偏移动画,所以要重置位置 ChildTP.enabled = false; ChildGoTrans.localPosition = new Vector3(-1f, -190f, 0f); //由于有延迟所以必须先手动重置 CacheTrans.localPosition = new Vector3(0, 290, 0); Panel.alpha = 1f; if (!Spirte.gameObject.activeSelf) { Spirte.gameObject.SetActive(true); } Spirte.width = 230; TipsLb.text = content; TipsLb.color = color; Utility.PlayTweenScale(ChildTS, new Vector3(0.5f, 0.5f, 0.5f), Vector3.one, 0.1f); Utility.PlayTweenPosition(TP, CacheTrans.localPosition, new Vector3(0, 330, 0), duration, delay); Utility.PlayTweenAlpha(TA, 1f, 0f, duration, delay); if (list.Count > 0) { Transform trans = null; UITipsView tipsView = null; int index; Vector3 offset; for (int i = 0; i < list.Count; i++) { tipsView = list[i]; trans = list[i].transform; index = list.Count - i; offset = Vector3.up * index * 30; if ((tipsView.CacheTrans.localPosition - CacheTrans.localPosition).y + (tipsView.ChildGoTrans.localPosition - ChildGoTrans.localPosition).y < offset.y) { Utility.PlayTweenPosition(tipsView.ChildTP, tipsView.ChildGoTrans.localPosition, ChildGoTrans.localPosition + offset, 0.2f); } } } if (list.Contains(this)) { list.Remove(this); } list.Add(this); TA.SetOnFinished(() => { TP.enabled = false; TP.delay = 0f; TA.delay = 0f; if (list != null) { list.Remove(this); } UIPool.Instance.PushUITipPanel(this); }); setViewLayer(); }
/// <summary>显示在中间的提示框 </summary> public void ShowCenterTips(string content, float timer, Color color) { mTipPos = TipPosType.Center; CacheTrans.localPosition = new Vector3(0, 200, 0); ChildGoTrans.localPosition = new Vector3(-1, -205, 0); ChildGoTrans.localScale = Vector3.one; if (!Spirte.gameObject.activeSelf) { Spirte.gameObject.SetActive(true); } TipsLb.text = content; TipsLb.color = color; TA.duration = timer; Timer.Instance.SetSchedule(timer, (s) => { TweenAlpha.Begin(gameObject, 1, 0); TA.SetOnFinished(() => { TP.enabled = false; UIPool.Instance.PushUITipPanel(this); // DestroyImmediate(gameObject); }); //if (TA != null) // TA.PlayForward(); }); setViewLayer(); }
public void ShowHonorTip(int _honor) { mTipPos = TipPosType.Honor; TipsHonor.SetActive(true); TipsHonor.GetComponentInChildren <UILabel>().text = _honor.ToString(); TweenPosition _tp = TipsHonor.GetComponent <TweenPosition>(); if (_tp != null) { _tp.ResetToBeginning(); _tp.PlayForward(); _tp.SetOnFinished(() => { this.gameObject.SetActive(false); Destroy(gameObject); }); } setViewLayer(); }
/// <summary>显示在中间向上飘的提示框 </summary> public void ShowCenterMoveUpTips(string content, float timer, Color color) { mTipPos = TipPosType.Center; Utility.TipsList.Add(this); ChildGoTrans.localPosition = new Vector3(0, 80, 0); if (!Spirte.gameObject.activeSelf) { Spirte.gameObject.SetActive(true); } TipsLb.text = content; TipsLb.color = color; Spirte.width = 230; TweenAlpha ta = this.GetComponent <TweenAlpha>(); ta.duration = 1f; ChildGoTrans.localScale = new Vector3(0.5f, 0.5f, 0.5f); Vector3 childPos = ChildGoTrans.localPosition; TweenScale.Begin(ChildGo, 0.1f, new Vector3(1, 1, 1)); TweenPosition.Begin(ChildGo, 0.1f, new Vector3(0, childPos.y + 20f, 0f)); Timer.Instance.SetSchedule(1f, (s) => { TweenPosition.Begin(ChildGo, 1f, new Vector3(0, 120, 0)); TweenAlpha.Begin(gameObject, 1, 0); TA.SetOnFinished(() => { ChildTP.enabled = false; ChildTS.enabled = false; TP.enabled = false; Utility.TipsList.Remove(this); UIPool.Instance.PushUITipPanel(this); }); }); setViewLayer(); }
//显示tips public void ShowTips(string content, float timer, Color color, bool flag = false) { if (!flag) { mTipPos = TipPosType.Down; CacheTrans.localPosition = Vector3.zero; if (!Spirte.gameObject.activeSelf) { Spirte.gameObject.SetActive(true); } Spirte.width = 540; } else { mTipPos = TipPosType.LeftDown; if (Spirte.gameObject.activeSelf) { Spirte.gameObject.SetActive(false); } CacheTrans.localPosition = new Vector3(-560, -85, 0); } ChildGoTrans.localPosition = new Vector3(-1, -205, 0); ChildGoTrans.localScale = Vector3.one; CacheTrans.localScale = Vector3.one; int count = !flag ? Utility.TipsList.Count : Utility.GameTipsList.Count; int moveIndex = 0; for (int i = 0; i < count; i++) { int index = i + 1; UITipsView view = !flag ? Utility.TipsList[count - index] : Utility.GameTipsList[count - index]; if (view.TipPos == TipPosType.LeftDown || view.TipPos == TipPosType.Down) { moveIndex++; view.MoveUp(moveIndex, flag); } } if (!flag) { Utility.TipsList.Add(this); TipsLb.text = content; TipsLb.color = color; } else { Utility.GameTipsList.Add(this); TipsGame.text = content; TipsGame.color = color; } mSchedule = Timer.Instance.SetSchedule(timer, (s) => { TA.SetOnFinished(() => { TP.enabled = false; UIPool.Instance.PushUITipPanel(this); if (!flag) { Utility.TipsList.Remove(this); } else { Utility.GameTipsList.Remove(this); } }); TweenAlpha.Begin(gameObject, 1, 0); }); setViewLayer(); }