/// <summary> /// 接口监听事件 /// </summary> /// <param name="componentName">组件名字</param> /// <param name="eventType">继承接口类型</param> /// <param name="action">回调</param> public void OnEventHandler(string itemName, string componentName, EventTriggerType eventType, UnityAction <BaseEventData> action) { UISubMgr tmp = GetGameObject <UISubMgr>(itemName); if (tmp != null) { tmp.EventHandler(componentName, eventType, action); } }
public void SetRawImage(string itemName, string componentName, Texture spr) { UISubMgr tmp = GetGameObject <UISubMgr>(itemName); if (tmp != null) { tmp.SetRawImage(componentName, spr); } }
public void SetText(string itemName, string componentName, string str) { UISubMgr tmp = GetGameObject <UISubMgr>(itemName); if (tmp != null) { tmp.SetText(componentName, str); } }
public void AddSliderListener(string itemName, string componentName, UnityAction <float> action) { UISubMgr tmp = GetGameObject <UISubMgr>(itemName); if (tmp != null) { tmp.AddSliderListener(componentName, action); } }
public void AddInputFieldValueChangedListener(string itemName, string componentName, UnityAction <string> action) { UISubMgr tmp = GetGameObject <UISubMgr>(itemName); if (tmp != null) { tmp.AddInputFieldValueChangedListener(componentName, action); } }
private void Start() { loginModel = new LoginModel(); loginLogic = new LoginLogic(loginModel); Ninput_Account = GetGameObject <InputField>("Ninput_Account"); Ninput_Psd = GetGameObject <InputField>("Ninput_Psd"); AddButtonListener("Nbtn_Login", loginLogic.OnClick); AddInputFieldEndEditListener("Ninput_Account", loginLogic.AccountEndEdit); AddInputFieldEndEditListener("Ninput_Psd", loginLogic.PasswordEndEdit); SetText("Ntxt", "赋值text"); OnEventHandler("Ntxt", EventTriggerType.Drag, DragCallback); subMgr = GetGameObject <UISubMgr>("itemName"); subMgr.SetText("txt_C", "laowang"); }