void OnEnable() { Transform trans = transform.Find("Creep1"); //creep1 = trans.gameObject; bar1 = trans.Find("Bar").gameObject.GetComponent <UISprite>(); cha1 = trans.Find("Cha").gameObject.GetComponent <UISprite>(); ButtonOnPress press = trans.GetComponent <ButtonOnPress>(); trans = trans.Find("Head"); head1 = trans.GetComponent <UISprite>(); press.AddListener(0, OnHeadPressFunc); // trans = transform.Find("Creep2"); bar2 = trans.Find("Bar").gameObject.GetComponent <UISprite>(); cha2 = trans.Find("Cha").gameObject.GetComponent <UISprite>(); //creep2 = trans.gameObject; press = trans.GetComponent <ButtonOnPress>(); trans = trans.Find("Head"); head2 = trans.GetComponent <UISprite>(); press.AddListener(1, OnHeadPressFunc); // head1.enabled = false; head2.enabled = false; }
void OnEnable() { Instance = this; SoldierSelectBtn = new List <ButtonOnPress>(); AltarHeadPhoto = new List <UISprite>(); ButtonOnPress mBtnSoldier1 = this.transform.Find("HeadShow/SoldierSelect/Soldier1").GetComponent <ButtonOnPress>(); SoldierSelectBtn.Add(mBtnSoldier1); UIGuideCtrl.Instance.AddUiGuideEventBtn(mBtnSoldier1.gameObject); SoldierSelectBtn.Add(this.transform.Find("HeadShow/SoldierSelect/Soldier2").GetComponent <ButtonOnPress>()); AltarHeadPhoto.Add(this.transform.Find("HeadShow/LastSelect/HalfPhoto").GetComponent <UISprite>()); AltarHeadPhoto.Add(SoldierSelectBtn[0].transform.Find("HalfPhoto").GetComponent <UISprite>()); AltarHeadPhoto.Add(SoldierSelectBtn[1].transform.Find("HalfPhoto").GetComponent <UISprite>()); for (int id = 0; id < SoldierSelectBtn.Count; id++) { SoldierSelectBtn[id].AddListener(id, OnSoldierSelectFunc); } ButtonOnPress BtnClose = this.transform.Find("CtrlBtn").GetComponent <ButtonOnPress>(); BtnClose.AddListener(OnUiCloseFunc); EventCenter.AddListener <Iplayer>((Int32)GameEventEnum.GameEvent_HeroDeathTime, ReMoveCurrGameObj); //死亡后重置祭坛 EventCenter.AddListener <Iplayer>((Int32)GameEventEnum.GameEvent_HeroBackTown, ReMoveCurrGameObj); //回城后重置祭坛 mStartEffect = false; mSetupEffect = false; mEffectTime = 0f; }
void OnEnable() { Input = this.transform.Find("Input").GetComponent <UIInput>(); ButtonOnPress sendBtn = this.transform.Find("SendMsg").GetComponent <ButtonOnPress>(); sendBtn.AddListener(OnSendMsg); }
void InitEffect() { mStartObj.SetActive(false); mReadyObj.SetActive(false); mTteamObj[0].transform.localPosition = new Vector3(mTteamObj[0].transform.localPosition.x - mXOffset, mTteamObj[0].transform.localPosition.y, mTteamObj[0].transform.localPosition.z); TweenPosition.Begin(mTteamObj[0], mMoveDuring, new Vector3(mTteamObj[0].transform.localPosition.x + mXOffset, mTteamObj[0].transform.localPosition.y, mTteamObj[0].transform.localPosition.z)); mTteamObj[1].transform.localPosition = new Vector3(mTteamObj[1].transform.localPosition.x + mXOffset, mTteamObj[1].transform.localPosition.y, mTteamObj[1].transform.localPosition.z); TweenPosition.Begin(mTteamObj[1], mMoveDuring, new Vector3(mTteamObj[1].transform.localPosition.x - mXOffset, mTteamObj[1].transform.localPosition.y, mTteamObj[1].transform.localPosition.z)); UICommon.UICommonMethod.TweenAlphaBegin(mMidObj, 0f, 0f); mTweenAlpha = UICommon.UICommonMethod.TweenAlphaBegin(mMidObj, mAlphaDuring, 1f); EventDelegate.Add(mTweenAlpha.onFinished, FinishMove, true); for (int i = 0; i < mSeatBtnList.Count; i++) { mSeatBtnList[i].AddListener(i, BtnEvent); if (mSeatBtnList.Count < SeatTeam) { mSoulObj[i].gameObject.SetActive(false); } } mBtnStart.AddListener((int)GameRoomBtn.STARTBATTLE, BtnEvent); mBtnQuit.AddListener((int)GameRoomBtn.LEAVEBATTLE, BtnEvent); mBtnSend.AddListener(SendTalk); mRoomState = RoomState.StartFlashState; //UIGuide IGuideTaskManager.Instance().AddTaskStartListerner((Int32)GameEventEnum.GameEvent_UIGuideRoomBeginBtnStart, StartIGuideTask); IGuideTaskManager.Instance().SendTaskTrigger((Int32)GameEventEnum.GameEvent_UIGuideTriggerRoomBeginGame); IGuideTaskManager.Instance().AddTaskStartListerner((Int32)GameEventEnum.GameEvent_UIGuideBackLobbyBtnStart, StartIGuideTask); IGuideTaskManager.Instance().SendTaskTrigger((Int32)GameEventEnum.GameEvent_UIGuideTriggerBackLobby); }
void init() { //isKeyPress = false; fectorTime = 1.5f; CustomButton = this.transform.Find("CustomButton").GetComponent <ButtonOnPress>(); CustomButton.AddListener((int)BUTTON_STATE.BTNCUSTOM, PvpBtnOnPress); CustomButton.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); // TweenColor.Begin (CustomButton.gameObject,0f,Color.black); // TweenColor.Begin (CustomButton.gameObject,1f,Color.white); // UICommonMethod.TweenAlphaBegin (CustomButton.gameObject,0.2f,0,UITweener.Style.Once); // MoveSprite scaleAlpha = new MoveSprite (); //scaleAlpha.CustonScaleAlpha (CustomButton.gameObject,0.5f,1f,0.6f); BtnModeSelect = this.transform.Find("ModeSelect"); MoneyLabel = new UILabel[BtnModeSelect.childCount]; BtnMove = new ButtonOnPress[BtnModeSelect.childCount]; SpriteBg = new UISprite[BtnModeSelect.childCount]; for (int i = 0; i < BtnModeSelect.childCount; i++) { BtnMove[i] = BtnModeSelect.Find(modeName[i]).GetComponent <ButtonOnPress>(); BtnMove[i].AddListener(i + 1, PvpBtnOnPress); MoneyLabel[i] = BtnMove[i].transform.Find("bBar/num").GetComponent <UILabel>(); MoneyLabel[i].text = "55"; SpriteBg[i] = BtnMove[i].transform.Find("pane").GetComponent <UISprite>(); SpriteBg[i].gameObject.SetActive(false); } ButtonOnPress tep = BtnMove [2]; BtnMove [2] = BtnMove [1]; BtnMove [1] = tep; int index = -1210; //X偏移值 float time = 0.08f; for (int i = 0; i < BtnModeSelect.childCount; i++, index += Interval) { MoveSprite ms = new MoveSprite(); ms.SetMoveState(time, BtnMove[i].gameObject, duringTime[i], new Vector3(index - 20 + (i * 10), 0, 0)); } //FriendButton = this.transform.FindChild("Training/FriendsListBtn").GetComponent<ButtonOnPress>(); MatteBg = this.transform.Find("Matte/Sprite").GetComponent <UISprite>(); EffectLine = this.transform.Find("pvp_line/flash").gameObject; GradualChange = this.transform.Find("Training").GetComponent <UISlider>(); ChangeDate = GradualChange.transform.Find("BottomBar").GetComponent <UISprite>(); BtnGuide = this.transform.Find("Training/Button"); for (int i = 0; i < BtnGuide.childCount; i++) { ButtonOnPress btn = BtnGuide.Find("Guide" + (i + 1)).GetComponent <ButtonOnPress>(); btn.AddListener(i + 4, PvpBtnOnPress); } BtnCancel = this.transform.Find("Time/button").GetComponent <ButtonOnPress>(); CountDownTime = this.transform.Find("Time/Time").GetComponent <UILabel>(); MatchNumber = this.transform.Find("Time/Num").GetComponent <UILabel>(); MatchNumber.text = "(1/6)"; BtnCancel.AddListener((int)BUTTON_STATE.BTN_CANCEL, PvpBtnOnPress); BtnCancel.transform.parent.gameObject.SetActive(false); //FriendButton.AddListener((int)BUTTON_STATE.BTN_FRIENDLIST, PvpBtnOnPress); }
void OnEnable() { SetSave(ref sOpenState, soundKey); SetSave(ref vOpenState, voiceKey); SetVoiceEnable(vOpenState); SetSoundEnable(sOpenState); btnVoice.AddListener(OnVoiceChange); btnSoundEffect.AddListener(OnSoundChange); btnChange.AddListener(OnChangeAccount); }
/// <summary> /// 处理完成触发信息 /// </summary> /// <param name="anchor"></param> private void DeltTriggerInfo(bool anchor) { if (mTaskInfo.mBtnTriggerType == ButtonTriggerType.mTypeClick) { Click = GuideEventButton.AddComponent <ButtonOnPress>(); if (anchor) { Click.AddListener(mTaskId, OnPressDown, ButtonOnPress.EventType.PressType); } else { Click.AddListener(mTaskId, OnClick, ButtonOnPress.EventType.ClickType); } } else { AddDragEventListener(); } }
void Init() { toggle = transform.Find("InfoBtn").GetComponent <ButtonOnPress>(); tran = transform.Find("Information"); RecordToggle = tran.Find("BattleBtn").GetComponent <UIToggle>(); AttributeToggle = tran.Find("StatusBtn").GetComponent <UIToggle>(); SystemSetToggle = tran.Find("SettingBtn").GetComponent <UIToggle>(); BattleState = BattleCurrInfo.BattleRecord; Transform temp = tran.Find("BattleInfo/Team/BlueTeam"); int index = temp.childCount; for (int i = 0; i < index; i++) { AllBlueTeam.Add(new BattleRealInfo(temp.Find("Player" + (i + 1)))); } temp = tran.Find("BattleInfo/Team/RedTeam"); index = temp.childCount; for (int i = 0; i < index; i++) { AllRedTeam.Add(new BattleRealInfo(temp.Find("Player" + (i + 1)))); } PlayerSpeed = tran.Find("StatusInfo/Speed/Num").GetComponent <UILabel>(); AttackInterval = tran.Find("StatusInfo/AtkInterval/Num").GetComponent <UILabel>(); AttackRange = tran.Find("StatusInfo/AtkRange/Num").GetComponent <UILabel>(); ResurgenceTime = tran.Find("StatusInfo/ResuTime/Num").GetComponent <UILabel>(); PhysicAttack = tran.Find("StatusInfo/PhysicAtk/Num").GetComponent <UILabel>(); SpellsAttack = tran.Find("StatusInfo/SpellsAtk/Num").GetComponent <UILabel>(); PhysicDef = tran.Find("StatusInfo/PhysicDef/Num").GetComponent <UILabel>(); SpellsDef = tran.Find("StatusInfo/SpellsDef/Num").GetComponent <UILabel>(); CloseBtn = tran.Find("CloseBtn").GetComponent <ButtonOnPress>(); tran = tran.Find("SettingInfo"); SoundBtn = tran.Find("SoundSwitch").GetComponent <ButtonOnPress>(); MusicBtn = tran.Find("MusicSwitch").GetComponent <ButtonOnPress>(); EffectBtn = tran.Find("EffectSwitch").GetComponent <ButtonOnPress>(); RangeBtn = tran.Find("RangeSwitch").GetComponent <ButtonOnPress>(); objOn[0] = SoundBtn.transform.Find("On").gameObject; ojbOff[0] = SoundBtn.transform.Find("Off").gameObject; objOn[1] = MusicBtn.transform.Find("On").gameObject; ojbOff[1] = MusicBtn.transform.Find("Off").gameObject; objOn[2] = EffectBtn.transform.Find("On").gameObject; ojbOff[2] = EffectBtn.transform.Find("Off").gameObject; objOn[3] = RangeBtn.transform.Find("On").gameObject; ojbOff[3] = RangeBtn.transform.Find("Off").gameObject; SoundBtn.AddListener((int)SystemSet.SoundButton, SoundButtonPress); MusicBtn.AddListener((int)SystemSet.MusicButton, SoundButtonPress); EffectBtn.AddListener((int)SystemSet.EffectButton, SoundButtonPress); RangeBtn.AddListener((int)SystemSet.RangeButton, SoundButtonPress); CloseBtn.AddListener((int)SystemSet.CloseButton, ClosePress); toggle.AddListener(OnPress); }
void Init() { Transform temp = transform.FindChild("Item"); for (int i = 0; i < temp.childCount; i++) { Transform tran = temp.FindChild("Item" + (i + 1)); PlayerPackage.Add(i, new PlayerPackageInfo(tran)); ButtonOnPress button = tran.GetComponent <ButtonOnPress>(); button.AddListener(i, OnPress); } }
void Init() { BtnOnPress = transform.FindChild("Arrow").GetComponent <ButtonOnPress>(); BtnOnPress.AddListener(0, OnButtonPress); AllRedKills = this.transform.FindChild("Panel/Kill/Spirit/KillLabel").GetComponent <UILabel>(); AllBuleKills = this.transform.FindChild("Panel/Kill/Undeath/KillLabel").GetComponent <UILabel>(); TimeLabel = this.transform.FindChild("Panel/Time/TimeLabel").GetComponent <UILabel>(); AllRedKills.text = "0"; AllBuleKills.text = "0"; greenHp = transform.FindChild("Panel/zcxt_s/Sprite").GetComponent <UISprite>(); redHp = transform.FindChild("Panel/zcxt_d/Sprite").GetComponent <UISprite>(); }
//窗口控件初始化 protected override void InitWidget() { Transform GameObj = mRoot.Find("EnemyTeamManager"); int num = GameObj.childCount; for (int i = 0; i < num; i++) { ButtonOnPress btn = GameObj.GetChild(i).GetComponent <ButtonOnPress>(); btn.AddListener(i, EnemyTeamSelectFunc); mEnemyTeamList.Add(new EnemyHeadInfo(btn)); } }
void Init() { for (int i = 0; i < transform.childCount; i++) { Transform tran = transform.Find("Button_" + i); SkillSlot skillSlot = new SkillSlot(tran, i); skillSlots.Add(skillSlot); ButtonOnPress button = tran.GetComponent <ButtonOnPress>(); button.AddListener(i, OnPress); if (i == 2 || i == 3) { skillSlot.SetFuryEffect(); } } }
private void RegistFunctionButtons() { UIButton mCancel = this.transform.Find("CancelButton").GetComponent <UIButton>(); UIGuideCtrl.Instance.AddUiGuideEventBtn(mCancel.gameObject); UIButton mBuy = this.transform.Find("Backpackage/BuyBtn").GetComponent <UIButton>(); EventDelegate.Add(mBuy.onClick, OnBuyButtonClick); UIGuideCtrl.Instance.AddUiGuideEventBtn(mBuy.gameObject); ButtonOnPress mSell = this.transform.Find("Backpackage/SellBtn").GetComponent <ButtonOnPress>(); EventDelegate.Add(mCancel.onClick, OnShopClose); mSell.AddListener((int)FuncButtons.SellBtn, FeatureButtonFunc); }
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); } }
public void CreatePPSdkButton() { ResourceUnit ppUnit = ResourcesManager.Instance.loadImmediate("Guis/PP", ResourceType.PREFAB); mToolBarObj = GameObject.Instantiate(ppUnit.Asset) as GameObject; DontDestroyOnLoad(mToolBarObj); //绑定到camera GameObject cameraObj = GameObject.Find("Camera"); mToolBarObj.transform.parent = cameraObj.transform; mToolBarObj.transform.localScale = new Vector3(1, 1, 1); mToolBarObj.transform.localPosition = new Vector3(0,0,0); //添加listener GameObject positonObj = mToolBarObj.transform.Find("Position").gameObject; ButtonOnPress positonButtonOnPress = positonObj.GetComponent<ButtonOnPress>(); //添加listener positonButtonOnPress.AddListener(PositionOnPress); }
void OnEnable() { SoldierSelectBtn = new List <ButtonOnPress>(); AltarHeadPhoto = new List <UISprite>(); SoldierSelectBtn.Add(this.transform.Find("HeadShow/SoldierSelect/Soldier1").GetComponent <ButtonOnPress>()); SoldierSelectBtn.Add(this.transform.Find("HeadShow/SoldierSelect/Soldier2").GetComponent <ButtonOnPress>()); AltarHeadPhoto.Add(this.transform.Find("HeadShow/LastSelect/HalfPhoto").GetComponent <UISprite>()); AltarHeadPhoto.Add(SoldierSelectBtn[1].transform.Find("HalfPhoto").GetComponent <UISprite>()); AltarHeadPhoto.Add(SoldierSelectBtn[0].transform.Find("HalfPhoto").GetComponent <UISprite>()); for (int id = 0; id < SoldierSelectBtn.Count; id++) { SoldierSelectBtn[id].AddListener(id, OnSoldierSelectFunc); } ButtonOnPress BtnClose = this.transform.Find("CtrlBtn").GetComponent <ButtonOnPress>(); BtnClose.AddListener(OnUiCloseFunc); EventCenter.AddListener <int, int>((Int32)GameEventEnum.GameEvent_ResetAbsHead, ResetAbsHead); EventCenter.AddListener <string>((Int32)GameEventEnum.GameEvent_ResetLockHead, ResetLockHead); }
void OnEnable() { Instance = this; int index = this.transform.childCount; for (int i = 0; i < index; i++) { Transform tran = this.transform.Find("Player" + (i + 1)); PersonList.Add(new PersonHead(tran)); ButtonOnPress button = tran.GetComponent <ButtonOnPress>(); button.AddListener(i, OnPress); } EventCenter.AddListener <IPlayer>((Int32)GameEventEnum.GameEvent_HeroInfoChange, OnUpdateHeroInfo); EventCenter.AddListener <IPlayer>((Int32)GameEventEnum.GameEvent_HeroHpChange, OnUpdateHeroHp); EventCenter.AddListener <IPlayer>((Int32)GameEventEnum.GameEvent_HeroLvChange, OnUpdateHeroLevel); EventCenter.AddListener <IPlayer>((Int32)GameEventEnum.GameEvent_HeroMpChange, OnUpdateHeroMp); EventCenter.AddListener <IPlayer>((Int32)GameEventEnum.GameEvent_HeroDeathTime, OnUpdateHeroDeathTime); EventCenter.AddListener <IPlayer>((Int32)GameEventEnum.GameEvent_PersonInitInfo, InitViewPersonInfo); }
//初始化选择状态 private void InitSelectHero() { for (int j = 0; j < mLabelDic.Length; j++) { mLabelDic[j].gameObject.SetActive(false); //已选定图像 禁用 } EnabledSurePress(false); //确定按钮初始化 禁用 for (int i = 0; i < mHeroShowList.Count; i++) { EventDelegate.Add(mHeroShowList[i].onChange, OnSelectHero); // 为可选英雄添加监听器 } mBtnSure.AddListener(OnCommitHero); //为确定按钮添加事件 mBtnCloseBuy.AddListener(CloseBuy); //为背景添加事件 (点击可关闭商店) mBtnBuy.AddListener(BuyHero); //为购买按钮添加事件 mLocalPlayer = PlayerManager.Instance.LocalAccount; InitFlash(); //动画设置并切换EnterSelect状态 InitRunePageList(); //初始化符文 }
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; } }
/// <summary> /// 初始化有强制的UI引导 /// </summary> private void InitGuideGroundBtn(int taskId) { GuideTaskInfo info = ConfigReader.GuideTaskXmlInfoDict[taskId]; string name = info.BtnName; GuideEventButton = UIGuideModel.Instance.GetUiGuideButtonGameObject(name); if (GuideEventButton == null) { return; } LocalParent = GuideEventButton.transform.parent.gameObject; GuideEventButton.transform.parent = mRoot.transform; GuideEventButton.SetActive(false); GuideEventButton.SetActive(true); GameObject obj = LoadUiResource.LoadRes(mRoot, "Guide/" + info.PrefabName); obj.transform.Find("Label").GetComponent <UILabel>().text = info.Text; obj.transform.localPosition = info.PosXYZ; ButtonOnPress ck = GuideEventButton.AddComponent <ButtonOnPress>(); ck.AddListener(taskId, OnUiGuideBtnFinishEvent, ButtonOnPress.EventType.ClickType); }
public void SetSelectHeroState(SelectHeroState state) { mSeletState = state; switch (mSeletState) { case SelectHeroState.InitSelect: for (int j = 0; j < mLabelDic.Length; j++) { mLabelDic[j].gameObject.SetActive(false); } EnabledSurePress(false); for (int i = 0; i < mHeroShowList.Count; i++) { EventDelegate.Add(mHeroShowList[i].onChange, OnSelectHero); } mBtnSure.AddListener(OnCommitHero); mBtnCloseBuy.AddListener(CloseBuy); mBtnBuy.AddListener(BuyHero); mLocalPlayer = PlayerManager.Instance.LocalAccount; InitFlash(); InitRunePageList(); break; case SelectHeroState.EnterSelect: EnterSelectHero(); break; case SelectHeroState.RandomSelect: RandomSelectHero(); break; case SelectHeroState.OutSelect: OutSelectHero(); break; } }
void OnEnable() { SendBtn.AddListener(BtnOnPress); }
//窗口控件初始化 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; }
void OnEnable() { Instance = this; Init(); CheckButton.AddListener(OnButtonPress); }
void OnEnable() { btnPress.AddListener(PressOver); }
void OnEnable() { Init(); LeftButton.AddListener((int)ButtonBtn.LeftButton, ButtonPress); RightButton.AddListener((int)ButtonBtn.RightButton, ButtonPress); }