//Ob位并且不是房主的按钮显示 void SetObTypeBtn() { mObStart.gameObject.SetActive(true); mStartSprite.ElementAt(0).transform.parent.gameObject.SetActive(false); mBgSprite.ElementAt(0).transform.parent.gameObject.SetActive(false); mBtnStart.GetComponent <BoxCollider>().enabled = false; }
protected virtual void ShowTextTip() { countText = 0; objLabel = objParent.transform.Find(taskData.TextPath).gameObject; objLabel.transform.localPosition = taskData.TextPos; objLabel.SetActive(true); labelContent = objLabel.transform.Find("Content").GetComponent <UILabel>(); labelTip = objLabel.transform.Find("Tip").GetComponent <UILabel>(); labelContent.text = taskData.TextContent.ElementAt(countText); btnNext = objLabel.GetComponent <ButtonOnPress>(); btnNext.AddListener(TurnTextPage); if (taskData.TextContent.Count > 1) { btnNext.GetComponent <BoxCollider>().enabled = true; labelTip.gameObject.SetActive(true); } else { labelTip.gameObject.SetActive(false); btnNext.GetComponent <BoxCollider>().enabled = false; } }
private void AddButtonListener(Transform head, int shopid) { ShopConfigInfo info = ConfigReader.ShopXmlInfoDict[shopid]; List <int> items = new List <int>(); for (int ct = 0; ct < PackageBtnCount; ct++) { int ctt = ct + 1; ShopPage page = (ShopPage)ctt; switch (page) { case PackageSelect.ShopPage.ShopPage1: items = info.un32ItemIDPage1; break; case PackageSelect.ShopPage.ShopPage2: items = info.un32ItemIDPage2; break; case PackageSelect.ShopPage.ShopPage3: items = info.un32ItemIDPage3; break; case PackageSelect.ShopPage.ShopPage4: items = info.un32ItemIDPage4; break; case PackageSelect.ShopPage.ShopPage5: items = info.un32ItemIDPage5; break; case PackageSelect.ShopPage.ShopPage6: items = UIShop.Instance.GetHeroRecommendEquip(); break; } ButtonOnPress click = head.Find("Kind" + ctt.ToString()).GetComponent <ButtonOnPress>(); if (items == null || items.Count == 0) { click.GetComponent <BoxCollider>().enabled = false; continue; } click.AddListener(ctt, KindSelectFunc, ButtonOnPress.EventType.PressType); PageButton.Add(click); } }
void EnabledSurePress(bool enable) { mBtnSure.GetComponent <BoxCollider>().enabled = enable; mObjHightLight.gameObject.SetActive(!enable); mObjCanPress.gameObject.SetActive(enable); }
//窗口控件初始化 protected override void InitWidget() { //技能按钮初始化 Transform Adjust = mRoot.Find("Adjust"); mBtnArray = new ButtonOnPress[Adjust.childCount]; for (int i = 0; i < mBtnArray.Length; i++) { ButtonOnPress btn = mRoot.Find("Adjust/Button_" + i).GetComponent <ButtonOnPress>(); mBtnArray[i] = btn; //事件注册 switch ((ShortCutBarBtn)i) { case ShortCutBarBtn.BTN_SKILL_1: btn.AddListener(i, OnSkillBtnFunc); btn.AddListener(i, OnSkillPress, ButtonOnPress.EventType.PressType); UIGuideCtrl.Instance.AddUiGuideEventBtn(btn.gameObject); break; case ShortCutBarBtn.BTN_SKILL_2: case ShortCutBarBtn.BTN_SKILL_3: case ShortCutBarBtn.BTN_SKILL_4: case ShortCutBarBtn.BTN_SKILL_5: case ShortCutBarBtn.BTN_SKILL_6: btn.AddListener(i, OnSkillBtnFunc); btn.AddListener(i, OnSkillPress, ButtonOnPress.EventType.PressType); break; case ShortCutBarBtn.BTN_AUTOFIGHT: case ShortCutBarBtn.BTN_CHANGELOCK: btn.AddListener(i, OnCutBarBtnFunc, ButtonOnPress.EventType.ClickType); UIGuideCtrl.Instance.AddUiGuideEventBtn(btn.gameObject); break; } //状态控制组件初始化 if (i < SkillCount) { GameObject obj = btn.transform.Find("Light").gameObject; mCanPressEffect.Add((ShortCutBarBtn)i, obj); UISprite sprite = mRoot.Find("Adjust/Button_" + i + "/CutBar_" + i).GetComponent <UISprite>(); mBtnSprite.Add((ShortCutBarBtn)i, sprite); ButtonSelectPic selectPic = btn.GetComponent <ButtonSelectPic>(); selectPic.state = ButtonSelectPic.SelectState.DisableState; mBtnSelectPic.Add((ShortCutBarBtn)i, selectPic); } } //暴气技能初始化 ResourceUnit effectUnit = ResourcesManager.Instance.loadImmediate(GameDefine.GameConstDefine.FurySkillBtnEffect, ResourceType.PREFAB); //技能1暴气 mEffect3 = GameObject.Instantiate(effectUnit.Asset) as GameObject; mEffect3.transform.parent = mBtnArray[(int)ShortCutBarBtn.BTN_SKILL_3].transform; mEffect3.transform.localPosition = new Vector3(0f, 0f, -10f); //技能2暴气 mEffect4 = GameObject.Instantiate(effectUnit.Asset) as GameObject; mEffect4.transform.parent = mBtnArray[(int)ShortCutBarBtn.BTN_SKILL_4].transform; mEffect4.transform.localPosition = new Vector3(0f, 0f, -10f); ChangeFuryState(EFuryState.eFuryNullState); //初始化技能按钮 ShowValideUseSkillBtn(ShortCutBarBtn.BTN_SKILL_1, true); ShowValideUseSkillBtn(ShortCutBarBtn.BTN_SKILL_2, true); ShowValideUseSkillBtn(ShortCutBarBtn.BTN_SKILL_3, true); ShowValideUseSkillBtn(ShortCutBarBtn.BTN_SKILL_4, true); if (SceneGuideTaskManager.Instance().IsNewsGuide() == SceneGuideTaskManager.SceneGuideType.NoGuide) { mBtnSelectPic[ShortCutBarBtn.BTN_SKILL_5].gameObject.SetActive(false); mBtnSelectPic[ShortCutBarBtn.BTN_SKILL_6].gameObject.SetActive(false); ShowValideUseSkillBtn(ShortCutBarBtn.BTN_SKILL_5, false); ShowValideUseSkillBtn(ShortCutBarBtn.BTN_SKILL_6, false); } //CD初始化 for (int i = 0; i < SkillCount; i++) { CdCountDown cd = mBtnArray[i].GetComponent <CdCountDown>(); mCdDownDic.Add((ShortCutBarBtn)i, cd); } ResetSkill(); mIsShowDes = false; mTimePressStart = 0f; mCurSkillPress = -1; }