Exemple #1
0
    public virtual BaseView OpenWindow()
    {
        if (mBaseView != null)
        {
            mBaseView.gameObject.SetActive(true);
            return(mBaseView);
        }
        if (string.IsNullOrEmpty(mViewPath))
        {
            SQDebug.Log("view path is null");
            return(null);
        }

        if (string.IsNullOrEmpty(mViewName))
        {
            SQDebug.Log("view name is null");
            return(null);
        }

        GameObject obj = GameObject.Instantiate((Resources.Load(mViewPath))) as GameObject;

        if (obj == null)
        {
            SQDebug.Log("加载错误:" + mViewPath);
            return(null);
        }
        obj.transform.parent        = Global.Inst.mUIRoot;
        obj.transform.localPosition = Vector3.zero;
        obj.transform.localRotation = Quaternion.Euler(Vector3.zero);
        obj.transform.localScale    = Vector3.one;
        obj.gameObject.SetActive(true);
        mBaseView = obj.GetComponent <BaseView>();
        mBaseView.AddView(mViewName);

        return(mBaseView);
    }