Example #1
0
    ProtoPopupUI GetPopupUI(string _tag)
    {
        ProtoPopupUI popupUI = popupUIList.Find(x => string.Equals(x.name, _tag));

        if (popupUI == null)
        {
            //Resources 경로 설정
            PopupUITable.PopupUIInfo popupUIInfo = popupUITable.GetPopupUIInfo(_tag);
            if (popupUIInfo == null)
            {
                Debug.LogError("Not found PopupUIInfo : " + _tag);
                return(null);
            }

            //string resourcePath = string.Format("{0}{1}", popupUIInfo.path, popupUIInfo.tag);

            GameObject newObj = ResourceManager.LoadAsset(popupUIInfo.path, popupUIInfo.tag, resLinkType) as GameObject;
            if (newObj == null)
            {
                Debug.LogError("Not found popup ui : " + _tag);
                return(null);
            }

            newObj = Instantiate(newObj);

            newObj.name = _tag;
            newObj.transform.SetParent(popupParent);
            newObj.transform.localPosition = Vector3.zero;
            newObj.transform.localRotation = Quaternion.identity;

            popupUI = newObj.GetComponent <ProtoPopupUI>();
            popupUIList.Add(popupUI);
        }

        return(popupUI);
    }