void Start()
    {
        //現在のユーザー情報を初期化
        CurrentlyUserInfo.DeleteAll();

        FileSystem.SaveLoadManager SaveLoadMng = new FileSystem.SaveLoadManager();
        //現在挑戦できる最大レベル
        var curMaxLevel = SaveLoadMng.GetRate();
        var myCanvas    = FindObjectOfType <Canvas>();

        Vector2 offset = new Vector2(0, 100);

        for (int i = 0; i < curMaxLevel; ++i)
        {
            //ボタンの位置などの設定
            var button = Instantiate(buttonPrefab) as Button;
            button.transform.SetParent(myCanvas.transform.GetChild(0));
            button.GetComponent <RectTransform>().localScale       = new Vector3(1, 1, 1);
            button.GetComponent <RectTransform>().anchoredPosition = offset + new Vector2(0, -i * button.GetComponent <RectTransform>().sizeDelta.y);

            //各ボタンのレベルを指定
            button.GetComponent <SelectLevelButton>().level = i + 1;

            //ボタンに表示するテキストの設定
            var buttontext = button.transform.FindChild("Text").GetComponent <Text>();

            int score = 0, bossscore = 0;
            SaveLoadMng.GetScore(i + 1, ref score, ref bossscore);
            buttontext.text = "Level" + (i + 1) +
                              ": " + score + "点、" + bossscore + "ボス点";
        }
    }
示例#2
0
    void Start()
    {
        FileSystem.SaveLoadManager save = new FileSystem.SaveLoadManager();
        save.GetScore(CurrentlyUserInfo.selectedLevel, ref myHighScore_RealValue, ref myBossHighScore_RealValue);
        myScore_RealValue = CurrentlyUserInfo.score;
        if (CurrentlyUserInfo.bBoss)
        {
            myBossScore_RealValue = CurrentlyUserInfo.bossScore;
            bBoss = true;
        }
        //問題の個数
        FileSystem.QuestionFileManager questionMng = new FileSystem.QuestionFileManager("Lesson" + CurrentlyUserInfo.selectedLevel);
        questionLength     = questionMng.GetNumOfQuestions();
        bossquestionLength = questionMng.GetNumOfQuestionsofBoss();

        //HighScore更新
        if (myHighScore_RealValue < myScore_RealValue)
        {
            myHighScore_RealValue       = myScore_RealValue;
            newScoreDisplayText.enabled = true;
        }
        //boss highscore
        if (myBossHighScore_RealValue < myBossScore_RealValue)
        {
            myBossHighScore_RealValue   = myBossScore_RealValue;
            newScoreDisplayText.enabled = true;
        }

        //ファイル更新
        save.SetScore(CurrentlyUserInfo.selectedLevel, (int)myHighScore_RealValue, (int)myBossHighScore_RealValue);

        //現在のユーザー情報を初期化
        CurrentlyUserInfo.DeleteAll();

        //表示するためのvalue
        myScore_DisplayValue         = 0;
        myBossScore_DisplayValue     = 0;
        myHighScore_DisplayValue     = 0;
        myBossHighScore_DisplayValue = 0;
        UpdateScoreText();
    }