Beispiel #1
0
        /// <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));
        }
Beispiel #2
0
        /// <summary>
        /// Return this instance to cache.
        /// </summary>
        public void Return()
        {
            Templates.ToCache(this);

            ShowAnimation = oldShowAnimation;
            HideAnimation = oldHideAnimation;

            SetMessage(Templates.Get(TemplateName).text.text);
        }
Beispiel #3
0
        /// <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;
            }
        }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        /// <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);
        }
Beispiel #6
0
 /// <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));
 }