Unity客户端架构-BaseDialog

发表于2018-09-10
评论0 1.6k浏览
继续Unity客户端架构系列的介绍,上一篇中给大家介绍了PanelManager的使用,这一篇我们就来看看BaseDialog的使用。

直接上代码:
using UnityEngine;
using System;
public class BaseDialog 
{
    private string name;
    private UILabel title;
    private UILabel prompt;
    private GameObject container;
    protected DialogType _type;
    public string Name
    {
        get
        {
            return this.name;
        }
        set 
        {
            this.name = value;
        }
    }
    public DialogType type
    {
        get
        {
            return this._type;
        }
        set
        {
            this._type = value;
        }
    }
    public GameObject Container
    {
        get
        {
            return this.container;
        }
        set
        {
            this.container = value;
        }
    }
    public void InitDialog(GameObject _container)
    {
        GameObject topobj = Util.Child(_container, "TopName");
        if (topobj != null)
        {
            this.prompt = topobj.GetComponent<UILabel>();
        }
    }
    protected void Open(GameObject container, string data)
    {
        this.container = container;
        this.InitDialog(container);
        if (!data.Equals(string.Empty) && this.title != null)
        {
            this.title.text = data;
        }
    }
    protected void Close()
    {
    }
}
来自:https://blog.csdn.net/u013108312/article/details/52565180

Unity客户端架构系列教程

如社区发表内容存在侵权行为,您可以点击这里查看侵权投诉指引