示例#1
0
    public UITipsView PopUITipPanel()
    {
        if (tipsTemplate == null)
        {
            //这里获取主面板
            GameObject panel = CreateUITips();
            tipsTemplate = panel.GetComponent <UITipsView>();
            tipsTemplate.gameObject.SetActive(false);
            //  UILayerMgr.Instance.SetLayer(panel, UILayerType.TopWindow);
            tipsTemplate.InitDepth(panel.GetComponent <UIPanel>().depth);
        }
        UITipsView tip = null;

        if (tipsList.Count > 0)
        {
            tip = tipsList[tipsList.Count - 1];
            tipsList.RemoveAt(tipsList.Count - 1);
        }
        else
        {
            tip = GameObject.Instantiate(tipsTemplate) as UITipsView;
        }
        tip.TipsLb.text   = "";
        tip.TipsGame.text = "";
        tip.TipsHonor.SetActive(false);
        tip.Panel.alpha              = 1;
        tip.CacheTrans.parent        = MainRoot.transform;
        tip.CacheTrans.localPosition = Vector3.zero;
        tip.CacheTrans.localScale    = Vector3.one;

        return(tip);
    }
示例#2
0
    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();
    }
示例#3
0
    /// <summary> 显示中间向上飘提示信息</summary>
    public static void ShowCenterMoveUpInfo(string content, Color color, float timer = 1.5f, int fontsize = 16)
    {
        if (TipsList.Count >= 5)
        {
            return;
        }

        for (int i = 0; i < TipsList.Count; i++)
        {
            UITipsView tip = TipsList[i];
            if (tip != null && tip.TipPos == UITipsView.TipPosType.Center)
            {
                Vector3 localPos = tip.transform.localPosition;
                tip.transform.localPosition = localPos + new Vector3(0, 25, 0);
            }
        }

        UITipsView tips = UIPool.Instance.PopUITipPanel();

        if (tips != null)
        {
            tips.gameObject.SetActive(true);
            tips.ShowCenterMoveUpTips(content, timer, color);
            tips.SizeTipSize(fontsize);
        }
    }
示例#4
0
 private void InitUi()
 {
     _view           = _prefab.GetComponent <UITipsView>() ?? _prefab.gameObject.AddComponent <UITipsView>();
     _view.img_bg    = _prefab.Find("Panel/Image").GetComponent <Image> ();
     _view.text_tips = _prefab.Find("Panel/Image/Text").GetComponent <Text> ();
     _view.btn_01    = _prefab.Find("Panel/Image/GameObject/Button").GetComponent <Button> ();
     _view.btn_02    = _prefab.Find("Panel/Image/GameObject/Button2").GetComponent <Button> ();
 }
示例#5
0
 public void PushUITipPanel(UITipsView tip)
 {
     if (tip == null)
     {
         return;
     }
     tip.gameObject.SetActive(false);
     tipsList.Add(tip);
 }
示例#6
0
    public static void ShowHonorInfo(int _honor)
    {
        UITipsView tips = UIPool.Instance.PopUITipPanel();

        if (tips != null)
        {
            tips.gameObject.SetActive(true);
            tips.ShowHonorTip(_honor);
        }
    }
示例#7
0
    /// <summary> 显示中间提示信息</summary>
    public static void ShowCenterInfo(string content, Color color, float timer = 1.5f)
    {
        UITipsView tips = UIPool.Instance.PopUITipPanel();

        if (tips != null)
        {
            tips.gameObject.SetActive(true);
            tips.ShowCenterTips(content, timer, color);
            tips.SizeTipSize(16);
        }
    }
示例#8
0
    public static void ShowCenterTipsBig(string content, Color color, float timer = 1.5f)
    {
        UITipsView tips = UIPool.Instance.PopUITipPanel();

        if (tips != null)
        {
            CenterTips = tips;
            tips.CacheTrans.localPosition = new Vector3(0, 200, 0);
            tips.gameObject.SetActive(true);
            tips.ShowCenterTips(content, timer, color);
            tips.SizeTipSize(18, 32);
        }
    }
示例#9
0
 static int set_CenterTips(IntPtr L)
 {
     try
     {
         UITipsView arg0 = (UITipsView)ToLua.CheckObject <UITipsView>(L, 2);
         Utility.CenterTips = arg0;
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#10
0
    public static void ShowCenterMoveUpInfo2(string content, List <UITipsView> list, float delay, Color color, float duration = 1.5f)
    {
        UITipsView tips = list.Count >= 3 ? list[0] : UIPool.Instance.PopUITipPanel();

        if (list.Count >= 3)
        {
            list.RemoveAt(0);
        }
        if (tips != null)
        {
            tips.gameObject.SetActive(true);
            tips.ShowCenterMoveUpTips(content, list, delay, duration, color);
            tips.SizeTipSize(16);
        }
    }
示例#11
0
    /// <summary>
    /// 显示底端信息提示
    /// </summary>
    /// <param name="content"></param>
    /// <param name="color"></param>
    /// <param name="timer"></param>
    public static void ShowTips(string content, Color color, float timer = 1.5f)
    {
        if (TipsList.Count >= 5)
        {
            return;
        }
        UITipsView tips = UIPool.Instance.PopUITipPanel();

        if (tips != null)
        {
            tips.gameObject.SetActive(true);
            tips.ShowTips(content, timer, color, false);
            tips.SizeTipSize(16);
        }
    }
示例#12
0
    /// <summary>
    ///显示右下角的提示
    /// </summary>
    /// <param name="content"></param>
    /// <param name="timer"></param>
    public static void ShowRightInfo(string content, float timer = 3f)
    {
        if (GameTipsList.Count >= 5)
        {
            foreach (var i in GameTipsList)
            {
                if (i.TipPos == UITipsView.TipPosType.Right)
                {
                    i.ImmediatelyBeginAlpha(true);
                }
                break;
            }
        }
        UITipsView tips = UIPool.Instance.PopUITipPanel();

        if (tips != null)
        {
            tips.transform.localPosition = new Vector3(400, -85, 0);
            tips.gameObject.SetActive(true);
            tips.ShowTips(content, timer, Color.white, true, UITipsView.TipPosType.Right);
            tips.SizeTipSize(24);
        }
    }
示例#13
0
    //显示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();
    }