void OnClick() { UISkillPanel skillPanel = NGUITools.FindInParents <UISkillPanel>(this.gameObject); if (skillPanel == null) { return; } if (slotType == SlotType.SkillSetting) { if (m_IsHighlight) { skillPanel.SendMsg(SkillId, slotIndex); } skillPanel.SetActionButtonState(true); skillPanel.SetEquipFlag(false); } else { skillPanel.SetActionButtonState(m_IsUnlock); skillPanel.SetEquipFlag(m_IsUnlock); UISkillGuide.Instance.OnUnlockSlotClick(SkillId); } if (circleSp != null) { NGUITools.SetActive(circleSp.gameObject, true); } skillPanel.SetSkillInfo(SkillId); skillPanel.ShowSlotHighlight(slotType); }
} // end UIFightPanel public void DoBeforeEntering() { isShowBar = false; gameObject = ObjectTool.InstantiateGo("UIFightPanel", ResourcesTool.LoadPrefabUI(id), SceneManager.mainCanvas.rectTransform); rectTransform = gameObject.GetComponent<RectTransform>(); rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta; mainCharacterPanel = rectTransform.Find("MainCharacterInfoPanel").gameObject.AddComponent<UIMainCharacterInfoPanel>(); lockCharacterPanel = rectTransform.Find("LockCharacterInfoPanel").gameObject.AddComponent<UILockCharacterInfoPanel>(); lockCharacterPanel.gameObject.SetActive(false); buffPanel = new UIBuffPanel(rectTransform.Find("BuffPanle") as RectTransform, new Vector2(35f, 35f)); avatar = rectTransform.Find("BarPanel").GetComponent<Animator>(); rectTransform.Find("BarPanel/BarBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickBarBtn(); }); rectTransform.Find("BarPanel/BtnList/InfoBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickInfoBtn); rectTransform.Find("BarPanel/BtnList/PackBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickPackBtn); rectTransform.Find("BarPanel/BtnList/SettingBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickSettingBtn); rectTransform.Find("AttackBtn").gameObject.AddComponent<UIButton>().AddListener(OnClickAttackBtn); skillPanel = new UISkillPanel(rectTransform); GameObject joystickUI = ObjectTool.InstantiateGo("Joystick", ResourcesTool.LoadPrefabUI("joystick_ui"), rectTransform); joystickUI.transform.Find("JoystickUI").gameObject.AddComponent<UIJoystick>(); joystickUI.GetComponent<RectTransform>().sizeDelta = SceneManager.mainCanvas.sizeDelta; if (null == SceneManager.mainCharacter) { DebugTool.LogError(GetType() + "DoBeforeEntering SceneManager mainCharacter is null!"); return; } // end if string roleType = SceneManager.mainCharacter.info.characterData.roleType; rectTransform.Find("AttackBtn").GetComponent<Image>().sprite = ResourcesTool.LoadSprite(roleType + "_attack"); } // end DoBeforeEntering
public void OnHideButtonClick() { UISkillPanel skillPanel = NGUITools.FindInParents <UISkillPanel>(gameObject); if (skillPanel != null) { if (skillPanel.IsSkillStorageTranslating()) { skillPanel.uiSkillStorage.OnTranslateFinishedHandler = HideSelf; skillPanel.uiSkillStorage.SetIsWaitingForClose(); return; } } ArkCrossEngine.LogicSystem.PublishLogicEvent("ge_set_preset", "lobby", UISkillSetting.presetIndex); UIManager.Instance.HideWindowByName("SkillPanel"); }
public void OnLoadedSkill(int presetIndex, int skillId, int slotPositon) { if (slotPositon <= 0 || slotPositon > c_SkillSlotNum) { return; } UISkillSlot skillSlot = skillStorageArr[slotPositon - 1]; if (skillSlot != null && skillSlot.SkillId == -1) { skillSlot.SkillId = skillId; skillSlot.SetSlotIconById(skillId); } else if (skillSlot != null && skillSlot.SkillId != -1) { UISkillPanel skillPanel = NGUITools.FindInParents <UISkillPanel>(this.gameObject); if (null != skillPanel) { skillPanel.OnUnloadedSkill(skillSlot.SkillId); skillSlot.SkillId = skillId; skillSlot.SetSlotIconById(skillId); } } }
/// <summary> /// Drop the item onto the specified object. /// </summary> protected virtual void OnDragDropRelease(UnityEngine.GameObject surface) { if (cloneOnDrag) { UISkillSlot dragedSlot = gameObject.GetComponent <UISkillSlot>(); //判断dragedslot是属于SkillSeting下的还是SkillStorage下 //从SkillSeting拖出 if (dragedSlot.slotType == SlotType.SkillSetting) { UISkillSetting ddSkillSeting = null; UISkillPanel skillPanel = NGUITools.FindInParents <UISkillPanel>(gameObject); if (skillPanel != null) { ddSkillSeting = skillPanel.uiSkillSetting; } if (ddSkillSeting == null) { return; } if (surface == null) { //通知卸载该技能 ddSkillSeting.UnloadSkill(dragedSlot); NGUITools.Destroy(gameObject); return; } UISkillSlot surfaceSlot = surface.GetComponent <UISkillSlot>(); if (surfaceSlot != null) { //surface含有UISkillSlot组件并属于SkillSeting或者SkillStorage时,进行交换 if (surfaceSlot.slotType == SlotType.SkillSetting) { ddSkillSeting.ExchangeSlot(dragedSlot, surfaceSlot); } else { //技能图标拖到非SkillSetting和非SkillStorage上时,卸载 ddSkillSeting.UnloadSkill(dragedSlot); } } else { //surface没有怪UISkillSlot时,卸载 ddSkillSeting.UnloadSkill(dragedSlot); } NGUITools.Destroy(gameObject); } //从SkillStorage拖出 else if (dragedSlot.slotType == SlotType.SkillStorage) { UISkillStorage ddSkillStorage = NGUITools.FindInParents <UISkillStorage>(gameObject); if (null == ddSkillStorage) { return; } //surface为空的话需要重置dragedslot if (surface == null) { ddSkillStorage.ResetSlot(dragedSlot); NGUITools.Destroy(gameObject); return; } UISkillSlot surfaceSlot = surface.GetComponent <UISkillSlot>(); if (surfaceSlot != null) { if (surfaceSlot.slotType == SlotType.SkillSetting) { //从Storage拖到SkillSetting时,交换 ddSkillStorage.ExchangeSlot(dragedSlot, surfaceSlot); ddSkillStorage.ResetSlot(dragedSlot); } else { //如果surface不是SkillSetting类型时,重置 ddSkillStorage.ResetSlot(dragedSlot); } } else { //surface中不含有UISkillSlot组件时,重置 ddSkillStorage.ResetSlot(dragedSlot); } NGUITools.Destroy(gameObject); } } }