void InitMissions()
    {
        Clicked(videoGameID, missionID);
        Utils.RemoveAllChildsIn(missionscontainer);
        List <MissionsManager.MissionsData> missionData = MissionsManager.Instance.videogames[videoGameID].missions;

        videogameTitleField.text = Data.Instance.videogamesData.all[videoGameID].name;
        //int missionUnblockedID = Data.Instance.missions.GetMissionsByVideoGame(videoGameID).missionUnblockedID;
        int missionUnblockedID = UserData.Instance.GetMissionUnblockedByVideogame(videoGameID);


        int id = 0;

        foreach (MissionsManager.MissionsData data in missionData)
        {
            MissionButtonMobile m = Instantiate(missionButton);
            m.transform.SetParent(missionscontainer);
            m.transform.localPosition = Vector3.zero;
            m.transform.localScale    = Vector3.one;
            m.Init(this, videoGameID, id, data);

            if (id == missionUnblockedID)
            {
                m.SetSelected(true);
            }
            else
            {
                m.SetSelected(false);
            }

            id++;
        }
    }
Esempio n. 2
0
    void AddButtons(int videoGameID)
    {
        List <MissionsManager.MissionsData> missionData = MissionsManager.Instance.videogames[videoGameID].missions;
        Transform container = null;

        switch (videoGameID)
        {
        case 0: container = videogame1_container; break;

        case 1: container = videogame2_container; break;

        default: container = videogame3_container; break;
        }
        int missionUnblockedID = UserData.Instance.GetMissionUnblockedByVideogame(videoGameID + 1);


        int id = 0;

        foreach (MissionsManager.MissionsData data in missionData)
        {
            MissionButtonMobile m = Instantiate(missionButton);
            m.transform.SetParent(container);
            m.transform.localPosition = Vector3.zero;
            m.transform.localScale    = Vector3.one;
            m.Init(this, videoGameID, id, data);

            if (id == missionUnblockedID)
            {
                m.SetSelected(true);
            }
            else
            {
                m.SetSelected(false);
            }

            id++;
            allButtons.Add(m);
        }

        switch (videoGameID)
        {
        case 0: scrollSnap_level1.Init(missionUnblockedID); break;

        case 1: scrollSnap_level2.Init(missionUnblockedID); break;

        default: scrollSnap_level3.Init(missionUnblockedID); break;
        }
    }
Esempio n. 3
0
    public void Init()
    {
        Data.Instance.events.SetHamburguerButton(false);
        panel.SetActive(true);
        Utils.RemoveAllChildsIn(missionsContainer);
        videoGameID = Data.Instance.videogamesData.actualID;
        title1.text = Data.Instance.videogamesData.GetActualVideogameData().name;
        int id = 0;
        List <Missions.MissionsData> missionData = Data.Instance.missions.videogames[videoGameID].missions;

        int missionUnblockedID = Data.Instance.missions.GetMissionsByVideoGame(videoGameID).missionUnblockedID;

        foreach (Missions.MissionsData data in missionData)
        {
            MissionButtonMobile m = Instantiate(missionButton);
            m.transform.SetParent(missionsContainer);
            m.transform.localPosition = Vector3.zero;
            m.transform.localScale    = Vector3.one;
            allMissions.Add(m);
            m.Init(this, videoGameID, id, data);



            if (id == missionUnblockedID)
            {
                m.SetSelected(true);
            }
            else
            {
                m.SetSelected(false);
            }

            id++;
        }
        hiscoresMobile.Init(videoGameID, missionUnblockedID, OnMyScoreLoaded);
    }