Exemple #1
0
    private void AddMapDOTPageList()
    {
        m_dragableCameraMapList.DestroyDOTPageList();
        m_iMapPageNum = 0;
        if (MapOpenPage <= 1)
        {
            return;
        }

        for (int i = 0; i < MapOpenPage; i++)
        {
            // 创建页数点
            ++m_iMapPageNum;
            int num = m_iMapPageNum;
            AssetCacheMgr.GetUIInstance("ChooseServerPage.prefab", (prefabPage, idPage, goPage) =>
            {
                GameObject objPage = (GameObject)goPage;

                objPage.transform.parent        = m_tranInstanceMissionChooseUIPageDOT;
                objPage.transform.localPosition = new Vector3((num - 1) * 40, 0, 0);
                objPage.transform.localScale    = Vector3.one;
                objPage.name = "MapPageNum" + num;
                m_dragableCameraMapList.ListPageDown.Add(objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject);
                m_tranInstanceMissionChooseUIPageDOT.localPosition = new Vector3(-20 * (num - 1), m_tranInstanceMissionChooseUIPageDOT.localPosition.y, 0);

                // 选择当前页
                if (num - 1 == m_dragableCameraMapList.GetCurrentPage())
                {
                    objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(true);
                }
                else
                {
                    objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(false);
                }
                m_dragableCameraMapList.GODOTPageList = m_tranInstanceMissionChooseUIPageDOT.gameObject;
                m_dragableCameraMapList.SetCurrentPage(m_dragableCameraMapList.GetCurrentPage());
            });
        }
    }
 /// <summary>
 /// 清空页数信息
 /// </summary>
 void EmptyActivityGridPageList()
 {
     m_dragableCameraActivityGridList.DestroyMovePagePosList(); // 删除翻页位置
     m_dragableCameraActivityGridList.DestroyDOTPageList();     // 删除页点
     m_iActivityGridPageNum = 0;
 }
    public void SetGridLayout(Action callback)
    {
        if (m_listChallengeUIGrid.Count == GRIDNUM)
        {
            if (callback != null)
            {
                callback();
            }
            EventDispatcher.TriggerEvent(DoorOfBurySystem.ON_CHALLENGE_SHOW);
            EventDispatcher.TriggerEvent(Events.CampaignEvent.GetCampaignLastTime, 1);
            EventDispatcher.TriggerEvent(Events.OccupyTowerEvent.GetOccupyTowerStatePoint);
            ChallengeUILogicManager.Instance.RefreshUI((int)ChallengeGridID.OgreMustDie);
            ChallengeUILogicManager.Instance.CollectChallengeUIGridMessage();
        }
        else
        {
            m_gridListMyDragableCamera.DestroyMovePagePosList(); // 删除翻页位置
            m_gridListMyDragableCamera.DestroyDOTPageList();     // 删除页点

            for (int i = 0; i < GRIDNUM; i++)
            {
                int index = i;

                INSTANCE_COUNT++;
                MogoGlobleUIManager.Instance.ShowWaitingTip(true);

                AssetCacheMgr.GetUIInstance("ChallengeGrid.prefab", (prefab, guid, go) =>
                {
                    GameObject temp = (GameObject)go;
                    temp.AddComponent <ChallengeUIGrid>();
                    temp.transform.parent        = m_tranChallengeGridList;
                    temp.transform.localPosition = new Vector3(index * ITEMSPACE + OFFSET_X, 0, 0);
                    temp.transform.localScale    = new Vector3(1, 1, 1);
                    temp.name = string.Concat("ChallengeGrid", index);
                    temp.GetComponentsInChildren <MyDragCamera>(true)[0].RelatedCamera = m_gridListCamera;

                    ChallengeUIGrid gridUI = temp.GetComponentInChildren <ChallengeUIGrid>();
                    gridUI.id = index + 1;
                    if (index < GRIDNUM)
                    {
                        gridUI.SetImg(gridImgName[index]);
                    }

                    m_listChallengeUIGrid.Add(gridUI);

                    m_gridListMyDragableCamera.MINX = OFFSET_X;
                    m_gridListMyDragableCamera.MAXX = (m_listChallengeUIGrid.Count - GRID_COUNT_ONE_PAGE) * ITEMSPACE;

                    // 创建翻页位置
                    if (index % GRID_COUNT_ONE_PAGE == 0)
                    {
                        GameObject trans                 = new GameObject();
                        trans.transform.parent           = m_gridListCamera.transform;
                        trans.transform.localPosition    = new Vector3(index / GRID_COUNT_ONE_PAGE * ITEMSPACE * GRID_COUNT_ONE_PAGE, 0, 0);
                        trans.transform.localEulerAngles = Vector3.zero;
                        trans.transform.localScale       = new Vector3(1, 1, 1);
                        trans.name = "GridListPosHorizon" + index / GRID_COUNT_ONE_PAGE;
                        m_gridListMyDragableCamera.transformList.Add(trans.transform);
                        m_gridListMyDragableCamera.SetCurrentPage(m_gridListMyDragableCamera.GetCurrentPage());

                        // 创建页数点
                        ++m_iDotPageNum;
                        int num = m_iDotPageNum;
                        AssetCacheMgr.GetUIInstance("ChooseServerPage.prefab", (prefabPage, idPage, goPage) =>
                        {
                            GameObject objPage = (GameObject)goPage;

                            objPage.transform.parent        = m_goChallengeUIPageDOTList.transform;
                            objPage.transform.localPosition = new Vector3((num - 1) * 40, 0, 0);
                            objPage.transform.localScale    = Vector3.one;
                            objPage.name = "ActivityGridPage" + num;
                            m_gridListMyDragableCamera.ListPageDown.Add(objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject);
                            m_goChallengeUIPageDOTList.transform.localPosition = new Vector3(-20 * (num - 1), m_goChallengeUIPageDOTList.transform.localPosition.y, 0);

                            // 选择当前页
                            if (num - 1 == m_gridListMyDragableCamera.GetCurrentPage())
                            {
                                objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(true);
                            }
                            else
                            {
                                objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(false);
                            }
                            m_gridListMyDragableCamera.GODOTPageList = m_goChallengeUIPageDOTList;
                            m_gridListMyDragableCamera.SetCurrentPage(m_gridListMyDragableCamera.GetCurrentPage());
                        });
                    }

                    INSTANCE_COUNT--;
                    if (INSTANCE_COUNT <= 0)
                    {
                        MogoGlobleUIManager.Instance.ShowWaitingTip(false);
                    }

                    if (m_listChallengeUIGrid.Count == GRIDNUM)
                    {
                        if (callback != null)
                        {
                            callback();
                        }

                        EventDispatcher.TriggerEvent(DoorOfBurySystem.ON_CHALLENGE_SHOW);
                        ChallengeUILogicManager.Instance.InitializeData();

                        EventDispatcher.TriggerEvent(Events.CampaignEvent.GetCampaignLastTime, 1);
                        EventDispatcher.TriggerEvent(Events.OccupyTowerEvent.GetOccupyTowerStatePoint);

                        ChallengeUILogicManager.Instance.RefreshUI((int)ChallengeGridID.OgreMustDie);
                        ChallengeUILogicManager.Instance.CollectChallengeUIGridMessage();
                    }
                });
            }
        }
    }
 /// <summary>
 /// ���ҳ����Ϣ
 /// </summary>
 void EmptyActivityGridPageList()
 {
     m_dragableCameraActivityGridList.DestroyMovePagePosList(); // ɾ����ҳλ��
     m_dragableCameraActivityGridList.DestroyDOTPageList();     // ɾ��ҳ��
     m_iActivityGridPageNum = 0;
 }