示例#1
0
    IEnumerator BoxInstantiate(int _startNum, TextChanger _tc)
    {
        ChoiseController cc;

        yield return(new WaitForSeconds(voiceDelayTime + 0.5f));

        if (_startNum == 1)
        {
            choiseBoxes[0] = Instantiate(choiseBoxPrefab);
            choiseBoxes[0].transform.parent        = canvas.transform;
            choiseBoxes[0].transform.localPosition = choiseBoxInitPosCenter;

            _tc = choiseBoxes[0].GetComponent <TextChanger>();
            _tc.ChangeIcon(ctd.GetSprite(0));
            _tc.ChangeText("");

            cc = choiseBoxes[0].GetComponent <ChoiseController>();
            cc.Init(0, this);
        }
        for (int i = _startNum; i < ctd.GetReplyCount(); ++i)
        {
            choiseBoxes[i] = Instantiate(choiseBoxPrefab);
            choiseBoxes[i].transform.parent        = canvas.transform;
            choiseBoxes[i].transform.localPosition = choiseBoxInitPosSide[i - _startNum];

            _tc = choiseBoxes[i].GetComponent <TextChanger>();
            _tc.ChangeIcon(ctd.GetSprite(i));
            _tc.ChangeText("");

            cc = choiseBoxes[i].GetComponent <ChoiseController>();
            cc.Init(i, this);
        }
    }