public void InitUIByData(UIDataParent UIDataParent) { tipContent = (TipData)UIDataParent; for (int i = 1; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(i == (int)tipContent.tipBtnType + 1); } transform.GetChild((int)tipContent.tipBtnType + 1).GetChild(0).GetComponent <Text>().text = tipContent.tipStr; }
public void OpenUITip(TipBtnType tipBtnType, TipConType tipConType, string tipStr, UnityAction EnsureEvent = null, UnityAction CancelEvent = null, PanelLayer panelLayer = PanelLayer.Tip) { TipData tipData = new TipData(); tipData.tipBtnType = tipBtnType; tipData.tipConType = tipConType; tipData.EnsureEvent = EnsureEvent; tipData.CancelEvent = CancelEvent; tipData.tipStr = tipStr; OpenUITip(tipData, panelLayer); }
public void OpenUITip(TipData tipData, PanelLayer panelLayer = PanelLayer.Tip) { if (TypeToTipPanel.ContainsKey(tipData.tipConType)) { //已经打开一个同类的Tip,因此是需要刷新 TypeToTipPanel[tipData.tipConType].RefreshUIByData(tipData); UIManager.Instance.ChangePanelLayer(panelLayer, TypeToTipPanel[tipData.tipConType].transform); } else { //是需要新打开一个tip UITip uiTipPanel = CreateTipPanel <UITip>(100000, UIManager.Instance.GetPanleLayer(panelLayer), tipData, true); TypeToTipPanel.Add(tipData.tipConType, uiTipPanel); } }
public void InitUIByData(UIDataParent UIDataParent) { tipContent = (TipData)UIDataParent; for (int i = 1; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(i == (int)tipContent.tipBtnType + 1); } transform.GetChild((int)tipContent.tipBtnType + 1).GetChild(0).GetComponent <Text>().text = tipContent.tipStr; if (tipContent.EnsureEvent != null) { OneEnsureBtn.onClick.AddListener(tipContent.EnsureEvent); TwoEnsureBtn.onClick.AddListener(tipContent.EnsureEvent); } if (tipContent.CancelEvent != null) { TwoCancelBtn.onClick.AddListener(tipContent.CancelEvent); } gameObject.SetActive(true); }
protected override void InitUI(UIDataParent UIDataParent = null) { if (UIDataParent != null) { tipContent = (TipData)UIDataParent; } OneEnsureBtn.onClick.AddListener(() => { CloseSelf(); }); TwoEnsureBtn.onClick.AddListener(() => { CloseSelf(); }); TwoCancelBtn.onClick.AddListener(() => { CloseSelf(); }); }