Example #1
0
    /// <summary>
    /// 从 Resources 文件夹下加载 UI 界面,并添加到指定层。
    /// </summary>
    /// <param name="_layer">UI层</param>
    /// <param name="_uiName">UI界面名称</param>
    /// <returns></returns>
    public GameObject AddUIPanel(UILayer _layer, string _uiName)
    {
        GameObject _addUI = GameResourcesManager.LoadUIPrefab(_uiName);

        _addUI.transform.SetParent(GetUILayer(_layer).transform, false);
        return(_addUI);
    }
Example #2
0
    public static T CreateGameObjectRoot <T>(string _gameObjectName) where T : GameObjectRootBase
    {
        GameObject _go             = GameResourcesManager.LoadUIPrefab(_gameObjectName);
        T          _gameObjectRoot = _go.GetComponent <T>();

        _gameObjectRoot.rootID = _gameObjectName;
        GameObjectRootDict.Add(_gameObjectRoot.rootID, _gameObjectRoot);
        return(_gameObjectRoot);
    }
Example #3
0
    public static T CreateUIRoot <T>(string _uiName, UILayer _layer) where T : UIRootBase
    {
        GameObject _go = GameResourcesManager.LoadUIPrefab(_uiName);
        //_go.transform.SetParent(GetUILayer(_layer).transform, false);
        T _uiRoot = _go.GetComponent <T>();

        _uiRoot.rootID = _uiName;
        UIRootDict.Add(_uiRoot.rootID, _uiRoot);
        return(_uiRoot);
    }