Ejemplo n.º 1
0
    /// <summary>
    /// 文字浮动提示
    /// </summary>
    /// <param name="message">提示内容</param>
    /// <param name="duration">持续时间</param>
    /// <param name="from">起始位置</param>
    /// <param name="to">目标位置</param>
    public static void ShowFloatTipPanel(string message, float duration = 0.8f, Vector2 from = default(Vector2), Vector2 to = default(Vector2), ETipPanelStyle imgStyle = ETipPanelStyle.NONE, Action hidePanelCallback = null)
    {
        if (string.IsNullOrEmpty(message))
        {
            return;
        }

        var panelName = typeof(PanelFloatTip).Name;

        if (!m_panelDic.ContainsKey(panelName))
        {
            m_panelDic.Add(panelName, new PanelFloatTip());
            m_panelLoopList.Add(m_panelDic[panelName]);
        }

        if (m_floatTipPanel != null)
        {
            m_floatTipPanel.HidePanel();
        }

        var param = new FloatTipPanelParams();

        param.message           = message;
        param.duration          = duration;
        param.from              = from;
        param.to                = to;
        param.style             = imgStyle;
        param.hidePanelCallback = hidePanelCallback;

        m_floatTipPanel = m_panelDic[panelName];
        m_floatTipPanel.SetParams(new object[] { param });
        m_floatTipPanel.ShowPanel(CanvasOverlay);
        m_floatTipPanel.LayerType = LayerType.Tip;
    }
Ejemplo n.º 2
0
    public override void OnHide()
    {
        if (m_data.hidePanelCallback != null)
        {
            m_data.hidePanelCallback();
        }

        m_params = null;
        m_data   = null;

        SetIconUnActive();
    }
Ejemplo n.º 3
0
    public override void OnHide()
    {
        if (m_data.hidePanelCallback != null)
        {
            m_data.hidePanelCallback();
        }

        m_params = null;
        m_data = null;

        SetIconUnActive();
    }
Ejemplo n.º 4
0
    public override void OnShow()
    {
        if (m_params == null || m_params.Length == 0 || !(m_params[0] is FloatTipPanelParams))
        {
            m_content.text = "";
            m_content2.text = "";
            HidePanel();
            return;
        }

        curIcon = warnImg;
        SetIconUnActive();
        m_data = m_params[0] as FloatTipPanelParams;
        if (m_data.style == ETipPanelStyle.NONE)
        {
            m_content.gameObject.SetActive(false);
            m_content2.gameObject.SetActive(true);
            m_content2.fontSize = 48;
            m_content2.text = m_data.message;
        }
        #region
        else
        {

            m_content.gameObject.SetActive(true);
            m_content2.gameObject.SetActive(false);
            m_content.fontSize = 48;
            m_content.text = m_data.message;

            if (m_data.style == ETipPanelStyle.STARBABY && nebula != null)
            {
                nebula.SetActive(true);
                curIcon = nebula;
            }
            else
            {
                if (m_data.style == ETipPanelStyle.WARN && warnImg != null)
                {
                    warnImg.SetActive(true);
                }
                else if (m_data.style == ETipPanelStyle.ERROR && errorImg != null)
                {
                    errorImg.SetActive(true);
                    curIcon = errorImg;
                }
                else if (m_data.style == ETipPanelStyle.SUCCESS && okImg != null)
                {
                    okImg.SetActive(true);
                    curIcon = okImg;
                }

                else if (warnImg != null)
                {
                    warnImg.SetActive(true);
                }

                SetContentPos(m_content.text);
            }
        }
        #endregion

        float duration = m_data.duration;
        Vector2 from = m_data.from;
        Vector2 to = m_data.to;
        //         if (from == default(Vector2)) from = Vector2.zero;
        //         if (to == default(Vector2)) to = new Vector2(0, 200);
        //         TweenPosition tweenPos = TweenPosition.Begin(m_goBg, duration, from, to);
        //         tweenPos.anchoredPosition = true;
        //         tweenPos.Play(true);

            //zhushi
        //         PlayActionManager.Instance.PlayAction(m_go);
        //         if (timer != 0)
        //         {
        //             GameLoader.Utils.Timer.TimerHeap.DelTimer(timer);
        //             timer = 0;
        //         }
        //
        //         timer = GameLoader.Utils.Timer.TimerHeap.AddTimer((uint)(duration*1000f), 0, () =>
        //         {
        //             PlayActionManager.Instance.CloseAction(m_go,() =>
        //             {
        //                 HidePanel();
        //             });
        //         });
    }
Ejemplo n.º 5
0
    public override void OnShow()
    {
        if (m_params == null || m_params.Length == 0 || !(m_params[0] is FloatTipPanelParams))
        {
            m_content.text  = "";
            m_content2.text = "";
            HidePanel();
            return;
        }

        curIcon = warnImg;
        SetIconUnActive();
        m_data = m_params[0] as FloatTipPanelParams;
        if (m_data.style == ETipPanelStyle.NONE)
        {
            m_content.gameObject.SetActive(false);
            m_content2.gameObject.SetActive(true);
            m_content2.fontSize = 48;
            m_content2.text     = m_data.message;
        }
        #region
        else
        {
            m_content.gameObject.SetActive(true);
            m_content2.gameObject.SetActive(false);
            m_content.fontSize = 48;
            m_content.text     = m_data.message;

            if (m_data.style == ETipPanelStyle.STARBABY && nebula != null)
            {
                nebula.SetActive(true);
                curIcon = nebula;
            }
            else
            {
                if (m_data.style == ETipPanelStyle.WARN && warnImg != null)
                {
                    warnImg.SetActive(true);
                }
                else if (m_data.style == ETipPanelStyle.ERROR && errorImg != null)
                {
                    errorImg.SetActive(true);
                    curIcon = errorImg;
                }
                else if (m_data.style == ETipPanelStyle.SUCCESS && okImg != null)
                {
                    okImg.SetActive(true);
                    curIcon = okImg;
                }

                else if (warnImg != null)
                {
                    warnImg.SetActive(true);
                }

                SetContentPos(m_content.text);
            }
        }
        #endregion


        float   duration = m_data.duration;
        Vector2 from     = m_data.from;
        Vector2 to       = m_data.to;
//         if (from == default(Vector2)) from = Vector2.zero;
//         if (to == default(Vector2)) to = new Vector2(0, 200);
//         TweenPosition tweenPos = TweenPosition.Begin(m_goBg, duration, from, to);
//         tweenPos.anchoredPosition = true;
//         tweenPos.Play(true);


        //zhushi
//         PlayActionManager.Instance.PlayAction(m_go);
//         if (timer != 0)
//         {
//             GameLoader.Utils.Timer.TimerHeap.DelTimer(timer);
//             timer = 0;
//         }
//
//         timer = GameLoader.Utils.Timer.TimerHeap.AddTimer((uint)(duration*1000f), 0, () =>
//         {
//             PlayActionManager.Instance.CloseAction(m_go,() =>
//             {
//                 HidePanel();
//             });
//         });
    }