コード例 #1
0
ファイル: LoadSongs.cs プロジェクト: s2cl/SENSHYTHM
    // Use this for initialization
    void Start()
    {
        // canvas 作成

        songlist = GameObject.Find("SongButton");

        GameObject    button = (GameObject)Resources.Load("Prefabs/MapSelect/Button");
        DirectoryInfo dir    = new DirectoryInfo(Setting.SongsPath + "map");

        FileInfo[] info = dir.GetFiles("*.senshythm");

        foreach (FileInfo f in info)
        {
            MapParam mapdata = MapParam.ReadData(f.Name);

            GameObject ButtonObj = Instantiate(button, new Vector3(), Quaternion.identity);
            ButtonObj.transform.SetParent(songlist.transform, false);
            ButtonObj.name = f.Name;

            btn = ButtonObj.GetComponent <Button>();
            btn.onClick.AddListener(btn.GetComponent <GameStart>().OnClick);

            GameObject title  = ButtonObj.transform.Find("Title").gameObject;
            GameObject artist = ButtonObj.transform.Find("Artist").gameObject;
            title.GetComponent <Text>().text  = $"{mapdata.Title} {mapdata.Length/60:D2}:{mapdata.Length%60:D2}";
            artist.GetComponent <Text>().text = $"{mapdata.Artist} // [{mapdata.Diffname}] create by {mapdata.Creator}";
        }
    }
コード例 #2
0
 public static void Set(string filename)
 {
     Song = MapParam.ReadData(filename, true);
 }