Пример #1
0
    void SkillEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.SKILLCD_BEGIN)
        {
            Client.stSkillCDChange st = (Client.stSkillCDChange)param;


            AddSkillCD(st.skillid, st.cd);
        }
    }
Пример #2
0
    public void PrepareUseSkill(GameCmd.stPrepareUseSkillSkillUserCmd_S cmd)
    {
        EntityType type      = EntitySystem.EntityHelper.GetEntityEtype(cmd.usertype);
        ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.userid, type);

        if (skillPart == null)
        {
            Engine.Utility.Log.Error("获取技能部件失败!" + cmd.userid + " type is " + Enum.GetName(typeof(EntityType), type));
            return;
        }
        if (cmd.level == 0)
        {
            cmd.level = 1;
        }
        SkillDatabase database = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(cmd.skillid, (int)cmd.level);

        if (database == null)
        {
            Engine.Utility.Log.Error(" skill database is null skillid is " + cmd.skillid.ToString() + " level is " + cmd.level.ToString());
            return;
        }
        skillPart.OnPrepareUseSkill(cmd);


        if (type == EntityType.EntityType_Player)
        {
            uint time = (database.dwReadTime);
            if (time > 0)
            {
                TimerAxis.Instance().SetTimer(m_uReadSliderTimerID, time, this, 1);
            }
        }
        else if (type == EntityType.EntityType_NPC)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
                return;
            }

            INPC npc = es.FindEntity <INPC>(cmd.userid);
            if (npc != null)
            {
                int masterID = npc.GetProp((int)NPCProp.Masterid);
                if (masterID == MainPlayerHelper.GetPlayerID())
                {
                    SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>((uint)cmd.skillid);
                    if (db != null)
                    {
                        if (db.petType == 1 || db.petType == 2)
                        {
                            Client.stSkillCDChange st = new Client.stSkillCDChange();
                            st.skillid = (uint)cmd.skillid;
                            st.cd      = -1;
                            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.SKILLCD_BEGIN, st);
                            TipsManager.Instance.ShowTips(npc.GetName() + CommonData.GetLocalString("使用") + db.strName);
                        }
                    }
                }
            }
        }
    }
Пример #3
0
    void SkillEvent(int eventID, object param)
    {
        if (MainPlayerHelper.GetMainPlayer() == null)
        {
            return;
        }
        long userUID = ClientGlobal.Instance().MainPlayer.GetUID();

        if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
        {
            stEntityBeginMove move = (stEntityBeginMove)param;
            if (move.uid != userUID)
            {
                return;
            }
        }
        else if (eventID == (int)Client.GameEventID.SKILLCD_BEGIN)
        {
            Client.stSkillCDChange st = (stSkillCDChange)param;
            uint skillid = (uint)st.skillid;
            DataManager.Manager <SkillCDManager>().AddSkillCD(st.skillid, st.cd);
            for (int i = 0; i < m_lstSkillBtns.Count; i++)
            {
                if (m_lstSkillBtns[i].SkillId == skillid)
                {
                    //Engine.Utility.Log.LogGroup("ZCX", "SKILLPANEL SHOW CD:技能{0} {1}", skillid, m_lstSkillBtns[i].name);
                    m_lstSkillBtns[i].RunCD();
                }
            }
            ExecutePublicCD(skillid);
        }
        else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBACK)
        {
        }
        else if (eventID == (int)GameEventID.SKILLSYSTEM_CDEND)
        {
            if (param != null && param is uint)
            {
                uint skillid = (uint)param;
                for (int i = 0; i < m_lstSkillBtns.Count; i++)
                {
                    if (m_lstSkillBtns[i].SkillId == skillid && m_lstSkillBtns[i].SkillId != CommonAttackID)
                    {
                        m_lstSkillBtns[i].AddEffectWhenCDEnd();
                    }
                }
            }
        }
        else if (eventID == (int)GameEventID.SKILLSYSTEM_REUSESKILLLONGATTACK)
        {
            ReqUseSkill(CommonAttackID);
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ed.uid == userUID)
            {
                bReadingSlider = false;
                CancelPressAttack();
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_RIDE || eventID == (int)GameEventID.ENTITYSYSTEM_UNRIDE)
        {
            //             LearnSkillDataManager data = DataManager.Manager<LearnSkillDataManager>();
            //             if (data != null && data.CurState != SkillSettingState.StateOne)
            //             {
            //                 for (int i = 0; i < m_lstSkillBtns.Count; i++)
            //                 {
            //                     if (m_lstSkillBtns[i].SkillIndex == 10)//第十个是状态转换
            //                     {
            //                         ChangeSkill(m_lstSkillBtns[i].gameObject);
            //                     }
            //                 }
            //             }

            SetSkillIcon();
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_CHANGE || eventID == (int)GameEventID.ENTITYSYSTEM_RESTORE)
        {
            stPlayerChange pc = (stPlayerChange)param;
            if (pc.uid == MainPlayerHelper.GetPlayerID())
            {
                for (int i = 0; i < m_lstSkillBtns.Count; i++)
                {
                    m_lstSkillBtns[i].SetSkillLockStatus(pc.status == 1);
                }
            }
        }
        else if (eventID == (int)GameEventID.SKILLSYSTEM_SKILLSTATECHANE)
        {
            m_uCommonAttackSkillID = DataManager.Manager <LearnSkillDataManager>().GetCommonSkillIDByJob();
        }
        else if (eventID == (int)GameEventID.HOTKEYPRESSDOWN)
        {
            stHotKeyDown hd = (stHotKeyDown)param;
            if (hd.type == 1)
            {
                uint pos = hd.pos;
                for (int i = 0; i < m_lstSkillBtns.Count; i++)
                {
                    SkillUseBtn use = m_lstSkillBtns[i];
                    if (use != null)
                    {
                        if (use.SkillIndex == pos)
                        {
                            UIButton btn = use.GetComponent <UIButton>();
                            if (btn != null)
                            {
                                btn.SendMessage("OnClick", SendMessageOptions.DontRequireReceiver);
                            }
                        }
                    }
                }
            }
        }
    }