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 阅读(...) 评论(...) 编辑 收藏