Beispiel #1
0
 public ToastBean(ToastEnum toastType, string content, Sprite toastIcon, float showTime)
 {
     this.toastType = toastType;
     this.content   = content;
     this.toastIcon = toastIcon;
     this.showTime  = showTime;
 }
Beispiel #2
0
 public ToastBean(ToastEnum toastType, string content, Sprite toastIcon)
 {
     this.toastType = toastType;
     this.content   = content;
     this.toastIcon = toastIcon;
     showTime       = 3;
 }
 public ToastDefinition(string message, ToastEnum type, int?timer = 10000)
 {
     Id          = Guid.NewGuid();
     IsDisplayed = true;
     Type        = type;
     Message     = message;
     Timer       = timer;
 }
Beispiel #4
0
    /// <summary>
    /// 创建toast
    /// </summary>
    /// <param name="toastType"></param>
    /// <param name="toastIconSp"></param>
    /// <param name="toastContentStr"></param>
    /// <param name="destoryTime"></param>
    public void CreateToast <T>(ToastEnum toastType, Sprite toastIconSp, string toastContentStr, float destoryTime) where T : ToastView
    {
        string     toastName = EnumUtil.GetEnumName(toastType);
        GameObject objToast  = CreateToast(toastName);

        if (objToast)
        {
            ToastView toastView = objToast.GetComponent <ToastView>();
            toastView.SetData(toastIconSp, toastContentStr, destoryTime);
        }
        else
        {
            LogUtil.LogError("没有找到指定Msg:" + "Resources/" + resUrl + toastName);
        }
    }
Beispiel #5
0
    /// <summary>
    /// 创建toast
    /// </summary>
    /// <param name="toastType"></param>
    /// <param name="toastIconSp"></param>
    /// <param name="toastContentStr"></param>
    /// <param name="destoryTime"></param>
    public void CreateToast <T>(ToastEnum toastType, Sprite toastIconSp, string toastContentStr, float destoryTime) where T : ToastView
    {
        string     toastName     = EnumUtil.GetEnumName(toastType);
        GameObject objToastModel = manager.GetToastModel(toastName);

        if (objToastModel == null)
        {
            LogUtil.LogError("没有找到指定Toast:" + toastName);
            return;
        }
        GameObject objToast = Instantiate(manager.objToastContainer, objToastModel);

        if (objToast)
        {
            ToastView toastView = objToast.GetComponent <ToastView>();
            toastView.SetData(toastIconSp, toastContentStr, destoryTime);
        }
        else
        {
            LogUtil.LogError("实例化Toast失败" + toastName);
        }
    }
Beispiel #6
0
    public float showTime;      //显示时间

    public ToastBean(ToastEnum toastType, string content)
    {
        this.toastType = toastType;
        this.content   = content;
        showTime       = 3;
    }