Exemple #1
0
        public override void Init()
        {
            m_ui = GetUI <UIPanelJoyStick>();

            // 注册移动
            MoveJoyStick move = m_ui.m_move;

            move.OnJoySticjEvent = OnMoveEvent;
            // 注册技能事件,升级按钮
            SkillJoyStick[] skillList = m_ui.m_SkillBtn;
            for (int i = 0; i < skillList.Length; i++)
            {
                skillList[i].SetLv(1);
                skillList[i].OnJoyStickEvent = OnSkillEvent;
                //skillList[i].OnLvUpEvent = OnClickLvUpBtn;
            }


            // 注册取消按钮
            UIDragListener.Get(m_ui.m_cancelBtn).OnDragEvent = (ev, delta) =>
            {
                if (ev == eDragEvent.Enter)       // 红色,取消技能
                {
                    SetSkillCancel(true);
                }
                else if (ev == eDragEvent.Exit)    // 不取消技能
                {
                    SetSkillCancel(false);
                }
            };
        }
Exemple #2
0
 private void OnCreateUI()
 {
     if (m_photoImage == null)
     {
         return;
     }
     m_photoImage.gameObject.SetActiveNew(true);
     UIDragListener.Get(m_photoImage.gameObject).OnDragEvent = (ev, delta) =>
     {
         if (m_boneEnt == null)
         {
             return;
         }
         if (m_boneEnt.m_animation != null && m_boneEnt.m_animation.IsPlaying("born"))
         {
             return;
         }
         if (ev == eDragEvent.Drag)
         {
             m_boneEnt.SetDirection(m_boneEnt.GetRotate() + new Vector3(0f, -1 * delta.x, 0f));
         }
     };
     UIEventListener.Get(m_photoImage.gameObject).onClick = (obj) =>
     {
         if (m_boneEnt == null || m_boneEnt.m_animation == null || !m_bCanClick)
         {
             return;
         }
         if (m_boneEnt.m_animation.IsPlaying("idle") &&
             !m_boneEnt.m_animation.IsPlaying(m_showEffectData.clickAnimaName)) // 在休闲时,才播放点击动作
         {
             m_bCanClick = false;
             AnimationAction anima = new AnimationAction();
             anima.crossTime = 0.2f;
             anima.strFull   = m_showEffectData.clickAnimaName;
             anima.eMode     = WrapMode.Once;
             anima.endEvent  = () =>
             {
                 m_bCanClick = true;
                 AnimationAction anima2 = new AnimationAction();
                 anima2.crossTime = 0.2f;
                 anima2.strFull   = "idle";
                 anima2.eMode     = WrapMode.Loop;
                 Play(anima2);
                 OnCreateIdleEffect();
             };
             Play(anima);
             OnDestroyIdleEffect();
             // 点击播放动作时,播放对应的特效,切换动作时删除
             int     hId = CEffectMgr.Create(m_showEffectData.clickEffectId, m_boneEnt, "origin");
             CEffect ef  = CEffectMgr.GetEffect(hId);
             if (ef != null)
             {
                 ef.SetLayer(LusuoLayer.eEL_Photo);
             }
         }
     };
 }