コード例 #1
0
ファイル: WinVolume.cs プロジェクト: deluxturtle/MonkeyBall
	// Use this for initialization
	void Awake ()
    {
        victoryText.SetActive(false);
        outOfTimeText.SetActive(false);
        if(GameObject.Find("Analytic"))
            analytic = GameObject.Find("Analytic").GetComponent<ScriptAnalytics>();
        else
        {
            Debug.Log("Analytics Disabled. (Please Start Game from Main Menu.");
            analytic = null;
        }
        scriptBananas = GameObject.Find("PanelBanana").GetComponent<ScriptAddBanana>();

	}
コード例 #2
0
	// Use this for initialization
	void Start ()
    {
        Dictionary<string, Button> dictLevels = new Dictionary<string, Button>();
        dictLevels.Add("LevelOne", btnLevelOne);
        dictLevels.Add("LevelTwo", btnLevelTwo);
        dictLevels.Add("LevelThree", btnLevelThree);
        dictLevels.Add("LevelFour", btnLevelFour);
        dictLevels.Add("LevelFive", btnLevelFive);

        analytic = GameObject.Find("Analytic").GetComponent<ScriptAnalytics>();

        List<string> lvlNames = new List<string>();
        lvlNames.Add("LevelOne");
        lvlNames.Add("LevelTwo");
        lvlNames.Add("LevelThree");
        lvlNames.Add("LevelFour");
        lvlNames.Add("LevelFive");
        
        foreach(string lvlName in dictLevels.Keys)
        {
            if (analytic.GetValue(lvlName) == 1)
            {
                dictLevels[lvlName].interactable = true;
            }
        }

        //Populate Times and # of plays.
        foreach(string lvlName in dictLevels.Keys)
        {
            dictLevels[lvlName].transform.FindChild("TextAvgTime").GetComponent<Text>().text =
                "Average: " + PlayerPrefs.GetFloat(lvlName + "averageTime").ToString();
            dictLevels[lvlName].transform.FindChild("TextFastest").GetComponent<Text>().text =
                "Fastest: " + PlayerPrefs.GetFloat(lvlName + "fastestTime").ToString();
            dictLevels[lvlName].transform.FindChild("TextCompleted").GetComponent<Text>().text =
                "Completed: (" + PlayerPrefs.GetInt(lvlName + "timesPlayed").ToString() + ") times.";

        }
    }