Ejemplo n.º 1
0
    void SkillEvent(int eventID, object param)
    {
        if (ClientGlobal.Instance().MainPlayer == null)
        {
            return;
        }
        long userUID = ClientGlobal.Instance().MainPlayer.GetUID();

        if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ed.uid == userUID)
            {
                DeleteFightPet(0);
            }
            if (CurPet != null)
            {
                INPC npc = GetNpcByPetID(CurPet.GetID());
                if (npc != null)
                {
                    if (ed.uid == npc.GetUID())
                    {
                        DeleteFightPet(0);
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="nPropID">属性ID</param>
        /// <param name="nValue">属性值</param>
        public override void SetProp(int nPropID, int nValue)
        {
            base.SetProp(nPropID, nValue);

            if (nPropID < (int)CreatureProp.Begin || nPropID >= (int)CreatureProp.End)
            {
                if (nPropID == (int)EntityProp.EntityState)
                {//保证服务器死亡时 客户端必须死亡
                    if ((nValue & (int)GameCmd.SceneEntryState.SceneEntry_Death) == (int)GameCmd.SceneEntryState.SceneEntry_Death)
                    {
                        if (GetCurState() != CreatureState.Dead && GetCurState() != CreatureState.BeginDead)
                        {
                            //Engine.Utility.Log.Error(" 服务器发来死亡标志,进入开始死亡状态 "+GetName()+"_"+GetID());
                            //// 进入死亡状态
                            ChangeState(CreatureState.BeginDead);
                        }
                    }
                }

                return;
            }

            if (nPropID == (int)CreatureProp.Hp)
            {
                // 进入死亡状态
                if (nValue <= 0)
                {
                    nValue = 0;
                    stEntityDead ed = new stEntityDead();
                    ed.uid = GetUID();

                    if (GetCurState() != CreatureState.Dead)
                    {
                        if (this.GetCurState() == CreatureState.Move)
                        {
                            this.SendMessage(EntityMessage.EntityCommand_StopMove, this.GetPos());
                        }

                        if (GetCurState() == CreatureState.BeginDead)
                        {
                            Engine.Utility.Log.LogGroup("ZDY", " 服务器已死 客户端扣血进入开始死亡状态 ");
                            //// 进入死亡状态
                            // ChangeState(CreatureState.Dead);
                        }

                        //// 发送死亡事件 代码改到进入死亡状态时发送
                        // Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYDEAD, ed);
                    }
                }
            }



            m_CreatureProp[nPropID - (int)CreatureProp.Begin].Number = nValue;
        }
Ejemplo n.º 3
0
 public void OnContrllerEvent(int nEventID, object param)
 {
     if (m_Host == null)
     {
         Engine.Utility.Log.Error("MoveController.OnContrllerEvent: host is null");
         return;
     }
     if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         if (m_bJoystick && stopEntity.uid == m_Host.GetUID() && !stopEntity.bExternal) // 自行移动停止才需要继续向前预测
         {
             // 继续向前预测
             MoveByDir(m_fCalcRotate);
         }
     }
     else if (nEventID == (int)Client.GameEventID.SKLL_LONGPRESS)
     {
         stSkillLongPress st = (stSkillLongPress)param;
         m_bSkillLongPress = st.bLongPress;
     }
     else if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYDEAD)
     {
         stEntityDead ed = (stEntityDead)param;
         if (m_ClientGlobal.IsMainPlayer(ed.uid))
         {
             m_bJoystick = false;
             m_Host.SendMessage(EntityMessage.EntityCommand_StopMove, m_ClientGlobal.MainPlayer.GetPos());
         }
     }
     else if (nEventID == (int)Client.GameEventID.SKILL_FORBIDDENJOYSTICK)
     {
         Client.stForbiddenJoystick info   = (Client.stForbiddenJoystick)param;
         Client.IPlayer             player = m_ClientGlobal.MainPlayer;
         if (player == null)
         {
             return;
         }
         if (info.playerID == player.GetUID())
         {
             //bForbiddenJoystick = info.bFobidden;
             //if(bForbiddenJoystick)
             //{
             //   // Log.LogGroup( "ZDY" , "摇杆禁用" );
             //}
             //else
             //{
             //  //  Log.LogGroup( "ZDY" , "摇杆回复" );
             //}
         }
     }
 }
Ejemplo n.º 4
0
        // 进入状态
        public override void Enter(object param)
        {
            m_Owner = m_Statemachine.GetOwner();
            if (m_Owner != null)
            {
                m_Owner.IsFighting = false;

                UnRide();
                PlayAudio();
                Color c = new Color(1, 1, 1);
                m_Owner.SendMessage(EntityMessage.EntityCommond_SetColor, c);
                m_Owner.SendMessage(EntityMessage.EntityCommand_StopMove, m_Owner.GetPos());
                //m_Owner.SendMessage(EntityMessage.EntityCommand_RemoveAllLinkObj, null);
                m_Owner.SendMessage(EntityMessage.EntityCommand_RemoveLinkAllEffect, null);
                m_Owner.PlayAction(Client.EntityAction.Dead, 0, 1f, -1.0f, 1, null, null);
                stEntityDead ed = new stEntityDead();
                ed.uid = m_Owner.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYDEAD, ed);
                Engine.Utility.Log.LogGroup("ZDY", "enter ====== dead " + m_Owner.GetName() + "_" + m_Owner.GetID());
            }
        }
Ejemplo n.º 5
0
 void OnEvent(int evenId, object param)
 {
     if (evenId == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
     {
         if (m_currEntity == null)
         {
             return;
         }
         stEntityDead ed = (stEntityDead)param;
         IEntity      e  = ControllerSystem.m_ClientGlobal.GetEntitySystem().FindEntity(ed.uid);
         if (e != null && e.GetUID() == m_currEntity.GetUID())
         {
             Engine.RareEngine.Instance().Root.GetComponent <MonoBehaviour>().StartCoroutine(WaitFoeOneSec(m_currEntity));
         }
     }
     else if (evenId == (int)GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         if (m_currEntity == null)
         {
             return;
         }
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         if (removeEntiy.uid == m_currEntity.GetUID())
         {
             ReleseTarget();
         }
     }
     else if (evenId == (int)GameEventID.ENTITYSYSTEM_TARGETCHANGE)
     {
         stTargetChange tc = (stTargetChange)param;
         if (tc.target != null)
         {
             m_currEntity = tc.target;
             SetTimer();
         }
     }
 }
Ejemplo n.º 6
0
 void OnEvent(int nEventID, object param)
 {
     if (nEventID == (int)GameEventID.UISHOWSLIDEREVENT)
     {
         stSliderBeginEvent st = (stSliderBeginEvent)param;
         StartSliderByEvent(st.dur, (GameCmd.UninterruptActionType)st.sliderType);
     }
     else if (nEventID == (int)GameEventID.UIHIDESLIDEREVENT)
     {
         HideSlider();
     }
     else if (nEventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) // 实体死亡
     {
         stEntityDead ed = (stEntityDead)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(ed.uid))
         {
             HideSlider();
         }
     }
     else if (nEventID == (int)GameEventID.NETWORK_CONNECTE_CLOSE)
     {
         HideSlider();
     }
 }
Ejemplo n.º 7
0
    void SkillEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART)
        {
            Client.stUninterruptMagic evenparam = (Client.stUninterruptMagic)param;
            if (ClientGlobal.Instance().IsMainPlayer(evenparam.uid))
            {
                if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.SliderPanel) == false)
                {
                    DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.SliderPanel, panelShowAction: (panel) =>
                    {
                        DispatchValueUpdateEvent(new ValueUpdateEventArgs()
                        {
                            key = SliderDataEnum.Begin.ToString()
                        });
                    });
                }
                float dur = (float)(evenparam.time * 1f / 1000);
                if (dur > 0)
                {
                    DataManager.Manager <SliderDataManager>().StartSliderByEvent(dur, evenparam.type);
                }
                else
                {
                    Log.Error("进度条时间小于 0");
                }
            }

            if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CJ ||
                evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ ||
                evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ)
            {
                Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

                if (es == null)
                {
                    return;
                }

                Client.IEntity player = es.FindEntity(evenparam.uid);

                if (player == null)
                {
                    return;
                }
                bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);
                if (moving)
                {
                    player.SendMessage(EntityMessage.EntityCommand_StopMove);
                }

                Client.INPC npc = es.FindNPC(evenparam.npcId);
                if (npc != null)
                {
                    player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos());
                }
                PlayAni(player, EntityAction.Collect);
            }
            else if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ)
            {
                //采集
                Log.Info("开始挖宝...");
                Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

                if (es == null)
                {
                    return;
                }
                Client.IEntity player = es.FindEntity(evenparam.uid);

                if (player == null)
                {
                    return;
                }
                bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);
                if (moving)
                {
                    player.SendMessage(EntityMessage.EntityCommand_StopMove);
                }

                Client.INPC npc = es.FindNPC(evenparam.npcId);
                if (npc != null)
                {
                    player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos());
                }
                //                PlayAni(player, EntityAction.Collect);
                //播放挖宝动作
                PlayAni(player, EntityAction.Mining);

                //更换武器模型
                DataManager.Manager <SuitDataManager>().OnMiningTreasureMapToChangeWeapon(player);
            }
        }
        else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK)
        {
            if (param != null)
            {
                stGuildBreak guildBreak = (stGuildBreak)param;
                if (ClientGlobal.Instance().IsMainPlayer(guildBreak.uid))
                {
                    DataManager.Manager <SliderDataManager>().HideSlider(guildBreak.action);
                    DataManager.Manager <SliderDataManager>().IsBreak         = true;
                    DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
                    //DataManager.Manager<TaskDataManager>().IsShowSlider = false;
                }

                if (guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CJ ||
                    guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ)
                {
                    //打断采集
                    Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
                    if (es == null)
                    {
                        return;
                    }
                    Client.IEntity entity = es.FindPlayer(guildBreak.uid);
                    if (entity != null)
                    {
                        bool moving = (bool)entity.SendMessage(EntityMessage.EntityCommand_IsMove, null);
                        if (!moving)
                        {
                            PlayAni(guildBreak.uid, EntityAction.Stand);
                        }
                    }
                }
            }
        }
        else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND)
        {
            DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
            //DataManager.Manager<TaskDataManager>().IsShowSlider = false;
            stGuildEnd guildEnd = (stGuildEnd)param;
            if (ClientGlobal.Instance().IsMainPlayer(guildEnd.uid))
            {
                //坐骑读条完毕后上马
                if (guildEnd.action == GameCmd.UninterruptActionType.UninterruptActionType_DEMON)
                {
                    DataManager.Instance.Sender.RideUsingRide();
                }
                else
                {
                    if (guildEnd.action != GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ)
                    {
                        PlayStand();
                    }
                }
            }
            else
            {
                //播站立动作
                PlayAni(guildEnd.uid, EntityAction.Stand);
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ClientGlobal.Instance().IsMainPlayer(ed.uid))
            {
                // HideSprite();
                DispatchValueUpdateEvent(new ValueUpdateEventArgs()
                {
                    key = SliderDataEnum.End.ToString(), oldValue = m_UninterruptActionType
                });
                DataManager.Manager <SliderDataManager>().IsBreak         = true;
                DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
            }
        }
    }
Ejemplo n.º 8
0
    void DoGameEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.ENTITYSYSTEM_RELIVE)
        {
            stEntityRelive stRelive = (stEntityRelive)param;
            if (ClientGlobal.Instance().IsMainPlayer(stRelive.uid))
            {
                PanelID panelId = UIFrameManager.Instance.CurrShowPanelID;
                DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ReLivePanel);
            }
        }
        else if (eventID == (int)GameEventID.SKILL_RELIVE)
        {
            stSkillRelive skillRe = (stSkillRelive)param;
            if (!ClientGlobal.Instance().IsMainPlayer(skillRe.id))
            {
                return;
            }

            //武斗场不使用技能复活
            if (DataManager.Manager <ArenaManager>().EnterArena)
            {
                return;
            }

            DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ReLivePanel);

            //如果人是活的
            if (false == Client.ClientGlobal.Instance().MainPlayer.IsDead())
            {
                return;
            }

            uint time = GameTableManager.Instance.GetGlobalConfig <uint>("ReliveCountdown");
            TipsManager.Instance.ShowTipWindow(0, time, TipWindowType.CancelOk, "是否复活", () =>
            {
                GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C();
                cmd.byType       = (uint)GameCmd.ReliveType.ReliveType_Skill;
                cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID();
                cmd.dwNpcID      = 0;
                NetService.Instance.Send(cmd);
            }, () =>
            {
                GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C();
                cmd.byType       = (uint)GameCmd.ReliveType.ReliveType_Home;
                cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID();
                cmd.dwNpcID      = 0;
                NetService.Instance.Send(cmd);
            });
        }
        else if (eventID == (int)GameEventID.RECONNECT_SUCESS)
        {
            stReconnectSucess reconnectSucess = (stReconnectSucess)param;
            if (reconnectSucess.isLogin)
            {
                MainPlayerRelive();
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ClientGlobal.Instance().IsMainPlayer(ed.uid))
            {
                this.m_deadTime = Time.realtimeSinceStartup;
            }
        }
    }
Ejemplo n.º 9
0
        private void OnEvent(int nEventID, object param)
        {
            // 地表没有创建成功的时候,就已经收到了角色和NPC的创建 这里重新设置位置和地表做碰撞
            if (nEventID == (int)GameEventID.SYSTEM_LOADSCENECOMPELETE)
            {
                //List<IPlayer> lstPlayer;
                FindAllEntity <IPlayer>(ref lstPlayer);
                for (int i = 0; i < lstPlayer.Count; ++i)
                {
                    Vector3 pos = lstPlayer[i].GetPos();
                    lstPlayer[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                }
                lstPlayer.Clear();

                //List<INPC> lstNPC;
                FindAllEntity <INPC>(ref lstNPC);
                for (int i = 0; i < lstNPC.Count; ++i)
                {
                    Vector3 pos = lstNPC[i].GetPos();
                    lstNPC[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                }
                lstNPC.Clear();

                //List<IBox> lstBox;
                FindAllEntity <IBox>(ref lstBox);
                for (int i = 0; i < lstBox.Count; ++i)
                {
                    Vector3 pos = lstBox[i].GetPos();
                    pos.y += 0.2f;
                    lstBox[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                }
                lstBox.Clear();

                //List<IRobot> lstRobot;
                FindAllEntity <IRobot>(ref lstRobot);
                for (int i = 0; i < lstRobot.Count; ++i)
                {
                    Vector3 pos = lstRobot[i].GetPos();
                    lstRobot[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                }
                lstRobot.Clear();
                // 请求同步移动时间
                ReqMoveServerTime();
            }
            else if (nEventID == (int)GameEventID.RECONNECT_SUCESS) // 重新连接成功
            {
                stReconnectSucess st = (stReconnectSucess)param;
                if (st.isLogin)
                {
                    Clear(false); // 不清理除主角
                    // 请求同步移动时间
                    ReqMoveServerTime();
                }
                else
                {//强制同步
                    GameCmd.stUserMoveMoveUserCmd_C cmd = new GameCmd.stUserMoveMoveUserCmd_C();
                    cmd.client_time = 0;
                    List <GameCmd.Pos> list = new List <GameCmd.Pos>();
                    GameCmd.Pos        pp   = new GameCmd.Pos();
                    pp.x = 0;
                    pp.y = 0;
                    list.Add(pp);
                    cmd.poslist.AddRange(list);
                    m_ClientGlobal.netService.Send(cmd);
                }
            }
            else if (nEventID == (int)GameEventID.NETWORK_CONNECTE_CLOSE)// 网络断开
            {
                if (m_ClientGlobal.MainPlayer != null)
                {
                    m_ClientGlobal.MainPlayer.SendMessage(EntityMessage.EntityCommand_RemoveLinkAllEffect);
                }
            }
            else if (nEventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) // 实体死亡
            {
                stEntityDead ed = (stEntityDead)param;
                if (m_ClientGlobal.IsMainPlayer(ed.uid))
                {
                    Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
                    if (rs != null)
                    {
                        rs.EnableGray(true);
                    }
                }
                IEntity en = FindEntity(ed.uid);
                if (en != null)
                {
                    AddEffectOnEntity(en, false);
                }
            }
            else if (nEventID == (int)GameEventID.ENTITYSYSTEM_RELIVE)
            {
                stEntityRelive ed = (stEntityRelive)param;
                if (m_ClientGlobal.IsMainPlayer(ed.uid))
                {
                    Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
                    if (rs != null)
                    {
                        rs.EnableGray(false);
                    }
                }

                IEntity en = FindEntity(ed.uid);
                if (en != null)
                {
                    AddEffectOnEntity(en, true);
                }
            }
            else if (nEventID == (int)GameEventID.PLAYER_LOGIN_SUCCESS)
            {
                Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
                if (rs != null)
                {
                    rs.EnableGray(false);
                }

                // 请求同步移动时间
                ReqMoveServerTime();
            }
            else if (nEventID == (int)GameEventID.ENTITYSYSTEM_LEAVEMAP) // 离开地图
            {
                // 清理地图上所有对象
                Clear(false);

                // 切地图时让主角停止移动
                IPlayer mainPlayer = EntitySystem.m_ClientGlobal.MainPlayer;
                if (mainPlayer != null)
                {
                    bool ismoving = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);
                    if (ismoving)
                    {
                        mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_StopMove, mainPlayer.GetPos());
                    }
                }
            }
            else if (nEventID == (int)GameEventID.ENTITYSYSTEM_CHANGEAREA) // 区域变化 动作处理
            {
                stEntityChangeArea changeArea = (stEntityChangeArea)param;
                IEntity            en         = FindEntity(changeArea.uid);
                if (en != null && en.GetEntityType() == EntityType.EntityType_Player)
                {
                    string strCurAni   = (string)en.SendMessage(EntityMessage.EntityCommand_GetCurAni, null);
                    bool   bChangeArea = false;
                    if (changeArea.eType == MapAreaType.Safe || changeArea.eType == MapAreaType.Fish)
                    {
                        if (strCurAni == EntityAction.Stand_Combat)
                        {
                            strCurAni   = EntityAction.Stand;
                            bChangeArea = true;
                        }

                        if (strCurAni == EntityAction.Run_Combat)
                        {
                            strCurAni   = EntityAction.Run;
                            bChangeArea = true;
                        }
                    }
                    else
                    {
                        if (strCurAni == EntityAction.Stand)
                        {
                            strCurAni   = EntityAction.Stand_Combat;
                            bChangeArea = true;
                        }

                        if (strCurAni == EntityAction.Run)
                        {
                            strCurAni   = EntityAction.Run_Combat;
                            bChangeArea = true;
                        }
                    }

                    if (bChangeArea)
                    {
                        PlayAni anim_param = new PlayAni();
                        anim_param.strAcionName = strCurAni;
                        anim_param.fSpeed       = 1;
                        anim_param.nStartFrame  = 0;
                        anim_param.nLoop        = -1;
                        anim_param.fBlendTime   = 0.1f;
                        en.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
                    }
                }
            }
            else if (nEventID == (int)GameEventID.ENTITYSYSTEM_CREATEENTITY)
            {
                stCreateEntity create = (stCreateEntity)param;
                IEntity        en     = FindEntity(create.uid);
                if (en != null)
                {
                    EntityManager.Instance().OnCreateEntity(en);
                }
            }
        }
Ejemplo n.º 10
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);
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 11
0
        private void OnEvent(int nEventID, object param)
        {
            GameEventID eventId = (GameEventID)nEventID;

            switch (eventId)
            {
            case GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE:
            {
                SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL);
                SetTimer(ATONCE_TIMERID, ATONCE_LEN);
            }
            break;

            case GameEventID.ENTITYSYSTEM_RELIVE:
            {
                stEntityRelive er = (stEntityRelive)param;
                if (ControllerSystem.m_ClientGlobal.IsMainPlayer(er.uid))
                {
                    SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL);
                    SetTimer(ATONCE_TIMERID, ATONCE_LEN);
                }
            }
            break;

            case GameEventID.ENTITYSYSTEM_ENTITYDEAD:
            {
                stEntityDead ed = (stEntityDead)param;
                if (ControllerSystem.m_ClientGlobal.IsMainPlayer(ed.uid))
                {
                    KillTimer(MEDICAL_TIMEID);
                    KillTimer(ATONCE_TIMERID);
                }
            }
            break;

            case GameEventID.SKILLSYSTEM_SKILLLISTCHANE:
            case GameEventID.SKILLSYSTEM_ADDSKILL:
                InitSkill();
                break;

            case GameEventID.SKILLNONESTATE_ENTER:
            {
                NextSkill = 0;
                OnCombat();
            }
            break;

            //case GameEventID.ROBOTCOMBAT_NEXTCMD:
            //    {
            //        if (param != null)
            //        {
            //            Client.stSkillDoubleHit skillDhHit = (Client.stSkillDoubleHit)param;
            //            OnUseDoubleHitSkill(skillDhHit);
            //        }
            //    }
            //    break;
            case GameEventID.SKILLSYSTEM_STIFFTIMEOVER:
            {        //挂机状态下 硬直结束(并且没有插入技能)只处理普攻前两招,第三招释放时如果有插入 就不播放收招
                stNextSkill st = (stNextSkill)param;
                NextSkill = st.nextSkillID;
                if (m_status == CombatRobotStatus.RUNNING && NextSkill != 0)
                {
                    DoAttack();
                }
                if (m_status == CombatRobotStatus.RUNNING && NextSkill == 0 && InsertSkillID != 0)
                {
                    DoAttack();
                }
            }
            break;

            case GameEventID.SKILLGUIDE_PROGRESSBREAK:
            {
                if (param != null)
                {
                    stGuildBreak skillFailed = (stGuildBreak)param;
                    if (skillFailed.action == GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ)
                    {
                        if (ControllerSystem.m_ClientGlobal.IsMainPlayer(skillFailed.uid))
                        {
                            m_nIgnoreSkillid = skillFailed.skillid;

                            // AddTips(string.Format("使用技能失败id:{0} ret{1}", skillFailed.skillid, skillFailed.msg));
                        }
                        ChangeRoleAction(RoleAction.NONE);
                    }
                }
                //ChangeRoleAction(RoleAction.USESKILL);
                //DoNextCMD();
            }
            break;

            case GameEventID.JOYSTICK_UNPRESS:
                m_fStopTime = UnityEngine.Time.realtimeSinceStartup;

                break;

            case GameEventID.JOYSTICK_PRESS:
                m_fStopTime = 0;
                OnPause(true);
                break;

            case GameEventID.ENTITYSYSTEM_CREATEENTITY:
            {
                Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
                Client.IEntitySystem  es           = ControllerSystem.m_ClientGlobal.GetEntitySystem();
                Client.IEntity        entity       = es.FindEntity(createEntity.uid);
                if (entity != null)
                {
                    if (entity.GetEntityType() == EntityType.EntityType_Box)
                    {
                        ShowBoxTips(entity.GetID());
                        OnPickUpItem();
                    }
                }
            }
            break;

            case GameEventID.ENTITYSYSTEM_REMOVEENTITY:
            {
                Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
                Client.IEntitySystem  es          = ControllerSystem.m_ClientGlobal.GetEntitySystem();
                Client.IEntity        entity      = es.FindEntity(removeEntiy.uid);
                if (entity != null)
                {
                    if (entity.GetEntityType() == EntityType.EntityType_Box)
                    {
                        OnPickUpItem();
                    }
                }
            }
            break;

            case GameEventID.ROBOTCOMBAT_COPYKILLWAVE:
            {
                if (param != null)
                {
                    stCopySkillWave copyWave = (stCopySkillWave)param;
                    if (m_bInCopy)
                    {
                        m_nLaskKillWave     = copyWave.waveId;
                        m_nLaskMovePosIndex = copyWave.posIndex;
                        //  AddTips(string.Format("副本wave{0} posIndex{1}", m_nLaskKillWave, m_nLaskMovePosIndex));
                        if (m_nLaskMovePosIndex != 0)
                        {
                            // SetTimer(COPYCOMBAT_TIMEID, 1600);
                            //OnPause(false);
                        }
                        //DoNextCMD();
                    }
                }
            }
            break;

            case GameEventID.NETWORK_CONNECTE_CLOSE:
            {
                m_disconnectStatus = m_status;
                if (m_disconnectStatus != CombatRobotStatus.STOP)
                {
                    Stop();
                    Engine.Utility.Log.Error("掉线了 挂机停止!!!");
                }
            }
            break;

            case GameEventID.RECONNECT_SUCESS:
            {
                if (m_disconnectStatus != CombatRobotStatus.STOP)
                {
                    Start();
                    if (m_disconnectStatus == CombatRobotStatus.PAUSE)
                    {
                        Pause();
                    }
                    m_disconnectStatus = CombatRobotStatus.STOP;
                }
            }
            break;

            default:
                break;
            }
        }