Exemplo n.º 1
0
    void Start()
    {
        ChapterCities chapterCityPrefab = m_ChapterRoot.transform.GetChild(0).GetComponent <ChapterCities>();

        chapterCityPrefab.transform.SetParent(null);

        int i = 0;

        foreach (var v in ChapterConfiguration.chapterDictionary)
        {
            i++;
            ChapterInfo   c           = v.Value;
            ChapterCities chapterCity = SupportTools.AddChild <ChapterCities>(m_ChapterRoot.gameObject, chapterCityPrefab.gameObject);
            chapterCity.text.text = c.name;
            chapterCity.name      = c.imageName.Substring(6); //imageName = Image_xxxxx  we just wanna get the real name
            chapterCity.chapter   = c.chapter;
            Sprite sprite = Resources.Load <Sprite>("UI/LaunchScene/MissionCards/" + c.imageName);
            if (sprite)
            {
                chapterCity.image.sprite = sprite;
            }
            bool b = c.chapter > ConstantData.LevelDatas.GetChapter(m_MissionProgress);
            chapterCity.lockMask.SetActive(b);
            int star = 0;
            if (!b)
            {
                star = ConstantData.missionRecords.GetChapterStars(v.Key);
            }
            chapterCity.process.text = string.Format(HOLocalizationConfiguration.GetValue(104), star, 60);
        }
        Destroy(chapterCityPrefab.gameObject);
        m_ChapterRoot.GetComponent <RectTransform>().sizeDelta = new Vector2(i * m_ChapterRoot.cellSize.x + i * m_ChapterRoot.spacing.x, m_ChapterRoot.cellSize.y);
        m_ChapterSnapElement.Initialize();
    }
Exemplo n.º 2
0
    public void LoadLevel(GameObject go)
    {
        ChapterCities city = go.GetComponent <ChapterCities>();

        LoadLevelWithChapter(city.chapter);
    }