public void SystemTips(string msg, PanelSystemTips.MessageType msgType) { if (_systemTipsList == null) { _systemTipsList = new List <SystemTipsParam>(); } PanelSystemTips systemTips = null; { // pool里空了,创建一个新的 var go = Resources.Load("UI/Common/PanelSystemTips"); if (go != null) { var go2 = Instantiate(go, transform) as GameObject; if (go2 != null) { systemTips = go2.GetComponent <PanelSystemTips>(); } } else { Debug.LogError("UI/PanelSystemTips not found!"); } } if (systemTips != null) { if (_systemTipsPlaying) { // 当前动画正在播放,新增的动画就保存起来 SystemTipsParam stp = new SystemTipsParam() { _type = msgType, _msg = msg, _tips = systemTips, }; // 添加到播放链表 _systemTipsList.Add(stp); systemTips.gameObject.SetActive(false); } else { // 否则直接播放 systemTips.Show(msg, msgType, OnSystemTipsComplete); _systemTipsPlaying = true; } } }
public void Play(ActorVisualizer av, string msg, PanelSystemTips.MessageType msgType) { _actor = av; _blood.text = msg; string strColorBeginFormat = "<color={0}>{1}{2}"; string strColorEnd = "</color>"; string msgWithColor = msg; switch (msgType) { case PanelSystemTips.MessageType.Success: msgWithColor = string.Format(strColorBeginFormat, "#7FFF00FF", msg, strColorEnd); break; case PanelSystemTips.MessageType.Error: msgWithColor = string.Format(strColorBeginFormat, "red", msg, strColorEnd); break; case PanelSystemTips.MessageType.Warning: msgWithColor = string.Format(strColorBeginFormat, "yellow", msg, strColorEnd); break; } _blood.text = msgWithColor; _startTime = 0; _pos = _actor.CurrentPosition; _pos.y += 16; _posScreen = HexGameUI.CurrentCamera.WorldToScreenPoint(_pos); transform.position = _posScreen; _posSaved = transform.position; _posEnd = _posSaved + new Vector3(0, _FLY_HEIGHT, 0); _posY = 0; _posEndY = _FLY_HEIGHT; }
public void SystemTips(string msg, PanelSystemTips.MessageType msgType) { if (_systemTips == null) { var go = Resources.Load("UI/Common/PanelSystemTips"); if (go != null) { var go2 = Instantiate(go, transform) as GameObject; if (go2 != null) { _systemTips = go2.GetComponent <PanelSystemTips>(); } } else { Debug.LogError("UI/PanelSystemTips not found!"); } } if (_systemTips != null) { _systemTips.Show(msg, msgType); } }