예제 #1
0
    public static UIBehaviour CreatePrefabUI(Object prefab, GameObject inactive_inctance, Type add_component_type, bool initVisible, Transform parent, int depth, GameSceneTables.SectionData section_data)
    {
        //IL_0059: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
        //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
        //IL_00af: Expected O, but got Unknown
        //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
        if (parent == null && MonoBehaviourSingleton <UIManager> .IsValid())
        {
            parent = MonoBehaviourSingleton <UIManager> .I._transform;
        }
        string text = prefab.get_name();

        if (text.StartsWith("internal__"))
        {
            text = text.Substring(text.LastIndexOf("__") + 2);
        }
        Transform val = Utility.CreateGameObject(text, parent, 5);

        val.get_gameObject().AddComponent <UIPanel>();
        Transform val2 = null;

        val2 = ((!(inactive_inctance != null)) ? ResourceUtility.Realizes(prefab, val, 5) : InstantiateManager.Realizes(ref inactive_inctance, val, 5));
        if (add_component_type == null)
        {
            add_component_type = Type.GetType(val2.get_name());
        }
        UIBehaviour uIBehaviour = (add_component_type == null) ? val.get_gameObject().AddComponent <UIBehaviour>() : (val.get_gameObject().AddComponent(add_component_type) as UIBehaviour);

        uIBehaviour.collectUI   = val2;
        uIBehaviour.sectionData = section_data;
        TestTransitionAnim(val2, section_data);
        if (MonoBehaviourSingleton <UIManager> .I.common != null)
        {
            int    num   = 0;
            string text2 = uIBehaviour.GetCaptionText();
            if (section_data != (GameSceneTables.SectionData)null)
            {
                if (text2 == null)
                {
                    text2 = section_data.GetText("CAPTION");
                }
                num = section_data.backButtonIndex;
            }
            if (num > 0)
            {
                MonoBehaviourSingleton <UIManager> .I.common.AttachBackButton(uIBehaviour, num - 1);
            }
            MonoBehaviourSingleton <UIManager> .I.common.AttachCaption(uIBehaviour, num, text2);
        }
        uIBehaviour.InitUI();
        uIBehaviour.baseDepth = depth;
        if (!initVisible)
        {
            val2.GetComponentsInChildren <UIWidget>(Temporary.uiWidgetList);
            int i = 0;
            for (int count = Temporary.uiWidgetList.Count; i < count; i++)
            {
                Temporary.uiWidgetList[i]._Update();
            }
            Temporary.uiWidgetList.Clear();
        }
        uIBehaviour.uiVisible = initVisible;
        return(uIBehaviour);
    }