Esempio n. 1
0
    private IEnumerator Start()
    {
        LoadingQueue load_queue      = new LoadingQueue(this);
        LoadObject   lo_event_banner = load_queue.LoadAndInstantiate(RESOURCE_CATEGORY.UI, "EventBanner");

        if (load_queue.IsLoading())
        {
            yield return((object)load_queue.Wait());
        }
        mEventBannerPrefab = (lo_event_banner.loadedObject as GameObject);
        AddPrefab(mEventBannerPrefab, lo_event_banner.PopInstantiatedGameObject());
        mCenterOnChild1          = GetCtrl(UI.WRP_EVENT_BANNER1).GetComponent <UICenterOnChild>();
        mCenterOnChild1.onCenter = OnCenter1;
        mCenterOnChild2          = GetCtrl(UI.WRP_EVENT_BANNER2).GetComponent <UICenterOnChild>();
        mCenterOnChild2.onCenter = OnCenter2;
    }
    public GameSection CreateSection(GameSceneTables.SectionData section_data, LoadObject[] use_objects)
    {
        //IL_0019: Unknown result type (might be due to invalid IL or missing references)
        //IL_0111: Unknown result type (might be due to invalid IL or missing references)
        //IL_0123: Unknown result type (might be due to invalid IL or missing references)
        //IL_0128: Expected O, but got Unknown
        GameSection   gameSection = null;
        HierarchyData last        = GetLast();
        Transform     parent      = (last != null) ? last.section._transform : MonoBehaviourSingleton <UIManager> .I.uiCamera.get_transform();

        if (section_data.type == GAME_SECTION_TYPE.COMMON_DIALOG)
        {
            gameSection           = (Utility.CreateGameObjectAndComponent(section_data.typeParams[0], parent, 5) as GameSection);
            gameSection.baseDepth = GetPrefabUIDepth(section_data.type);
            gameSection.set_name(section_data.sectionName);
            parent = gameSection._transform;
        }
        int i = 0;

        for (int num = use_objects.Length; i < num; i++)
        {
            LoadObject loadObject = use_objects[i];
            if (loadObject != null)
            {
                GameObject val = loadObject.loadedObject as GameObject;
                if (val != null)
                {
                    if (val.GetComponent <UIVirtualScreen>() != null)
                    {
                        Type type = null;
                        if (gameSection == null)
                        {
                            type = Type.GetType(section_data.sectionName);
                        }
                        UIBehaviour uIBehaviour = UIManager.CreatePrefabUI(val, loadObject.PopInstantiatedGameObject(), type, false, parent, GetPrefabUIDepth(section_data.type), section_data);
                        if (gameSection == null && section_data.type == GAME_SECTION_TYPE.COMMON_DIALOG)
                        {
                            gameSection = (uIBehaviour.get_gameObject().AddComponent(Type.GetType(section_data.typeParams[0])) as GameSection);
                            parent      = gameSection._transform;
                        }
                        else if (gameSection == null && type != null)
                        {
                            gameSection = (uIBehaviour.GetComponent <UIBehaviour>() as GameSection);
                            parent      = gameSection._transform;
                        }
                        else
                        {
                            if (gameSection == null)
                            {
                                gameSection = (uIBehaviour.GetComponent <UIBehaviour>() as GameSection);
                            }
                            if (gameSection == null)
                            {
                                gameSection           = (Utility.CreateGameObjectAndComponent(section_data.sectionName, parent, 5) as GameSection);
                                gameSection.baseDepth = GetPrefabUIDepth(section_data.type);
                                parent = gameSection._transform;
                            }
                            if (section_data.type != GAME_SECTION_TYPE.COMMON_DIALOG)
                            {
                                uIBehaviour.Open(UITransition.TYPE.OPEN);
                            }
                        }
                    }
                    else if (gameSection != null)
                    {
                        gameSection.AddPrefab(val, loadObject.PopInstantiatedGameObject());
                    }
                    else
                    {
                        Log.Warning(LOG.GAMESCENE, "[{0}] is not used.", val.get_name());
                    }
                }
            }
        }
        if (gameSection == null)
        {
            gameSection           = (Utility.CreateGameObjectAndComponent(section_data.sectionName, parent, 5) as GameSection);
            gameSection.baseDepth = GetPrefabUIDepth(section_data.type);
        }
        HierarchyData hierarchyData = new HierarchyData();

        hierarchyData.section = gameSection;
        hierarchyData.data    = section_data;
        hierarchyList.Add(hierarchyData);
        int type2 = (int)section_data.type;

        if (typedDatas[type2] == null)
        {
            typedDatas[type2] = hierarchyData;
        }
        return(gameSection);
    }