Ejemplo n.º 1
0
    public void FillNewInstanceUIChooseLevelGridData(int num)
    {
        for (int i = 0; i < num; ++i)
        {
            int id = i;

            AssetCacheMgr.GetUIInstance("NewInstanceUIChooseLevelGrid.prefab", (prefab, guid, gameObject) =>
            {
                GameObject go = (GameObject)gameObject;

                go.transform.parent        = m_listChooseLevelGridPos[id].transform;
                go.transform.localPosition = Vector3.zero;
                go.transform.localScale    = Vector3.one;
                go.name = string.Concat("NewInstanceUIChooseLevelGrid", id);

                NewInstanceGrid grid = go.transform.Find("NewInstanceUIChooseLevelGridIcon").gameObject.AddComponent <NewInstanceGrid>();
                grid.gameObject.SetActive(true);
                grid.id = id;

                m_listChooseLevelGrid.Add(go);

                if (id == num - 1)
                {
                    FillNewInstanceUIChooseLevelPath();
                }
            });
        }
    }
    /// <summary>
    /// 创建关卡,包括[普通关卡]和[特殊关卡-迷雾深渊]
    /// </summary>
    /// <param name="num"></param>
    public void FillNewInstanceUIChooseLevelGridData(int num, int MapWithMissionGridIndex)
    {
        for (int i = 0; i < num; ++i)
        {
            int index = i;
            if (index <= MaxNormalMissionIndex)
            {
                // [普通副本]
                AssetCacheMgr.GetUIInstance("NewInstanceUIChooseLevelGrid.prefab", (prefab, guid, gameObject) =>
                {
                    GameObject goMissionGrid = (GameObject)gameObject;

                    goMissionGrid.transform.parent        = m_listChooseLevelGridPos[index].transform;
                    goMissionGrid.transform.localPosition = Vector3.zero;
                    goMissionGrid.transform.localScale    = Vector3.one;
                    goMissionGrid.name = string.Concat("NewInstanceUIChooseLevelGrid", MapWithMissionGridIndex, index);

                    NewInstanceGrid gridUI = goMissionGrid.transform.FindChild("NewInstanceUIChooseLevelGridIcon").gameObject.AddComponent <NewInstanceGrid>();
                    gridUI.gameObject.SetActive(true);
                    gridUI.id = index;
                    goMissionGrid.SetActive(false);
                    m_maplistChooseLevelGrid[index] = goMissionGrid;

                    if (m_maplistChooseLevelGrid.Count == num)
                    {
                        // 自动填充路径点
                        FillNewInstanceUIChooseLevelPath();
                    }
                });
            }
            else if (index == FoggyAbyssMissionIndex)
            {
                // [特殊副本-迷雾深渊]
                AssetCacheMgr.GetUIInstance("InstanceMissionFoggyAbyssGrid.prefab", (prefab, guid, gameObject) =>
                {
                    GameObject goMissionGrid = (GameObject)gameObject;

                    goMissionGrid.transform.parent        = m_listChooseLevelGridPos[index].transform;
                    goMissionGrid.transform.localPosition = Vector3.zero;
                    goMissionGrid.transform.localScale    = Vector3.one;
                    goMissionGrid.name = string.Concat("NewInstanceUIChooseLevelGrid", MapWithMissionGridIndex, index);

                    InstanceMissionFoggyAbyssGrid gridUI = goMissionGrid.AddComponent <InstanceMissionFoggyAbyssGrid>();
                    goMissionGrid.SetActive(false);
                    gridUI.LoadResourceInsteadOfAwake();

                    m_maplistChooseLevelGrid[index] = goMissionGrid;

                    if (m_maplistChooseLevelGrid.Count == num)
                    {
                        // 自动填充路径点
                        FillNewInstanceUIChooseLevelPath();
                    }
                });
            }
        }
    }