首页 > 技术文章 > Unity3d 多次显示关闭一个UI

kuangwu 2013-07-23 12:26 原文

publicclass OpenClooseGoUI : MonoBehaviour {

public  GameObject   closeBt;

public  GameObject   goUI;

public  GameObject   openBt;

void Start () {

if(closeBt)

UIEventListener.Get(closeBt).onPress += closeList;

if(openBt)

UIEventListener.Get(openBt).onPress += openList;

}

void closeList(GameObject go, bool istrue) {

       if (istrue)

  return;

openCloose(false);

    }

internal  void  openCloose(bool isbool){

 

opencloosegoUI(isbool);

 

}

void openList(GameObject go, bool istrue) {

        if (istrue)

  return;

openCloose(true);

    }

 

void opencloosegoUI(bool  isbool)

{

  if(goUI && goUI.active!=isbool)

goUI.SetActiveRecursively(isbool);

}

}

推荐阅读