/// <summary> /// Return dialog instance using current instance as template. /// </summary> /// <returns>New Dialog instance.</returns> public Dialog Clone() { if ((TemplateName != null) && Templates.Exists(TemplateName)) { // do nothing } else if (!Templates.Exists(gameObject.name)) { Templates.Add(gameObject.name, this); } else if (Templates.Get(gameObject.name) != this) { Templates.Add(gameObject.name, this); } var id = gameObject.GetInstanceID().ToString(); if (!Templates.Exists(id)) { Templates.Add(id, this); } else if (Templates.Get(id) != this) { Templates.Add(id, this); } return(Templates.Instance(id)); }
/// <summary> /// Return this instance to cache. /// </summary> public void Return() { Templates.ToCache(this); ShowAnimation = oldShowAnimation; HideAnimation = oldHideAnimation; SetMessage(Templates.Get(TemplateName).text.text); }
/// <summary> /// Return this instance to cache. /// </summary> public void Return() { Templates.ToCache(this); ShowAnimation = oldShowAnimation; HideAnimation = oldHideAnimation; if (text != null) { text.text = Templates.Get(TemplateName).text.text; } }
/// <summary> /// Resets the parameters. /// </summary> protected virtual void ResetParametres() { var template = Templates.Get(TemplateName); OnClose = null; OnCancel = null; var title = template.TitleText != null ? template.TitleText.text : string.Empty; var content = template.ContentText != null ? template.ContentText.text : string.Empty; var icon = template.Icon != null ? template.Icon.sprite : null; SetInfo(title, content, icon); }
/// <summary> /// Return this instance to cache. /// </summary> public void Return() { Templates.ToCache(this); ShowAnimation = oldShowAnimation; HideAnimation = oldHideAnimation; var rt = transform as RectTransform; rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, oldSize.x); rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, oldSize.y); rt.localRotation = oldRotation; var le = GetComponent <LayoutElement>(); if (le != null) { le.ignoreLayout = false; } SetMessage(Templates.Get(TemplateName).text.text); }
/// <summary> /// Gets the template by name. /// </summary> /// <returns>The template.</returns> /// <param name="template">Template name.</param> static public Notify GetTemplate(string template) { return(Templates.Get(template)); }