Ejemplo n.º 1
0
    void OnEvent(int nEventid, object param)
    {
        if (nEventid == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            Client.stCreateEntity createEntity = (Client.stCreateEntity)param;

            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                Client.IEntity e = es.FindEntity(createEntity.uid);
                if (e == null)
                {
                    return;
                }
                if (e.GetEntityType() != Client.EntityType.EntityType_Box)
                {
                    return;
                }

                if (!m_dicBoxTime.ContainsKey(createEntity.uid))
                {
                    m_dicBoxTime.Add(createEntity.uid, createEntity.boxTime);
                }
                else
                {
                    Engine.Utility.Log.Error("重复添加box{0}", createEntity.uid);
                }
            }
        }
        else if (nEventid == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
        {
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            Client.IEntitySystem  es          = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                Client.IEntity e = es.FindEntity(removeEntiy.uid);
                if (e == null)
                {
                    return;
                }
                if (e.GetEntityType() != Client.EntityType.EntityType_Box)
                {
                    return;
                }
                if (m_dicBoxTime.ContainsKey(removeEntiy.uid))
                {
                    m_dicBoxTime.Remove(removeEntiy.uid);
                }
            }
        }
    }
Ejemplo n.º 2
0
    //-----------------------------------------------------------------------------------------------
    private void OnStartCollectSlider(ref Client.stUninterruptMagic uninterrupt)
    {
        if (ShowCollectTip(uninterrupt.type))
        {
            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                return;
            }

            Client.IEntity entity = es.FindEntity(uninterrupt.uid);
            if (entity != null && Client.ClientGlobal.Instance().IsMainPlayer(entity.GetUID()) == false)
            {
                RoleStateBar bar = GetRoleBarByUID(uninterrupt.uid);
                if (bar != null)
                {
                    HeadTipData data = new HeadTipData(entity, HeadTipType.Collect, true);
                    data.SetCollectType(uninterrupt.type);
                    bar.UpdateWidget(data);
                }
            }
        }
    }
Ejemplo n.º 3
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.º 4
0
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            Client.stCreateEntity ce = (Client.stCreateEntity)param;
            Client.IEntitySystem  es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }
            Client.IEntity en = es.FindEntity(ce.uid);
            if (en != null)
            {
                int rideId = en.GetProp((int)Client.PlayerProp.RideBaseId);
                if (rideId != 0)
                {
                    //if (Client.ClientGlobal.Instance().IsMainPlayer(en))
                    //{
                    //    UsingRide = (uint)rideId;
                    //}
                    bool isride = (bool)en.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
                    if (!isride)
                    {
                        en.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId);
                    }
                    //                    Engine.Utility.Log.LogGroup("ZCX", "EntityCommond_Ride {0}",en.GetID());
                }

                //int transModelId = en.GetProp((int)Client.PlayerProp.TransModelResId);
                //if (transModelId != 0)
                //{
                //    en.SendMessage(Client.EntityMessage.EntityCommand_Change, new Client.ChangeBody() {  resId = transModelId});
                //}
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_RIDE)
        {
            Client.stEntityRide ride = (Client.stEntityRide)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid))
            {
                if (UsingRideCallback != null)
                {
                    UsingRideCallback(UsingRideCallbackParam);
                    UsingRideCallback      = null;
                    UsingRideCallbackParam = null;
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE)
        {
            Client.stEntityUnRide ride = (Client.stEntityUnRide)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid))
            {
                if (UnRideCallback != null)
                {
                    UnRideCallback(UnRideCallbackParam);
                    UnRideCallback      = null;
                    UnRideCallbackParam = null;
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE)
        {
            Client.IEntity mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
            if (mainPlayer == null)
            {
                return;
            }
            //int rideId = mainPlayer.GetProp((int)Client.PlayerProp.RideBaseId);
            //if (rideId != 0)
            //{

            //    UsingRide = (uint)rideId;
            //    bool isride = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
            //    if (!isride)
            //    {
            //        mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId);
            //    }
            //}
        }
        else if (eventID == (int)Client.GameEventID.UIEVENT_UPDATEITEM)
        {
            List <string> tempIDList = GameTableManager.Instance.GetGlobalConfigKeyList("Knight_ExpItem");


            uint breakItemID = GameTableManager.Instance.GetGlobalConfig <uint>("KngithRankItem");

            ItemDefine.UpdateItemPassData data = (ItemDefine.UpdateItemPassData)param;
            if (data != null)
            {
                if (data.BaseId == breakItemID || tempIDList.Contains(data.BaseId.ToString()))
                {
                    DisPatchRideRedPoint();
                }
            }
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// 事件处理
 /// </summary>
 /// <param name="nEventID"></param>
 /// <param name="param"></param>
 public void GlobalEventHandler(int eventID, object param)
 {
     if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED)
     {
         if (null != param && param is Client.INPC)
         {
             UpdateNpcHeadMask((Client.INPC)param);
         }
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
     {
         Client.stCreateEntity ce = (Client.stCreateEntity)param;
         OnCretateEntity(ref ce);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         RemoveBar(removeEntiy);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME)
     {
         stEntityChangename e = (stEntityChangename)param;
         OnChangeName(e.uid);
     }
     else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE)
     {
         stEntityHide st = (stEntityHide)param;
         OnSetEntityHide(ref st);
         return;
     }
     else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号
     {
         Client.stTitleWear data = (Client.stTitleWear)param;
         OnTitleWear(data.uid);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param;
         OnStartCollectSlider(ref uninterrupt);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK)
     {
         if (param != null)
         {
             stGuildBreak guildbreak = (stGuildBreak)param;
             if (ShowCollectTip(guildbreak.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (param != null)
         {
             stGuildEnd guildEnd = (stGuildEnd)param;
             if (ShowCollectTip(guildEnd.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN ||
              eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID ||
              eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove)
     {
         OnRefreshAllClanTitile();
     }
     else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE)
     {
         long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
         RoleStateBar bar = GetRoleBarByUID(uid);
         if (bar != null)
         {
             Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
             if (es == null)
             {
                 return;
             }
             RefreshClanName(es.FindEntity(uid), bar);
         }
     }
     else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY)
     {
         OnRefreshAllHpSlider();
     }
 }
Ejemplo n.º 6
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;
            }
        }