Ejemplo n.º 1
0
 public void Init(Config.StageInfo info)
 {
     this.info  = info;
     panelImage = GetComponent <Image>();
     button     = GetComponent <Button>();
     PlayData.StageData stageData = Game.Instance.playData.stageDatas[info.id - 1];
     clearLevel       = stageData.clearLevel;
     description.text = "clear previous stage";
     Config.WorldInfo worldInfo = Game.Instance.config.worldInfos [info.world - 1];
     if (info.id == worldInfo.stageInfos [0].id)
     {
         description.text = "collect " + worldInfo.openStar + " stars";
     }
     open = stageData.open;
 }
Ejemplo n.º 2
0
    public void Init()
    {
        totalStarCount = Game.Instance.playData.star;

        stageScrollRects = new List <ScrollRect>(new ScrollRect[Game.Instance.config.worldInfos.Count]);
        stageInfos       = new List <UIStageInfo> (new UIStageInfo[Game.Instance.config.stageInfos.Count]);
        for (int i = 0; i < Game.Instance.config.worldInfos.Count; i++)
        {
            ScrollRect stageScrollRect = GameObject.Instantiate <ScrollRect> (stageScrollRectPrefab);
            stageScrollRect.transform.SetParent(content, false);
            stageScrollRects[i] = stageScrollRect;

            Config.WorldInfo worldInfo = Game.Instance.config.worldInfos[i];
            foreach (Config.StageInfo stageInfo in worldInfo.stageInfos)
            {
                UIStageInfo uiStageInfo = GameObject.Instantiate <UIStageInfo>(stageInfoPrefab);
                uiStageInfo.transform.SetParent(stageScrollRect.content, false);
                uiStageInfo.Init(stageInfo);
                stageInfos [stageInfo.id - 1] = uiStageInfo;
            }
        }

        scrollSnapRect.Init();

        achievementButton.onClick.AddListener(() => {
            AudioManager.Instance.Play("ButtonClick");
            Game.Instance.achievementPanel.gameObject.SetActive(true);
            Game.Instance.achievementPanel.Sort();
            Game.Instance.rootPanel.ScrollScreen(new Vector3(0.0f, -1.0f, 0.0f), () => {
                gameObject.SetActive(false);
            });
            newAchievement.SetActive(false);
        });

        shopButton.onClick.AddListener(() => {
            AudioManager.Instance.Play("ButtonClick");
            Game.Instance.shopPanel.gameObject.SetActive(true);
            Game.Instance.rootPanel.ScrollScreen(new Vector3(0.0f, 1.0f, 0.0f), () => {
                gameObject.SetActive(false);
            });
        });
    }
Ejemplo n.º 3
0
    private int GetNewOpenWorld()
    {
        for (int i = 0; i < playData.openWorlds.Length; i++)
        {
            Config.WorldInfo worldInfo = config.worldInfos[i];

            if (false == playData.openWorlds [i] && playData.star >= worldInfo.openStar)
            {
                playData.openWorlds [i] = true;
                stagePanel.GetStageInfo(worldInfo.stageInfos[0].id).open = true;

                Analytics.CustomEvent("OpenWorld_" + (i + 1).ToString(), new Dictionary <string, object> {
                    { "stage", playData.currentStage },
                    { "level", playData.currentStage + "-" + playData.currentLevel },
                    { "star", playData.star }
                });
                return(i + 1);
            }
        }
        return(0);
    }