/// <summary> /// 初始化宣传列表 /// </summary> void initTap() { List <Bulletin> bulletinList = BulletinManager.Instance.getButtletinList(); if (bulletinList == null) { MaskWindow.UnlockUI(); return; } if (buttonList == null) { buttonList = new BulletinButton[bulletinList.Count]; for (int i = 0; i < bulletinList.Count; i++) { buttonList [i] = NGUITools.AddChild(tapContent.gameObject, bulletinPerfab).GetComponent <BulletinButton> (); buttonList [i].name = (1000 + i) + ""; buttonList [i].initButton(this, bulletinList [i]); buttonList [i].gameObject.SetActive(true); } } tapContent.repositionNow = true; StartCoroutine(Utils.DelayRun(() => { if (showButton == null && buttonList != null) { showButton = buttonList [0]; showButton.DoClickEvent(); } MaskWindow.UnlockUI(); }, 0.3f)); }
/// <summary> /// 设置当前展示按钮 /// </summary> public void setShowButton(BulletinButton _button) { if (showButton != null) { UIButton butotnTmp1 = showButton.GetComponent <UIButton> (); butotnTmp1.normalSprite = "buttonTap_Normal"; showButton.spriteBg.spriteName = "buttonTap_Normal"; } showButton = _button; UIButton butotnTmp2 = showButton.GetComponent <UIButton> (); butotnTmp2.normalSprite = "buttonTap_ClickOn"; showButton.spriteBg.spriteName = "buttonTap_ClickOn"; updatePos(); }