Example #1
0
    void CreateGameMap()
    {
        maplist    = new Transform[IGamerProfile.gameLevel.mapData.Length];
        maplist[0] = mapUnit.transform;
        UiMapData dt = maplist[0].GetComponent <UiMapData>();

        dt.levelNum.Text = "1";
        dt.SetActiveLocker(false);
        dt.SetActiveBoss(IGamerProfile.gameLevel.mapData[0].bossData.BossType == "" ? false : true);

        int lastLockMapIndex = IGamerProfile.Instance.getLastLockedMap;

        for (int i = 1; i < IGamerProfile.gameLevel.mapData.Length; i++)
        {
            GameObject obj = Instantiate(mapUnit);
            obj.name = "map" + (i + 1).ToString();
            obj.transform.SetParent(mapUnit.transform.parent);
            Vector3 pos = mapUnit.transform.localPosition;
            pos.x = i * mapDisX;
            obj.transform.localPosition = pos;
            maplist[i]       = obj.transform;
            dt               = obj.GetComponent <UiMapData>();
            dt.levelNum.Text = (i + 1).ToString();
            dt.SetActiveLocker(lastLockMapIndex < i ? true : false);
            dt.SetActiveBoss(IGamerProfile.gameLevel.mapData[i].bossData.BossType == "" ? false : true);
        }
    }
Example #2
0
    void UpdateMapLevelLock()
    {
        for (int i = 0; i < m_MapData.m_MapList.Count; i++)
        {
            UiMapData dt = m_MapData.m_MapList[i].GetComponent <UiMapData>();
            if (dt != null)
            {
                if (i < 2)
                {
                    dt.SetActiveLocker(false);
                }
                else
                {
                    int dVal = m_MapData.m_UnlockMaxLevel - m_MapData.m_CurLevel;
                    if (dVal > 0)
                    {
                        dt.SetActiveLocker(false);
                    }
                    else
                    {
                        m_MapData.m_UnlockMaxLevel = m_MapData.m_CurLevel;
                        dt.SetActiveLocker(true);
                    }
                }

                bool isBoss = GetIsBossLevel(m_MapData.m_CurLevel - 1 + i);
                dt.SetActiveBoss(isBoss);
            }
        }
    }