예제 #1
0
    public BaseUi Hide(Type type)
    {
        BaseUi ui = UiRelations.Instance.GetUi(type);

        if (ui != null)
        {
            ui.Hide();
        }
        return(ui);
    }
예제 #2
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());
     }
 }