Beispiel #1
0
    IEnumerator LoadPrefabFromRes(string name, params object[] paramsList)
    {
        ResourceRequest quest = Resources.LoadAsync("Prefabs/Gui/" + name);

        yield return(quest);

        GameObject instance = Instantiate(quest.asset) as GameObject;

        Transform instanceTran = instance.transform;

        instanceTran.parent        = GameUiManager.UIRootTran;
        instanceTran.localPosition = Vector3.zero;
        instanceTran.localScale    = Vector3.one;
        GameObject mainBottomObj = ObjectCommon.GetChild(GameUiManager.UIRootTran.gameObject, PanelType.UIMain_bottom);

        if (mainBottomObj != null)
        {
            mainBottomObj.transform.SetSiblingIndex(instanceTran.GetSiblingIndex());
        }

        PanelManager.PanelModuleData panelData = PanelManager.GetInstance().getComponent(name);
        Debuger.LogError("pannel data is null ?" + panelData);

        instance.name = name;
        string component = panelData.panelName;

        if (string.IsNullOrEmpty(component) == false)
        {
            instance.AddComponent(panelData.panelType);
        }

        UIPanelBase panel = instance.gameObject.GetComponent <UIPanelBase>();

        if (instance != null && instance.gameObject != null)
        {
            instance.gameObject.SetActive(true);
        }



        if (panel != null)
        {
            panel.OnShow();
            //GameUiManager.getInst().DontUseThisShowPanel(panel, paramsList);
        }



        GameUiManager.getInst().addLoadedWindow(name, panel, true);
        GameUiManager.getInst().removeLoadingWindow(name);
    }