Example #1
0
    //非同期でロードする
    private IEnumerator LoadAsync()
    {
        //非同期ロード開始
        ResourceRequest resourceRequest_chara       = Resources.LoadAsync <GameObject> ("Prefabs/Chara");
        ResourceRequest resourceRequest_mana        = Resources.LoadAsync <GameObject> ("Prefabs/Mana");
        ResourceRequest resourceRequest_param_chara = Resources.LoadAsync <TextAsset> ("Parameter/characters");

        //ロードが終わるまで待機(resourceRequest.progressで進捗率を確認出来る)
        while (!resourceRequest_chara.isDone || !resourceRequest_mana.isDone || !resourceRequest_param_chara.isDone)
        {
            Debug.Log("ロード待ち");
            yield return(0);
        }
        Debug.Log("ロード完了!");
        //ロード完了、resourceRequest.assetからロードしたアセットを取得
        characterIcon = resourceRequest_chara.asset as GameObject;
        manaIcon      = resourceRequest_mana.asset as GameObject;
        TextAsset csv = resourceRequest_param_chara.asset as TextAsset;

        // var strReader = new StringReader(csv.text);
        // var csvReader = new CsvHelper.CsvReader(strReader, System.Globalization.CultureInfo.CreateSpecificCulture("ja-JP"));
        // csvReader.Configuration.RegisterClassMap<CharacterMapper>();
        // charaParameters = csvReader.GetRecords<Character>().ToArray();
        (charaParameters, _) = CsvLoader.Reader <Character, CharacterMapper>(csv);
        yield return(new WaitForSeconds(0.5f));

        Debug.Log("セットアップ開始!");
        SetUp();
    }