Exemplo n.º 1
0
 /// <summary>
 /// 给UiPnlModelBackground添加点击事件
 /// </summary>
 /// <param name="ui"></param>
 private void AddClickEvent(BaseUi ui)
 {
     if (ui.model && ui.autoClickHide)
     {
         UiLayer layer                 = ui.layer;
         UiPnlModelBackground back     = ui.modelBackground.GetComponent <UiPnlModelBackground>();
         BoxCollider          collider = UiUtility.AddIfMissing <BoxCollider>(back.spriteBack.gameObject);
         collider.isTrigger = true;
         UIEventListener.Get(back.spriteBack.gameObject).onClick = go => ui.Hide();
         UiModelTool.ChangeTransformLayer(ui.modelBackground.gameObject, layer.ToString());
     }
 }