Unity NGUI 批量点击跳转场景

public  GameObject[]   loadLevelBtS;

public  string[]   loadLevelNameS;

 

void addListener(){

foreach(GameObject go in loadLevelBtS){

UIEventListener.Get(go).onPress+=loadList;

}

}

void loadList(GameObject go,bool canwith){

int listener=0;

if(!canwith){

if(listener==0){

listener=1;

int index=int.Parse(go.name.Split('_')[1]);

Application.LoadLevel(loadLevelNameS[index]);

}

}

}

// Use this for initialization

void Start () {

addListener();

}

posted @ 2013-03-11 16:39  韦斯利yx  阅读(694)  评论(0编辑  收藏  举报