Пример #1
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            // 加载部件
            if (m_EntityView == null)
            {
                return;
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);
            Vector3 currPos = GetPos();

            SetPos(ref currPos);
            Vector3 dir = GetRotate();

            SetRotate(dir);


            // 根据外部设置来设置
            SendMessage(EntityMessage.EntityCommand_EnableShowModel, EntityConfig.m_bShowEntity);

            SendMessage(EntityMessage.EntityCommond_SetColor, new Color(1, 1, 1));

            // 先做回调
            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Пример #2
0
    /// <summary>
    /// 实体创建
    /// </summary>
    /// <param name="ce"></param>
    private void OnCretateEntity(Client.stCreateEntity ce)
    {
        IEntity entity = RoleStateBarManager.GetEntity(ce.uid);

        if (entity == null)
        {
            Engine.Utility.Log.Error("找不到对象------------{0}", ce.uid);
            return;
        }

        if (entity.GetEntityType() == EntityType.EntityType_Pet)
        {
            return;
        }

        if (entity.GetEntityType() == EntityType.EntityType_NPC)
        {
            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID));
            if (npctable != null)
            {
                if (npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_TRAP)
                {
                    return;
                }
            }
        }
        AddRoleBar(entity);
    }
Пример #3
0
    public void OnEvent(int eventid, object param)
    {
        if (eventid == (int)Client.GameEventID.TASK_VISITNPC)
        {
            m_currvisitNpc = (uint)param;
        }
        else if (eventid == (int)Client.GameEventID.TASK_ITEM_COLLECT_USE)
        {
            Client.stTaskNpcItem stData = (Client.stTaskNpcItem)param;
            TaskItemCollect(stData);
        }
        else if (eventid == (int)Client.GameEventID.SYSTEM_LOADUICOMPELETE)
        {
            if (!FirstLoginSuccess)
            {
                FirstLoginSuccess = true;

                if (m_nAcceptTaskId != 0)
                {
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_ACCEPT, m_nAcceptTaskId);
                    m_nAcceptTaskId = 0;
                }
            }
        }
        else if ((int)Client.GameEventID.RECONNECT_SUCESS == eventid)
        {
            this.FirstLoginSuccess = true;

            //大重连  服务器会重发所有消息
            Client.stReconnectSucess rs = (Client.stReconnectSucess)param;
            if (rs.isLogin)
            {
                this.m_bReconnect = true;

                if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.NpcDialogPanel))
                {
                    DataManager.Manager <UIPanelManager>().HidePanel(PanelID.NpcDialogPanel);
                    DataManager.Manager <UIPanelManager>().ShowMain();
                }
                Engine.Utility.Log.Info("重连成功关闭任务追踪界面");
                //DataManager.Manager<UIPanelManager>().HidePanel(PanelID.MissionAndTeamPanel);
            }
        }
        else if ((int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY == eventid)
        {
            Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
            AddEntityEffect(createEntity);
        }
        else if ((int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY == eventid)
        {
            Client.stRemoveEntity removeEntity = (Client.stRemoveEntity)param;
            RemoveEntityEffect(removeEntity);
        }
        else if ((int)Client.GameEventID.TASK_CANSUBMIT == eventid)
        {
            Client.stTaskCanSubmit taskSubmit = (Client.stTaskCanSubmit)param;
            RemoveCollectNpcEffectByTaskId(taskSubmit.taskid);
        }
    }
Пример #4
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            // 加载部件
            if (m_EntityView == null)
            {
                m_bChangeRestore = false;
                return;
            }

            // 设置层信息
            if (EntitySystem.m_ClientGlobal.IsMainPlayer(this))
            {
                m_EntityView.renderObj.SetLayer(LayerMask.NameToLayer("MainPlayer"));
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);
            Vector3 dir = GetRotate();

            SetRotate(dir);

            // 还原时回调
            if (m_ChangeEventHandler != null)
            {
                m_ChangeEventHandler(m_ChangeParam);
                m_ChangeEventHandler = null;
                m_ChangeParam        = null;
            }

            // 根据外部设置来设置
            SendMessage(EntityMessage.EntityCommond_SetColor, new Color(1, 1, 1));
            SendMessage(EntityMessage.EntityCommand_EnableShowModel, EntityConfig.m_bShowEntity);

            // 播放下动画
            PlayAction(m_EntityView.GetCurAniName());

            // 先做回调
            if (!m_bChangeRestore)
            {
                Client.stCreateEntity createEntity = new Client.stCreateEntity();
                createEntity.uid = GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
            }
            else
            {
                m_bChangeRestore = false;
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_RESTORE,
                                                                    new Client.stPlayerChange()
                {
                    status = 2, uid = GetID()
                });
            }
        }
Пример #5
0
    /// <summary>
    /// 全局UI事件处理器
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    public void GlobalEventHandler(int eventType, object data)
    {
        switch (eventType)
        {
        case (int)Client.GameEventID.SYSTEM_LOADSCENECOMPELETE:
        {
            Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)data;
            if (loadScene.nMapID == 159)
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CampFightingPanel);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_LEVELUP:
        {
            CaculateCampSectionIndex();
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY:
        {
            //             if (isEnterScene == false)
            //             {
            //                 return;
            //             }

            Client.stCreateEntity npcEntity = (Client.stCreateEntity)data;

            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }

            Client.IEntity npc = es.FindEntity(npcEntity.uid);
            if (npc == null)
            {
                return;
            }

            int npcBaseId = npc.GetProp((int)Client.EntityProp.BaseID);
            //采集物
            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcBaseId);
            if (npctable != null && npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT)        //采集物
            {
                GameCmd.eCamp camp = (GameCmd.eCamp)npc.GetProp((int)Client.CreatureProp.Camp);
                if (m_CampCombatResultInfo != null && m_CampCombatResultInfo.m_MyCampCombatInfo.camp != camp)
                {
                    CampNpcOnTrigger callback = new CampNpcOnTrigger();
                    npc.SetCallback(callback);
                }
            }
        }
        break;
        }
    }
Пример #6
0
    /// <summary>
    /// 为采集物添加特效
    /// </summary>
    /// <param name="npcEntity">npc</param>
    void AddEntityEffect(Client.stCreateEntity npcEntity)
    {
        QuestDataBase questDb = GameTableManager.Instance.GetTableItem <QuestDataBase>(DoingTaskID);

        if (questDb == null)
        {
            return;
        }

        if (questDb.dwSubType != (uint)TaskSubType.Collection)
        {
            return;
        }

        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        IEntity npc = es.FindEntity(npcEntity.uid);

        if (npc == null)
        {
            return;
        }

        //List<QuestTraceInfo> traceTask;
        //GetAllQuestTraceInfo(out traceTask, null);
        //if (traceTask == null)
        //{
        //    return;
        //}

        ////正在采集为   要加特效
        //QuestTraceInfo questTraceInfo = traceTask.Find((data) => { return data.taskId == DoingTaskID && data.taskSubType == TaskSubType.Collection; });

        //if (questTraceInfo == null)
        //{
        //    RemoveCollectNpcEffectAndCleanDataByNpcId(npc.GetID());
        //    return;
        //}

        uint npcBaseId = (uint)npc.GetProp((int)EntityProp.BaseID);

        if (questDb.collect_npc != npcBaseId)
        {
            RemoveCollectNpcEffectAndCleanDataByNpcId(npc.GetID());
            return;
        }

        AddCollectNpcEffect(npc.GetID(), 9002);
        AddCollectNpcEffect(npc.GetID(), 9003);
    }
Пример #7
0
    void DoGameEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            if (m_bEnterCityWar == false)
            {
                return;
            }

            Client.stCreateEntity npcEntity = (Client.stCreateEntity)param;

            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }

            IEntity npc = es.FindEntity(npcEntity.uid);
            if (npc == null)
            {
                return;
            }

            int npcBaseId = npc.GetProp((int)EntityProp.BaseID);

            // 1、设置城战图腾氏族ID
            CityWarTotem cityWarTotem = m_lstCityWarTotem.Find((d) => { return(d.npcBaseId == npcBaseId); });
            if (cityWarTotem != null)
            {
                //npc.SetProp((int)Client.CreatureProp.ClanId, (int)cityWarTotem.clanId);

                uint clanId     = cityWarTotem.clanId;
                int  clanIdLow  = (int)(clanId & 0x0000ffff);
                int  clanIdHigh = (int)(clanId >> 16);
                npc.SetProp((int)Client.CreatureProp.ClanIdLow, clanIdLow);
                npc.SetProp((int)Client.CreatureProp.ClanIdHigh, clanIdHigh);
            }

            // 2、采集物
            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcBaseId);
            if (npctable != null && npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT)//采集物
            {
                CampNpcOnTrigger callback = new CampNpcOnTrigger();
                npc.SetCallback(callback);
            }

            // 城战打印
            //UnityEngine.Debug.LogError("------npctable.dwID = " + npcBaseId);
            //List<CityWarTotem> list = DataManager.Manager<CityWarManager>().CityWarTotemList;
            //for (int i = 0; i < list.Count; i++)
            //{
            //    UnityEngine.Debug.LogError(">>>>>>totemNpcId = " + list[i].totemNpcId + " clanId = " + list[i].clanId);
            //}
        }
    }
Пример #8
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);
                }
            }
        }
    }
Пример #9
0
 void OnEvent(int eventID, object param)
 {
     if (eventID == (int)GameEventID.ENTITYSYSTEM_CREATEENTITY)
     {
         Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
         if (createEntity.uid == m_Master.GetUID())
         {
             for (int i = m_unCreateEffectList.Count - 1; i >= 0; i--)
             {
                 uint runID = m_unCreateEffectList[i];
                 CreateEffect(runID);
                 m_unCreateEffectList.Remove(runID);
             }
         }
     }
 }
Пример #10
0
        //-------------------------------------------------------------------------------------------------------
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                return;
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Пример #11
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                return;
            }

            if (m_EntityView.GetNode() == null)
            {
                Engine.Utility.Log.Error("OnCreateRenderObj  m_EntityView.GetNode() is null");
                return;
            }
            int nID        = GetProp((int)EntityProp.BaseID);
            var table_data = GameTableManager.Instance.GetTableItem <table.ItemDataBase>((uint)nID);

            if (table_data != null)
            {
                m_EntityView.GetNode().SetScale(UnityEngine.Vector3.one * table_data.scale * 0.01f);
            }

            if (nID == 60001)
            {
                UnityEngine.Vector3 pos = GetPos();
                pos.y += 0.05f;
                SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
            }
            // 根据全局配置设置阴影
            //int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);
            //m_EntityView.SetShadowLevel(nShadowLevel);


            Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
            if (rs == null)
            {
                return;
            }
            // 取下地表高度
            // 再计算移动速度
            Engine.IScene curScene = rs.GetActiveScene();
            if (curScene == null)
            {
                return;
            }
            Material mat = curScene.GetBoxMat();

            if (mat != null)
            {
                if (m_EntityView.GetMaterial() == null)
                {
                    return;
                }
                Texture tex = m_EntityView.GetMaterial().mainTexture;
                mat.mainTexture = tex;
                m_EntityView.ApplySharedMaterial(mat);
            }


            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
            //             if (!m_sendPickMsg && CanAutoPick())
            //             {
            //                 m_sendPickMsg = true;
            //                 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_PICKUPITEM, new Client.stPickUpItem() { itemid = GetID(), state = 0 });
            //             }
        }
Пример #12
0
    public 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)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Client.IEntity en = es.FindEntity(createEntity.uid);
            if (en != null && en is Client.INPC)
            {
                List <QuestTraceInfo> traceTask;
                DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask);
                int         index;
                Client.INPC npc = en as Client.INPC;
                if (IsNeedSetTip(npc, ref traceTask, out index))
                {
                    SetNpcTipsByTraceInfo(traceTask[index]);
                }
            }
        }
        else if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
        {
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            Client.IEntitySystem  es          = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Client.IEntity en = es.FindEntity(removeEntiy.uid);
            if (en != null && en is Client.INPC)
            {
                Client.INPC npc = en as Client.INPC;
                DeleteEffectByNpc(npc);
            }
        }
        else if (nEventId == (int)Client.GameEventID.TASK_ACCEPT)
        {
            uint taskId = (uint)param;
            SetNpcTipsByTaskID(taskId, true);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_DELETE)
        {
            uint taskId = (uint)param;
            DeleteEffectByTaskID(taskId);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_DONE)
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            DeleteEffectByTaskID(td.taskid);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_CANSUBMIT)
        {
            Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param;
            SetNpcTipsByTaskID(tcs.taskid, false);
        }
        else if (nEventId == (int)Client.GameEventID.SYSTEM_GAME_READY)
        {
            RefreshAllNpcTips();
        }
        else if (nEventId == (int)Client.GameEventID.TASK_CANACCEPT)
        {
            uint taskId = (uint)param;
            SetNpcTipsByTaskID(taskId, false);
        }
    }
Пример #13
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();
                }
            }
        }
    }
Пример #14
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();
     }
 }
Пример #15
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            // 加载部件
            if (m_EntityView == null)
            {
                return;
            }
            //if (m_Data == null)
            //{
            //    Engine.Utility.Log.Error("m_data is null");
            //    return;
            //}
            //if (m_Data.ViewList == null)
            //{
            //    return;
            //}

            ////string strResName = "";
            //for (int i = 0; i < m_Data.ViewList.Length; ++i)
            //{
            //    if (m_Data.ViewList[i] == null)
            //    {
            //        continue;
            //    }

            //    if (m_Data.ViewList[i].nPos == (int)EquipPos.EquipPos_Body)
            //    {
            //        var table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //        m_EntityView.AddSuitData(EquipPos.EquipPos_Body, m_Data.ViewList[i].value, table_data == null ? 0 : (int)table_data.resid, obj);
            //    }

            //    if (m_Data.ViewList[i].nPos != (int)EquipPos.EquipPos_Body)
            //    {
            //        // 读取时装配置表,挂接装备
            //        ChangeEquip changeEquip = new ChangeEquip();
            //        changeEquip.pos = (EquipPos)m_Data.ViewList[i].nPos;

            //        // 武器
            //        table.SuitDataBase table_data = null;
            //        int nSuitID = m_Data.ViewList[i].value;
            //        if (changeEquip.pos == EquipPos.EquipPos_Weapon)
            //        {
            //            if (m_Data.ViewList[i].value == 0)
            //            {
            //                table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //                if (table_data == null)
            //                {
            //                    var role_data = table.SelectRoleDataBase.Where((GameCmd.enumProfession)GetProp((int)PuppetProp.Job), (GameCmd.enmCharSex)GetProp((int)PuppetProp.Sex));
            //                    if (role_data == null)
            //                    {
            //                        Engine.Utility.Log.Error("OnCreateRenderObj:job{0}或者sex{1}数据非法!", GetProp((int)PuppetProp.Job), GetProp((int)PuppetProp.Sex));
            //                        return;
            //                    }

            //                    table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)role_data.weaponPath);
            //                }
            //            }
            //            else
            //            {
            //                table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //            }
            //        }
            //        else
            //        {
            //            table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //        }

            //        if (table_data != null)
            //        {
            //            nSuitID = (int)table_data.base_id;
            //        }
            //        else
            //        {
            //            Engine.Utility.Log.Error("OnCreateRenderObj:{0}位置 资源{1}找不到资源数据!", changeEquip.pos, m_Data.ViewList[i].value);
            //            return;
            //        }

            //        changeEquip.nSuitID = nSuitID;
            //        changeEquip.nLayer = m_Data.nLayer;
            //        SendMessage(EntityMessage.EntityCommand_ChangeEquip, changeEquip);
            //    }
            //}
            m_Data = null; // 释放资源

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            // 播放下动画
            PlayAction(m_EntityView.GetCurAniName());

            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Пример #16
0
    /// <summary>
    /// 事件处理
    /// </summary>
    /// <param name="nEventID"></param>
    /// <param name="param"></param>
    public void GlobalEventHandler(int eventID, object param)
    {
        switch (eventID)
        {
        case (int)Client.GameEventID.ENTITYSYSTEM_CHANGE:
        {
            if (null != param && param is Client.stPlayerChange)
            {
                Client.stPlayerChange change = (Client.stPlayerChange)param;
                IEntity entity = RoleStateBarManager.GetEntityByUserID <IPlayer>(change.uid);
                if (null == entity)
                {
                    entity = RoleStateBarManager.GetEntityByUserID <INPC>(change.uid);
                }

                if (null != entity)
                {
                    LateUpdateChangePos(entity.GetUID());
                }
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE:
        {
            if (null != param && param is stEntityUnRide)
            {
                stEntityUnRide unride = (stEntityUnRide)param;
                LateUpdateChangePos(unride.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_RIDE:
        {
            if (null != param && param is stEntityRide)
            {
                stEntityRide ride = (stEntityRide)param;
                LateUpdateChangePos(ride.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE:
        {
            if (null != param && param is stEntityBeginMove)
            {
                stEntityBeginMove move = (stEntityBeginMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYMOVE:
        {
            if (null != param && param is stEntityMove)
            {
                stEntityMove move = (stEntityMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE:
        {
            if (null != param && param is stEntityStopMove)
            {
                stEntityStopMove move = (stEntityStopMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY:
        {
            //实体创建
            Client.stCreateEntity ce = (Client.stCreateEntity)param;
            OnCretateEntity(ce);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY:
        {
            //实体删除
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            RemoveRoleBar(removeEntiy.uid);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE:
        {
            //实体属性变更
            stPropUpdate prop = (stPropUpdate)param;
            OnPropUpdate(ref prop);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE:
        {
            //实体属性变更
            stPropUpdate prop = (stPropUpdate)param;
            OnPropUpdate(ref prop);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME:
        {
            //实体名称改变
            stEntityChangename e = (stEntityChangename)param;
            UpdateHeadStaus(e.uid, HeadStatusType.Name);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_SETHIDE:
        {
            //实体名称改变
            stEntityHide st = (stEntityHide)param;
            //UpdateHeadStaus(e.uid, HeadStatusType.Name);
            OnSetEntityHide(ref st);
        }
        break;

        case (int)Client.GameEventID.TITLE_WEAR:
        {
            Client.stTitleWear data   = (Client.stTitleWear)param;
            IPlayer            player = RoleStateBarManager.GetEntityByUserID <IPlayer>(data.uid);
            if (null != player)
            {
                //佩戴称号
                UpdateHeadStaus(player.GetUID(), HeadStatusType.Title);
            }
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART:
        {
            //引导技能开始
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSBREAK:
        {
            //引导技能中断
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSEND:
        {
            //引导技能结束
        }
        break;

        case (int)Client.GameEventID.CLANQUIT:
        case (int)Client.GameEventID.CLANJOIN:
        case (int)Client.GameEventID.CLANREFRESHID:
        case (int)Client.GameEventID.CITYWARWINERCLANID:
        case (int)Client.GameEventID.CLANDeclareInfoAdd:
        case (int)Client.GameEventID.CLANDeclareInfoRemove:
        {
            //氏族状态改变
            OnRefreshAllClan();
        }
        break;

        case (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE:
        {
            long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
            UpdateHeadStaus(uid, HeadStatusType.Clan);
        }
        break;

        case (int)Client.GameEventID.SYSTEM_GAME_READY:
        {
            OnRefresAllHp();
        }
        break;

        case (int)Client.GameEventID.CAMERA_MOVE_END:
        {
            UpdateAllPos();
        }
        break;

        case (int)Client.GameEventID.RFRESHENTITYHEADSTATUS:
        {
            HeadStatusType status = (HeadStatusType)param;
            RefreshAllHeadStatus(status);
        }
        break;

        //npc头顶任务状态
        case (int)Client.GameEventID.TASK_ACCEPT:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_ACCEPT);
        }
        break;

        case (int)Client.GameEventID.TASK_DELETE:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_DELETE);
        }
        break;

        case (int)Client.GameEventID.TASK_DONE:
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            OnUpdateNpcTaskStatus(td.taskid, Client.GameEventID.TASK_DONE);
        }
        break;

        case (int)Client.GameEventID.TASK_CANSUBMIT:
        {
            Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param;
            OnUpdateNpcTaskStatus(tcs.taskid, Client.GameEventID.TASK_CANSUBMIT);
        }
        break;

        case (int)Client.GameEventID.TASK_CANACCEPT:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_CANACCEPT);
        }
        break;
        }
    }
Пример #17
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                m_bChange = false;
                return;
            }

            if (m_Data == null)
            {
                m_bChange = false;
                return;
            }

            int nID        = GetProp((int)EntityProp.BaseID);
            var table_data = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)nID);

            if (table_data != null)
            {
                m_EntityView.GetNode().SetScale(UnityEngine.Vector3.one * table_data.scale * 0.01f);//100为基数
            }
            int suitID = GetProp((int)NPCProp.SuitID);

            if (suitID != 0)
            {
                var suitData = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)suitID);
                if (suitData != null)
                {
                    m_EntityView.GetNode().SetScale(UnityEngine.Vector3.one * suitData.sceneModleScale);//100为基数
                }
            }
            // 时装位置
            //string strResName = "";
            if (m_Data.ViewList != null)
            {
                for (int i = 0; i < m_Data.ViewList.Length; ++i)
                {
                    if (m_Data.ViewList[i] == null)
                    {
                        continue;
                    }

                    if (m_Data.ViewList[i].nPos != (int)EquipPos.EquipPos_Body)
                    {
                        // 读取时装配置表,挂接时装
                        ChangeEquip changeEquip = new ChangeEquip();
                        changeEquip.pos     = (EquipPos)m_Data.ViewList[i].nPos;
                        changeEquip.nSuitID = m_Data.ViewList[i].value;
                        changeEquip.nLayer  = m_Data.nLayer;
                        SendMessage(EntityMessage.EntityCommand_ChangeEquip, changeEquip);
                    }
                }
            }

            if (m_ChangeEventHandler != null)
            {
                m_ChangeEventHandler(m_ChangeParam);
                m_ChangeEventHandler = null;
                m_ChangeParam        = null;
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            Vector3 dir = GetRotate();

            SetRotate(dir);

            // 根据外部设置来设置
            SendMessage(EntityMessage.EntityCommond_SetColor, new Color(1, 1, 1));
            SendMessage(EntityMessage.EntityCommand_EnableShowModel, EntityConfig.m_bShowEntity);

            PlayAction(m_EntityView.GetCurAniName());

            if (!m_bChange)
            {
                Client.stCreateEntity createEntity = new Client.stCreateEntity();
                createEntity.uid = GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);

                m_bChange = false;
            }
        }
Пример #18
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;
            }
        }