コード例 #1
0
    private void Start()
    {
        try {
            sceneController = GameObject.FindGameObjectWithTag("SceneController").GetComponent <SceneController>();
        }
        catch (System.Exception e) {
            sceneController = Instantiate(sceneControllerObj).GetComponent <SceneController>();
        }

        uiLevels = new List <UILevel>();
        for (int i = 0; i < sceneController.levels.Length; i++)
        {
            UILevel level = Instantiate(levelObj, main.transform).GetComponent <UILevel>();
            level.GetComponent <RectTransform>().anchoredPosition = new Vector2(i * 200f, 0f);
            level.Initialize(sceneController.levels[i], this, (i + 1));
            uiLevels.Add(level);
        }

        currentLevel = PlayerPrefs.GetInt("CurrentLevel", 1);
        if (currentLevel > sceneController.levels.Length)
        {
            currentLevel = sceneController.levels.Length;
        }
        focus = uiLevels[currentLevel - 1];
    }
コード例 #2
0
 public void Initialize()
 {
     uiAddExp.Initialize();
     uiLevel.Initialize();
     uiExpBar.Initialize();
 }